Mail Archive Home | fractal-commits List | January 2007 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Wednesday, January 17, 2007 @ 15:09:17
Author: seintur
Path: /cvsroot/fractal/julia
Added: LICENCE.txt examples/juliak/README.txt examples/juliak/build.xml
examples/juliak/etc/execute.properties
examples/juliak/etc/julia.cfg examples/juliak/lib/dtdparser.jar
examples/juliak/lib/fractal-adl.jar
examples/juliak/lib/ow_deployment_scheduling.jar
examples/juliak/src/membrane/Main.java
examples/juliak/src/membrane/glue/BasicLoggerControllerImpl.java
examples/juliak/src/membrane/glue/C.java
examples/juliak/src/membrane/glue/Loggable.java
examples/juliak/src/membrane/glue/LoggablePrimitive.fractal
examples/juliak/src/membrane/glue/LoggablePrimitive.java
examples/juliak/src/membrane/glue/LoggerController.fractal
examples/juliak/src/membrane/glue/LoggerController.java
examples/juliak/src/membrane/glue/LoggerControllerRegister.java
examples/juliak/src/membrane/glue/LoggerControllerType.fractal
examples/juliak/src/membrane/glue/Main.java
examples/juliak/src/membrane/glue/Util.java
examples/juliak/src/membrane/interceptor/C.java
examples/juliak/src/membrane/interceptor/Main.java
examples/juliak/src/membrane/introspect/Main.java
examples/juliak/src/membrane/mix/ClientImpl.java
examples/juliak/src/membrane/mix/Main.java
examples/juliak/src/membrane/mix/ServerImpl.java
examples/juliak/src/membrane/mix/Service.java
examples/juliak/src/membrane/mix/ServiceAttributes.java
src/org/objectweb/fractal/juliak/factory/BasicGenericFactoryImpl.java
src/org/objectweb/fractal/juliak/membrane/AutoBindingComposite.java
src/org/objectweb/fractal/juliak/membrane/AutoBindingPrimitive.java
src/org/objectweb/fractal/juliak/membrane/Bootstrap.java
src/org/objectweb/fractal/juliak/membrane/Composite.java
src/org/objectweb/fractal/juliak/membrane/CompositeTemplate.java
src/org/objectweb/fractal/juliak/membrane/FlatParametricPrimitive.java
src/org/objectweb/fractal/juliak/membrane/FlatParametricPrimitiveTemplate.java
src/org/objectweb/fractal/juliak/membrane/FlatPrimitive.java
src/org/objectweb/fractal/juliak/membrane/FlatPrimitiveTemplate.java
src/org/objectweb/fractal/juliak/membrane/ParametricComposite.java
src/org/objectweb/fractal/juliak/membrane/ParametricCompositeTemplate.java
src/org/objectweb/fractal/juliak/membrane/ParametricPrimitive.java
src/org/objectweb/fractal/juliak/membrane/ParametricPrimitiveTemplate.java
src/org/objectweb/fractal/juliak/membrane/Primitive.java
src/org/objectweb/fractal/juliak/membrane/PrimitiveTemplate.java
test/conform/org/objectweb/fractal/julia/conform/controllers/StatComposite.java
test/conform/org/objectweb/fractal/julia/conform/controllers/StatPrimitive.java
Modified: README.txt build.xml
src/org/objectweb/fractal/julia/overview.html
src/org/objectweb/fractal/juliak/BootstrapComponentImpl.java
src/org/objectweb/fractal/juliak/Juliak.java
src/org/objectweb/fractal/juliak/control/attribute/BasicAttributeControllerMixin.java
src/org/objectweb/fractal/juliak/factory/AbstractGenericFactoryImpl.java
src/org/objectweb/fractal/juliak/platform/PlatformItf.java
src/org/objectweb/fractal/juliak/platform/PlatformJSE.java
Removed: config/dtdparser.jar config/fractal-adl.jar
config/ow_deployment_scheduling.jar examples/membrane/README.txt
examples/membrane/build.xml
examples/membrane/etc/execute.properties
examples/membrane/etc/julia.cfg
examples/membrane/lib/dtdparser.jar
examples/membrane/lib/fractal-adl.jar
examples/membrane/lib/ow_deployment_scheduling.jar
examples/membrane/src/membrane/Main.java
examples/membrane/src/membrane/glue/BasicLoggerControllerImpl.java
examples/membrane/src/membrane/glue/C.java
examples/membrane/src/membrane/glue/Loggable.java
examples/membrane/src/membrane/glue/LoggablePrimitive.fractal
examples/membrane/src/membrane/glue/LoggerController.fractal
examples/membrane/src/membrane/glue/LoggerController.java
examples/membrane/src/membrane/glue/LoggerControllerRegister.java
examples/membrane/src/membrane/glue/LoggerControllerType.fractal
examples/membrane/src/membrane/glue/Main.java
examples/membrane/src/membrane/glue/Util.java
examples/membrane/src/membrane/interceptor/C.java
examples/membrane/src/membrane/interceptor/Main.java
examples/membrane/src/membrane/introspect/Main.java
src/org/objectweb/fractal/juliak/factory/CompBasedMembraneGenericFactoryImpl.java
src/org/objectweb/fractal/juliak/membrane/backend/BackendDef.java
src/org/objectweb/fractal/juliak/membrane/backend/Compile2Java.java
src/org/objectweb/fractal/juliak/membrane/backend/MembraneCompiler.java
src/org/objectweb/fractal/juliak/membrane/backend/StaticBackend.fractal
src/org/objectweb/fractal/juliak/membrane/backend/StaticComponentBuilder.java
src/org/objectweb/fractal/juliak/membrane/backend/package.html
- remove dependency adherence towards Fractal-ADL
- juliak example package renaming
---------------------------------------------------------------------------------------+
LICENCE.txt
| 22
README.txt
| 11
build.xml
| 67 -
config/dtdparser.jar
| <<Binary file>>
config/fractal-adl.jar
| <<Binary file>>
config/ow_deployment_scheduling.jar
| <<Binary file>>
examples/juliak/README.txt
| 9
examples/juliak/build.xml
| 81 +
examples/juliak/etc/execute.properties
| 12
examples/juliak/etc/julia.cfg
| 613 ++++++++++
examples/juliak/lib/dtdparser.jar
| <<Binary file>>
examples/juliak/lib/fractal-adl.jar
| <<Binary file>>
examples/juliak/lib/ow_deployment_scheduling.jar
| <<Binary file>>
examples/juliak/src/membrane/Main.java
| 61
examples/juliak/src/membrane/glue/BasicLoggerControllerImpl.java
| 258 ++++
examples/juliak/src/membrane/glue/C.java
| 47
examples/juliak/src/membrane/glue/Loggable.java
| 44
examples/juliak/src/membrane/glue/LoggablePrimitive.fractal
| 36
examples/juliak/src/membrane/glue/LoggablePrimitive.java
| 160 ++
examples/juliak/src/membrane/glue/LoggerController.fractal
| 34
examples/juliak/src/membrane/glue/LoggerController.java
| 93 +
examples/juliak/src/membrane/glue/LoggerControllerRegister.java
| 51
examples/juliak/src/membrane/glue/LoggerControllerType.fractal
| 39
examples/juliak/src/membrane/glue/Main.java
| 110 +
examples/juliak/src/membrane/glue/Util.java
| 48
examples/juliak/src/membrane/interceptor/C.java
| 37
examples/juliak/src/membrane/interceptor/Main.java
| 127 ++
examples/juliak/src/membrane/introspect/Main.java
| 101 +
examples/juliak/src/membrane/mix/ClientImpl.java
| 55
examples/juliak/src/membrane/mix/Main.java
| 132 ++
examples/juliak/src/membrane/mix/ServerImpl.java
| 66 +
examples/juliak/src/membrane/mix/Service.java
| 30
examples/juliak/src/membrane/mix/ServiceAttributes.java
| 35
examples/membrane/README.txt
| 9
examples/membrane/build.xml
| 81 -
examples/membrane/etc/execute.properties
| 12
examples/membrane/etc/julia.cfg
| 613 ----------
examples/membrane/lib/dtdparser.jar
| <<Binary file>>
examples/membrane/lib/fractal-adl.jar
| <<Binary file>>
examples/membrane/lib/ow_deployment_scheduling.jar
| <<Binary file>>
examples/membrane/src/membrane/Main.java
| 55
examples/membrane/src/membrane/glue/BasicLoggerControllerImpl.java
| 258 ----
examples/membrane/src/membrane/glue/C.java
| 47
examples/membrane/src/membrane/glue/Loggable.java
| 44
examples/membrane/src/membrane/glue/LoggablePrimitive.fractal
| 36
examples/membrane/src/membrane/glue/LoggerController.fractal
| 34
examples/membrane/src/membrane/glue/LoggerController.java
| 93 -
examples/membrane/src/membrane/glue/LoggerControllerRegister.java
| 51
examples/membrane/src/membrane/glue/LoggerControllerType.fractal
| 39
examples/membrane/src/membrane/glue/Main.java
| 109 -
examples/membrane/src/membrane/glue/Util.java
| 48
examples/membrane/src/membrane/interceptor/C.java
| 37
examples/membrane/src/membrane/interceptor/Main.java
| 127 --
examples/membrane/src/membrane/introspect/Main.java
| 101 -
src/org/objectweb/fractal/julia/overview.html
| 30
src/org/objectweb/fractal/juliak/BootstrapComponentImpl.java
| 7
src/org/objectweb/fractal/juliak/Juliak.java
| 10
src/org/objectweb/fractal/juliak/control/attribute/BasicAttributeControllerMixin.java
| 6
src/org/objectweb/fractal/juliak/factory/AbstractGenericFactoryImpl.java
| 50
src/org/objectweb/fractal/juliak/factory/BasicGenericFactoryImpl.java
| 422 ++++++
src/org/objectweb/fractal/juliak/factory/CompBasedMembraneGenericFactoryImpl.java
| 472 -------
src/org/objectweb/fractal/juliak/membrane/AutoBindingComposite.java
| 145 ++
src/org/objectweb/fractal/juliak/membrane/AutoBindingPrimitive.java
| 147 ++
src/org/objectweb/fractal/juliak/membrane/Bootstrap.java
| 88 +
src/org/objectweb/fractal/juliak/membrane/Composite.java
| 147 ++
src/org/objectweb/fractal/juliak/membrane/CompositeTemplate.java
| 150 ++
src/org/objectweb/fractal/juliak/membrane/FlatParametricPrimitive.java
| 136 ++
src/org/objectweb/fractal/juliak/membrane/FlatParametricPrimitiveTemplate.java
| 126 ++
src/org/objectweb/fractal/juliak/membrane/FlatPrimitive.java
| 136 ++
src/org/objectweb/fractal/juliak/membrane/FlatPrimitiveTemplate.java
| 126 ++
src/org/objectweb/fractal/juliak/membrane/ParametricComposite.java
| 147 ++
src/org/objectweb/fractal/juliak/membrane/ParametricCompositeTemplate.java
| 160 ++
src/org/objectweb/fractal/juliak/membrane/ParametricPrimitive.java
| 147 ++
src/org/objectweb/fractal/juliak/membrane/ParametricPrimitiveTemplate.java
| 149 ++
src/org/objectweb/fractal/juliak/membrane/Primitive.java
| 147 ++
src/org/objectweb/fractal/juliak/membrane/PrimitiveTemplate.java
| 137 ++
src/org/objectweb/fractal/juliak/membrane/backend/BackendDef.java
| 48
src/org/objectweb/fractal/juliak/membrane/backend/Compile2Java.java
| 205 ---
src/org/objectweb/fractal/juliak/membrane/backend/MembraneCompiler.java
| 75 -
src/org/objectweb/fractal/juliak/membrane/backend/StaticBackend.fractal
| 35
src/org/objectweb/fractal/juliak/membrane/backend/StaticComponentBuilder.java
| 47
src/org/objectweb/fractal/juliak/membrane/backend/package.html
| 34
src/org/objectweb/fractal/juliak/platform/PlatformItf.java
| 5
src/org/objectweb/fractal/juliak/platform/PlatformJSE.java
| 5
test/conform/org/objectweb/fractal/julia/conform/controllers/StatComposite.java
| 171 ++
test/conform/org/objectweb/fractal/julia/conform/controllers/StatPrimitive.java
| 158 ++
86 files changed, 5210 insertions(+), 2840 deletions(-)
Index: julia/LICENCE.txt
diff -u /dev/null julia/LICENCE.txt:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/LICENCE.txt Wed Jan 17 15:09:16 2007
@@ -0,0 +1,22 @@
+============================================================================
+AOKell
+Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Contact: Lionel.Seinturier@xxxxxxx
+
+Author: Lionel Seinturier
+============================================================================
Index: julia/README.txt
diff -u julia/README.txt:1.3 julia/README.txt:1.4
--- julia/README.txt:1.3 Sun Nov 19 22:03:37 2006
+++ julia/README.txt Wed Jan 17 15:09:16 2007
@@ -37,9 +37,7 @@
- org.objectweb.fractal.juliak.Juliak
This is an alternate Fractal provider class which is available since Julia
2.5. Components created by this provider are associated with a
component-based
- control membrane. A control membrane is the software entity which provides
- the extra-functional services, such as the management of bindings, needed
to
- handle components.
+ control membrane.
These two Fractal provider classes can be used independently or jointly. When
used jointly in the same JVM, applications can use either components
controlled
@@ -75,7 +73,7 @@
- collection: A simple example with auto-binding components
- interceptor: A simple example to illustrate the use of interceptors
- j2me: The Hello world example for Java ME CLDC
- - membrane: Illustrates the engineering of control membranes
+ - juliak: Illustrates the usage of component-based control membranes
- protoactive:
Fractal components that communicate through asynchronous
method calls with futures, as in ProActive
@@ -94,11 +92,6 @@
- Fractal API 2 <http://fractal.objectweb.org>
- Monolog 1.8 <http://monolog.objectweb.org>
-Two additional librairies are used when compiling applications which use
-component-based control membranes:
- - Fractal ADL 2 <http://fractal.objectweb.org>
- - Spoon 1.0 <http://spoon.gforge.inria.fr>
-
For any question concerning Julia, please contact the Julia development team
at
fractal@xxxxxxxxxxxxx
Index: julia/build.xml
diff -u julia/build.xml:1.15 julia/build.xml:1.16
--- julia/build.xml:1.15 Wed Dec 20 21:29:35 2006
+++ julia/build.xml Wed Jan 17 15:09:16 2007
@@ -43,7 +43,6 @@
<property name="out.dist.jdoc" value="${out.dist.doc}/javadoc"/>
<property name="out.dist.examples" value="${out.dist}/examples"/>
<property name="out.dist.externals" value="${out.dist}/externals"/>
- <property name="out.generated" value="${out}/generated"/>
<property name="out.test" value="${out}/test"/>
<property name="out.zip" value="${out}/zip"/>
@@ -91,12 +90,6 @@
<pathelement path="${fractal.path}"/>
<pathelement path="${monolog.path}"/>
</path>
-
- <path id="fullclasspath">
- <pathelement location="${out.build}"/>
- <fileset dir="${config}" includes="**/*.jar" />
- <fileset dir="${externals}" includes="**/*.jar" />
- </path>
</target>
<!-- =================================== -->
@@ -104,21 +97,19 @@
<!-- =================================== -->
<target name="compile" depends="init" description="Compiles Julia">
- <antcall target="compile-julia" />
- <antcall target="compile-juliak" />
- <antcall target="compile-julia-j2me" />
- </target>
-
- <target name="compile-julia">
+
<mkdir dir="${out.build}"/>
<javac destdir="${out.build}" debug="on" source="1.3" target="1.3">
<classpath refid="classpath"/>
<src path="${src}"/>
- <include name="org/objectweb/fractal/julia/**/*.java"/>
+ <include name="org/objectweb/fractal/julia*/**/*.java"/>
</javac>
- </target>
-
- <target name="compile-julia-j2me" depends="compile-julia">
+
+ <!-- Include Fractal ADL description for control membranes -->
+ <copy todir="${out.build}">
+ <fileset dir="${src}"
includes="org/objectweb/fractal/juliak/**/*.fractal" />
+ </copy>
+
<mkdir dir="${out.build}/j2me"/>
<taskdef name="j2mec"
classname="org.objectweb.fractal.julia.ant.J2MEConverter">
@@ -134,48 +125,6 @@
</target>
<!-- =================================== -->
- <!-- ====== COMPILE JULIAK ======= -->
- <!-- =================================== -->
-
- <target name="compile-juliak">
- <!-- Compile Juliak source code -->
- <mkdir dir="${out.build}" />
- <javac destdir="${out.build}">
- <src path="${src}"/>
- <include name="org/objectweb/fractal/juliak/**/*.java"/>
- <classpath refid="fullclasspath" />
- </javac>
- <!-- Check whether membranes must be compiled -->
- <uptodate
- property="compile-juliak.membrane.notrequired"
-
targetfile="${out.build}/org/objectweb/fractal/juliak/membrane/Bootstrap.class">
- <srcfiles dir="${src}" includes="**/*.fractal" />
- </uptodate>
- <antcall target="compile-juliak.membrane" />
- </target>
-
- <!-- Control membranes compilation -->
- <target name="compile-juliak.membrane"
unless="compile-juliak.membrane.notrequired">
- <mkdir dir="${out.build}" />
- <copy todir="${out.build}">
- <fileset dir="${src}"
includes="org/objectweb/fractal/juliak/**/*.fractal" />
- </copy>
- <!-- Generate the Java code associated to control membranes -->
- <mkdir dir="${out.generated}" />
- <java
classname="org.objectweb.fractal.juliak.membrane.backend.MembraneCompiler"
- classpathref="fullclasspath" fork="yes">
- <arg value="-d" />
- <arg value="${out.generated}" />
- </java>
- <!-- Compile the generated code -->
- <javac destdir="${out.build}">
- <src path="${out.generated}" />
- <include name="org/objectweb/fractal/juliak/membrane/**" />
- <classpath refid="fullclasspath" />
- </javac>
- </target>
-
- <!-- =================================== -->
<!-- ========== TEST ========== -->
<!-- =================================== -->
Index: julia/config/dtdparser.jar
<<Binary file>>
Index: julia/config/fractal-adl.jar
<<Binary file>>
Index: julia/config/ow_deployment_scheduling.jar
<<Binary file>>
Index: julia/examples/juliak/README.txt
diff -u /dev/null julia/examples/juliak/README.txt:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/README.txt Wed Jan 17 15:09:16 2007
@@ -0,0 +1,9 @@
+This example illustrates the features of Julia for the component-based
+engineering of control membranes.
+
+The three existing subpackages illustrates:
+- glue: the dynamic gluing of a control membrane to a content instance,
+- interceptor: the dynamic adding and removing of an interceptor,
+- intropect: the introspection of a control membrane.
+
+October 20, 2006. <Lionel.Seinturier@xxxxxxx>
\ No newline at end of file
Index: julia/examples/juliak/build.xml
diff -u /dev/null julia/examples/juliak/build.xml:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/build.xml Wed Jan 17 15:09:16 2007
@@ -0,0 +1,81 @@
+<!--
+ ! This library is free software; you can redistribute it and/or
+ ! modify it under the terms of the GNU Lesser General Public
+ ! License as published by the Free Software Foundation; either
+ ! version 2 of the License, or (at your option) any later version.
+ !
+ ! This library is distributed in the hope that it will be useful,
+ ! but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ! Lesser General Public License for more details.
+ !
+ ! You should have received a copy of the GNU Lesser General Public
+ ! License along with this library; if not, write to the Free Software
+ ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ !
+ ! Contact: sebastien.chassande@xxxxxxxxxxxx
+-->
+
+<project name="Examples" default="compile">
+
+ <!-- directory definition -->
+
+ <property name="src" value="${basedir}/src"/>
+ <property name="build" value="${basedir}/build"/>
+
+ <property file="${basedir}/../etc/build.properties"/>
+ <property file="${basedir}/etc/build.properties"/>
+ <property file="${basedir}/etc/execute.properties"/>
+
+ <!-- Building of a path which contains external jars -->
+
+ <path id="classpath">
+ <pathelement path="${asm.path}"/>
+ <pathelement path="${fractal.path}"/>
+ <pathelement path="${monolog.path}"/>
+ <pathelement path="${julia.path}"/>
+ <pathelement path="${juliak.path}"/>
+ <fileset dir="${basedir}" includes="lib/**/*.jar" />
+ <fileset dir="${basedir}/.." includes="lib/**/*.jar" />
+ <fileset dir="${basedir}/../.." includes="lib/**/*.jar" />
+ <fileset dir="${basedir}/../.." includes="externals/**/*.jar" />
+ <pathelement location="${build}"/>
+ </path>
+
+ <!-- ================================== -->
+ <!-- EXECUTE -->
+ <!-- ================================== -->
+
+ <target name="execute" depends="compile" description="Execute the example">
+ <java classname="${run.classname}"
+ classpathref="classpath"
+ fork="yes"
+ failonerror="yes">
+ <jvmarg line="${run.jvm.parameters}"/>
+ <arg line="${run.parameters}"/>
+ </java>
+ </target>
+
+ <!-- ================================== -->
+ <!-- COMPILE -->
+ <!-- ================================== -->
+
+ <target name="compile" description="Compile the example">
+ <mkdir dir="${build}"/>
+ <javac srcdir="${src}" destdir="${build}" debug="on">
+ <classpath refid="classpath"/>
+ <include name="**/*.java"/>
+ </javac>
+ <copy todir="${build}">
+ <fileset dir="${src}" includes="**/*.fractal" />
+ </copy>
+ </target>
+
+ <!-- ================================== -->
+ <!-- CLEAN -->
+ <!-- ================================== -->
+
+ <target name="clean" description="Clean the example">
+ <delete dir="${build}"/>
+ </target>
+</project>
Index: julia/examples/juliak/etc/execute.properties
diff -u /dev/null julia/examples/juliak/etc/execute.properties:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/etc/execute.properties Wed Jan 17 15:09:15
2007
@@ -0,0 +1,12 @@
+run.jvm.parameters \
+ -Dfractal.provider=org.objectweb.fractal.juliak.Juliak
+
+# Java class to be launched
+
+run.classname membrane.Main
+
+# Application arguments
+# add "templates" to build the components through templates
+# add "wrapper" to add an additional composite around each primitive
+
+run.parameters
Index: julia/examples/juliak/etc/julia.cfg
diff -u /dev/null julia/examples/juliak/etc/julia.cfg:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/etc/julia.cfg Wed Jan 17 15:09:15 2007
@@ -0,0 +1,613 @@
+###############################################################################
+# STANDARD JULIA CONFIGURATION FILE - DO NOT EDIT
+#
+# PUT NEW OR OVERRIDEN DEFINITIONS AT THE END OF THE FILE, OR IN OTHER FILES
+###############################################################################
+
+#
-----------------------------------------------------------------------------
+# INTERFACE CLASS GENERATORS
+#
-----------------------------------------------------------------------------
+
+# default class generator, generates sub classes of BasicComponentInterface
+
+(interface-class-generator
+ (org.objectweb.fractal.julia.asm.InterfaceClassGenerator
+ org.objectweb.fractal.julia.BasicComponentInterface
+ )
+)
+
+#
-----------------------------------------------------------------------------
+# CONTROLLER INTERFACES
+#
+# each definition must be of the form (interface-name interface-signature)
+#
-----------------------------------------------------------------------------
+
+# Component interface
+
+(component-itf
+ (component org.objectweb.fractal.api.Component)
+)
+
+# TypeFactory interface
+
+(type-factory-itf
+ (type-factory org.objectweb.fractal.api.type.TypeFactory)
+)
+
+# GenericFactory interface
+
+(generic-factory-itf
+ (generic-factory org.objectweb.fractal.api.factory.GenericFactory)
+)
+
+# Factory interface
+
+(factory-itf
+ # choose one of the following definitions:
+ # the first one provides only the Fractal Factory interface
+ # the second one provides a Julia extension of the Factory interface
+ # (factory org.objectweb.fractal.api.factory.Factory)
+ (factory org.objectweb.fractal.julia.factory.Template)
+)
+
+(julia-factory-itf
+ (/template org.objectweb.fractal.julia.factory.Template)
+)
+
+# AttributeController interface
+
+(attribute-controller-itf
+ (attribute org.objectweb.fractal.api.control.AttributeController)
+)
+
+(julia-attribute-controller-itf
+ (/cloneable-attribute-controller
org.objectweb.fractal.julia.control.attribute.CloneableAttributeController)
+)
+
+# BindingController interface
+
+(binding-controller-itf
+ (binding-controller org.objectweb.fractal.api.control.BindingController)
+)
+
+# ContentController interface
+
+(content-controller-itf
+ (content-controller org.objectweb.fractal.api.control.ContentController)
+)
+
+# SuperController interface
+
+(super-controller-itf
+ # choose one of the following definitions:
+ # the first one provides only the Fractal SuperController interface
+ # the second one provides a Julia extension of the SuperController
interface
+ # (super-controller org.objectweb.fractal.api.control.SuperController)
+ (super-controller
org.objectweb.fractal.julia.control.content.SuperControllerNotifier)
+)
+
+(julia-super-controller-itf
+ (/super-controller-notifier
org.objectweb.fractal.julia.control.content.SuperControllerNotifier)
+)
+
+# LifeCycleController interface
+
+(lifecycle-controller-itf
+ # choose one of the following definitions:
+ # the first one provides only the Fractal LifeCycleController interface
+ # the second one provides a Julia extension of the LifeCycleController
interface
+ # (lifecycle-controller
org.objectweb.fractal.api.control.LifeCycleController)
+ (lifecycle-controller
org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator)
+)
+
+(julia-lifecycle-controller-itf
+ (/lifecycle-coordinator
org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator)
+)
+
+# NameController interface
+
+(name-controller-itf
+ (name-controller org.objectweb.fractal.api.control.NameController)
+)
+
+#
-----------------------------------------------------------------------------
+# CONTROLLER OBJECTS
+#
+# each definition must be an object descriptor
+#
-----------------------------------------------------------------------------
+
+# Component implementation
+
+(component-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ ComponentImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.BasicComponentMixin
+ # to check type related constraints, and for collection interfaces
support:
+ org.objectweb.fractal.julia.TypeComponentMixin
+ ))
+)
+
+# TypeFactory implementation
+
+(type-factory-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ TypeFactoryImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.type.BasicTypeFactoryMixin
+ ))
+)
+
+# GenericFactory implementation
+
+(generic-factory-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ GenericFactoryImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.BasicInitializableMixin
+ org.objectweb.fractal.julia.loader.UseLoaderMixin
+ org.objectweb.fractal.julia.type.UseTypeFactoryMixin
+ org.objectweb.fractal.julia.factory.BasicGenericFactoryMixin
+ # to check the component content descriptor with the Java Reflection API:
+ org.objectweb.fractal.julia.factory.CheckGenericFactoryMixin
+ ))
+)
+
+# Factory implementation (for template components)
+
+(factory-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ FactoryImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+ org.objectweb.fractal.julia.factory.BasicTemplateMixin
+ # to copy the template's attributes to the components it creates:
+
org.objectweb.fractal.julia.control.attribute.UseCloneableAttributeControllerMixin
+ org.objectweb.fractal.julia.factory.AttributeTemplateMixin
+ # to copy the template's name to the components it creates:
+ org.objectweb.fractal.julia.control.name.UseNameControllerMixin
+ org.objectweb.fractal.julia.factory.NameTemplateMixin
+ ))
+)
+
+# Factory implementation (for singleton template components)
+
+(singleton-factory-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ SingletonFactoryImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+ org.objectweb.fractal.julia.factory.BasicTemplateMixin
+ # to copy the template's attributes to the components it creates:
+
org.objectweb.fractal.julia.control.attribute.UseCloneableAttributeControllerMixin
+ org.objectweb.fractal.julia.factory.AttributeTemplateMixin
+ # to copy the template's name to the components it creates:
+ org.objectweb.fractal.julia.control.name.UseNameControllerMixin
+ org.objectweb.fractal.julia.factory.NameTemplateMixin
+ # to provide the singleton semantics to the template:
+ org.objectweb.fractal.julia.factory.SingletonTemplateMixin
+ ))
+)
+
+# BindingController implementation (for primitive components without content)
+
+(primitive-binding-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ PrimitiveBindingControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.control.binding.BasicBindingControllerMixin
+ # to initialize the BasicBindingControllerMixin from the component's
type:
+ org.objectweb.fractal.julia.control.binding.TypeBasicBindingMixin
+ # to check some basic pre conditions (interface not already bound, ...)
+ org.objectweb.fractal.julia.UseComponentMixin
+ org.objectweb.fractal.julia.control.binding.CheckBindingMixin
+ # to check type related constraints for bindings:
+ org.objectweb.fractal.julia.control.binding.TypeBindingMixin
+ # to check content related constraints for bindings:
+ org.objectweb.fractal.julia.control.content.UseSuperControllerMixin
+ org.objectweb.fractal.julia.control.binding.ContentBindingMixin
+ # to check lifecycle related constraints for bindings:
+ org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin
+ org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
+ ))
+)
+
+# BindingController implementation (for primitive components with content)
+
+(container-binding-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ ContainerBindingControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+
org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin
+ # to skip Interface objects before delegating to the encapsulated
component:
+ #
org.objectweb.fractal.julia.control.binding.OptimizedContainerBindingMixin
+ # to manage output interceptors:
+ org.objectweb.fractal.julia.UseComponentMixin
+ org.objectweb.fractal.julia.control.binding.InterceptorBindingMixin
+ # to check some basic pre conditions (interface not already bound, ...)
+ org.objectweb.fractal.julia.control.binding.CheckBindingMixin
+ # to check type related constraints for bindings:
+ org.objectweb.fractal.julia.control.binding.TypeBindingMixin
+ # to check content related constraints for bindings:
+ org.objectweb.fractal.julia.control.content.UseSuperControllerMixin
+ org.objectweb.fractal.julia.control.binding.ContentBindingMixin
+ # to check lifecycle related constraints for bindings:
+ org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin
+ org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
+ ))
+)
+
+# BindingController implementation (for composite components)
+
+(composite-binding-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ CompositeBindingControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.control.binding.BasicBindingControllerMixin
+ # to initialize the BasicBindingControllerMixin from the component's
type:
+ org.objectweb.fractal.julia.control.binding.TypeBasicBindingMixin
+ # to check some basic pre conditions (interface not already bound, ...)
+ org.objectweb.fractal.julia.UseComponentMixin
+ org.objectweb.fractal.julia.control.binding.CheckBindingMixin
+ # to check type related constraints for bindings:
+ org.objectweb.fractal.julia.control.binding.TypeBindingMixin
+ # to check content related constraints for bindings:
+ org.objectweb.fractal.julia.control.content.UseSuperControllerMixin
+ org.objectweb.fractal.julia.control.binding.ContentBindingMixin
+ # to check lifecycle related constraints for bindings:
+ org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin
+ org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
+ # to manage the getFcItfImpl links of the Interface objects:
+ # choose one of ComponentBindingMixin and OptimizedCompositeBindingMixin
+ # (the last one creates and updates shortcuts links when possible)
+ org.objectweb.fractal.julia.control.content.UseContentControllerMixin
+ # org.objectweb.fractal.julia.control.binding.CompositeBindingMixin
+
org.objectweb.fractal.julia.control.binding.OptimizedCompositeBindingMixin
+ ))
+)
+
+# ContentController implementation
+
+(content-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ ContentControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+ org.objectweb.fractal.julia.control.content.BasicContentControllerMixin
+ # to check some basic pre conditions, and to prevent hierarchy cycles:
+ org.objectweb.fractal.julia.control.content.CheckContentMixin
+ # to check type related constraints in getFcInternalInterface:
+ org.objectweb.fractal.julia.control.content.TypeContentMixin
+ # to check binding locality related constraints in removeFcSubComponent:
+ org.objectweb.fractal.julia.control.content.BindingContentMixin
+ # to check lifecycle related constraints:
+ org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin
+ org.objectweb.fractal.julia.control.content.LifeCycleContentMixin
+ # to notify sub components when they are added or removed from this
component:
+ org.objectweb.fractal.julia.control.content.SuperContentMixin
+ ))
+)
+
+# SuperController implementation
+
+(super-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ SuperControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.control.content.BasicSuperControllerMixin
+ ))
+)
+
+# LifeCycleController implementation (for primitive or composite components)
+
+(lifecycle-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ LifeCycleControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleCoordinatorMixin
+
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin
+ # to check that mandatory client interfaces are bound in startFc:
+ org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
+ # to notify the encapsulated component (if present) when its state
changes:
+ org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin
+ ))
+)
+
+# LifeCycleController implementation (for composite components only)
+
+(composite-lifecycle-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ CompositeLifeCycleControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.UseComponentMixin
+
org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleCoordinatorMixin
+
org.objectweb.fractal.julia.control.lifecycle.OptimizedLifeCycleControllerMixin
+ # to check that mandatory client interfaces are bound in startFc:
+ org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin
+ ))
+)
+
+# NameController implementation
+
+(name-controller-impl
+ ((org.objectweb.fractal.julia.asm.MixinClassGenerator
+ NameControllerImpl
+ org.objectweb.fractal.julia.BasicControllerMixin
+ org.objectweb.fractal.julia.control.name.BasicNameControllerMixin
+ ))
+)
+
+#
-----------------------------------------------------------------------------
+# CONTROLLER DESCRIPTORS
+#
-----------------------------------------------------------------------------
+
+(optimizationLevel
+ # choose one of the following optimization options:
+ none
+ # mergeControllers
+ # mergeControllersAndInterceptors
+ # mergeControllersAndContent
+ # mergeControllersInterceptorsAndContent
+)
+
+(bootstrap
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'type-factory-itf
+ 'generic-factory-itf
+ (loader org.objectweb.fractal.julia.loader.Loader)
+ )
+ (
+ 'component-impl
+ 'type-factory-impl
+ 'generic-factory-impl
+ # choose one of the following classes:
+ # the first one loads all classes from the classpath
+ # the second one can generate missing classes on the fly, dynamically
+ # org.objectweb.fractal.julia.loader.BasicLoader
+ org.objectweb.fractal.julia.loader.DynamicLoader
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ none
+ )
+)
+
+(primitive
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'binding-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'lifecycle-controller-itf
+ # only if lifecycle-controller-itf does not designate the Julia
interface:
+ # 'julia-lifecycle-controller-itf
+ 'name-controller-itf
+ )
+ (
+ 'component-impl
+ 'container-binding-controller-impl
+ 'super-controller-impl
+ 'lifecycle-controller-impl
+ 'name-controller-impl
+ )
+ (
+ (org.objectweb.fractal.julia.asm.InterceptorClassGenerator
+ org.objectweb.fractal.julia.asm.LifeCycleCodeGenerator
+ )
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+(parametricPrimitive
+ 'primitive
+)
+
+(composite
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'binding-controller-itf
+ 'content-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'lifecycle-controller-itf
+ # only if lifecycle-controller-itf does not designate the Julia
interface:
+ # 'julia-lifecycle-controller-itf
+ 'name-controller-itf
+ )
+ (
+ 'component-impl
+ 'composite-binding-controller-impl
+ 'content-controller-impl
+ 'super-controller-impl
+ 'composite-lifecycle-controller-impl
+ 'name-controller-impl
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+(parametricComposite
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'binding-controller-itf
+ 'content-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'lifecycle-controller-itf
+ # only if lifecycle-controller-itf does not designate the Julia
interface:
+ # 'julia-lifecycle-controller-itf
+ 'name-controller-itf
+ )
+ (
+ 'component-impl
+ ((org.objectweb.fractal.julia.asm.AttributeControllerClassGenerator
+ ('attributeControllerInterface)
+ ))
+ 'composite-binding-controller-impl
+ 'content-controller-impl
+ 'super-controller-impl
+ 'composite-lifecycle-controller-impl
+ 'name-controller-impl
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+(primitiveTemplate
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'binding-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'name-controller-itf
+ 'factory-itf
+ # only if factory-itf does not designate the Julia interface:
+ # 'julia-factory-itf
+ )
+ (
+ 'component-impl
+ 'primitive-binding-controller-impl
+ 'super-controller-impl
+ 'name-controller-impl
+ 'factory-impl
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+(parametricPrimitiveTemplate
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'julia-attribute-controller-itf
+ 'binding-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'name-controller-itf
+ 'factory-itf
+ # only if factory-itf does not designate the Julia interface:
+ # 'julia-factory-itf
+ )
+ (
+ 'component-impl
+ ((org.objectweb.fractal.julia.asm.AttributeControllerClassGenerator
+ ('attributeControllerInterface)
+ ))
+ 'primitive-binding-controller-impl
+ 'super-controller-impl
+ 'name-controller-impl
+ 'factory-impl
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+(compositeTemplate
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'binding-controller-itf
+ 'content-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'name-controller-itf
+ 'factory-itf
+ # only if factory-itf does not designate the Julia interface:
+ # 'julia-factory-itf
+ )
+ (
+ 'component-impl
+ 'composite-binding-controller-impl
+ 'content-controller-impl
+ 'super-controller-impl
+ 'name-controller-impl
+ 'factory-impl
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+(parametricCompositeTemplate
+ (
+ 'interface-class-generator
+ (
+ 'component-itf
+ 'julia-attribute-controller-itf
+ 'binding-controller-itf
+ 'content-controller-itf
+ 'super-controller-itf
+ # only if super-controller-itf does not designate the Julia interface:
+ # 'julia-super-controller-itf
+ 'name-controller-itf
+ 'factory-itf
+ # only if factory-itf does not designate the Julia interface:
+ # 'julia-factory-itf
+ )
+ (
+ 'component-impl
+ ((org.objectweb.fractal.julia.asm.AttributeControllerClassGenerator
+ ('attributeControllerInterface)
+ ))
+ 'composite-binding-controller-impl
+ 'content-controller-impl
+ 'super-controller-impl
+ 'name-controller-impl
+ 'factory-impl
+ )
+ (
+ # no interceptors
+ )
+ org.objectweb.fractal.julia.asm.MergeClassGenerator
+ 'optimizationLevel
+ )
+)
+
+###############################################################################
+# CUSTOM CONFIGURATION INFORMATION
+###############################################################################
+
+# no custom definitions
Index: julia/examples/juliak/lib/dtdparser.jar
<<Binary file>>
Index: julia/examples/juliak/lib/fractal-adl.jar
<<Binary file>>
Index: julia/examples/juliak/lib/ow_deployment_scheduling.jar
<<Binary file>>
Index: julia/examples/juliak/src/membrane/Main.java
diff -u /dev/null julia/examples/juliak/src/membrane/Main.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/Main.java Wed Jan 17 15:09:16
2007
@@ -0,0 +1,61 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ */
+
+package membrane;
+
+
+/**
+ * This class illustrates three features which are specific to the {@link
+ * org.objectweb.fractal.julia.Juliak} Fractal provider class for developing
+ * component-based control membranes:
+ * <ul>
+ * <li> control membrane introspection </li>
+ * <li> gluing of a control membrane to a content instance </li>
+ * <li> dynamic management of interceptors </li>
+ * </ul>
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+
+
System.err.println("===================================================");
+ System.err.println("==== Control membrane introspection
====");
+
System.err.println("===================================================");
+ membrane.introspect.Main.main(args);
+
+ System.err.println();
+
System.err.println("===================================================");
+ System.err.println("==== Gluing of a control membrane to a content
instance");
+
System.err.println("===================================================");
+ membrane.glue.Main.main(args);
+
+ System.err.println();
+
System.err.println("===================================================");
+ System.err.println("==== Dynamic management of interceptors
====");
+
System.err.println("===================================================");
+ membrane.interceptor.Main.main(args);
+
+ }
+}
Index: julia/examples/juliak/src/membrane/glue/BasicLoggerControllerImpl.java
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/BasicLoggerControllerImpl.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/BasicLoggerControllerImpl.java
Wed Jan 17 15:09:15 2007
@@ -0,0 +1,258 @@
+/**
+ * Dream
+ * Copyright (C) 2003-2004 INRIA Rhone-Alpes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: dream@xxxxxxxxxxxxx
+ *
+ * Initial developer(s): Matthieu Leclercq
+ * Contributor(s): Lionel Seinturier
+ */
+
+package membrane.glue;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.objectweb.fractal.julia.Controller;
+import org.objectweb.fractal.julia.InitializationContext;
+import org.objectweb.util.monolog.Monolog;
+import org.objectweb.util.monolog.api.BasicLevel;
+import org.objectweb.util.monolog.api.Logger;
+
+/**
+ * Basic implementation of logger controller. A
<code>"monolog-conf-file"</code>
+ * initialisation parameter can be set to specify the location of the monolog
+ * configuration file.
+ */
+public class BasicLoggerControllerImpl
+ implements LoggerController, LoggerControllerRegister, Controller
+{
+
+ String baseName;
+
+ /** Map associating logger name and list of registred loggables */
+ Map registrations;
+ /** Map associating logger name and logger instance */
+ Map loggers;
+ Logger baseLogger;
+
+
+ public void initFcController(InitializationContext ic) {
+
+ String monologConfFile = "etc/monolog.properties";
+ if (Monolog.monologFactory == Monolog.getDefaultMonologFactory())
+ {
+ Monolog.getMonologFactory(monologConfFile);
+ }
+
+ baseName = Util.getNextUnnamedBaseName();
+ registrations = new HashMap();
+ loggers = new HashMap();
+ }
+
+ //
-------------------------------------------------------------------------
+ // Fields and methods added and overriden by the mixin class
+ //
-------------------------------------------------------------------------
+
+ /**
+ * @see LoggerControllerItf#getBaseName()
+ */
+ public String getBaseName()
+ {
+ return baseName;
+ }
+
+ /**
+ * @see LoggerControllerItf#setBaseName(String)
+ */
+ public void setBaseName(String name)
+ {
+ this.baseName = name;
+ baseNameChanged();
+ }
+
+ /**
+ * @see LoggerControllerItf#getLoggerLevel(String)
+ */
+ public int getLoggerLevel(String loggerName)
+ {
+ Logger l = (Logger) loggers.get(loggerName);
+ if (l == null)
+ {
+ if (loggerName == null)
+ {
+ if (baseLogger == null)
+ {
+ baseLogger = Monolog.monologFactory.getLogger(baseName);
+ }
+ l = baseLogger;
+ }
+ else
+ {
+ return INHERIT;
+ }
+ }
+ int i = l.getCurrentIntLevel();
+ if (i == BasicLevel.DEBUG)
+ return DEBUG;
+ if (i == BasicLevel.INFO)
+ return INFO;
+ if (i == BasicLevel.WARN)
+ return WARN;
+ if (i == BasicLevel.ERROR)
+ return ERROR;
+ if (i == BasicLevel.FATAL)
+ return FATAL;
+ if (i == BasicLevel.INHERIT)
+ return INHERIT;
+ throw new IllegalStateException("Unknown logger level : " + i);
+ }
+
+ /**
+ * @see LoggerControllerItf#setLoggerLevel(String, int)
+ */
+ public void setLoggerLevel(String loggerName, int level)
+ {
+ Logger l = (Logger) loggers.get(loggerName);
+ if (l == null)
+ {
+ if (loggerName == null)
+ {
+ if (baseLogger == null)
+ {
+ baseLogger = Monolog.monologFactory.getLogger(baseName);
+ }
+ l = baseLogger;
+ }
+ else
+ {
+ return;
+ }
+ }
+ switch (level)
+ {
+ case DEBUG :
+ l.setLevel(BasicLevel.LEVEL_DEBUG);
+ break;
+ case INFO :
+ l.setLevel(BasicLevel.LEVEL_INFO);
+ break;
+ case WARN :
+ l.setLevel(BasicLevel.LEVEL_WARN);
+ break;
+ case ERROR :
+ l.setLevel(BasicLevel.LEVEL_ERROR);
+ break;
+ case FATAL :
+ l.setLevel(BasicLevel.LEVEL_FATAL);
+ break;
+ case INHERIT :
+ l.setLevel(BasicLevel.LEVEL_INHERIT);
+ break;
+ default :
+ throw new IllegalArgumentException("Unknown level " + level);
+ }
+ }
+
+ /**
+ * @see LoggerControllerItf#getLoggerNames()
+ */
+ public String[] getLoggerNames()
+ {
+ return (String[]) loggers.keySet().toArray(new String[loggers.size()]);
+ }
+
+ /**
+ * @see LoggerControllerRegister#register(String, Loggable)
+ */
+ public void register(String loggerName, Loggable loggable)
+ {
+ Set s = (Set) registrations.get(loggerName);
+ if (s == null)
+ {
+ s = new HashSet();
+ registrations.put(loggerName, s);
+ }
+ s.add(loggable);
+ giveLogger(loggerName, loggable);
+ }
+
+ /**
+ * @see LoggerControllerRegister#unregiser(String, Loggable)
+ */
+ public void unregister(String loggerName, Loggable loggable)
+ {
+ Set s = (Set) registrations.get(loggerName);
+ if (s == null)
+ {
+ return;
+ }
+ s.remove(loggable);
+ if (s.isEmpty())
+ {
+ // no more registration for this logger, remove reference to it, for
+ // garbage collector
+ registrations.remove(loggerName);
+ loggers.remove(loggerName);
+ }
+ }
+
+ //
---------------------------------------------------------------------------
+ // Utility methods
+ //
---------------------------------------------------------------------------
+
+ void baseNameChanged()
+ {
+ loggers.clear();
+ Iterator iter = registrations.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String loggerName = (String) entry.getKey();
+ Set loggables = (Set) entry.getValue();
+ Iterator iter2 = loggables.iterator();
+ while (iter2.hasNext())
+ {
+ Loggable loggable = (Loggable) iter2.next();
+ giveLogger(loggerName, loggable);
+ }
+ }
+ }
+
+ void giveLogger(String loggerName, Loggable loggable)
+ {
+ Logger logger = (Logger) loggers.get(loggerName);
+ if (logger == null)
+ {
+ String name;
+ if (loggerName == null)
+ {
+ name = baseName;
+ }
+ else
+ {
+ name = baseName + "." + loggerName;
+ }
+ logger = Monolog.monologFactory.getLogger(name);
+ loggers.put(loggerName, logger);
+ }
+ loggable.setLogger(loggerName, logger);
+ }
+}
Index: julia/examples/juliak/src/membrane/glue/C.java
diff -u /dev/null julia/examples/juliak/src/membrane/glue/C.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/C.java Wed Jan 17 15:09:15
2007
@@ -0,0 +1,47 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ */
+
+package membrane.glue;
+
+import org.objectweb.util.monolog.api.BasicLevel;
+import org.objectweb.util.monolog.api.Logger;
+
+
+/**
+ * Content class for the example.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class C implements Runnable, Loggable {
+
+ public void run() {
+ logger.log( BasicLevel.INFO, "Hello World from "+this );
+ }
+
+ private Logger logger;
+
+ public void setLogger(String name, Logger logger) {
+ this.logger = logger;
+ }
+
+}
Index: julia/examples/juliak/src/membrane/glue/Loggable.java
diff -u /dev/null julia/examples/juliak/src/membrane/glue/Loggable.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/Loggable.java Wed Jan 17
15:09:15 2007
@@ -0,0 +1,44 @@
+/**
+ * Dream
+ * Copyright (C) 2003-2004 INRIA Rhone-Alpes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: dream@xxxxxxxxxxxxx
+ *
+ * Initial developer(s): Matthieu Leclercq
+ * Contributor(s):
+ */
+
+package membrane.glue;
+
+import org.objectweb.util.monolog.api.Logger;
+
+/**
+ * Interface used to give logger to a component implementation or a
controller
+ * that has register with the logger controller using
+ * {@link LoggerControllerRegister#register(String, Loggable)}.
+ */
+public interface Loggable
+{
+
+ /**
+ * Gives the logger.
+ *
+ * @param name the registration name.
+ * @param logger the logger.
+ */
+ void setLogger(String name, Logger logger);
+}
\ No newline at end of file
Index: julia/examples/juliak/src/membrane/glue/LoggablePrimitive.fractal
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/LoggablePrimitive.fractal:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/LoggablePrimitive.fractal Wed
Jan 17 15:09:15 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
+
+<!--
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ -->
+
+<definition
+ name="membrane.glue.LoggablePrimitive"
+
extends="org.objectweb.fractal.juliak.membrane.Primitive,membrane.glue.LoggerControllerType"
>
+
+ <component name="LogC" definition="membrane.glue.LoggerController" />
+
+ <binding client="this.//logger-controller"
server="LogC.//logger-controller" />
+ <binding client="this.///logger-controller-register"
server="LogC.///logger-controller-register" />
+
+</definition>
Index: julia/examples/juliak/src/membrane/glue/LoggablePrimitive.java
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/LoggablePrimitive.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/LoggablePrimitive.java Wed
Jan 17 15:09:15 2007
@@ -0,0 +1,160 @@
+/*
+ * Generated by org.objectweb.fractal.adl.juliak.Compile2Java on: Wed Jan 10
21:57:14 CET 2007
+ */
+package membrane.glue;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.factory.GenericFactory;
+import org.objectweb.fractal.api.type.ComponentType;
+import org.objectweb.fractal.api.type.InterfaceType;
+import org.objectweb.fractal.api.type.TypeFactory;
+import org.objectweb.fractal.util.Fractal;
+import org.objectweb.fractal.api.NoSuchInterfaceException;
+
+/**
+ * Default implementation of the LoggablePrimitive membrane.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class LoggablePrimitive implements
org.objectweb.fractal.juliak.membrane.CustomFactory {
+
+ private TypeFactory typeFactory;
+ public void setFcTypeFactory( TypeFactory tf ) {
+ typeFactory = tf;
+ }
+ public TypeFactory getFcTypeFactory() {
+ return typeFactory;
+ }
+
+ private GenericFactory genericFactory;
+ public void setFcGenericFactory( GenericFactory gf ) {
+ genericFactory = gf;
+ }
+ public GenericFactory getFcGenericFactory() {
+ return genericFactory;
+ }
+
+ public Object getFcContentDesc() {
+ throw new java.lang.UnsupportedOperationException();
+ }
+
+ public Object getFcControllerDesc() {
+ throw new java.lang.UnsupportedOperationException();
+ }
+
+ public Component newFcInstance() throws
org.objectweb.fractal.api.factory.InstantiationException {
+ try {
+ // --------------------------------------------------
+InterfaceType IT0 = typeFactory.createFcItfType("//logger-controller",
"membrane.glue.LoggerController", false, false, false);
+InterfaceType IT1 =
typeFactory.createFcItfType("///logger-controller-register",
"membrane.glue.LoggerControllerRegister", false, false, false);
+ComponentType CT0 = typeFactory.createFcType(new InterfaceType [] { IT0, IT1
});
+Component C0 = genericFactory.newFcInstance(CT0, "mPrimitive",
"membrane.glue.BasicLoggerControllerImpl");
+try { Fractal.getNameController(C0).setFcName("LogC"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT2 = typeFactory.createFcItfType("//component",
"org.objectweb.fractal.api.Component", false, false, false);
+ComponentType CT1 = typeFactory.createFcType(new InterfaceType [] { IT2 });
+Component C1 = genericFactory.newFcInstance(CT1, "mPrimitive",
"org.objectweb.fractal.juliak.control.component.ComponentImpl");
+try { Fractal.getNameController(C1).setFcName("Comp"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT3 = typeFactory.createFcItfType("//name-controller",
"org.objectweb.fractal.api.control.NameController", false, false, false);
+ComponentType CT2 = typeFactory.createFcType(new InterfaceType [] { IT3 });
+Component C2 = genericFactory.newFcInstance(CT2, "mPrimitive",
"org.objectweb.fractal.juliak.control.name.NameControllerImpl");
+try { Fractal.getNameController(C2).setFcName("NC"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT4 = typeFactory.createFcItfType("//component",
"org.objectweb.fractal.api.Component", true, false, false);
+InterfaceType IT5 = typeFactory.createFcItfType("//lifecycle-controller",
"org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator", false,
false, false);
+ComponentType CT3 = typeFactory.createFcType(new InterfaceType [] { IT4, IT5
});
+Component C3 = genericFactory.newFcInstance(CT3, "mPrimitive",
"org.objectweb.fractal.juliak.control.lifecycle.LifeCycleControllerImpl");
+try { Fractal.getNameController(C3).setFcName("LC"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT6 = typeFactory.createFcItfType("//lifecycle-controller",
"org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator", true,
false, false);
+InterfaceType IT7 = typeFactory.createFcItfType("//super-controller",
"org.objectweb.fractal.julia.control.content.SuperControllerNotifier", true,
false, false);
+InterfaceType IT8 = typeFactory.createFcItfType("//component",
"org.objectweb.fractal.api.Component", true, false, false);
+InterfaceType IT9 = typeFactory.createFcItfType("//binding-controller",
"org.objectweb.fractal.api.control.BindingController", false, false, false);
+ComponentType CT4 = typeFactory.createFcType(new InterfaceType [] { IT6,
IT7, IT8, IT9 });
+Component C4 = genericFactory.newFcInstance(CT4, "mPrimitive",
"org.objectweb.fractal.juliak.control.binding.ContainerBindingControllerImpl");
+try { Fractal.getNameController(C4).setFcName("BC"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT10 = typeFactory.createFcItfType("//super-controller",
"org.objectweb.fractal.julia.control.content.SuperControllerNotifier", false,
false, false);
+ComponentType CT5 = typeFactory.createFcType(new InterfaceType [] { IT10 });
+Component C5 = genericFactory.newFcInstance(CT5, "mPrimitive",
"org.objectweb.fractal.juliak.control.content.SuperControllerImpl");
+try { Fractal.getNameController(C5).setFcName("SC"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT11 = typeFactory.createFcItfType("//lifecycle-controller",
"org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator", true,
false, false);
+InterfaceType IT12 = typeFactory.createFcItfType("//component",
"org.objectweb.fractal.api.Component", true, false, false);
+InterfaceType IT13 =
typeFactory.createFcItfType("///interceptor-controller",
"org.objectweb.fractal.juliak.control.interceptor.InterceptorController",
false, false, false);
+InterfaceType IT14 = typeFactory.createFcItfType("attribute-controller",
"org.objectweb.fractal.juliak.control.interceptor.InterceptorDefAttributes",
false, false, false);
+ComponentType CT6 = typeFactory.createFcType(new InterfaceType [] { IT11,
IT12, IT13, IT14 });
+Component C6 = genericFactory.newFcInstance(CT6, "mPrimitive",
"org.objectweb.fractal.juliak.control.interceptor.InterceptorCompControllerImpl");
+try { Fractal.getNameController(C6).setFcName("IC"); } catch
(NoSuchInterfaceException ignored) { }
+((org.objectweb.fractal.juliak.control.interceptor.InterceptorDefAttributes)Fractal.getAttributeController(C6)).setInterceptors("(org.objectweb.fractal.julia.asm.InterceptorClassGenerator
org.objectweb.fractal.julia.asm.LifeCycleCodeGenerator)");
+InterfaceType IT15 = typeFactory.createFcItfType("///membrane-controller",
"org.objectweb.fractal.juliak.control.membrane.MembraneController", false,
false, false);
+ComponentType CT7 = typeFactory.createFcType(new InterfaceType [] { IT15 });
+Component C7 = genericFactory.newFcInstance(CT7, "mPrimitive",
"org.objectweb.fractal.juliak.control.membrane.MembraneControllerImpl");
+try { Fractal.getNameController(C7).setFcName("MC"); } catch
(NoSuchInterfaceException ignored) { }
+InterfaceType IT16 = typeFactory.createFcItfType("//logger-controller",
"membrane.glue.LoggerController", false, false, false);
+InterfaceType IT17 =
typeFactory.createFcItfType("///logger-controller-register",
"membrane.glue.LoggerControllerRegister", false, false, false);
+InterfaceType IT18 = typeFactory.createFcItfType("///membrane-controller",
"org.objectweb.fractal.juliak.control.membrane.MembraneController", false,
false, false);
+InterfaceType IT19 =
typeFactory.createFcItfType("///interceptor-controller",
"org.objectweb.fractal.juliak.control.interceptor.InterceptorController",
false, false, false);
+InterfaceType IT20 = typeFactory.createFcItfType("//super-controller",
"org.objectweb.fractal.julia.control.content.SuperControllerNotifier", false,
false, false);
+InterfaceType IT21 = typeFactory.createFcItfType("//name-controller",
"org.objectweb.fractal.api.control.NameController", false, false, false);
+InterfaceType IT22 = typeFactory.createFcItfType("//component",
"org.objectweb.fractal.api.Component", false, false, false);
+InterfaceType IT23 = typeFactory.createFcItfType("//binding-controller",
"org.objectweb.fractal.api.control.BindingController", false, false, false);
+InterfaceType IT24 = typeFactory.createFcItfType("//lifecycle-controller",
"org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator", false,
false, false);
+ComponentType CT8 = typeFactory.createFcType(new InterfaceType [] { IT16,
IT17, IT18, IT19, IT20, IT21, IT22, IT23, IT24 });
+Component C8 = genericFactory.newFcInstance(CT8, "mComposite", null);
+try {
Fractal.getNameController(C8).setFcName("membrane.glue.LoggablePrimitive"); }
catch (NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C0);
+try { Fractal.getNameController(C0).setFcName("LogC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C1);
+try { Fractal.getNameController(C1).setFcName("Comp"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C2);
+try { Fractal.getNameController(C2).setFcName("NC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C3);
+try { Fractal.getNameController(C3).setFcName("LC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C4);
+try { Fractal.getNameController(C4).setFcName("BC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C5);
+try { Fractal.getNameController(C5).setFcName("SC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C6);
+try { Fractal.getNameController(C6).setFcName("IC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getContentController(C8).addFcSubComponent(C7);
+try { Fractal.getNameController(C7).setFcName("MC"); } catch
(NoSuchInterfaceException ignored) { }
+Fractal.getBindingController(C8).bindFc("//logger-controller",
C0.getFcInterface("//logger-controller"));
+Fractal.getBindingController(C8).bindFc("///logger-controller-register",
C0.getFcInterface("///logger-controller-register"));
+Fractal.getBindingController(C8).bindFc("//component",
C1.getFcInterface("//component"));
+Fractal.getBindingController(C8).bindFc("//name-controller",
C2.getFcInterface("//name-controller"));
+Fractal.getBindingController(C8).bindFc("//lifecycle-controller",
C3.getFcInterface("//lifecycle-controller"));
+Fractal.getBindingController(C8).bindFc("//binding-controller",
C4.getFcInterface("//binding-controller"));
+Fractal.getBindingController(C8).bindFc("//super-controller",
C5.getFcInterface("//super-controller"));
+Fractal.getBindingController(C8).bindFc("///interceptor-controller",
C6.getFcInterface("///interceptor-controller"));
+Fractal.getBindingController(C4).bindFc("//component",
C1.getFcInterface("//component"));
+Fractal.getBindingController(C4).bindFc("//super-controller",
C5.getFcInterface("//super-controller"));
+Fractal.getBindingController(C4).bindFc("//lifecycle-controller",
C3.getFcInterface("//lifecycle-controller"));
+Fractal.getBindingController(C3).bindFc("//component",
C1.getFcInterface("//component"));
+Fractal.getBindingController(C6).bindFc("//component",
C1.getFcInterface("//component"));
+Fractal.getBindingController(C6).bindFc("//lifecycle-controller",
C3.getFcInterface("//lifecycle-controller"));
+Fractal.getBindingController(C8).bindFc("///membrane-controller",
C7.getFcInterface("///membrane-controller"));
+ // --------------------------------------------------
+ return C8;
+ }
+ catch( Exception e ) {
+ throw new
org.objectweb.fractal.api.factory.InstantiationException(e.getMessage());
+ }
+ }
+
+ public org.objectweb.fractal.api.Type getFcInstanceType() {
+ try {
+ // --------------------------------------------------
+InterfaceType IT25 = typeFactory.createFcItfType("//logger-controller",
"membrane.glue.LoggerController", false, false, false);
+InterfaceType IT26 =
typeFactory.createFcItfType("///logger-controller-register",
"membrane.glue.LoggerControllerRegister", false, false, false);
+InterfaceType IT27 = typeFactory.createFcItfType("///membrane-controller",
"org.objectweb.fractal.juliak.control.membrane.MembraneController", false,
false, false);
+InterfaceType IT28 =
typeFactory.createFcItfType("///interceptor-controller",
"org.objectweb.fractal.juliak.control.interceptor.InterceptorController",
false, false, false);
+InterfaceType IT29 = typeFactory.createFcItfType("//super-controller",
"org.objectweb.fractal.julia.control.content.SuperControllerNotifier", false,
false, false);
+InterfaceType IT30 = typeFactory.createFcItfType("//name-controller",
"org.objectweb.fractal.api.control.NameController", false, false, false);
+InterfaceType IT31 = typeFactory.createFcItfType("//component",
"org.objectweb.fractal.api.Component", false, false, false);
+InterfaceType IT32 = typeFactory.createFcItfType("//binding-controller",
"org.objectweb.fractal.api.control.BindingController", false, false, false);
+InterfaceType IT33 = typeFactory.createFcItfType("//lifecycle-controller",
"org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator", false,
false, false);
+ComponentType CT9 = typeFactory.createFcType(new InterfaceType [] { IT25,
IT26, IT27, IT28, IT29, IT30, IT31, IT32, IT33 });
+ // --------------------------------------------------
+ return CT9;
+ }
+ catch( Exception e ) {
+ throw new RuntimeException(e.getMessage());
+ }
+ }
+}
Index: julia/examples/juliak/src/membrane/glue/LoggerController.fractal
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/LoggerController.fractal:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/LoggerController.fractal Wed
Jan 17 15:09:15 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
+
+<!--
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ -->
+
+<definition
+ name="membrane.glue.LoggerController"
+ extends="membrane.glue.LoggerControllerType" >
+
+ <content class="membrane.glue.BasicLoggerControllerImpl" />
+
+ <controller desc="mPrimitive" />
+</definition>
Index: julia/examples/juliak/src/membrane/glue/LoggerController.java
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/LoggerController.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/LoggerController.java Wed
Jan 17 15:09:15 2007
@@ -0,0 +1,93 @@
+/**
+ * Dream
+ * Copyright (C) 2003-2004 INRIA Rhone-Alpes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact : dream@xxxxxxxxxxxxx
+ *
+ * Initial developer(s): Matthieu Leclercq
+ * Contributor(s): Vivien Quema
+ */
+
+package membrane.glue;
+
+/**
+ * Controller interface to control
+ * {@link org.objectweb.util.monolog.api.Logger loggers }associated with the
+ * component this controller belong. Every loggers define in a component
shared
+ * the same base name and have a suffix (can be <code>null</code>).
+ */
+public interface LoggerController
+{
+ /**
+ * Logger level for debug message. <br/>This constant can be used to change
+ * logger level remotly. Indeed, monolog
+ * {@link org.objectweb.util.monolog.api.BasicLevel }levels must be
+ * initialized by monolog factories. So if this interface is used remotly,
the
+ * caller may not have initialized it.
+ */
+ int DEBUG = 0;
+ /** Logger level for info message. */
+ int INFO = 1;
+ /** Logger level for warning message. */
+ int WARN = 2;
+ /** Logger level for error message. */
+ int ERROR = 3;
+ /** Logger level for fatal message. */
+ int FATAL = 4;
+ /**
+ * Logger level indicates that the level is inherited from logger's
ancestors.
+ */
+ int INHERIT = 5;
+
+ /**
+ * Sets the loggers' base name.
+ *
+ * @param name the base name
+ */
+ void setBaseName(String name);
+
+ /**
+ * Returns the loggers' base name.
+ *
+ * @return the loggers' base name.
+ */
+ String getBaseName();
+
+ /**
+ * Returns the current logging level of a logger
+ *
+ * @param loggerName the name of the logger
+ * @return the current logging level of a logger. Returns
<code>INHERIT</code>
+ * if given name is unknown.
+ */
+ int getLoggerLevel(String loggerName);
+
+ /**
+ * Sets the logging level of a logger.
+ *
+ * @param loggerName the name of the logger
+ * @param level a level
+ */
+ void setLoggerLevel(String loggerName, int level);
+
+ /**
+ * Returns the name of every registered loggers.
+ *
+ * @return an array of registered loggers name.
+ */
+ String[] getLoggerNames();
+}
\ No newline at end of file
Index: julia/examples/juliak/src/membrane/glue/LoggerControllerRegister.java
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/LoggerControllerRegister.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/LoggerControllerRegister.java
Wed Jan 17 15:09:15 2007
@@ -0,0 +1,51 @@
+/**
+ * Dream
+ * Copyright (C) 2003-2004 INRIA Rhone-Alpes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: dream@xxxxxxxxxxxxx
+ *
+ * Initial developer(s): Matthieu Leclercq
+ * Contributor(s):
+ */
+
+package membrane.glue;
+
+/**
+ * Interface implemented by logger controller to allow other controllers and
+ * content class to register as <i>logger controller client <i>.
+ */
+public interface LoggerControllerRegister
+{
+
+ /**
+ * Registers a loggable as client of this logger controller for the
specified
+ * logger name.
+ *
+ * @param loggerName a logger name
+ * @param loggable a loggable object (controller or content class).
+ */
+ void register(String loggerName, Loggable loggable);
+
+ /**
+ * Un registers a loggable.
+ *
+ * @param loggerName the registred logger name
+ * @param loggable the registred loggable object (controller or content
+ * class).
+ */
+ void unregister(String loggerName, Loggable loggable);
+}
\ No newline at end of file
Index: julia/examples/juliak/src/membrane/glue/LoggerControllerType.fractal
diff -u /dev/null
julia/examples/juliak/src/membrane/glue/LoggerControllerType.fractal:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/LoggerControllerType.fractal
Wed Jan 17 15:09:15 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC "-//objectweb.org//DTD Fractal ADL 2.0//EN"
"classpath://org/objectweb/fractal/adl/xml/standard.dtd">
+
+<!--
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ -->
+
+<definition name="membrane.glue.LoggerControllerType">
+ <interface
+ name="//logger-controller"
+ signature="membrane.glue.LoggerController"
+ role="server"
+ />
+
+ <interface
+ name="///logger-controller-register"
+ signature="membrane.glue.LoggerControllerRegister"
+ role="server"
+ />
+</definition>
Index: julia/examples/juliak/src/membrane/glue/Main.java
diff -u /dev/null julia/examples/juliak/src/membrane/glue/Main.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/Main.java Wed Jan 17 15:09:15
2007
@@ -0,0 +1,110 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ */
+
+package membrane.glue;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.factory.GenericFactory;
+import org.objectweb.fractal.api.type.ComponentType;
+import org.objectweb.fractal.api.type.InterfaceType;
+import org.objectweb.fractal.api.type.TypeFactory;
+import org.objectweb.fractal.juliak.membrane.CustomFactory;
+import org.objectweb.fractal.juliak.membrane.MembraneDef;
+import org.objectweb.fractal.juliak.membrane.Membranes;
+import org.objectweb.fractal.util.Fractal;
+
+/**
+ * This class illustrates the definition of new control membranes.
+ *
+ * This example defines a control membrane which extends the control
membrane of
+ * primitive components with a logger controller (as defined by the
+ * <a href="http://dream.objectweb.org">Dream</a<
+ * framework). This new membrane, represented as a control {@link
Component}, is
+ * used to instantiate an application level component.
+ *
+ * Two techniques are illustrated. The first technique consists in
instanciating
+ * the control membrane with the Fractal API (just like any Fractal
component)
+ * and then using this component as the control part for instanciating
+ * another component. The second techniques consists in registering the new
+ * control membrane with the membrane repository.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+
+ Component boot = Fractal.getBootstrapComponent();
+ TypeFactory tf = Fractal.getTypeFactory(boot);
+ GenericFactory gf = Fractal.getGenericFactory(boot);
+
+ /*
+ * Create the component type.
+ */
+ ComponentType type =
+ tf.createFcType(
+ new InterfaceType[]{
+ tf.createFcItfType(
+ "r", Runnable.class.getName(), false, false, false)
+ }
+ );
+
+ /*
+ * Use a component as the control membrane for creating another
+ * component.
+ */
+ String adl = LoggablePrimitive.class.getName();
+ Class cl = Class.forName(adl);
+ CustomFactory cf = (CustomFactory) cl.newInstance();
+ cf.setFcGenericFactory(gf);
+ cf.setFcTypeFactory(tf);
+ Component membrane = cf.newFcInstance();
+ Component c1 = gf.newFcInstance(type, membrane, C.class.getName());
+ run(c1);
+
+ /*
+ * Register a new membrane with the membrane repository.
+ */
+ MembraneDef mdef = new MembraneDef("loggablePrimitive",adl);
+ Membranes membranes = Membranes.get();
+ membranes.register(mdef);
+ Component c2 = gf.newFcInstance(type, "loggablePrimitive",
C.class.getName());
+ run(c2);
+ }
+
+ private static void run( Component c ) throws Exception {
+ /*
+ * Register the component with the logger controller.
+ */
+ LoggerControllerRegister lcr = (LoggerControllerRegister)
+ c.getFcInterface("/logger-controller-register");
+ Loggable content = (Loggable) c.getFcInterface("/content");
+ lcr.register("myLogger", content);
+
+ /*
+ * Start and run the application.
+ */
+ Fractal.getLifeCycleController(c).startFc();
+ ((Runnable)c.getFcInterface("r")).run();
+ }
+}
Index: julia/examples/juliak/src/membrane/glue/Util.java
diff -u /dev/null julia/examples/juliak/src/membrane/glue/Util.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/glue/Util.java Wed Jan 17 15:09:15
2007
@@ -0,0 +1,48 @@
+/**
+ * Dream
+ * Copyright (C) 2003-2004 INRIA Rhone-Alpes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: dream@xxxxxxxxxxxxx
+ *
+ * Initial developer(s): Matthieu Leclercq
+ * Contributor(s):
+ */
+
+package membrane.glue;
+
+/**
+ * Utility class for logger controller.
+ */
+public final class Util
+{
+
+ private static int nextUnnamedBaseName = 0;
+
+ private Util()
+ {
+ }
+
+ /**
+ * Returns a unique logger base name for an unnamed component.
+ *
+ * @return a unique logger base name for an unnamed component.
+ */
+ public static String getNextUnnamedBaseName()
+ {
+ return "unnamedComponent." + (nextUnnamedBaseName++);
+ }
+}
\ No newline at end of file
Index: julia/examples/juliak/src/membrane/interceptor/C.java
diff -u /dev/null julia/examples/juliak/src/membrane/interceptor/C.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/interceptor/C.java Wed Jan 17
15:09:16 2007
@@ -0,0 +1,37 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ */
+
+package membrane.interceptor;
+
+
+/**
+ * Content class for the example.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class C implements Runnable {
+
+ public void run() {
+ System.err.println( "Hello World from " + this );
+ }
+}
Index: julia/examples/juliak/src/membrane/interceptor/Main.java
diff -u /dev/null julia/examples/juliak/src/membrane/interceptor/Main.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/interceptor/Main.java Wed Jan 17
15:09:16 2007
@@ -0,0 +1,127 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ */
+
+package membrane.interceptor;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.factory.GenericFactory;
+import org.objectweb.fractal.api.factory.InstantiationException;
+import org.objectweb.fractal.api.type.ComponentType;
+import org.objectweb.fractal.api.type.InterfaceType;
+import org.objectweb.fractal.api.type.TypeFactory;
+import org.objectweb.fractal.julia.ComponentInterface;
+import org.objectweb.fractal.julia.InitializationContext;
+import org.objectweb.fractal.julia.Interceptor;
+import
org.objectweb.fractal.juliak.control.interceptor.InterceptorController;
+import org.objectweb.fractal.util.Fractal;
+
+/**
+ * This class illustrates the usage of the interceptor controller for
+ * dynamically adding and removing an interceptor.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+
+ Component boot = Fractal.getBootstrapComponent();
+ TypeFactory tf = Fractal.getTypeFactory(boot);
+ GenericFactory gf = Fractal.getGenericFactory(boot);
+
+ /*
+ * Create the component type.
+ */
+ ComponentType type =
+ tf.createFcType(
+ new InterfaceType[]{
+ tf.createFcItfType(
+ "r", Runnable.class.getName(), false, false, false)
+ }
+ );
+
+ /*
+ * Create a primitive component, start it and invoke it.
+ */
+ Component c = gf.newFcInstance(type, "primitive", C.class.getName());
+ Fractal.getLifeCycleController(c).startFc();
+ ComponentInterface itf = (ComponentInterface) c.getFcInterface("r");
+ ((Runnable)itf).run();
+
+ /*
+ * Adding an interceptor.
+ */
+ System.err.println("<< Adding an interceptor");
+ InterceptorController ic = (InterceptorController)
+ c.getFcInterface("/interceptor-controller");
+ Interceptor myInterceptor = new MyInterceptor();
+ ic.addFcInterceptor(itf, myInterceptor);
+
+ /*
+ * Re-invoking the component.
+ */
+ ((Runnable)itf).run();
+
+ /*
+ * Removing the interceptor.
+ */
+ System.err.println("<< Removing the interceptor");
+ ic.removeFcInterceptor(itf, myInterceptor);
+
+ /*
+ * Re-invoking the component.
+ */
+ ((Runnable)itf).run();
+ }
+}
+
+class MyInterceptor implements Runnable, Interceptor {
+
+ public void run() {
+ System.err.println(" [[ In the interceptor ]]");
+ delegate.run();
+ }
+
+ public Object getFcItfDelegate() {
+ return delegate;
+ }
+
+ public void setFcItfDelegate(Object delegate) {
+ this.delegate = (Runnable) delegate;
+ }
+
+ private Runnable delegate;
+
+ public void initFcController(InitializationContext ic) throws
InstantiationException {
+ }
+
+ public Object clone() {
+ try {
+ return super.clone();
+ }
+ catch( CloneNotSupportedException cnse ) {
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Index: julia/examples/juliak/src/membrane/introspect/Main.java
diff -u /dev/null julia/examples/juliak/src/membrane/introspect/Main.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/introspect/Main.java Wed Jan 17
15:09:15 2007
@@ -0,0 +1,101 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Lionel Seinturier
+ */
+
+package membrane.introspect;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.Interface;
+import org.objectweb.fractal.api.factory.GenericFactory;
+import org.objectweb.fractal.api.type.ComponentType;
+import org.objectweb.fractal.api.type.InterfaceType;
+import org.objectweb.fractal.api.type.TypeFactory;
+import org.objectweb.fractal.juliak.FractalHelper;
+import org.objectweb.fractal.juliak.control.membrane.MembraneController;
+import org.objectweb.fractal.util.Fractal;
+
+/**
+ * This class illustrates the usage of the membrane controller to introspect
+ * control membranes.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+
+ Component boot = Fractal.getBootstrapComponent();
+ TypeFactory tf = Fractal.getTypeFactory(boot);
+ GenericFactory gf = Fractal.getGenericFactory(boot);
+
+ ComponentType type =
+ tf.createFcType(
+ new InterfaceType[]{
+ tf.createFcItfType(
+ "r", Runnable.class.getName(), false, true, false)
+ }
+ );
+
+ Component c = gf.newFcInstance(type, "composite", null);
+
+ /*
+ * Get the membrane control which provides the getFcMembrane() method
+ * for retrieving the reference of the control membrane.
+ */
+ Object itf = c.getFcInterface("/membrane-controller");
+ MembraneController mc = (MembraneController) itf;
+ Component membrane = mc.getFcMembrane();
+
+ /*
+ * Display the content of the control membrane.
+ */
+ System.err.println("Membrane introspection for a composite
component");
+ System.err.println();
+ display(membrane);
+ }
+
+ /**
+ * Display a description of the given component: interfaces,
+ * sub-components and bindings.
+ *
+ * @param c a component
+ */
+ private static void display( Component c ) {
+
+ System.err.println(" Interfaces");
+ Object[] itfs = c.getFcInterfaces();
+ for (int i = 0; i < itfs.length; i++) {
+ Interface itf = (Interface) itfs[i];
+ InterfaceType it = (InterfaceType) itf.getFcItfType();
+ System.err.println(" "+i+": "+FractalHelper.toString(it));
+ }
+ System.err.println();
+
+ System.err.println(" Sub-components (control components)");
+ Component[] subs = FractalHelper.getAllSubComponents(c);
+ // start at index 1 to skip c
+ for (int i = 1; i < subs.length; i++) {
+ String name =
FractalHelper.getNameController(subs[i]).getFcName();
+ System.err.println(" "+(i-1)+": "+name);
+ }
+ }
+}
Index: julia/examples/juliak/src/membrane/mix/ClientImpl.java
diff -u /dev/null julia/examples/juliak/src/membrane/mix/ClientImpl.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/mix/ClientImpl.java Wed Jan 17
15:09:15 2007
@@ -0,0 +1,55 @@
+/***
+ * Fractal Hello World Example
+ * Copyright (C) 2001-2002 France Telecom R&D
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Eric.Bruneton@xxxxxxxxxxxxxxxxxxxx
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Eric Bruneton
+ * Author: Lionel Seinturier
+ */
+
+package membrane.mix;
+
+import org.objectweb.fractal.api.control.BindingController;
+
+
+public class ClientImpl implements Runnable, BindingController {
+
+ public ClientImpl () {
+ System.err.println("CLIENT created");
+ }
+
+ public void run () {
+ s.print("hello world");
+ }
+
+ private Service s;
+
+ public String[] listFc () { return new String[] { "s" }; }
+ public Object lookupFc (String itfName) {
+ if (itfName.equals("s")) { return s; }
+ else return null;
+ }
+ public void bindFc (String itfName, Object itfValue) {
+ if (itfName.equals("s")) { s = (Service)itfValue; }
+ }
+ public void unbindFc (String itfName) {
+ if (itfName.equals("s")) { s = null; }
+ }
+
+}
Index: julia/examples/juliak/src/membrane/mix/Main.java
diff -u /dev/null julia/examples/juliak/src/membrane/mix/Main.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/mix/Main.java Wed Jan 17 15:09:15
2007
@@ -0,0 +1,132 @@
+/***
+ * Julia
+ * Copyright (C) 2005-2006 INRIA, France Telecom, USTL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Eric.Bruneton@xxxxxxxxxxxxxxxxxxxx
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Eric Bruneton
+ * Author: Lionel Seinturier
+ */
+
+package membrane.mix;
+
+import org.objectweb.fractal.api.Component;
+import org.objectweb.fractal.api.factory.GenericFactory;
+import org.objectweb.fractal.api.type.ComponentType;
+import org.objectweb.fractal.api.type.InterfaceType;
+import org.objectweb.fractal.api.type.TypeFactory;
+import org.objectweb.fractal.util.Fractal;
+
+
+/**
+ * This example illustrates the assembling of components with an object-based
+ * membrane and components with a component-based membrane in the same
+ * composite.
+ *
+ * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
+ */
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+
+ // ----------------------------------------------------------
+ // Get the bootstrap component and factories
+ // ----------------------------------------------------------
+ Component boot = Fractal.getBootstrapComponent();
+ TypeFactory tf = Fractal.getTypeFactory(boot);
+ GenericFactory cf = Fractal.getGenericFactory(boot);
+
+ // ----------------------------------------------------------
+ // Create the component types
+ // ----------------------------------------------------------
+ ComponentType rType = tf.createFcType(new InterfaceType[] {
+ tf.createFcItfType(
+ "m",
+ "java.lang.Runnable",
+ false, // server interface
+ false, // mandatory
+ false) // singleton
+ });
+
+ ComponentType cType = tf.createFcType(new InterfaceType[] {
+ tf.createFcItfType("m", "java.lang.Runnable", false, false,
false),
+ tf.createFcItfType("s", Service.class.getName(), true,
false, false)
+ });
+ ComponentType sType = tf.createFcType(new InterfaceType[] {
+ tf.createFcItfType("s", Service.class.getName(), false,
false, false),
+ tf.createFcItfType(
+ "attribute-controller",
+ ServiceAttributes.class.getName(),
+ false,
+ false,
+ false)
+ });
+
+ // ----------------------------------------------------------
+ // Instantiate and initialize the components
+ //
+ // rComp and sComp are associated with a component-based membrane
+ // cComp is associated with an object-based membrane
+ // with the /julia/ prefix, the Juliak provider delegates
+ // the instanciation of component to the Julia provider
+ // ----------------------------------------------------------
+ Component rComp = cf.newFcInstance(
+ rType,
+ "composite",
+ null);
+
+ Component cComp = cf.newFcInstance(cType, "/julia/primitive",
ClientImpl.class.getName());
+ Component sComp = cf.newFcInstance(sType, "parametricPrimitive",
ServerImpl.class.getName());
+
+
+ ServiceAttributes sa = (ServiceAttributes)
+ Fractal.getAttributeController(sComp);
+ sa.setHeader("->");
+ sa.setCount(1);
+
+ // ----------------------------------------------------------
+ // Set component names
+ // ----------------------------------------------------------
+ Fractal.getNameController(rComp).setFcName("root");
+ Fractal.getNameController(cComp).setFcName("client");
+ Fractal.getNameController(sComp).setFcName("server");
+
+ // ----------------------------------------------------------
+ // Add the Client and Server components in the Root composite
+ // ----------------------------------------------------------
+ Fractal.getContentController(rComp).addFcSubComponent(cComp);
+ Fractal.getContentController(rComp).addFcSubComponent(sComp);
+
+ // ----------------------------------------------------------
+ // Create bindings
+ // ----------------------------------------------------------
+ Fractal.getBindingController(rComp).bindFc("m",
cComp.getFcInterface("m"));
+ Fractal.getBindingController(cComp).bindFc("s",
sComp.getFcInterface("s"));
+
+ // ----------------------------------------------------------
+ // Start the Root component
+ // ----------------------------------------------------------
+ Fractal.getLifeCycleController(rComp).startFc();
+
+ // ----------------------------------------------------------
+ // Call the entry point of the application
+ // ----------------------------------------------------------
+ Runnable mainItf = (Runnable)rComp.getFcInterface("m");
+ mainItf.run();
+ }
+}
Index: julia/examples/juliak/src/membrane/mix/ServerImpl.java
diff -u /dev/null julia/examples/juliak/src/membrane/mix/ServerImpl.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/mix/ServerImpl.java Wed Jan 17
15:09:15 2007
@@ -0,0 +1,66 @@
+/***
+ * Fractal Hello World Example
+ * Copyright (C) 2001-2002 France Telecom R&D
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Eric.Bruneton@xxxxxxxxxxxxxxxxxxxx
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Eric Bruneton
+ * Author: Lionel Seinturier
+ */
+package membrane.mix;
+
+public class ServerImpl implements Service, ServiceAttributes {
+
+ private String header;
+
+ private int count;
+
+ public ServerImpl () {
+ System.err.println("SERVER created");
+ }
+
+ public void print (final String msg) {
+ new Exception() {
+ private static final long serialVersionUID = 2182742162070453637L;
+ public String toString () {
+ return "Server: print method called";
+ }
+ }.printStackTrace();
+ System.err.println("Server: begin printing...");
+ for (int i = 0; i < count; ++i) {
+ System.err.println(header + msg);
+ }
+ System.err.println("Server: print done.");
+ }
+
+ public String getHeader () {
+ return header;
+ }
+
+ public void setHeader (final String header) {
+ this.header = header;
+ }
+
+ public int getCount () {
+ return count;
+ }
+
+ public void setCount (final int count) {
+ this.count = count;
+ }
+}
Index: julia/examples/juliak/src/membrane/mix/Service.java
diff -u /dev/null julia/examples/juliak/src/membrane/mix/Service.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/mix/Service.java Wed Jan 17 15:09:15
2007
@@ -0,0 +1,30 @@
+/***
+ * Fractal Hello World Example
+ * Copyright (C) 2001-2002 France Telecom R&D
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Eric.Bruneton@xxxxxxxxxxxxxxxxxxxx
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Eric Bruneton
+ * Author: Lionel Seinturier
+ */
+
+package membrane.mix;
+
+public interface Service {
+ void print (String msg);
+}
Index: julia/examples/juliak/src/membrane/mix/ServiceAttributes.java
diff -u /dev/null
julia/examples/juliak/src/membrane/mix/ServiceAttributes.java:1.1
--- /dev/null Wed Jan 17 15:09:17 2007
+++ julia/examples/juliak/src/membrane/mix/ServiceAttributes.java Wed
Jan 17 15:09:15 2007
@@ -0,0 +1,35 @@
+/***
+ * Fractal Hello World Example
+ * Copyright (C) 2001-2002 France Telecom R&D
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Contact: Eric.Bruneton@xxxxxxxxxxxxxxxxxxxx
+ * Contact: Lionel.Seinturier@xxxxxxx
+ *
+ * Author: Eric Bruneton
+ * Author: Lionel Seinturier
+ */
+
+package membrane.mix;
+
+import org.objectweb.fractal.api.control.AttributeController;
+
+public interface ServiceAttributes extends AttributeController {
+ String getHeader ();
+ void setHeader (String header);
+ int getCount ();
+ void setCount (int count);
+}
Index: julia/examples/membrane/README.txt
diff -u julia/examples/membrane/README.txt:1.1
julia/examples/membrane/README.txt:removed
--- julia/examples/membrane/README.txt:1.1 Tue Oct 24 12:56:19 2006
+++ julia/examples/membrane/README.txt Wed Jan 17 15:09:17 2007
@@ -1,9 +0,0 @@
-This example illustrates the features of Julia for the component-based
-engineering of control membranes.
-
-The three existing subpackages illustrates:
-- glue: the dynamic binding of a control membrane to a content instance,
-- interceptor: the dynamic adding and removing of an interceptor,
-- intropect: the introspection of a control membrane.
-
-October 20, 2006. <Lionel.Seinturier@xxxxxxx>
\ No newline at end of file
Index: julia/examples/membrane/build.xml
diff -u julia/examples/membrane/build.xml:1.2
julia/examples/membrane/build.xml:removed
--- julia/examples/membrane/build.xml:1.2 Sun Nov 19 22:23:41 2006
+++ julia/examples/membrane/build.xml Wed Jan 17 15:09:17 2007
@@ -1,81 +0,0 @@
-<!--
- ! This library is free software; you can redistribute it and/or
- ! modify it under the terms of the GNU Lesser General Public
- ! License as published by the Free Software Foundation; either
- ! version 2 of the License, or (at your option) any later version.
- !
- ! This library is distributed in the hope that it will be useful,
- ! but WITHOUT ANY WARRANTY; without even the implied warranty of
- ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ! Lesser General Public License for more details.
- !
- ! You should have received a copy of the GNU Lesser General Public
- ! License along with this library; if not, write to the Free Software
- ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- !
- ! Contact: sebastien.chassande@xxxxxxxxxxxx
--->
-
-<project name="Examples" default="compile">
-
- <!-- directory definition -->
-
- <property name="src" value="${basedir}/src"/>
- <property name="build" value="${basedir}/build"/>
-
- <property file="${basedir}/../etc/build.properties"/>
- <property file="${basedir}/etc/build.properties"/>
- <property file="${basedir}/etc/execute.properties"/>
-
- <!-- Building of a path which contains external jars -->
-
- <path id="classpath">
- <pathelement path="${asm.path}"/>
- <pathelement path="${fractal.path}"/>
- <pathelement path="${monolog.path}"/>
- <pathelement path="${julia.path}"/>
- <pathelement path="${juliak.path}"/>
- <fileset dir="${basedir}" includes="lib/**/*.jar" />
- <fileset dir="${basedir}/.." includes="lib/**/*.jar" />
- <fileset dir="${basedir}/../.." includes="lib/**/*.jar" />
- <fileset dir="${basedir}/../.." includes="externals/**/*.jar" />
- <pathelement location="${build}"/>
- </path>
-
- <!-- ================================== -->
- <!-- EXECUTE -->
- <!-- ================================== -->
-
- <target name="execute" depends="compile" description="Execute the example">
- <java classname="${run.classname}"
- classpathref="classpath"
- fork="yes"
- failonerror="yes">
- <jvmarg line="${run.jvm.parameters}"/>
- <arg line="${run.parameters}"/>
- </java>
- </target>
-
- <!-- ================================== -->
- <!-- COMPILE -->
- <!-- ================================== -->
-
- <target name="compile" description="Compile the example">
- <mkdir dir="${build}"/>
- <javac srcdir="${src}" destdir="${build}" debug="on">
- <classpath refid="classpath"/>
- <include name="**/*.java"/>
- </javac>
- <copy todir="${build}">
- <fileset dir="${src}" includes="**/*.fractal" />
- </copy>
- </target>
-
- <!-- ================================== -->
- <!-- CLEAN -->
- <!-- ================================== -->
-
- <target name="clean" description="Clean the example">
- <delete dir="${build}"/>
- </target>
-</project>
Index: julia/examples/membrane/etc/execute.properties
diff -u julia/examples/membrane/etc/execute.properties:1.1
julia/examples/membrane/etc/execute.properties:removed
--- julia/examples/membrane/etc/execute.properties:1.1 Tue Oct 24 12:56:19
2006
+++ julia/examples/membrane/etc/execute.properties Wed Jan 17 15:09:17
2007
@@ -1,12 +0,0 @@
-run.jvm.parameters \
- -Dfractal.provider=org.objectweb.fractal.juliak.Juliak
-
-# Java class to be launched
-
-run.classname membrane.Main
-
-# Application arguments
-# add "templates" to build the components through templates
-# add "wrapper" to add an additional composite around each primitive
-
-run.parameters
Index: julia/examples/membrane/etc/julia.cfg
diff -u julia/examples/membrane/etc/julia.cfg:1.1
julia/examples/membrane/etc/julia.cfg:removed
--- julia/examples/membrane/etc/julia.cfg:1.1 Tue Oct 24 12:56:19 2006
+++ julia/examples/membrane/etc/julia.cfg Wed Jan 17 15:09:17 2007
@@ -1,613 +0,0 @@
-###############################################################################
-# STANDARD JULIA CONFIGURATION FILE - DO NOT EDIT
-#
-# PUT NEW OR OVERRIDEN DEFINITIONS AT THE END OF THE FILE, OR IN OTHER FILES
-###############################################################################
-
-#
-----------------------------------------------------------------------------
-# INTERFACE CLASS GENERATORS
-#
-----------------------------------------------------------------------------
-
-# default class generator, generates sub classes of BasicComponentInterface
-
-(interface-class-generator
- (org.objectweb.fractal.julia.asm.InterfaceClassGenerator
- org.objectweb.fractal.julia.BasicComponentInterface
- )
-)
-
-#
-----------------------------------------------------------------------------
-# CONTROLLER INTERFACES
-#
-# each definition must be of the form (interface-name interface-signature)
-#
-----------------------------------------------------------------------------
-
-# Component interface
-
-(component-itf
- (component org.objectweb.fractal.api.Component)
-)
-
-# TypeFactory interface
-
-(type-factory-itf
- (type-factory org.objectweb.fractal.api.type.TypeFactory)
-)
-
-# GenericFactory interface
-
-(generic-factory-itf
- (generic-factory org.objectweb.fractal.api.factory.GenericFactory)
-)
-
-# Factory interface
-
-(factory-itf
- # choose one of the following definition