CVS: plexus-container-new/src/java/org/apache/plexus/lifecycle AbstractLifecycleHandler.java,1.3,1.4 LifecycleHandler.java,1.2,1.3 LifecycleHandlerFactory.java,1.3,1.4
[email protected] Sun, 27 Apr 2003 23:35:39 -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-serv12233/src/java/org/apache/plexus/lifecycle
Modified Files:
AbstractLifecycleHandler.java LifecycleHandler.java
LifecycleHandlerFactory.java
Log Message:
o The factories are now completely responsible for setting up a base entity.
So for each of the factories I've tried to follow the pattern of sending
in the defaultConfiguration, configuration, loggerManager, classLoader and
then any other parameters that the factory requires to setup the base
entity.
Index: AbstractLifecycleHandler.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle/AbstractLifecycleHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- AbstractLifecycleHandler.java 25 Apr 2003 19:22:33 -0000 1.3
+++ AbstractLifecycleHandler.java 28 Apr 2003 04:35:37 -0000 1.4
@@ -1,14 +1,14 @@
package org.apache.plexus.lifecycle;
-import org.apache.plexus.logging.AbstractLogEnabled;
import org.apache.plexus.lifecycle.phase.Phase;
+import org.apache.plexus.logging.AbstractLogEnabled;
import org.apache.plexus.service.repository.ServiceCapsule;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
import java.util.Iterator;
-import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
public abstract class AbstractLifecycleHandler
extends AbstractLogEnabled
Index: LifecycleHandler.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle/LifecycleHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- LifecycleHandler.java 25 Apr 2003 19:24:42 -0000 1.2
+++ LifecycleHandler.java 28 Apr 2003 04:35:37 -0000 1.3
@@ -4,6 +4,7 @@
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 java.util.Map;
@@ -48,4 +49,5 @@
void addEndSegmentPhase( Phase phase );
+ void enableLogging( Logger logger );
}
Index: LifecycleHandlerFactory.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/lifecycle/LifecycleHandlerFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- LifecycleHandlerFactory.java 28 Apr 2003 03:13:24 -0000 1.3
+++ LifecycleHandlerFactory.java 28 Apr 2003 04:35:37 -0000 1.4
@@ -1,31 +1,50 @@
package org.apache.plexus.lifecycle;
import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.plexus.lifecycle.phase.Phase;
import org.apache.plexus.factory.AbstractPlexusFactory;
+import org.apache.plexus.lifecycle.phase.Phase;
+import org.apache.plexus.logging.LoggerManager;
public class LifecycleHandlerFactory
extends AbstractPlexusFactory
{
- public static LifecycleHandler create( Configuration configuration, ClassLoader classLoader )
+ public static LifecycleHandler create( Configuration defaultConfiguration,
+ Configuration configuration,
+ LoggerManager loggerManager,
+ ClassLoader classLoader )
throws Exception
{
- LifecycleHandler lh =
- (LifecycleHandler) getInstance( configuration.getChild( "implementation" ).getValue(),
- classLoader );
+ String implementation;
+ Configuration c;
- Configuration[] a = configuration.getChild( "start-segment" ).getChildren( "phase" );
+ if ( configuration.getChild( "lifecycle-handler", false ) != null )
+ {
+ c = configuration.getChild( "lifecycle-handler" );
+ implementation = c.getChild( "implementation" ).getValue();
+ }
+ else
+ {
+ c = defaultConfiguration.getChild( "lifecycle-handler" );
+ implementation = c.getChild( "implementation" ).getValue();
+ }
+
+ LifecycleHandler lh = (LifecycleHandler) getInstance( implementation, classLoader );
+
+ // Setup logging
+ lh.enableLogging( loggerManager.getLogger( "lifecycle-handler" ) );
+
+ Configuration[] a = c.getChild( "start-segment" ).getChildren( "phase" );
for ( int i = 0; i < a.length; i++ )
{
lh.addBeginSegmentPhase(
- (Phase) getInstance( a[i].getAttribute( "implementation" ), classLoader) );
+ (Phase) getInstance( a[i].getAttribute( "implementation" ), classLoader ) );
}
- Configuration[] b = configuration.getChild( "end-segment" ).getChildren( "phase" );
+ Configuration[] b = c.getChild( "end-segment" ).getChildren( "phase" );
for ( int i = 0; i < b.length; i++ )
{
lh.addEndSegmentPhase(
- (Phase) getInstance( b[i].getAttribute( "implementation" ), classLoader) );
+ (Phase) getInstance( b[i].getAttribute( "implementation" ), classLoader ) );
}
// Initialize the lifecycle handler before returning the instance.