CVS: plexus-container-new/src/java/org/apache/plexus/lifecycle AbstractLifecycleHandler.java,1.4,1.5 LifecycleHandler.java,1.3,1.4 LifecycleHandlerFactory.java,1.4,1.5
[email protected] Thu, 1 May 2003 14:35:38 -0500
| Newsgroups | gmane.comp.java.plexus.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle
In directory eng.werken.com:/tmp/cvs-serv18124/src/java/org/apache/plexus/lifecycle
Modified Files:
AbstractLifecycleHandler.java LifecycleHandler.java
LifecycleHandlerFactory.java
Log Message:
o This will require a separate message as more than a few changes have
occurred in order to support handling for various instantiation strategies
and scriptable components.
Index: AbstractLifecycleHandler.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle/AbstractLifecycleHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- AbstractLifecycleHandler.java 28 Apr 2003 04:35:37 -0000 1.4
+++ AbstractLifecycleHandler.java 1 May 2003 19:35:36 -0000 1.5
@@ -2,7 +2,8 @@
import org.apache.plexus.lifecycle.phase.Phase;
import org.apache.plexus.logging.AbstractLogEnabled;
-import org.apache.plexus.service.repository.ServiceCapsule;
+import org.apache.plexus.service.repository.ComponentManager;
+import org.apache.plexus.service.repository.ComponentHousing;
import java.util.ArrayList;
import java.util.HashMap;
@@ -130,35 +131,35 @@
/** Start a component's lifecycle.
*
- * @param service The component service.
+ * @param housing The component service.
*
* @throws java.lang.Exception If an error occurs while attempting to beginSegment
* the component's lifecycle.
*/
- public void startLifecycle( ServiceCapsule service )
+ public void startLifecycle( ComponentHousing housing )
throws Exception
{
for ( Iterator i = getBeginSegment().iterator(); i.hasNext(); )
{
Phase phase = (Phase) i.next();
- phase.execute( service, this );
+ phase.execute( housing, this );
}
}
/** End a component's lifecycle.
*
- * @param service The component service.
+ * @param housing The component service.
*
* @throws java.lang.Exception If an error occurs while attempting to endSegment
* the component's lifecycle.
*/
- public void endLifecycle( ServiceCapsule service )
+ public void endLifecycle( ComponentHousing housing )
throws Exception
{
for ( Iterator i = getEndSegment().iterator(); i.hasNext(); )
{
Phase phase = (Phase) i.next();
- phase.execute( service, this );
+ phase.execute( housing, this );
}
}
}
Index: LifecycleHandler.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle/LifecycleHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- LifecycleHandler.java 28 Apr 2003 04:35:37 -0000 1.3
+++ LifecycleHandler.java 1 May 2003 19:35:36 -0000 1.4
@@ -1,10 +1,8 @@
package org.apache.plexus.lifecycle;
-import org.apache.plexus.service.repository.ServiceCapsule;
-import org.apache.plexus.lifecycle.phase.Phase;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.Logger;
+import org.apache.plexus.lifecycle.phase.Phase;
+import org.apache.plexus.service.repository.ComponentHousing;
import java.util.Map;
@@ -33,13 +31,13 @@
/** Start lifecycle.
*
*/
- void startLifecycle( ServiceCapsule service )
+ void startLifecycle( ComponentHousing housing )
throws Exception;
/** End Lifecycle
*
*/
- void endLifecycle( ServiceCapsule service )
+ void endLifecycle( ComponentHousing housing )
throws Exception;
void initialize()
Index: LifecycleHandlerFactory.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle/LifecycleHandlerFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- LifecycleHandlerFactory.java 28 Apr 2003 04:35:37 -0000 1.4
+++ LifecycleHandlerFactory.java 1 May 2003 19:35:36 -0000 1.5
@@ -1,9 +1,11 @@
package org.apache.plexus.lifecycle;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.context.Context;
import org.apache.plexus.factory.AbstractPlexusFactory;
import org.apache.plexus.lifecycle.phase.Phase;
import org.apache.plexus.logging.LoggerManager;
+import org.apache.plexus.service.repository.ComponentRepository;
public class LifecycleHandlerFactory
extends AbstractPlexusFactory
@@ -11,7 +13,9 @@
public static LifecycleHandler create( Configuration defaultConfiguration,
Configuration configuration,
LoggerManager loggerManager,
- ClassLoader classLoader )
+ ClassLoader classLoader,
+ Context context,
+ ComponentRepository componentRepository )
throws Exception
{
String implementation;
@@ -46,6 +50,15 @@
lh.addEndSegmentPhase(
(Phase) getInstance( b[i].getAttribute( "implementation" ), classLoader ) );
}
+
+ // Add some standard entities to the lifecycle handler. The lifecycle
+ // handler may wish to use some of these entities to create new types
+ // of entities for its lifecycle phases. For example the AvalonLifecycleHandler
+ // uses the ServiceRepository and adapts it to create an Avalon ServiceManager.
+ // The entities MUST be added before initialization of the lifecyclehandler.
+ lh.addEntity( LifecycleHandler.LOGGER, loggerManager.getRootLogger() );
+ lh.addEntity( LifecycleHandler.CONTEXT, context );
+ lh.addEntity( LifecycleHandler.SERVICE_REPOSITORY, componentRepository );
// Initialize the lifecycle handler before returning the instance.
lh.initialize();