Hi again,
Here's a patch for ExcaliburComponentManager that moves static calls to
ComponentHandler in protected methods. This allows subclasses to
redefine/extend the component handling strategy.
The main idea I have behind this is a ProfilingComponentManager and
associated ComponentHandlers that output detailed component usage
information.
Thanks if you agree with this patch.
--
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com
Index: ExcaliburComponentManager.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java,v
retrieving revision 1.6
diff -u -r1.6 ExcaliburComponentManager.java
--- ExcaliburComponentManager.java 2001/08/25 14:52:59 1.6
+++ ExcaliburComponentManager.java 2001/09/10 15:50:36
@@ -276,13 +276,7 @@
final Configuration configuration = new DefaultConfiguration( "", "-"
);
- handler =
- ComponentHandler.getComponentHandler( componentClass,
- configuration,
- this,
- m_context,
- m_roles,
- m_logkit);
+ handler = getComponentHandler( componentClass, configuration );
handler.setLogger( getLogger() );
handler.initialize();
@@ -481,13 +475,7 @@
getLogger().debug("Attempting to get Handler for: " + role);
}
- final ComponentHandler handler =
- ComponentHandler.getComponentHandler( component,
- configuration,
- this,
- m_context,
- m_roles,
- m_logkit );
+ final ComponentHandler handler = getComponentHandler( component,
+configuration);
if (getLogger().isDebugEnabled())
{
@@ -517,8 +505,7 @@
try
{
- ComponentHandler handler =
- ComponentHandler.getComponentHandler( instance );
+ ComponentHandler handler = getComponentHandler( instance );
handler.setLogger( getLogger() );
m_componentHandlers.put( role, handler );
}
@@ -529,5 +516,29 @@
getLogger().warn( "Could not set up Component for role: " + role, e );
}
}
+ }
+
+ /**
+ * Get a <code>ComponentHandler suitable for a given component class.
+ */
+
+ protected ComponentHandler getComponentHandler( final Class componentClass, final
+Configuration configuration )
+ throws Exception
+ {
+ return ComponentHandler.getComponentHandler( componentClass,
+ configuration,
+ this,
+ m_context,
+ m_roles,
+ m_logkit);
+ }
+
+ /**
+ * Get a <code>ComponentHandler</code> for the given component instance.
+ */
+ protected ComponentHandler getComponentHandler( final Component componentInstance
+)
+ throws Exception
+ {
+ return ComponentHandler.getComponentHandler(componentInstance);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]