proyal 2003/03/16 19:43:17
Modified: src/java/org/apache/avalon/phoenix/containerkit/lifecycle
LifecycleHelper.java
Log:
* Add support for InstrumentManageable
* Add support for Instrumentable blocks
Revision Changes Path
1.4 +35 -9
avalon-phoenix/src/java/org/apache/avalon/phoenix/containerkit/lifecycle/LifecycleHelper.java
Index: LifecycleHelper.java
===================================================================
RCS file:
/home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/containerkit/lifecycle/LifecycleHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LifecycleHelper.java 22 Feb 2003 05:34:45 -0000 1.3
+++ LifecycleHelper.java 17 Mar 2003 03:43:17 -0000 1.4
@@ -26,6 +26,9 @@
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
+import org.apache.excalibur.instrument.InstrumentManageable;
+import org.apache.excalibur.instrument.InstrumentManager;
+import org.apache.excalibur.instrument.Instrumentable;
/**
* This is a class to help an Application manage the lifecycle of a component.
@@ -44,15 +47,17 @@
//Constants to designate stages
private static final int STAGE_CREATE = 0;
private static final int STAGE_LOGGER = 1;
- private static final int STAGE_CONTEXT = 2;
- private static final int STAGE_COMPOSE = 3;
- private static final int STAGE_CONFIG = 4;
- private static final int STAGE_PARAMETER = 5;
- private static final int STAGE_INIT = 6;
- private static final int STAGE_START = 7;
- private static final int STAGE_STOP = 8;
- private static final int STAGE_DISPOSE = 9;
- private static final int STAGE_DESTROY = 10;
+ private static final int STAGE_INSTRUMENTMGR = 2;
+ private static final int STAGE_CONTEXT = 3;
+ private static final int STAGE_COMPOSE = 4;
+ private static final int STAGE_CONFIG = 5;
+ private static final int STAGE_PARAMETER = 6;
+ private static final int STAGE_INIT = 7;
+ private static final int STAGE_INSTRUMENTABLE = 8;
+ private static final int STAGE_START = 9;
+ private static final int STAGE_STOP = 10;
+ private static final int STAGE_DISPOSE = 11;
+ private static final int STAGE_DESTROY = 12;
/**
* Method to run a component through it's startup phase.
@@ -78,6 +83,7 @@
stage = STAGE_CREATE;
notice( name, stage );
final Object object = provider.createObject( entry );
+ final InstrumentManager instrumentManager =
provider.createInstrumentManager( entry );
//LogEnabled stage
stage = STAGE_LOGGER;
@@ -88,6 +94,15 @@
ContainerUtil.enableLogging( object, logger );
}
+ //InstrumentManageable stage
+ stage = STAGE_INSTRUMENTMGR;
+ if( object instanceof InstrumentManageable )
+ {
+ notice( name, stage );
+
+ ( (InstrumentManageable)object ).setInstrumentManager(
instrumentManager );
+ }
+
//Contextualize stage
stage = STAGE_CONTEXT;
if( object instanceof Contextualizable )
@@ -140,6 +155,17 @@
{
notice( name, stage );
ContainerUtil.initialize( object );
+ }
+
+ //InstrumentManageable stage
+ stage = STAGE_INSTRUMENTABLE;
+ if( object instanceof Instrumentable )
+ {
+ notice( name, stage );
+ final String instrumentableName =
provider.createInstrumentableName( entry );
+ final Instrumentable instrumentable = (Instrumentable)object;
+ instrumentable.setInstrumentableName( instrumentableName );
+ instrumentManager.registerInstrumentable( instrumentable,
instrumentableName );
}
//Start stage
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]