|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.fractal.julia.logger.LoggerLifeCycleMixin
Assigns a logger to a component during its startup. The topic name is based on the component path in the architecture. To use this mixin you have to add two lines in the julia.cfg configuration file:
(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 automatically assign the logger and logger factory:
org.objectweb.fractal.julia.BasicInitializableMixin
org.objectweb.fractal.julia.logger.LoggerLifeCycleMixin
# to notify the encapsulated component (if present) when its state changes:
org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin
)
# optional initialization parameter (monolog configuration file name):
(monolog-conf-file monolog.properties)
)
)
The user component must also implement either BindingController or
Loggable. In the first case, the logger and logger factory can be
retreived like this:
public void bindFc (String s, Object o) {
if ("logger".equals(s)) {
myLogger = (Logger) o;
} else if ("monolog-factory".equals(s)) { // optional
String baseName = myLogger.getName();
otherLogger1 = ((LoggerFactory) o).getLogger(baseName + ".toto");
otherLogger2 = ((LoggerFactory) o).getLogger(baseName + ".titi");
} else ...
}
The other BindingController methods, and in particular the listFc method, must not take these logger
"bindings" into account.
| Field Summary | |
|---|---|
Component |
_this_weaveableC
The weaveableC field required by this mixin. |
| Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
|---|
STARTED, STOPPED |
| Method Summary | |
|---|---|
abstract void |
_super_initialize(Tree args)
The initialize method overriden by this
mixin. |
abstract boolean |
_super_setFcStarted()
The setFcStarted method overriden
by this mixin. |
void |
initialize(Tree args)
Initializes this object with the given arguments. |
boolean |
setFcStarted()
Calls the overriden method and then sets the logger and logger factory of the user component encapsulated in this component (if there is one). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator |
|---|
fcActivated, fcInactivated, setFcStopped, setFcStopping |
| Methods inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
|---|
getFcState, startFc, stopFc |
| Field Detail |
public Component _this_weaveableC
Component interface of the component to
which this controller object belongs.
| Method Detail |
public void initialize(Tree args)
throws Exception
Initializable
initialize in interface Initializableargs - the arguments to be used to initialize this object. The format
of these arguments depends on the class of this object.
Exception - if a problem occurs during the object initialization.
public boolean setFcStarted()
throws IllegalLifeCycleException
setFcStarted in interface LifeCycleCoordinatorSTARTED value.
IllegalLifeCycleException - if a problem occurs.
public abstract void _super_initialize(Tree args)
throws Exception
initialize method overriden by this
mixin.
args - the arguments to be used to initialize this object. The format
of these arguments depends on the class of this object.
Exception - if a problem occurs during the object initialization.
public abstract boolean _super_setFcStarted()
throws IllegalLifeCycleException
setFcStarted method overriden
by this mixin.
STARTED value.
IllegalLifeCycleException - if a problem occurs.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||