mcconnell 2002/11/19 11:16:01 Modified: assembly build.xml assembly/src/java/org/apache/excalibur/merlin/assembly ServiceRegistry.java TypeManager.java TypeRegistry.java assembly/src/java/org/apache/excalibur/merlin/container ContainerHelper.java assembly/src/java/org/apache/excalibur/merlin/resource DefaultLifestyleManager.java PooledLifestyleHandler.java Log: Applied patch from Gary Shea - extra info in debug logging, exception population, and docs. Revision Changes Path 1.75 +2 -1 jakarta-avalon-excalibur/assembly/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/build.xml,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- build.xml 19 Nov 2002 03:12:20 -0000 1.74 +++ build.xml 19 Nov 2002 19:16:01 -0000 1.75 @@ -204,7 +204,8 @@ <param name="-link" value="http://java.sun.com/j2se/1.4/docs/api/"/> <param name="-link" value="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/> <param name="-link" value="http://jakarta.apache.org/avalon/api/"/> - <param name="-bottom" + <param name="-link" value="../meta/"/> + <param name="-bottom" value=""Copyright © ${year} Apache Jakarta Project. All Rights Reserved.""/> </doclet> </javadoc> 1.10 +1 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ServiceRegistry.java Index: ServiceRegistry.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/ServiceRegistry.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ServiceRegistry.java 19 Nov 2002 03:12:20 -0000 1.9 +++ ServiceRegistry.java 19 Nov 2002 19:16:01 -0000 1.10 @@ -115,7 +115,6 @@ m_classloader = loader; super.enableLogging( logger ); - m_builder.enableLogging( logger ); getLogger().debug( "service registry established" ); } 1.29 +13 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeManager.java Index: TypeManager.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeManager.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- TypeManager.java 19 Nov 2002 03:12:20 -0000 1.28 +++ TypeManager.java 19 Nov 2002 19:16:01 -0000 1.29 @@ -96,6 +96,7 @@ * Abstract type manager. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Gary Shea</a> * @version $Revision$ $Date$ */ public abstract class TypeManager extends URLClassLoader @@ -576,6 +577,11 @@ public Type getType( String classname ) throws TypeException { getLocalLogger().debug( "load: " + classname ); + + // + // get the type from the type registry (m_types) + // + Type type = m_types.getType( classname ); if( type != null ) { @@ -583,6 +589,7 @@ } else { + getLocalLogger().debug( "adding new type: " + classname ); // // try to construct the type @@ -590,6 +597,10 @@ try { + // + // load the type form the classloader and build the type defintion + // + return m_types.addType( classname ); } catch( Throwable e ) @@ -606,7 +617,7 @@ else { throw new TypeException( - "Type not found, classname: " + classname ); + "Type not found, classname: " + classname, e ); } } } 1.22 +9 -3 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeRegistry.java Index: TypeRegistry.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/assembly/TypeRegistry.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- TypeRegistry.java 19 Nov 2002 03:12:20 -0000 1.21 +++ TypeRegistry.java 19 Nov 2002 19:16:01 -0000 1.22 @@ -77,6 +77,7 @@ * to the service it provides. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Gary Shea</a> * @version $Revision$ $Date$ */ class TypeRegistry extends AbstractLogEnabled @@ -121,8 +122,6 @@ { m_classloader = loader; super.enableLogging( logger ); - m_typeBuilder.enableLogging( logger ); - m_blockBuilder.enableLogging( logger ); getLogger().debug( "type registry established" ); } @@ -156,9 +155,15 @@ final String classname = path.replace( '/', '.' ); getLogger().debug( "type: " + classname ); + + // Try loading it from the local collection of known Types. + Type type = getType( classname ); if( type == null ) { + // Ask a TypeBuilder object to build the Type from + // a <classname>.xinfo resource. + type = m_typeBuilder.build( classname, m_classloader ); verify( type ); register( type ); @@ -330,6 +335,7 @@ */ public Type getType( String classname ) { + // m_types is a hash table of registered Types return (Type)m_types.get( classname ); } 1.9 +3 -2 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ContainerHelper.java Index: ContainerHelper.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ContainerHelper.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ContainerHelper.java 18 Nov 2002 10:52:53 -0000 1.8 +++ ContainerHelper.java 19 Nov 2002 19:16:01 -0000 1.9 @@ -80,6 +80,7 @@ * container). * * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Gary Shea</a> * @version $Revision$ $Date$ */ public class ContainerHelper extends AbstractLogEnabled @@ -234,7 +235,7 @@ "Ignoring component declaration at " + component.getLocation() + " due to unknown type: " + c; - getLogger().warn( warning ); + getLogger().warn( warning, e ); } } 1.11 +12 -6 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultLifestyleManager.java Index: DefaultLifestyleManager.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/DefaultLifestyleManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DefaultLifestyleManager.java 23 Oct 2002 16:33:08 -0000 1.10 +++ DefaultLifestyleManager.java 19 Nov 2002 19:16:01 -0000 1.11 @@ -71,9 +71,10 @@ * handler based on a supplied profile. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Gary Shea</a> */ public class DefaultLifestyleManager extends AbstractLogEnabled - implements LifestyleManager, Configurable, Contextualizable, Initializable + implements LifestyleManager, Initializable, Configurable, Contextualizable { /** * The supplied configuration. @@ -152,8 +153,7 @@ DeploymentHelper deployment, LifecycleHelper helper, Profile profile, - Context context ) - throws Exception + Context context ) throws Exception { final String policy = profile.getType().getInfo().getAttribute( AVALON_LIFESTYLE_KEY, "singleton" ); @@ -197,19 +197,25 @@ // create a pooled lifestyle handler // + if ( getLogger().isDebugEnabled() ) { + getLogger().debug ( + "m_poolManager is " + + (m_poolManager == null ? "null" : "not null") ); + } + try { PooledLifestyleHandler handler = new PooledLifestyleHandler( manager, deployment, helper, profile, context, m_poolManager ); handler.enableLogging( getLogger() ); + handler.initialize(); return handler; } catch( Exception e ) { final String error = - "Unable to handle the 'pooled' lifestyle policy due to an error\n" - + e.getMessage(); - throw new IllegalArgumentException( error ); + "Unexpected error handling pooled lifestyle policy."; + throw new ResourceRuntimeException( error, e ); } } else 1.9 +20 -3 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/PooledLifestyleHandler.java Index: PooledLifestyleHandler.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/resource/PooledLifestyleHandler.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- PooledLifestyleHandler.java 24 Oct 2002 04:12:45 -0000 1.8 +++ PooledLifestyleHandler.java 19 Nov 2002 19:16:01 -0000 1.9 @@ -56,6 +56,7 @@ package org.apache.excalibur.merlin.resource; import org.apache.avalon.framework.activity.Disposable; +import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.context.Context; import org.apache.excalibur.merlin.assembly.ContainerManager; import org.apache.excalibur.merlin.model.Profile; @@ -70,9 +71,12 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a> * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Gary Shea</a> */ -public class PooledLifestyleHandler extends AbstractLifestyleHandler implements ObjectFactory +public class PooledLifestyleHandler extends AbstractLifestyleHandler implements ObjectFactory, Initializable { + + private PoolManager m_poolManager; private Profile m_profile; private ContainerManager m_manager; private Context m_context; @@ -99,14 +103,26 @@ throws Exception { super( manager, deployment, helper, profile, context ); + + m_poolManager = poolManager; m_profile = profile; m_manager = manager; - // get a pool for our component with 5 initial entries - m_pool = poolManager.getManagedPool( this, 5 ); + m_context = context; } /** + * Set up the pool. + * + * @exception Exception if an error occurs setting up the pool + */ + public void initialize() throws Exception + { + // get a pool for our component with 5 initial entries + m_pool = m_poolManager.getManagedPool( this, 5 ); + } + + /** * Returns an instance of the object type supported by the * manager to the client. * @@ -214,6 +230,7 @@ m_pool = null; m_profile = null; m_manager = null; + m_poolManager = null; super.dispose(); }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>