You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Anton Tagunov <at...@mail.cnt.ru> on 2003/05/28 10:48:00 UTC
[Patch] #11
Hello Berin!
It great so much of my patches has been applied.
I'm particularly glad Patch #8 has made it through
and that you have even managed to make it work for store!
Cheers to you and us :)
AT> .. Now I'm proposing to ... return to the original code
BL> :) I guess I'm smarter than I thought. Although, humility just went
BL> out the window with that comment ;P
:) I've been always putting my hat down at you!
Especially when I managed to get a couple year old pdf of
"Developing With Apache Avalon", printed it out and kept reading
for a couple of days (it turned out to be a bit outdated version,
but that was okay). So, thank you, Berin! :-))
B> Patch #10 needs to be reimplemented.
Will do. It will be called Patch #10.1 then.
Is it okay tomorrow?
Now, about the current Patch (#11):
1) ========================
BL> Interestingly enough my thoughts on this was that if a container
BL> wanted to define its own SourceResolver, it would create its own to
BL> override what was passed in.
Okay, okay! You have persuaded me, it's great to have a default one :)
However, _if_ the invoker has supplied a ServiceManager, then we may
assume that _those_ service manager already contains a SourceResolver,
probably cofigured differently.
Hmm.. can ContextManager be used in a _nested_ container?
Not likely, but theoretically possible.
Hence, this patch. Do you like what is in the patch on this subject?
2) =======================
AT> LoggerManager, PoolManager, InstrumentManager, MetaInfoManager
AT> LifecycleExtensionsManager, Queue are passed to the Container
AT> twice: via contextualize() and via service()
BL> This duplication originated from having them *originally* passed in as
BL> context entries. Later, after looking at what these things really were,
BL> we determined that we were using a Context to access services. We
BL> should go the other way and make them only available via the service
BL> mechanism.
I understand they are service because they have an interface and
a ROLE in it? But we never really release them -- is not that an
argument for accessing them via Context?
And after all they are quite different from user services - these
are system entities.
If they are available via ServiceManager someone may configure a
component implementing a PoolManager or a Queue interface or a
MetaInfoManager in the normal .xconf file and have nested containers
use that.
But should these things really be configured like that?
I do not mean this is a security violation but rather that
these things are so deep internal to system things ( like Queue )
that it looks a bit of order to configure them where normal
user components are configured.
So, I personally would have been more comfortable with accessing
them from the Context. Mainly because we never release them.
ServiceManager context contract is just to "heavy" in concept
for such a simple thing as "take what I give you once and live on it".
Is there any use to discussion this topic?
The patch supplied in this mail goes the ServiceManager
way and removes the duplicated entities from m_childContext.
3) ===============================
This patch also hides *CONFIGURAION and *CONFIGURATION_URI
from the container implementation.
4) ===============================
I have also updated the main section of the
inline documentation on ContextManager a bit.
The inline sections on separate methods still
are outdated sometimes - but I think this is
bearable at them moment.
diff -ru src.orig/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java
--- src.orig/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 10:20:10.000000000 +0400
+++ src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 12:33:30.000000000 +0400
@@ -205,7 +205,7 @@
ContainerUtil.enableLogging( instance, m_logger );
ContainerUtil.contextualize( instance, implContext );
- final ServiceManager serviceManager = createServiceManager( implContext );
+ final ServiceManager serviceManager = createServiceManager( managerContext );
ContainerUtil.service( instance, serviceManager );
diff -ru src.orig/java/org/apache/avalon/fortress/util/ContextManager.java src/java/org/apache/avalon/fortress/util/ContextManager.java
--- src.orig/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 10:20:26.000000000 +0400
+++ src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 12:45:06.000000000 +0400
@@ -103,20 +103,16 @@
* get an instance of the Context, it is made read-only and returned. No
* further operations will be possible on it.</p>
*
- * <p>You can get two different contexts from the ContextManager: the child
- * context and the impl manager context. The former contains all
- * managers, such as the pool manager etc. necessary for a child impl to
- * create additional child containers. The impl manager context contains
- * all of the child context, but also initialization parameters for the
- * impl, such as a Configuration object, a ComponentLocator, etc., that
- * the impl wants, but does not want to pass on to its children.</p>
+ * <p>You can get two different contexts from the ContextManager:
+ * the container context (m_childContext)
+ * and container the manager context (m_contaimerManagerContext).
*
- * <p>You would typically use the impl manager context to initialize
- * the impl manager, and let it pass the child context on to the
- * impl.</p>
+ * <p>The container manager context is used to provide the container manager
+ * with all the data needed to initialize the container.</p>
+ * <p>The container context is passed directly to the container.</p>
*
- * <p>The ContextManager will sometimes create new components, such as a
- * component manager, a pool manager, etc. It will manage these components
+ * <p>The ContextManager will sometimes create new components, such as
+ * a service manager, a pool manager, etc. It will manage these components
* and dispose of them properly when it itself is disposed .</p>
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
@@ -163,7 +159,6 @@
*/
private Logger m_logger;
private final Logger m_primordialLogger;
- private ServiceManager m_manager;
/**
* The components that are "owned" by this context and should
@@ -237,6 +232,7 @@
*/
public void initialize() throws Exception
{
+ initializeDefaultSourceResolver();
initializeServiceManager();
initializeLoggerManager();
initializeMetaInfoManager();
@@ -248,6 +244,8 @@
m_childContext.makeReadOnly();
m_containerManagerContext.makeReadOnly();
+
+ m_defaultSourceResolver = null;
}
/**
@@ -295,6 +293,16 @@
getLogger().debug( "Could not copy Context parameters. This may be Ok depending on "
+ "other configured context values." );
}
+
+ // hide from the container implementation what it does not need
+ m_childContext.put( CONFIGURATION, null );
+ m_childContext.put( CONFIGURATION_URI, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION_URI, null );
}
/**
@@ -392,7 +400,7 @@
{
try
{
- m_rootContext.get( Queue.ROLE );
+ copyEntry( Queue.ROLE );
return;
}
catch ( ContextException ce )
@@ -400,7 +408,7 @@
}
// No CommandQueue specified, create a default one
- m_childContext.put( Queue.ROLE, createCommandSink() );
+ m_containerManagerContext.put( Queue.ROLE, createCommandSink() );
}
/**
@@ -418,7 +426,7 @@
assumeOwnership( tm );
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Get the logger for the thread manager
final Logger tmLogger = loggerManager.getLoggerForCategory( "system.threadmgr" );
@@ -487,16 +495,16 @@
{
try
{
- m_rootContext.get( PoolManager.ROLE );
+ copyEntry( PoolManager.ROLE );
return;
}
catch ( ContextException ce )
{
}
- final PoolManager pm = new DefaultPoolManager( (Sink) m_childContext.get( Queue.ROLE ) );
+ final PoolManager pm = new DefaultPoolManager( (Sink) m_containerManagerContext.get( Queue.ROLE ) );
assumeOwnership( pm );
- m_childContext.put( PoolManager.ROLE, pm );
+ m_containerManagerContext.put( PoolManager.ROLE, pm );
}
/**
@@ -535,7 +543,7 @@
}
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Lookup the context class loader
final ClassLoader classLoader = (ClassLoader) m_rootContext.get( ClassLoader.class.getName() );
@@ -560,7 +568,17 @@
protected void initializeMetaInfoManager() throws Exception
{
- final boolean mmSupplied = entryPresent( m_rootContext, MetaInfoManager.ROLE );
+ boolean mmSupplied = false;
+ try
+ {
+ copyEntry( MetaInfoManager.ROLE );
+ mmSupplied = true;
+ }
+ catch( ContextException ce )
+ {
+ // okay, we will create one
+ }
+
RoleManager roleManager = obtainRoleManager();
final boolean rmSupplied = roleManager != null;
@@ -575,7 +593,7 @@
}
else
{
- final LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager)m_containerManagerContext.get( LoggerManager.ROLE );
final ClassLoader classLoader = (ClassLoader)m_rootContext.get( ClassLoader.class.getName() );
if ( ! rmSupplied )
@@ -592,21 +610,25 @@
metaManager.enableLogging( loggerManager.getLoggerForCategory("system.meta") );
metaManager.initialize();
assumeOwnership( metaManager );
- m_childContext.put( MetaInfoManager.ROLE, metaManager );
+ m_containerManagerContext.put( MetaInfoManager.ROLE, metaManager );
}
}
/**
- * Get a reference to the initial ComponentLocator used by the
- * ContainerManager to hold the Components used for parsing the config
- * files and setting up the environment.
- *
- * @throws Exception when there is an error.
+ * Source resolver used to read-in the configurations.
+ * and provided as a default source resolver if the
+ * user has not supplied a ServiceManager.
+ * (Otherwise it or an overriding sourceresolver
+ * is probably available from that.)
*/
- protected void initializeServiceManager() throws Exception
+ protected SourceResolver m_defaultSourceResolver;
+
+ /**
+ * Initialize the default SrouceResolver.
+ */
+ protected void initializeDefaultSourceResolver() throws Exception
{
- final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
- final DefaultServiceManager manager = new DefaultServiceManager( parent );
+ final DefaultServiceManager manager = new DefaultServiceManager();
final DefaultServiceSelector selector = new DefaultServiceSelector();
final URLSourceFactory file = new URLSourceFactory();
file.enableLogging( getLogger() );
@@ -623,15 +645,32 @@
ContainerUtil.service( resolver, manager );
ContainerUtil.parameterize( resolver, new Parameters() );
- manager.put( SourceResolver.ROLE, resolver );
-
- manager.makeReadOnly();
-
- assumeOwnership( manager );
-
- m_manager = manager;
-
- m_childContext.put( ContextManagerConstants.SERVICE_MANAGER, m_manager );
+ m_defaultSourceResolver = resolver;
+ }
+ /**
+ * Get a reference to the initial ComponentLocator used by the
+ * ContainerManager to hold the Components used for parsing the config
+ * files and setting up the environment.
+ *
+ * @throws Exception when there is an error.
+ */
+ protected void initializeServiceManager() throws Exception
+ {
+ try
+ {
+ copyEntry( SERVICE_MANAGER );
+ }
+ catch( ContextException ce )
+ {
+ final DefaultServiceManager manager = new DefaultServiceManager();
+
+ // provide a default source resolver good in many situations
+ manager.put( SourceResolver.ROLE, m_defaultSourceResolver );
+
+ manager.makeReadOnly();
+
+ m_containerManagerContext.put( ContextManagerConstants.SERVICE_MANAGER, manager );
+ }
}
/**
@@ -668,8 +707,7 @@
Source src = null;
try
{
- resolver = (SourceResolver) m_manager.lookup( SourceResolver.ROLE );
- src = resolver.resolveURI( configUri );
+ src = m_defaultSourceResolver.resolveURI( configUri );
if ( configBuilder == null )
{
configBuilder = new DefaultConfigurationBuilder();
@@ -685,12 +723,7 @@
}
finally
{
- if ( null != resolver )
- {
- resolver.release( src );
- }
-
- m_manager.release( resolver );
+ m_defaultSourceResolver.release( src );
}
}
@@ -747,7 +780,7 @@
{
// Try copying an already existing logger manager from the override context.
- m_childContext.put( LoggerManager.ROLE, m_rootContext.get( LoggerManager.ROLE ) );
+ copyEntry( LoggerManager.ROLE );
}
catch ( ContextException ce )
{
@@ -788,7 +821,7 @@
assumeOwnership( logManager );
- m_childContext.put( LoggerManager.ROLE, logManager );
+ m_containerManagerContext.put( LoggerManager.ROLE, logManager );
}
// Since we now have a LoggerManager, we can update the this.logger field
@@ -798,7 +831,7 @@
{
getLogger().debug( "Switching to default Logger provided by LoggerManager." );
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
m_logger = loggerManager.getDefaultLogger();
}
}
@@ -819,7 +852,7 @@
{
// Try copying an already existing instrument manager from the override context.
- m_rootContext.get( InstrumentManager.ROLE );
+ copyEntry( InstrumentManager.ROLE );
}
catch ( ContextException ce )
{
@@ -833,7 +866,7 @@
}
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Get the logger for the instrument manager
final Logger imLogger = loggerManager.getLoggerForCategory(
@@ -847,7 +880,7 @@
assumeOwnership( instrumentManager );
- m_childContext.put( InstrumentManager.ROLE, instrumentManager );
+ m_containerManagerContext.put( InstrumentManager.ROLE, instrumentManager );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] #11-bis - there was a typo in the inline docs
Posted by Anton Tagunov <at...@mail.cnt.ru>.
Sorry to double post. An incorrectly placed "the" in the inline doc
has made me resend the patch.
diff -ru src.orig/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java
--- src.orig/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 10:20:10.000000000 +0400
+++ src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 12:33:30.000000000 +0400
@@ -205,7 +205,7 @@
ContainerUtil.enableLogging( instance, m_logger );
ContainerUtil.contextualize( instance, implContext );
- final ServiceManager serviceManager = createServiceManager( implContext );
+ final ServiceManager serviceManager = createServiceManager( managerContext );
ContainerUtil.service( instance, serviceManager );
diff -ru src.orig/java/org/apache/avalon/fortress/util/ContextManager.java src/java/org/apache/avalon/fortress/util/ContextManager.java
--- src.orig/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 10:20:26.000000000 +0400
+++ src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 12:53:45.000000000 +0400
@@ -103,20 +103,16 @@
* get an instance of the Context, it is made read-only and returned. No
* further operations will be possible on it.</p>
*
- * <p>You can get two different contexts from the ContextManager: the child
- * context and the impl manager context. The former contains all
- * managers, such as the pool manager etc. necessary for a child impl to
- * create additional child containers. The impl manager context contains
- * all of the child context, but also initialization parameters for the
- * impl, such as a Configuration object, a ComponentLocator, etc., that
- * the impl wants, but does not want to pass on to its children.</p>
+ * <p>You can get two different contexts from the ContextManager:
+ * the container context (m_childContext)
+ * and the container manager context (m_contaimerManagerContext).
*
- * <p>You would typically use the impl manager context to initialize
- * the impl manager, and let it pass the child context on to the
- * impl.</p>
+ * <p>The container manager context is used to provide the container manager
+ * with all the data needed to initialize the container.</p>
+ * <p>The container context is passed directly to the container.</p>
*
- * <p>The ContextManager will sometimes create new components, such as a
- * component manager, a pool manager, etc. It will manage these components
+ * <p>The ContextManager will sometimes create new components, such as
+ * a service manager, a pool manager, etc. It will manage these components
* and dispose of them properly when it itself is disposed .</p>
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
@@ -163,7 +159,6 @@
*/
private Logger m_logger;
private final Logger m_primordialLogger;
- private ServiceManager m_manager;
/**
* The components that are "owned" by this context and should
@@ -237,6 +232,7 @@
*/
public void initialize() throws Exception
{
+ initializeDefaultSourceResolver();
initializeServiceManager();
initializeLoggerManager();
initializeMetaInfoManager();
@@ -248,6 +244,8 @@
m_childContext.makeReadOnly();
m_containerManagerContext.makeReadOnly();
+
+ m_defaultSourceResolver = null;
}
/**
@@ -295,6 +293,16 @@
getLogger().debug( "Could not copy Context parameters. This may be Ok depending on "
+ "other configured context values." );
}
+
+ // hide from the container implementation what it does not need
+ m_childContext.put( CONFIGURATION, null );
+ m_childContext.put( CONFIGURATION_URI, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION_URI, null );
}
/**
@@ -392,7 +400,7 @@
{
try
{
- m_rootContext.get( Queue.ROLE );
+ copyEntry( Queue.ROLE );
return;
}
catch ( ContextException ce )
@@ -400,7 +408,7 @@
}
// No CommandQueue specified, create a default one
- m_childContext.put( Queue.ROLE, createCommandSink() );
+ m_containerManagerContext.put( Queue.ROLE, createCommandSink() );
}
/**
@@ -418,7 +426,7 @@
assumeOwnership( tm );
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Get the logger for the thread manager
final Logger tmLogger = loggerManager.getLoggerForCategory( "system.threadmgr" );
@@ -487,16 +495,16 @@
{
try
{
- m_rootContext.get( PoolManager.ROLE );
+ copyEntry( PoolManager.ROLE );
return;
}
catch ( ContextException ce )
{
}
- final PoolManager pm = new DefaultPoolManager( (Sink) m_childContext.get( Queue.ROLE ) );
+ final PoolManager pm = new DefaultPoolManager( (Sink) m_containerManagerContext.get( Queue.ROLE ) );
assumeOwnership( pm );
- m_childContext.put( PoolManager.ROLE, pm );
+ m_containerManagerContext.put( PoolManager.ROLE, pm );
}
/**
@@ -535,7 +543,7 @@
}
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Lookup the context class loader
final ClassLoader classLoader = (ClassLoader) m_rootContext.get( ClassLoader.class.getName() );
@@ -560,7 +568,17 @@
protected void initializeMetaInfoManager() throws Exception
{
- final boolean mmSupplied = entryPresent( m_rootContext, MetaInfoManager.ROLE );
+ boolean mmSupplied = false;
+ try
+ {
+ copyEntry( MetaInfoManager.ROLE );
+ mmSupplied = true;
+ }
+ catch( ContextException ce )
+ {
+ // okay, we will create one
+ }
+
RoleManager roleManager = obtainRoleManager();
final boolean rmSupplied = roleManager != null;
@@ -575,7 +593,7 @@
}
else
{
- final LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager)m_containerManagerContext.get( LoggerManager.ROLE );
final ClassLoader classLoader = (ClassLoader)m_rootContext.get( ClassLoader.class.getName() );
if ( ! rmSupplied )
@@ -592,21 +610,25 @@
metaManager.enableLogging( loggerManager.getLoggerForCategory("system.meta") );
metaManager.initialize();
assumeOwnership( metaManager );
- m_childContext.put( MetaInfoManager.ROLE, metaManager );
+ m_containerManagerContext.put( MetaInfoManager.ROLE, metaManager );
}
}
/**
- * Get a reference to the initial ComponentLocator used by the
- * ContainerManager to hold the Components used for parsing the config
- * files and setting up the environment.
- *
- * @throws Exception when there is an error.
+ * Source resolver used to read-in the configurations.
+ * and provided as a default source resolver if the
+ * user has not supplied a ServiceManager.
+ * (Otherwise it or an overriding sourceresolver
+ * is probably available from that.)
*/
- protected void initializeServiceManager() throws Exception
+ protected SourceResolver m_defaultSourceResolver;
+
+ /**
+ * Initialize the default SrouceResolver.
+ */
+ protected void initializeDefaultSourceResolver() throws Exception
{
- final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
- final DefaultServiceManager manager = new DefaultServiceManager( parent );
+ final DefaultServiceManager manager = new DefaultServiceManager();
final DefaultServiceSelector selector = new DefaultServiceSelector();
final URLSourceFactory file = new URLSourceFactory();
file.enableLogging( getLogger() );
@@ -623,15 +645,32 @@
ContainerUtil.service( resolver, manager );
ContainerUtil.parameterize( resolver, new Parameters() );
- manager.put( SourceResolver.ROLE, resolver );
-
- manager.makeReadOnly();
-
- assumeOwnership( manager );
-
- m_manager = manager;
-
- m_childContext.put( ContextManagerConstants.SERVICE_MANAGER, m_manager );
+ m_defaultSourceResolver = resolver;
+ }
+ /**
+ * Get a reference to the initial ComponentLocator used by the
+ * ContainerManager to hold the Components used for parsing the config
+ * files and setting up the environment.
+ *
+ * @throws Exception when there is an error.
+ */
+ protected void initializeServiceManager() throws Exception
+ {
+ try
+ {
+ copyEntry( SERVICE_MANAGER );
+ }
+ catch( ContextException ce )
+ {
+ final DefaultServiceManager manager = new DefaultServiceManager();
+
+ // provide a default source resolver good in many situations
+ manager.put( SourceResolver.ROLE, m_defaultSourceResolver );
+
+ manager.makeReadOnly();
+
+ m_containerManagerContext.put( ContextManagerConstants.SERVICE_MANAGER, manager );
+ }
}
/**
@@ -668,8 +707,7 @@
Source src = null;
try
{
- resolver = (SourceResolver) m_manager.lookup( SourceResolver.ROLE );
- src = resolver.resolveURI( configUri );
+ src = m_defaultSourceResolver.resolveURI( configUri );
if ( configBuilder == null )
{
configBuilder = new DefaultConfigurationBuilder();
@@ -685,12 +723,7 @@
}
finally
{
- if ( null != resolver )
- {
- resolver.release( src );
- }
-
- m_manager.release( resolver );
+ m_defaultSourceResolver.release( src );
}
}
@@ -747,7 +780,7 @@
{
// Try copying an already existing logger manager from the override context.
- m_childContext.put( LoggerManager.ROLE, m_rootContext.get( LoggerManager.ROLE ) );
+ copyEntry( LoggerManager.ROLE );
}
catch ( ContextException ce )
{
@@ -788,7 +821,7 @@
assumeOwnership( logManager );
- m_childContext.put( LoggerManager.ROLE, logManager );
+ m_containerManagerContext.put( LoggerManager.ROLE, logManager );
}
// Since we now have a LoggerManager, we can update the this.logger field
@@ -798,7 +831,7 @@
{
getLogger().debug( "Switching to default Logger provided by LoggerManager." );
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
m_logger = loggerManager.getDefaultLogger();
}
}
@@ -819,7 +852,7 @@
{
// Try copying an already existing instrument manager from the override context.
- m_rootContext.get( InstrumentManager.ROLE );
+ copyEntry( InstrumentManager.ROLE );
}
catch ( ContextException ce )
{
@@ -833,7 +866,7 @@
}
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Get the logger for the instrument manager
final Logger imLogger = loggerManager.getLoggerForCategory(
@@ -847,7 +880,7 @@
assumeOwnership( instrumentManager );
- m_childContext.put( InstrumentManager.ROLE, instrumentManager );
+ m_containerManagerContext.put( InstrumentManager.ROLE, instrumentManager );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
[Patch] #11.3
Posted by Anton Tagunov <at...@mail.cnt.ru>.
Uff.. More nuts -- more taste :)
1. ===============
I just couldn't resist this refactoring of
DefaultContainerManager/ContextManager.
I beleive that this patch as compared to #11-bis-2
improves code simplicity. The difference is the following:
loggerManager
queue
metaInfoManager
poolManager
instrumentManager
etc. -- all that AbstractContainer fetches from
its ServiceManager -- are now stuffed into the
serviceManager directly by ContextManager.
This has required the introduction of
m_loggerManager
m_queue
m_metaInfoManager
m_poolManager
m_instrumentManager
variables into ContextManager, but this is all the
overhead we get.
In return DefaultContainerManager
has become two methods shorter and we do not need
to fetch loggerManager and queue back from
m_containerManagerContext when we need them again in
ContextManager/initialize*.
As an additional bonus this makes the ServiceManager
hierarchy one level shorter in the common usage scenario.
2. ===============
On my way I have found that a change would be desirable
to event//CommandManager, we were calling
Sink getCommandSink()
on it and after that coerced the result to Queue (as
really a queue was returned)
This patch adds a getCommandQueue() method to CommandManager.
3. ==============
Naturally this patch includes all that is included into
#11
#11-bis-2
so the comments in the respective comments apply.
Sorry about scattering them among severl mails :-/
WBR, Anton
diff -ru avalon-excalibur.0/event/src/java/org/apache/excalibur/event/command/CommandManager.java avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java
--- avalon-excalibur.0/event/src/java/org/apache/excalibur/event/command/CommandManager.java 2003-03-22 15:46:28.000000000 +0300
+++ avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java 2003-05-28 14:09:50.000000000 +0400
@@ -130,6 +130,16 @@
}
/**
+ * Get the Command Queue so that you can enqueue and dequeue commands.
+ *
+ * @return the Sink that feeds the CommandManager
+ */
+ public final Queue getCommandQueue()
+ {
+ return m_queue;
+ }
+
+ /**
* Register a Signal with an EventHandler. The Signal is a special object
* that implements the {@link Signal} interface. When CommandManager recieves
* events that match the Signal, it will send a copy of it to all the
diff -ru avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java
--- avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 10:20:10.000000000 +0400
+++ avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 14:00:12.000000000 +0400
@@ -205,7 +205,8 @@
ContainerUtil.enableLogging( instance, m_logger );
ContainerUtil.contextualize( instance, implContext );
- final ServiceManager serviceManager = createServiceManager( implContext );
+ final ServiceManager serviceManager =
+ (ServiceManager) getContextEntry( managerContext, SERVICE_MANAGER );
ContainerUtil.service( instance, serviceManager );
@@ -230,38 +231,6 @@
}
}
- private ServiceManager createServiceManager( final Context managerContext )
- {
- final ServiceManager smanager =
- (ServiceManager) getContextEntry( managerContext, SERVICE_MANAGER );
- final DefaultServiceManager serviceManager = new DefaultServiceManager( smanager );
-
- addService( Queue.ROLE, managerContext, serviceManager );
- addService( LoggerManager.ROLE, managerContext, serviceManager );
- addService( PoolManager.ROLE, managerContext, serviceManager );
- addService( InstrumentManager.ROLE, managerContext, serviceManager );
- addService( MetaInfoManager.ROLE, managerContext, serviceManager );
- addService( RoleManager.ROLE, managerContext, serviceManager );
- addService( LifecycleExtensionManager.ROLE, managerContext, serviceManager );
- serviceManager.makeReadOnly();
-
- return serviceManager;
- }
-
- private void addService( final String role,
- final Context context,
- final DefaultServiceManager serviceManager )
- {
- try
- {
- final Object object = context.get( role );
- serviceManager.put( role, object );
- }
- catch ( ContextException e )
- {
- }
- }
-
/**
* Retrieve an entry from context if it exists, else return null.
*
diff -ru avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java
--- avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 10:20:26.000000000 +0400
+++ avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 14:34:54.000000000 +0400
@@ -74,7 +74,6 @@
import org.apache.avalon.framework.service.DefaultServiceSelector;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.excalibur.event.Queue;
-import org.apache.excalibur.event.Sink;
import org.apache.excalibur.event.command.CommandManager;
import org.apache.excalibur.event.command.TPCThreadManager;
import org.apache.excalibur.event.command.ThreadManager;
@@ -103,20 +102,16 @@
* get an instance of the Context, it is made read-only and returned. No
* further operations will be possible on it.</p>
*
- * <p>You can get two different contexts from the ContextManager: the child
- * context and the impl manager context. The former contains all
- * managers, such as the pool manager etc. necessary for a child impl to
- * create additional child containers. The impl manager context contains
- * all of the child context, but also initialization parameters for the
- * impl, such as a Configuration object, a ComponentLocator, etc., that
- * the impl wants, but does not want to pass on to its children.</p>
+ * <p>You can get two different contexts from the ContextManager:
+ * the container context (m_childContext)
+ * and the container manager context (m_contaimerManagerContext).
*
- * <p>You would typically use the impl manager context to initialize
- * the impl manager, and let it pass the child context on to the
- * impl.</p>
+ * <p>The container manager context is used to provide the container manager
+ * with all the data needed to initialize the container.</p>
+ * <p>The container context is passed directly to the container.</p>
*
- * <p>The ContextManager will sometimes create new components, such as a
- * component manager, a pool manager, etc. It will manage these components
+ * <p>The ContextManager will sometimes create new components, such as
+ * a service manager, a pool manager, etc. It will manage these components
* and dispose of them properly when it itself is disposed .</p>
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
@@ -139,21 +134,21 @@
/**
* The root context.
*/
- private final Context m_rootContext;
+ protected final Context m_rootContext;
/**
* The context of the new impl. This context has the rootContext
* as its parent. Put everything here that you want the new impl
* to have in its own context.
*/
- private final DefaultContext m_childContext;
+ protected final DefaultContext m_childContext;
/**
* Container manager's context. This context has the child context
* as parent. Put things here that you want the impl manager
* to see, but do not wish to expose to the impl.
*/
- private final DefaultContext m_containerManagerContext;
+ protected final DefaultContext m_containerManagerContext;
/**
* New context passed in, maybe from a FortressConfig.
@@ -161,9 +156,45 @@
* other pointers. The ContextManager inspects it for
* elements it can use to create component managers etc.
*/
- private Logger m_logger;
- private final Logger m_primordialLogger;
- private ServiceManager m_manager;
+ protected Logger m_logger;
+ protected final Logger m_primordialLogger;
+
+ /**
+ * Source resolver used to read-in the configurations.
+ * and provided as a default source resolver if the
+ * user has not supplied a ServiceManager.
+ */
+ protected SourceResolver m_defaultSourceResolver;
+
+ /**
+ * The logger manager in use.
+ * Either supplied via rootContext, or created locally.
+ */
+ protected LoggerManager m_loggerManager;
+
+ /**
+ * The Queue in use.
+ * Either supplied via rootContext or created locally.
+ */
+ protected Queue m_queue;
+
+ /**
+ * The MetaInfoManager to be used by the container.
+ * Either supplied via rootContext or created locally.
+ */
+ protected MetaInfoManager m_metaInfoManager;
+
+ /**
+ * The PoolManager to be used by the container.
+ * Either supplied via rootContext or created locally.
+ */
+ protected PoolManager m_poolManager;
+
+ /**
+ * The InstrumentManager to be used by the container.
+ * Either supplied via rootContext or created locally.
+ */
+ protected InstrumentManager m_instrumentManager;
/**
* The components that are "owned" by this context and should
@@ -219,7 +250,7 @@
*
* @throws IllegalArgumentException if the object is null.
*/
- private void assumeOwnership( final Object object )
+ protected void assumeOwnership( final Object object )
{
if ( object == null )
{
@@ -237,7 +268,7 @@
*/
public void initialize() throws Exception
{
- initializeServiceManager();
+ initializeDefaultSourceResolver();
initializeLoggerManager();
initializeMetaInfoManager();
initializeCommandQueue();
@@ -245,9 +276,12 @@
initializeContext();
initializeInstrumentManager();
initializeConfiguration();
+ initializeServiceManager();
m_childContext.makeReadOnly();
m_containerManagerContext.makeReadOnly();
+
+ m_defaultSourceResolver = null;
}
/**
@@ -295,6 +329,22 @@
getLogger().debug( "Could not copy Context parameters. This may be Ok depending on "
+ "other configured context values." );
}
+
+ // hide from the container implementation what it does not need
+ m_childContext.put( CONFIGURATION, null );
+ m_childContext.put( CONFIGURATION_URI, null );
+ m_childContext.put( RoleManager.ROLE, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( LoggerManager.ROLE, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( InstrumentManager.ROLE, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( Queue.ROLE, null );
+ m_childContext.put( MetaInfoManager.ROLE, null );
+ m_childContext.put( PoolManager.ROLE, null );
}
/**
@@ -392,15 +442,13 @@
{
try
{
- m_rootContext.get( Queue.ROLE );
- return;
+ m_queue = (Queue) m_rootContext.get( Queue.ROLE );
}
catch ( ContextException ce )
{
+ // No CommandQueue specified, create a default one
+ m_queue = createCommandQueue();
}
-
- // No CommandQueue specified, create a default one
- m_childContext.put( Queue.ROLE, createCommandSink() );
}
/**
@@ -409,7 +457,7 @@
* @return a default <code>CommandQueue</code>
* @throws Exception if an error occurs
*/
- private Sink createCommandSink() throws Exception
+ private Queue createCommandQueue() throws Exception
{
final CommandManager cm = new CommandManager();
final ThreadManager tm = new TPCThreadManager();
@@ -417,11 +465,8 @@
assumeOwnership( cm );
assumeOwnership( tm );
- // Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
-
// Get the logger for the thread manager
- final Logger tmLogger = loggerManager.getLoggerForCategory( "system.threadmgr" );
+ final Logger tmLogger = m_loggerManager.getLoggerForCategory( "system.threadmgr" );
ContainerUtil.enableLogging( tm, tmLogger );
ContainerUtil.parameterize( tm, buildCommandQueueConfig() );
@@ -429,7 +474,7 @@
tm.register( cm );
- return cm.getCommandSink();
+ return cm.getCommandQueue();
}
/**
@@ -487,16 +532,14 @@
{
try
{
- m_rootContext.get( PoolManager.ROLE );
- return;
+ m_poolManager = (PoolManager) m_rootContext.get( PoolManager.ROLE );
}
catch ( ContextException ce )
{
+ final PoolManager pm = new DefaultPoolManager( m_queue );
+ assumeOwnership( pm );
+ m_poolManager = pm;
}
-
- final PoolManager pm = new DefaultPoolManager( (Sink) m_childContext.get( Queue.ROLE ) );
- assumeOwnership( pm );
- m_childContext.put( PoolManager.ROLE, pm );
}
/**
@@ -534,14 +577,11 @@
return null;
}
- // Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
-
// Lookup the context class loader
final ClassLoader classLoader = (ClassLoader) m_rootContext.get( ClassLoader.class.getName() );
// Create a logger for the role manager
- final Logger rmLogger = loggerManager.getLoggerForCategory(
+ final Logger rmLogger = m_loggerManager.getLoggerForCategory(
roleConfig.getAttribute( "logger", "system.roles" ) );
// Create a parent role manager with all the default roles
@@ -560,7 +600,17 @@
protected void initializeMetaInfoManager() throws Exception
{
- final boolean mmSupplied = entryPresent( m_rootContext, MetaInfoManager.ROLE );
+ boolean mmSupplied = false;
+ try
+ {
+ m_metaInfoManager = (MetaInfoManager) m_rootContext.get( MetaInfoManager.ROLE );
+ mmSupplied = true;
+ }
+ catch( ContextException ce )
+ {
+ // okay, we will create one
+ }
+
RoleManager roleManager = obtainRoleManager();
final boolean rmSupplied = roleManager != null;
@@ -575,13 +625,12 @@
}
else
{
- final LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE );
final ClassLoader classLoader = (ClassLoader)m_rootContext.get( ClassLoader.class.getName() );
if ( ! rmSupplied )
{
final FortressRoleManager newRoleManager = new FortressRoleManager( null, classLoader );
- newRoleManager.enableLogging(loggerManager.getLoggerForCategory("system.roles"));
+ newRoleManager.enableLogging(m_loggerManager.getLoggerForCategory("system.roles"));
newRoleManager.initialize();
roleManager = newRoleManager;
@@ -589,24 +638,19 @@
final ServiceMetaManager metaManager = new ServiceMetaManager( new Role2MetaInfoManager( roleManager ), classLoader );
- metaManager.enableLogging( loggerManager.getLoggerForCategory("system.meta") );
+ metaManager.enableLogging( m_loggerManager.getLoggerForCategory("system.meta") );
metaManager.initialize();
assumeOwnership( metaManager );
- m_childContext.put( MetaInfoManager.ROLE, metaManager );
+ m_metaInfoManager = metaManager;
}
}
/**
- * Get a reference to the initial ComponentLocator used by the
- * ContainerManager to hold the Components used for parsing the config
- * files and setting up the environment.
- *
- * @throws Exception when there is an error.
+ * Initialize the default SrouceResolver.
*/
- protected void initializeServiceManager() throws Exception
+ protected void initializeDefaultSourceResolver() throws Exception
{
- final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
- final DefaultServiceManager manager = new DefaultServiceManager( parent );
+ final DefaultServiceManager manager = new DefaultServiceManager();
final DefaultServiceSelector selector = new DefaultServiceSelector();
final URLSourceFactory file = new URLSourceFactory();
file.enableLogging( getLogger() );
@@ -623,15 +667,41 @@
ContainerUtil.service( resolver, manager );
ContainerUtil.parameterize( resolver, new Parameters() );
- manager.put( SourceResolver.ROLE, resolver );
-
- manager.makeReadOnly();
-
- assumeOwnership( manager );
+ m_defaultSourceResolver = resolver;
+ }
+ /**
+ * Get a reference to the initial ComponentLocator used by the
+ * ContainerManager to hold the Components used for parsing the config
+ * files and setting up the environment.
+ *
+ * @throws Exception when there is an error.
+ */
+ protected void initializeServiceManager() throws Exception
+ {
+ final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
+ final DefaultServiceManager manager = new DefaultServiceManager( parent );
- m_manager = manager;
+ /**
+ * We assume that if there is a parent ServiceManager provided,
+ * there is a SourceResolver mounted there. And if there
+ * is none, then it is the true caller's intetion.
+ * However it is hard to imagine how that could be usefull
+ * except for testing purposes.
+ */
+ if ( parent == null )
+ {
+ manager.put( SourceResolver.ROLE, m_defaultSourceResolver );
+ }
+
+ manager.put( LoggerManager.ROLE, m_loggerManager );
+ manager.put( Queue.ROLE, m_queue );
+ manager.put( MetaInfoManager.ROLE, m_metaInfoManager );
+ manager.put( PoolManager.ROLE, m_poolManager );
+ manager.put( InstrumentManager.ROLE, m_instrumentManager );
- m_childContext.put( ContextManagerConstants.SERVICE_MANAGER, m_manager );
+ manager.makeReadOnly();
+
+ m_containerManagerContext.put( SERVICE_MANAGER, manager );
}
/**
@@ -668,8 +738,7 @@
Source src = null;
try
{
- resolver = (SourceResolver) m_manager.lookup( SourceResolver.ROLE );
- src = resolver.resolveURI( configUri );
+ src = m_defaultSourceResolver.resolveURI( configUri );
if ( configBuilder == null )
{
configBuilder = new DefaultConfigurationBuilder();
@@ -685,12 +754,7 @@
}
finally
{
- if ( null != resolver )
- {
- resolver.release( src );
- }
-
- m_manager.release( resolver );
+ m_defaultSourceResolver.release( src );
}
}
@@ -747,7 +811,7 @@
{
// Try copying an already existing logger manager from the override context.
- m_childContext.put( LoggerManager.ROLE, m_rootContext.get( LoggerManager.ROLE ) );
+ m_loggerManager = (LoggerManager) m_rootContext.get( LoggerManager.ROLE );
}
catch ( ContextException ce )
{
@@ -788,7 +852,7 @@
assumeOwnership( logManager );
- m_childContext.put( LoggerManager.ROLE, logManager );
+ m_loggerManager = logManager;
}
// Since we now have a LoggerManager, we can update the this.logger field
@@ -798,8 +862,7 @@
{
getLogger().debug( "Switching to default Logger provided by LoggerManager." );
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
- m_logger = loggerManager.getDefaultLogger();
+ m_logger = m_loggerManager.getDefaultLogger();
}
}
@@ -819,7 +882,7 @@
{
// Try copying an already existing instrument manager from the override context.
- m_rootContext.get( InstrumentManager.ROLE );
+ m_instrumentManager = (InstrumentManager) m_rootContext.get( InstrumentManager.ROLE );
}
catch ( ContextException ce )
{
@@ -832,11 +895,8 @@
instrumentConfig = EMPTY_CONFIG;
}
- // Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
-
// Get the logger for the instrument manager
- final Logger imLogger = loggerManager.getLoggerForCategory(
+ final Logger imLogger = m_loggerManager.getLoggerForCategory(
instrumentConfig.getAttribute( "logger", "system.instrument" ) );
// Set up the Instrument Manager
@@ -847,7 +907,7 @@
assumeOwnership( instrumentManager );
- m_childContext.put( InstrumentManager.ROLE, instrumentManager );
+ m_instrumentManager = instrumentManager;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] #11
Posted by Berin Loritsch <bl...@apache.org>.
Anton Tagunov wrote:
> Hello Berin!
>
> It great so much of my patches has been applied.
>
> Hmm.. can ContextManager be used in a _nested_ container?
> Not likely, but theoretically possible.
>
> Hence, this patch. Do you like what is in the patch on this subject?
I'll look more deeply at the patch in a bit. For now, I am addressing
the other questions.
>
> 2) =======================
>
> AT> LoggerManager, PoolManager, InstrumentManager, MetaInfoManager
> AT> LifecycleExtensionsManager, Queue are passed to the Container
> AT> twice: via contextualize() and via service()
>
> BL> This duplication originated from having them *originally* passed in as
> BL> context entries. Later, after looking at what these things really were,
> BL> we determined that we were using a Context to access services. We
> BL> should go the other way and make them only available via the service
> BL> mechanism.
>
> I understand they are service because they have an interface and
> a ROLE in it? But we never really release them -- is not that an
> argument for accessing them via Context?
They are *services* because they are entities that perform a function.
They are logically services, and behaviorily services. The purpose
of the Context is to pass constants to the client.
Admittedly there is some overlap between a Context and the
ServiceManager, and in a future version of Avalon we _might_ merge
the concepts. However, we should be true to the purpose of these
objects.
>
> And after all they are quite different from user services - these
> are system entities.
>
Yes they are system entities, but they are services.
> If they are available via ServiceManager someone may configure a
> component implementing a PoolManager or a Queue interface or a
> MetaInfoManager in the normal .xconf file and have nested containers
> use that.
True. They should be expected to know what they are doing. I
purposely did not want to limit users of Fortress to *have* to use
the central PoolManager, etc. if they didn't want to.
Everything will be able to be overridden. That is the beauty of
a heirarchical system. You have your central container, and you
can have other containers put on top of that. Your containers
would be allowed to replace any service passed to them within that
level of the hierarchy.
For example:
A-+B
+C+D
+E
The root container (A) defines all the core system services. Container
B or C can simply use them, or define new ones. If container C defines
new system services, it only affects itself (there is no way for it
to infect the root container). If container C defines new system
services then it will affect containers D and E because they are C's
children.
Again, the developer who does this should know what they are doing.
9 times out of 10 most people will simply use what is available.
>
> But should these things really be configured like that?
> I do not mean this is a security violation but rather that
> these things are so deep internal to system things ( like Queue )
> that it looks a bit of order to configure them where normal
> user components are configured.
What if I have a modularly written system like Cocoon? One container
has a different set of components than the next, and I may want to
use a different pool to manage my component instances.
I think it should be like that.
>
> So, I personally would have been more comfortable with accessing
> them from the Context. Mainly because we never release them.
> ServiceManager context contract is just to "heavy" in concept
> for such a simple thing as "take what I give you once and live on it".
>
No its not. The ServiceManager concept is very simple. They are
services, not *constants*. The Context should be a place for data,
not services.
Now, if those services were never in the context to begin with,
would you still be asking about it? I doubt that, because most
people just go with what they have been given. It is because
there was a duplication that we had a problem.
> Is there any use to discussion this topic?
I haven't had a convincing argument why services should be in a
context, and I am of the mindset that it was a mistake to use that
"contract" to begin with.
>
> The patch supplied in this mail goes the ServiceManager
> way and removes the duplicated entities from m_childContext.
Good. :) It will most likely be applied then.
>
> 3) ===============================
> This patch also hides *CONFIGURAION and *CONFIGURATION_URI
> from the container implementation.
Ok.
>
> 4) ===============================
> I have also updated the main section of the
> inline documentation on ContextManager a bit.
> The inline sections on separate methods still
> are outdated sometimes - but I think this is
> bearable at them moment.
Ok.
<snip type="patch"/>
--
"You know the world is going crazy when the best
rapper is a white guy, the best golfer is a black guy,
The Swiss hold the America's Cup, France is
accusing the US of arrogance, and Germany doesn't want
to go to war. And the 3 most powerful men in America
are named 'Bush', 'Dick', and 'Colon' (sic)".
-----Chris Rock
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] #11-bis-2
Posted by Anton Tagunov <at...@mail.cnt.ru>.
This patch does all the same as [Patch] #11
but also it changes private to public in
ContextManager on several member variables
(m_childContext, m_contextManagerContext, etc)
and one function (assumeOwership).
As all of the initialize* methods are protected
this assumes that theoretically this class might
be switched from final to non-final in the future
and subclassed.
Well, I sort of felt embarassed the initialize*
methods are protected and the variables that
their overriden analogs would need to operate
upon (if the class was not final) are private.
I beleive that this change is otherwise useless,
except that it improves the style and readablity.
I beleive that this discrepance is really somthing
a Java developer may stumble upon reading the code and
burn his mind-cycles on solving an unexisting puzzle.
So I ask you to kindly accept these changes :)
Oh, BTW, I have also relocated m_localSourceResolver
to a more suitable location in the file.
- Anton
diff -ru src.orig/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java
--- src.orig/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 10:20:10.000000000 +0400
+++ src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 12:33:30.000000000 +0400
@@ -205,7 +205,7 @@
ContainerUtil.enableLogging( instance, m_logger );
ContainerUtil.contextualize( instance, implContext );
- final ServiceManager serviceManager = createServiceManager( implContext );
+ final ServiceManager serviceManager = createServiceManager( managerContext );
ContainerUtil.service( instance, serviceManager );
diff -ru src.orig/java/org/apache/avalon/fortress/util/ContextManager.java src/java/org/apache/avalon/fortress/util/ContextManager.java
--- src.orig/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 10:20:26.000000000 +0400
+++ src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 13:29:43.000000000 +0400
@@ -103,20 +103,16 @@
* get an instance of the Context, it is made read-only and returned. No
* further operations will be possible on it.</p>
*
- * <p>You can get two different contexts from the ContextManager: the child
- * context and the impl manager context. The former contains all
- * managers, such as the pool manager etc. necessary for a child impl to
- * create additional child containers. The impl manager context contains
- * all of the child context, but also initialization parameters for the
- * impl, such as a Configuration object, a ComponentLocator, etc., that
- * the impl wants, but does not want to pass on to its children.</p>
+ * <p>You can get two different contexts from the ContextManager:
+ * the container context (m_childContext)
+ * and the container manager context (m_contaimerManagerContext).
*
- * <p>You would typically use the impl manager context to initialize
- * the impl manager, and let it pass the child context on to the
- * impl.</p>
+ * <p>The container manager context is used to provide the container manager
+ * with all the data needed to initialize the container.</p>
+ * <p>The container context is passed directly to the container.</p>
*
- * <p>The ContextManager will sometimes create new components, such as a
- * component manager, a pool manager, etc. It will manage these components
+ * <p>The ContextManager will sometimes create new components, such as
+ * a service manager, a pool manager, etc. It will manage these components
* and dispose of them properly when it itself is disposed .</p>
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
@@ -139,21 +135,21 @@
/**
* The root context.
*/
- private final Context m_rootContext;
+ protected final Context m_rootContext;
/**
* The context of the new impl. This context has the rootContext
* as its parent. Put everything here that you want the new impl
* to have in its own context.
*/
- private final DefaultContext m_childContext;
+ protected final DefaultContext m_childContext;
/**
* Container manager's context. This context has the child context
* as parent. Put things here that you want the impl manager
* to see, but do not wish to expose to the impl.
*/
- private final DefaultContext m_containerManagerContext;
+ protected final DefaultContext m_containerManagerContext;
/**
* New context passed in, maybe from a FortressConfig.
@@ -161,9 +157,15 @@
* other pointers. The ContextManager inspects it for
* elements it can use to create component managers etc.
*/
- private Logger m_logger;
- private final Logger m_primordialLogger;
- private ServiceManager m_manager;
+ protected Logger m_logger;
+ protected final Logger m_primordialLogger;
+
+ /**
+ * Source resolver used to read-in the configurations.
+ * and provided as a default source resolver if the
+ * user has not supplied a ServiceManager.
+ */
+ protected SourceResolver m_defaultSourceResolver;
/**
* The components that are "owned" by this context and should
@@ -219,7 +221,7 @@
*
* @throws IllegalArgumentException if the object is null.
*/
- private void assumeOwnership( final Object object )
+ protected void assumeOwnership( final Object object )
{
if ( object == null )
{
@@ -237,6 +239,7 @@
*/
public void initialize() throws Exception
{
+ initializeDefaultSourceResolver();
initializeServiceManager();
initializeLoggerManager();
initializeMetaInfoManager();
@@ -248,6 +251,8 @@
m_childContext.makeReadOnly();
m_containerManagerContext.makeReadOnly();
+
+ m_defaultSourceResolver = null;
}
/**
@@ -295,6 +300,16 @@
getLogger().debug( "Could not copy Context parameters. This may be Ok depending on "
+ "other configured context values." );
}
+
+ // hide from the container implementation what it does not need
+ m_childContext.put( CONFIGURATION, null );
+ m_childContext.put( CONFIGURATION_URI, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION_URI, null );
}
/**
@@ -392,7 +407,7 @@
{
try
{
- m_rootContext.get( Queue.ROLE );
+ copyEntry( Queue.ROLE );
return;
}
catch ( ContextException ce )
@@ -400,7 +415,7 @@
}
// No CommandQueue specified, create a default one
- m_childContext.put( Queue.ROLE, createCommandSink() );
+ m_containerManagerContext.put( Queue.ROLE, createCommandSink() );
}
/**
@@ -418,7 +433,7 @@
assumeOwnership( tm );
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Get the logger for the thread manager
final Logger tmLogger = loggerManager.getLoggerForCategory( "system.threadmgr" );
@@ -487,16 +502,16 @@
{
try
{
- m_rootContext.get( PoolManager.ROLE );
+ copyEntry( PoolManager.ROLE );
return;
}
catch ( ContextException ce )
{
}
- final PoolManager pm = new DefaultPoolManager( (Sink) m_childContext.get( Queue.ROLE ) );
+ final PoolManager pm = new DefaultPoolManager( (Sink) m_containerManagerContext.get( Queue.ROLE ) );
assumeOwnership( pm );
- m_childContext.put( PoolManager.ROLE, pm );
+ m_containerManagerContext.put( PoolManager.ROLE, pm );
}
/**
@@ -535,7 +550,7 @@
}
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Lookup the context class loader
final ClassLoader classLoader = (ClassLoader) m_rootContext.get( ClassLoader.class.getName() );
@@ -560,7 +575,17 @@
protected void initializeMetaInfoManager() throws Exception
{
- final boolean mmSupplied = entryPresent( m_rootContext, MetaInfoManager.ROLE );
+ boolean mmSupplied = false;
+ try
+ {
+ copyEntry( MetaInfoManager.ROLE );
+ mmSupplied = true;
+ }
+ catch( ContextException ce )
+ {
+ // okay, we will create one
+ }
+
RoleManager roleManager = obtainRoleManager();
final boolean rmSupplied = roleManager != null;
@@ -575,7 +600,7 @@
}
else
{
- final LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager)m_containerManagerContext.get( LoggerManager.ROLE );
final ClassLoader classLoader = (ClassLoader)m_rootContext.get( ClassLoader.class.getName() );
if ( ! rmSupplied )
@@ -592,21 +617,16 @@
metaManager.enableLogging( loggerManager.getLoggerForCategory("system.meta") );
metaManager.initialize();
assumeOwnership( metaManager );
- m_childContext.put( MetaInfoManager.ROLE, metaManager );
+ m_containerManagerContext.put( MetaInfoManager.ROLE, metaManager );
}
}
/**
- * Get a reference to the initial ComponentLocator used by the
- * ContainerManager to hold the Components used for parsing the config
- * files and setting up the environment.
- *
- * @throws Exception when there is an error.
+ * Initialize the default SrouceResolver.
*/
- protected void initializeServiceManager() throws Exception
+ protected void initializeDefaultSourceResolver() throws Exception
{
- final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
- final DefaultServiceManager manager = new DefaultServiceManager( parent );
+ final DefaultServiceManager manager = new DefaultServiceManager();
final DefaultServiceSelector selector = new DefaultServiceSelector();
final URLSourceFactory file = new URLSourceFactory();
file.enableLogging( getLogger() );
@@ -623,15 +643,32 @@
ContainerUtil.service( resolver, manager );
ContainerUtil.parameterize( resolver, new Parameters() );
- manager.put( SourceResolver.ROLE, resolver );
-
- manager.makeReadOnly();
-
- assumeOwnership( manager );
-
- m_manager = manager;
-
- m_childContext.put( ContextManagerConstants.SERVICE_MANAGER, m_manager );
+ m_defaultSourceResolver = resolver;
+ }
+ /**
+ * Get a reference to the initial ComponentLocator used by the
+ * ContainerManager to hold the Components used for parsing the config
+ * files and setting up the environment.
+ *
+ * @throws Exception when there is an error.
+ */
+ protected void initializeServiceManager() throws Exception
+ {
+ try
+ {
+ copyEntry( SERVICE_MANAGER );
+ }
+ catch( ContextException ce )
+ {
+ final DefaultServiceManager manager = new DefaultServiceManager();
+
+ // provide a default source resolver good in many situations
+ manager.put( SourceResolver.ROLE, m_defaultSourceResolver );
+
+ manager.makeReadOnly();
+
+ m_containerManagerContext.put( ContextManagerConstants.SERVICE_MANAGER, manager );
+ }
}
/**
@@ -668,8 +705,7 @@
Source src = null;
try
{
- resolver = (SourceResolver) m_manager.lookup( SourceResolver.ROLE );
- src = resolver.resolveURI( configUri );
+ src = m_defaultSourceResolver.resolveURI( configUri );
if ( configBuilder == null )
{
configBuilder = new DefaultConfigurationBuilder();
@@ -685,12 +721,7 @@
}
finally
{
- if ( null != resolver )
- {
- resolver.release( src );
- }
-
- m_manager.release( resolver );
+ m_defaultSourceResolver.release( src );
}
}
@@ -747,7 +778,7 @@
{
// Try copying an already existing logger manager from the override context.
- m_childContext.put( LoggerManager.ROLE, m_rootContext.get( LoggerManager.ROLE ) );
+ copyEntry( LoggerManager.ROLE );
}
catch ( ContextException ce )
{
@@ -788,7 +819,7 @@
assumeOwnership( logManager );
- m_childContext.put( LoggerManager.ROLE, logManager );
+ m_containerManagerContext.put( LoggerManager.ROLE, logManager );
}
// Since we now have a LoggerManager, we can update the this.logger field
@@ -798,7 +829,7 @@
{
getLogger().debug( "Switching to default Logger provided by LoggerManager." );
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
m_logger = loggerManager.getDefaultLogger();
}
}
@@ -819,7 +850,7 @@
{
// Try copying an already existing instrument manager from the override context.
- m_rootContext.get( InstrumentManager.ROLE );
+ copyEntry( InstrumentManager.ROLE );
}
catch ( ContextException ce )
{
@@ -833,7 +864,7 @@
}
// Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
+ final LoggerManager loggerManager = (LoggerManager) m_containerManagerContext.get( LoggerManager.ROLE );
// Get the logger for the instrument manager
final Logger imLogger = loggerManager.getLoggerForCategory(
@@ -847,7 +878,7 @@
assumeOwnership( instrumentManager );
- m_childContext.put( InstrumentManager.ROLE, instrumentManager );
+ m_containerManagerContext.put( InstrumentManager.ROLE, instrumentManager );
}
}
Only in src/java/org/apache/avalon/fortress/util: patch11-bis-2.diff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re[2]: [Patch] #11.4 -- oops #11.3 blue up one of the tests
Posted by Anton Tagunov <at...@mail.cnt.ru>.
Hello Berin!
I see lots of "Ok" from you and this definetely rises my spirits!
:-)
BL> I am rapidly reaching the point of Fortress being "Good Enough" for
BL> release. Unless you find any *bugs*, I suggest we hold off on the
BL> refactoring until after the release.
Here's what I think will be needed before release:
1) Patch #10 (a rewritten analog) is _definetely_ needed.
1.1) I see it like this: we always create a copy of
LifecycleExtensionManager in every container and add the
InstrumentableCreator to the copy (not to infect our parent
container).
1.2) And yes, I beleive we do need getChildContext() from that
patch badly too -- it is a means of allowing
containers to modify the context before handing it to
their children.
I will be able to send #10.1 tomorrow.
2)
Oh, one more thing we may want before release:
I've sent a mail to the list about teaching
ContextManager to alternatively create a Log4JLoggerManager
by duducting the type of the logger manager from the
logger manager configuration file.
I was asking in that mail how is it best to it.
2.1) One variant was to check the name of the root node in .xlog
and if it is log4j:configuration go for Log4JConfLoggerManager.
2.2) There was also an issue of automatically propagating
worker directory to Log4J configuration DOM tree if
there isn't one already.
I beleive that anyone including me might easily implement
2.1 (but I won't be able to test it :-(
I think this will significantly add value to Fortress.
As I have said I will be able to send 1.1, 1.2 and 2.1
tomorrow.
As for 2.2 I need at least an advice. (Or this may wait
until 1.0.1)
- Anton
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] #11.4 -- oops #11.3 blue up one of the tests
Posted by Berin Loritsch <bl...@apache.org>.
Anton Tagunov wrote:
> Really sorry about this - again a new version.
> 2. ==================
>
> DefaultContainerManager was left without a logger as LoggerManager
> was no longer put to m_containerManagerContext.
>
> This version of the patch adds a LOGGER constant to
> ContainerManagerConstants and makes ContextManager pass its
> own logger to DefaultContainerManager.
Ok.
>
> This even looks a code simplification to me:
>
> 1) we no longer deal with LoggerManager in DefaultContainerManager,
> only with Logger
Ok.
>
> 2) in the following rare situation
> (usage scenario not promoted by any examples but
> theoretically possible)
>
> ContextManager ctxm = new ContextManager( fortressConfig.getContext(),
> my-unique-and-desired-logger );
>
> ContainerManager ctnm = new DefaultContainerManager( cm );
>
> ContainerManager will use the same logger as was
> passed to the ContextManager, which is probably desirable
> as ContextManager is only a spare part used by ContainerManager
> and they should act as a one thing.
> Without this change ContainerManager in this situation will use
> loggerManager.getDefaultLogger().
Ok. Sounds good so far.
>
> P.S. Aren't you tired from my refactoring the code?
> XP says it's a good thing, and what do you say? ;-)
I am rapidly reaching the point of Fortress being "Good Enough" for
release. Unless you find any *bugs*, I suggest we hold off on the
refactoring until after the release.
>
>
> P.P.S.
>
> Hopefully this has been my last pass on ContextManager,
> (unless someone says: oh, it was so nice to pass all the
> stuff to Container via Context, not ServiceManager :-)
No one will say that ;P
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: To Sink or to Queue
Posted by Berin Loritsch <bl...@apache.org>.
Anton Tagunov wrote:
> Hello Berin!
>
> BL> As I mentioned earlier, the Sink is the real contract. It should
> BL> be a Sink. Now, the method does return a Queue (which includes
> BL> both a Sink and a Source). For the time being it works, but if
> BL> we get more strict then it won't.
>
> Just what I'm speaking about.
> Let's do one of
>
> A. Make Sink a Role interface (add a ROLE there)
> and go forward to switching to Sink from Queue.
>
> B. Keep in mind that a Sink is kept under Queue.ROLE
> and never coerce what we get from Queue.ROLE
> to Queue, but only to Sink.
>
> I understand that A. might upset someone already
> using Fortress, but isn't now the last moment to do A?
Yes it is, so that is what we *should* do.
--
"You know the world is going crazy when the best
rapper is a white guy, the best golfer is a black guy,
The Swiss hold the America's Cup, France is
accusing the US of arrogance, and Germany doesn't want
to go to war. And the 3 most powerful men in America
are named 'Bush', 'Dick', and 'Colon' (sic)".
-----Chris Rock
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
To Sink or to Queue (was: [Patch] #11.4 -- oops #11.3 blue up one of the tests)
Posted by Anton Tagunov <at...@mail.cnt.ru>.
Hello Berin!
BL> As I mentioned earlier, the Sink is the real contract. It should
BL> be a Sink. Now, the method does return a Queue (which includes
BL> both a Sink and a Source). For the time being it works, but if
BL> we get more strict then it won't.
Just what I'm speaking about.
Let's do one of
A. Make Sink a Role interface (add a ROLE there)
and go forward to switching to Sink from Queue.
B. Keep in mind that a Sink is kept under Queue.ROLE
and never coerce what we get from Queue.ROLE
to Queue, but only to Sink.
I understand that A. might upset someone already
using Fortress, but isn't now the last moment to do A?
- Anton
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] #11.4 -- oops #11.3 blue up one of the tests
Posted by Berin Loritsch <bl...@apache.org>.
Anton Tagunov wrote:
> Hello Berin!
>
>
>>> /**
>>>+ * Get the Command Queue so that you can enqueue and dequeue commands.
>>>+ *
>>>+ * @return the Sink that feeds the CommandManager
>>>+ */
>>>+ public final Queue getCommandQueue()
>>>+ {
>>>+ return m_queue;
>>>+ }
>
>
> BL> Already has a getCommandSink() which is the real contract.
>
>
> But we need a Queue!
> We do coerce like (Queue) after we invoke getCommandSink(),
> so I see two good ways out now:
>
> a) change the return type (or introduce a new method, which
> seemed less desctructive to me)
>
> b) change our requirements and treat what we get only as
> a Sink, not as a Queue
>
> Which is what we really need?
As I mentioned earlier, the Sink is the real contract. It should
be a Sink. Now, the method does return a Queue (which includes
both a Sink and a Source). For the time being it works, but if
we get more strict then it won't.
--
"You know the world is going crazy when the best
rapper is a white guy, the best golfer is a black guy,
The Swiss hold the America's Cup, France is
accusing the US of arrogance, and Germany doesn't want
to go to war. And the 3 most powerful men in America
are named 'Bush', 'Dick', and 'Colon' (sic)".
-----Chris Rock
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re[2]: [Patch] #11.4 -- oops #11.3 blue up one of the tests
Posted by Anton Tagunov <at...@mail.cnt.ru>.
Hello Berin!
>> /**
>> + * Get the Command Queue so that you can enqueue and dequeue commands.
>> + *
>> + * @return the Sink that feeds the CommandManager
>> + */
>> + public final Queue getCommandQueue()
>> + {
>> + return m_queue;
>> + }
BL> Already has a getCommandSink() which is the real contract.
But we need a Queue!
We do coerce like (Queue) after we invoke getCommandSink(),
so I see two good ways out now:
a) change the return type (or introduce a new method, which
seemed less desctructive to me)
b) change our requirements and treat what we get only as
a Sink, not as a Queue
Which is what we really need?
- Anton
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Patch] #11.4 -- oops #11.3 blue up one of the tests
Posted by Berin Loritsch <bl...@apache.org>.
>
> diff -ru avalon-excalibur.0/event/src/java/org/apache/excalibur/event/command/CommandManager.java avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java
> --- avalon-excalibur.0/event/src/java/org/apache/excalibur/event/command/CommandManager.java 2003-03-22 15:46:28.000000000 +0300
> +++ avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java 2003-05-28 14:09:50.000000000 +0400
> @@ -130,6 +130,16 @@
> }
>
> /**
> + * Get the Command Queue so that you can enqueue and dequeue commands.
> + *
> + * @return the Sink that feeds the CommandManager
> + */
> + public final Queue getCommandQueue()
> + {
> + return m_queue;
> + }
Already has a getCommandSink() which is the real contract.
--
"You know the world is going crazy when the best
rapper is a white guy, the best golfer is a black guy,
The Swiss hold the America's Cup, France is
accusing the US of arrogance, and Germany doesn't want
to go to war. And the 3 most powerful men in America
are named 'Bush', 'Dick', and 'Colon' (sic)".
-----Chris Rock
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
[Patch] #11.4 -- oops #11.3 blue up one of the tests
Posted by Anton Tagunov <at...@mail.cnt.ru>.
Really sorry about this - again a new version.
1. ==================
A test has been brought up to date with the changed contract
of ContextManager.
(Accidentially submitted the patch before the test series completed)
2. ==================
DefaultContainerManager was left without a logger as LoggerManager
was no longer put to m_containerManagerContext.
This version of the patch adds a LOGGER constant to
ContainerManagerConstants and makes ContextManager pass its
own logger to DefaultContainerManager.
This even looks a code simplification to me:
1) we no longer deal with LoggerManager in DefaultContainerManager,
only with Logger
2) in the following rare situation
(usage scenario not promoted by any examples but
theoretically possible)
ContextManager ctxm = new ContextManager( fortressConfig.getContext(),
my-unique-and-desired-logger );
ContainerManager ctnm = new DefaultContainerManager( cm );
ContainerManager will use the same logger as was
passed to the ContextManager, which is probably desirable
as ContextManager is only a spare part used by ContainerManager
and they should act as a one thing.
Without this change ContainerManager in this situation will use
loggerManager.getDefaultLogger().
I agree the example above could be rewritten as
ContextManager ctxm = new ContextManager( fortressConfig.getContext(),
my-unique-and-desired-logger
);
ContainerManager ctnm = new DefaultContainerManager( cm,
my-unique-and-desired-logger );
In this situaion both Context and Container manager will use
the desired logger even without the change, but still see
this change as bringing a 0.001% enhancment to system behavior.
WBR, Anton
P.S. Aren't you tired from my refactoring the code?
XP says it's a good thing, and what do you say? ;-)
P.P.S.
Hopefully this has been my last pass on ContextManager,
(unless someone says: oh, it was so nice to pass all the
stuff to Container via Context, not ServiceManager :-)
diff -ru avalon-excalibur.0/event/src/java/org/apache/excalibur/event/command/CommandManager.java avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java
--- avalon-excalibur.0/event/src/java/org/apache/excalibur/event/command/CommandManager.java 2003-03-22 15:46:28.000000000 +0300
+++ avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java 2003-05-28 14:09:50.000000000 +0400
@@ -130,6 +130,16 @@
}
/**
+ * Get the Command Queue so that you can enqueue and dequeue commands.
+ *
+ * @return the Sink that feeds the CommandManager
+ */
+ public final Queue getCommandQueue()
+ {
+ return m_queue;
+ }
+
+ /**
* Register a Signal with an EventHandler. The Signal is a special object
* that implements the {@link Signal} interface. When CommandManager recieves
* events that match the Signal, it will send a copy of it to all the
diff -ru avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/ContainerManagerConstants.java avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/ContainerManagerConstants.java
--- avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/ContainerManagerConstants.java 2003-04-22 16:37:08.000000000 +0400
+++ avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/ContainerManagerConstants.java 2003-05-28 14:57:14.000000000 +0400
@@ -49,6 +49,7 @@
*/
package org.apache.avalon.fortress;
+import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
/**
@@ -72,6 +73,11 @@
String SERVICE_MANAGER = ServiceManager.class.getName();
/**
+ * Logger where to log our own messages.
+ */
+ String LOGGER = Logger.class.getName();
+
+ /**
* Configuration: The configuration to give to the impl.
*/
String CONFIGURATION = "impl.configuration";
diff -ru avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java
--- avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 10:20:10.000000000 +0400
+++ avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/impl/DefaultContainerManager.java 2003-05-28 14:55:52.000000000 +0400
@@ -49,7 +49,6 @@
*/
package org.apache.avalon.fortress.impl;
-import org.apache.avalon.excalibur.logger.LoggerManager;
import org.apache.avalon.fortress.*;
import org.apache.avalon.fortress.util.ContextManager;
import org.apache.avalon.fortress.util.LifecycleExtensionManager;
@@ -143,8 +142,8 @@
{
try
{
- final LoggerManager loggerManager = (LoggerManager) initParameters.get( LoggerManager.ROLE );
- return loggerManager.getDefaultLogger();
+ final Logger logger = (Logger) initParameters.get( LOGGER );
+ return logger;
}
catch ( ContextException ce )
{
@@ -205,7 +204,8 @@
ContainerUtil.enableLogging( instance, m_logger );
ContainerUtil.contextualize( instance, implContext );
- final ServiceManager serviceManager = createServiceManager( implContext );
+ final ServiceManager serviceManager =
+ (ServiceManager) getContextEntry( managerContext, SERVICE_MANAGER );
ContainerUtil.service( instance, serviceManager );
@@ -230,38 +230,6 @@
}
}
- private ServiceManager createServiceManager( final Context managerContext )
- {
- final ServiceManager smanager =
- (ServiceManager) getContextEntry( managerContext, SERVICE_MANAGER );
- final DefaultServiceManager serviceManager = new DefaultServiceManager( smanager );
-
- addService( Queue.ROLE, managerContext, serviceManager );
- addService( LoggerManager.ROLE, managerContext, serviceManager );
- addService( PoolManager.ROLE, managerContext, serviceManager );
- addService( InstrumentManager.ROLE, managerContext, serviceManager );
- addService( MetaInfoManager.ROLE, managerContext, serviceManager );
- addService( RoleManager.ROLE, managerContext, serviceManager );
- addService( LifecycleExtensionManager.ROLE, managerContext, serviceManager );
- serviceManager.makeReadOnly();
-
- return serviceManager;
- }
-
- private void addService( final String role,
- final Context context,
- final DefaultServiceManager serviceManager )
- {
- try
- {
- final Object object = context.get( role );
- serviceManager.put( role, object );
- }
- catch ( ContextException e )
- {
- }
- }
-
/**
* Retrieve an entry from context if it exists, else return null.
*
diff -ru avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java
--- avalon-excalibur.0/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 10:20:26.000000000 +0400
+++ avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java 2003-05-28 14:54:54.000000000 +0400
@@ -74,7 +74,6 @@
import org.apache.avalon.framework.service.DefaultServiceSelector;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.excalibur.event.Queue;
-import org.apache.excalibur.event.Sink;
import org.apache.excalibur.event.command.CommandManager;
import org.apache.excalibur.event.command.TPCThreadManager;
import org.apache.excalibur.event.command.ThreadManager;
@@ -103,20 +102,16 @@
* get an instance of the Context, it is made read-only and returned. No
* further operations will be possible on it.</p>
*
- * <p>You can get two different contexts from the ContextManager: the child
- * context and the impl manager context. The former contains all
- * managers, such as the pool manager etc. necessary for a child impl to
- * create additional child containers. The impl manager context contains
- * all of the child context, but also initialization parameters for the
- * impl, such as a Configuration object, a ComponentLocator, etc., that
- * the impl wants, but does not want to pass on to its children.</p>
+ * <p>You can get two different contexts from the ContextManager:
+ * the container context (m_childContext)
+ * and the container manager context (m_contaimerManagerContext).
*
- * <p>You would typically use the impl manager context to initialize
- * the impl manager, and let it pass the child context on to the
- * impl.</p>
+ * <p>The container manager context is used to provide the container manager
+ * with all the data needed to initialize the container.</p>
+ * <p>The container context is passed directly to the container.</p>
*
- * <p>The ContextManager will sometimes create new components, such as a
- * component manager, a pool manager, etc. It will manage these components
+ * <p>The ContextManager will sometimes create new components, such as
+ * a service manager, a pool manager, etc. It will manage these components
* and dispose of them properly when it itself is disposed .</p>
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
@@ -139,21 +134,21 @@
/**
* The root context.
*/
- private final Context m_rootContext;
+ protected final Context m_rootContext;
/**
* The context of the new impl. This context has the rootContext
* as its parent. Put everything here that you want the new impl
* to have in its own context.
*/
- private final DefaultContext m_childContext;
+ protected final DefaultContext m_childContext;
/**
* Container manager's context. This context has the child context
* as parent. Put things here that you want the impl manager
* to see, but do not wish to expose to the impl.
*/
- private final DefaultContext m_containerManagerContext;
+ protected final DefaultContext m_containerManagerContext;
/**
* New context passed in, maybe from a FortressConfig.
@@ -161,9 +156,45 @@
* other pointers. The ContextManager inspects it for
* elements it can use to create component managers etc.
*/
- private Logger m_logger;
- private final Logger m_primordialLogger;
- private ServiceManager m_manager;
+ protected Logger m_logger;
+ protected final Logger m_primordialLogger;
+
+ /**
+ * Source resolver used to read-in the configurations.
+ * and provided as a default source resolver if the
+ * user has not supplied a ServiceManager.
+ */
+ protected SourceResolver m_defaultSourceResolver;
+
+ /**
+ * The logger manager in use.
+ * Either supplied via rootContext, or created locally.
+ */
+ protected LoggerManager m_loggerManager;
+
+ /**
+ * The Queue in use.
+ * Either supplied via rootContext or created locally.
+ */
+ protected Queue m_queue;
+
+ /**
+ * The MetaInfoManager to be used by the container.
+ * Either supplied via rootContext or created locally.
+ */
+ protected MetaInfoManager m_metaInfoManager;
+
+ /**
+ * The PoolManager to be used by the container.
+ * Either supplied via rootContext or created locally.
+ */
+ protected PoolManager m_poolManager;
+
+ /**
+ * The InstrumentManager to be used by the container.
+ * Either supplied via rootContext or created locally.
+ */
+ protected InstrumentManager m_instrumentManager;
/**
* The components that are "owned" by this context and should
@@ -219,7 +250,7 @@
*
* @throws IllegalArgumentException if the object is null.
*/
- private void assumeOwnership( final Object object )
+ protected void assumeOwnership( final Object object )
{
if ( object == null )
{
@@ -237,7 +268,7 @@
*/
public void initialize() throws Exception
{
- initializeServiceManager();
+ initializeDefaultSourceResolver();
initializeLoggerManager();
initializeMetaInfoManager();
initializeCommandQueue();
@@ -245,9 +276,12 @@
initializeContext();
initializeInstrumentManager();
initializeConfiguration();
+ initializeServiceManager();
m_childContext.makeReadOnly();
m_containerManagerContext.makeReadOnly();
+
+ m_defaultSourceResolver = null;
}
/**
@@ -295,6 +329,22 @@
getLogger().debug( "Could not copy Context parameters. This may be Ok depending on "
+ "other configured context values." );
}
+
+ // hide from the container implementation what it does not need
+ m_childContext.put( CONFIGURATION, null );
+ m_childContext.put( CONFIGURATION_URI, null );
+ m_childContext.put( RoleManager.ROLE, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION, null );
+ m_childContext.put( ROLE_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( LoggerManager.ROLE, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION, null );
+ m_childContext.put( LOGGER_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( InstrumentManager.ROLE, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION, null );
+ m_childContext.put( INSTRUMENT_MANAGER_CONFIGURATION_URI, null );
+ m_childContext.put( Queue.ROLE, null );
+ m_childContext.put( MetaInfoManager.ROLE, null );
+ m_childContext.put( PoolManager.ROLE, null );
}
/**
@@ -392,15 +442,13 @@
{
try
{
- m_rootContext.get( Queue.ROLE );
- return;
+ m_queue = (Queue) m_rootContext.get( Queue.ROLE );
}
catch ( ContextException ce )
{
+ // No CommandQueue specified, create a default one
+ m_queue = createCommandQueue();
}
-
- // No CommandQueue specified, create a default one
- m_childContext.put( Queue.ROLE, createCommandSink() );
}
/**
@@ -409,7 +457,7 @@
* @return a default <code>CommandQueue</code>
* @throws Exception if an error occurs
*/
- private Sink createCommandSink() throws Exception
+ private Queue createCommandQueue() throws Exception
{
final CommandManager cm = new CommandManager();
final ThreadManager tm = new TPCThreadManager();
@@ -417,11 +465,8 @@
assumeOwnership( cm );
assumeOwnership( tm );
- // Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
-
// Get the logger for the thread manager
- final Logger tmLogger = loggerManager.getLoggerForCategory( "system.threadmgr" );
+ final Logger tmLogger = m_loggerManager.getLoggerForCategory( "system.threadmgr" );
ContainerUtil.enableLogging( tm, tmLogger );
ContainerUtil.parameterize( tm, buildCommandQueueConfig() );
@@ -429,7 +474,7 @@
tm.register( cm );
- return cm.getCommandSink();
+ return cm.getCommandQueue();
}
/**
@@ -487,16 +532,14 @@
{
try
{
- m_rootContext.get( PoolManager.ROLE );
- return;
+ m_poolManager = (PoolManager) m_rootContext.get( PoolManager.ROLE );
}
catch ( ContextException ce )
{
+ final PoolManager pm = new DefaultPoolManager( m_queue );
+ assumeOwnership( pm );
+ m_poolManager = pm;
}
-
- final PoolManager pm = new DefaultPoolManager( (Sink) m_childContext.get( Queue.ROLE ) );
- assumeOwnership( pm );
- m_childContext.put( PoolManager.ROLE, pm );
}
/**
@@ -534,14 +577,11 @@
return null;
}
- // Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
-
// Lookup the context class loader
final ClassLoader classLoader = (ClassLoader) m_rootContext.get( ClassLoader.class.getName() );
// Create a logger for the role manager
- final Logger rmLogger = loggerManager.getLoggerForCategory(
+ final Logger rmLogger = m_loggerManager.getLoggerForCategory(
roleConfig.getAttribute( "logger", "system.roles" ) );
// Create a parent role manager with all the default roles
@@ -560,7 +600,17 @@
protected void initializeMetaInfoManager() throws Exception
{
- final boolean mmSupplied = entryPresent( m_rootContext, MetaInfoManager.ROLE );
+ boolean mmSupplied = false;
+ try
+ {
+ m_metaInfoManager = (MetaInfoManager) m_rootContext.get( MetaInfoManager.ROLE );
+ mmSupplied = true;
+ }
+ catch( ContextException ce )
+ {
+ // okay, we will create one
+ }
+
RoleManager roleManager = obtainRoleManager();
final boolean rmSupplied = roleManager != null;
@@ -575,13 +625,12 @@
}
else
{
- final LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE );
final ClassLoader classLoader = (ClassLoader)m_rootContext.get( ClassLoader.class.getName() );
if ( ! rmSupplied )
{
final FortressRoleManager newRoleManager = new FortressRoleManager( null, classLoader );
- newRoleManager.enableLogging(loggerManager.getLoggerForCategory("system.roles"));
+ newRoleManager.enableLogging(m_loggerManager.getLoggerForCategory("system.roles"));
newRoleManager.initialize();
roleManager = newRoleManager;
@@ -589,24 +638,19 @@
final ServiceMetaManager metaManager = new ServiceMetaManager( new Role2MetaInfoManager( roleManager ), classLoader );
- metaManager.enableLogging( loggerManager.getLoggerForCategory("system.meta") );
+ metaManager.enableLogging( m_loggerManager.getLoggerForCategory("system.meta") );
metaManager.initialize();
assumeOwnership( metaManager );
- m_childContext.put( MetaInfoManager.ROLE, metaManager );
+ m_metaInfoManager = metaManager;
}
}
/**
- * Get a reference to the initial ComponentLocator used by the
- * ContainerManager to hold the Components used for parsing the config
- * files and setting up the environment.
- *
- * @throws Exception when there is an error.
+ * Initialize the default SrouceResolver.
*/
- protected void initializeServiceManager() throws Exception
+ protected void initializeDefaultSourceResolver() throws Exception
{
- final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
- final DefaultServiceManager manager = new DefaultServiceManager( parent );
+ final DefaultServiceManager manager = new DefaultServiceManager();
final DefaultServiceSelector selector = new DefaultServiceSelector();
final URLSourceFactory file = new URLSourceFactory();
file.enableLogging( getLogger() );
@@ -623,15 +667,41 @@
ContainerUtil.service( resolver, manager );
ContainerUtil.parameterize( resolver, new Parameters() );
- manager.put( SourceResolver.ROLE, resolver );
-
- manager.makeReadOnly();
-
- assumeOwnership( manager );
+ m_defaultSourceResolver = resolver;
+ }
+ /**
+ * Get a reference to the initial ComponentLocator used by the
+ * ContainerManager to hold the Components used for parsing the config
+ * files and setting up the environment.
+ *
+ * @throws Exception when there is an error.
+ */
+ protected void initializeServiceManager() throws Exception
+ {
+ final ServiceManager parent = (ServiceManager) get( m_rootContext, SERVICE_MANAGER, null );
+ final DefaultServiceManager manager = new DefaultServiceManager( parent );
- m_manager = manager;
+ /**
+ * We assume that if there is a parent ServiceManager provided,
+ * there is a SourceResolver mounted there. And if there
+ * is none, then it is the true caller's intetion.
+ * However it is hard to imagine how that could be usefull
+ * except for testing purposes.
+ */
+ if ( parent == null )
+ {
+ manager.put( SourceResolver.ROLE, m_defaultSourceResolver );
+ }
+
+ manager.put( LoggerManager.ROLE, m_loggerManager );
+ manager.put( Queue.ROLE, m_queue );
+ manager.put( MetaInfoManager.ROLE, m_metaInfoManager );
+ manager.put( PoolManager.ROLE, m_poolManager );
+ manager.put( InstrumentManager.ROLE, m_instrumentManager );
- m_childContext.put( ContextManagerConstants.SERVICE_MANAGER, m_manager );
+ manager.makeReadOnly();
+
+ m_containerManagerContext.put( SERVICE_MANAGER, manager );
}
/**
@@ -668,8 +738,7 @@
Source src = null;
try
{
- resolver = (SourceResolver) m_manager.lookup( SourceResolver.ROLE );
- src = resolver.resolveURI( configUri );
+ src = m_defaultSourceResolver.resolveURI( configUri );
if ( configBuilder == null )
{
configBuilder = new DefaultConfigurationBuilder();
@@ -685,12 +754,7 @@
}
finally
{
- if ( null != resolver )
- {
- resolver.release( src );
- }
-
- m_manager.release( resolver );
+ m_defaultSourceResolver.release( src );
}
}
@@ -747,7 +811,7 @@
{
// Try copying an already existing logger manager from the override context.
- m_childContext.put( LoggerManager.ROLE, m_rootContext.get( LoggerManager.ROLE ) );
+ m_loggerManager = (LoggerManager) m_rootContext.get( LoggerManager.ROLE );
}
catch ( ContextException ce )
{
@@ -788,7 +852,7 @@
assumeOwnership( logManager );
- m_childContext.put( LoggerManager.ROLE, logManager );
+ m_loggerManager = logManager;
}
// Since we now have a LoggerManager, we can update the this.logger field
@@ -798,9 +862,11 @@
{
getLogger().debug( "Switching to default Logger provided by LoggerManager." );
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
- m_logger = loggerManager.getDefaultLogger();
+ m_logger = m_loggerManager.getDefaultLogger();
}
+
+ // pass our own logger to the ContainerManager
+ m_containerManagerContext.put( LOGGER, m_logger );
}
/**
@@ -819,7 +885,7 @@
{
// Try copying an already existing instrument manager from the override context.
- m_rootContext.get( InstrumentManager.ROLE );
+ m_instrumentManager = (InstrumentManager) m_rootContext.get( InstrumentManager.ROLE );
}
catch ( ContextException ce )
{
@@ -832,11 +898,8 @@
instrumentConfig = EMPTY_CONFIG;
}
- // Get the context Logger Manager
- final LoggerManager loggerManager = (LoggerManager) m_childContext.get( LoggerManager.ROLE );
-
// Get the logger for the instrument manager
- final Logger imLogger = loggerManager.getLoggerForCategory(
+ final Logger imLogger = m_loggerManager.getLoggerForCategory(
instrumentConfig.getAttribute( "logger", "system.instrument" ) );
// Set up the Instrument Manager
@@ -847,7 +910,7 @@
assumeOwnership( instrumentManager );
- m_childContext.put( InstrumentManager.ROLE, instrumentManager );
+ m_instrumentManager = instrumentManager;
}
}
diff -ru avalon-excalibur.0/fortress/src/test/org/apache/avalon/fortress/util/test/ContextManagerTestCase.java avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/ContextManagerTestCase.java
--- avalon-excalibur.0/fortress/src/test/org/apache/avalon/fortress/util/test/ContextManagerTestCase.java 2003-05-15 18:19:56.000000000 +0400
+++ avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/ContextManagerTestCase.java 2003-05-28 14:47:38.000000000 +0400
@@ -50,10 +50,13 @@
package org.apache.avalon.fortress.util.test;
import junit.framework.TestCase;
+import org.apache.avalon.fortress.ContainerManagerConstants;
import org.apache.avalon.fortress.util.ContextManager;
import org.apache.avalon.fortress.util.FortressConfig;
import org.apache.avalon.framework.logger.NullLogger;
import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.service.ServiceManager;
import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
import org.apache.excalibur.instrument.InstrumentManager;
@@ -63,7 +66,7 @@
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
-public class ContextManagerTestCase extends TestCase
+public class ContextManagerTestCase extends TestCase implements ContainerManagerConstants
{
private ContextManager m_manager;
private InstrumentManager m_instrManager;
@@ -91,9 +94,14 @@
public void testContextManager() throws Exception
{
assertNotNull( m_manager.getChildContext() );
- assertNotNull( m_manager.getContainerManagerContext() );
- assertNotNull( m_manager.getContainerManagerContext().get(InstrumentManager.ROLE));
- assertSame( m_instrManager, m_manager.getContainerManagerContext().get( InstrumentManager.ROLE ) );
+ final Context managerContext = m_manager.getContainerManagerContext();
+ assertNotNull( managerContext );
+ final ServiceManager serviceManager = (ServiceManager) managerContext.get(SERVICE_MANAGER);
+ assertNotNull( serviceManager );
+ final InstrumentManager instrumentManager =
+ (InstrumentManager) serviceManager.lookup( InstrumentManager.ROLE );
+ assertNotNull( instrumentManager);
+ assertSame( m_instrManager, instrumentManager );
}
public void tearDown()
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org