Hello Shash!
SC> The problem is that the create(...) method of my extension needs a
SC> ServiceManager. In the old way, by the time Container.initialize() was
SC> called, the service amanger had been setup/configured already, and all
SC> we had to do was:
SC> if (creator instanceof Serviceable) {
SC> creator.service(m_serviceManager);
SC> }
SC> This is no longer possible.
errr.. what has happened? Why isn't this possible?
SC> Any ideas/suggestions on how best to provide
SC> the extension with a ServiceManager?
My idea is that it would be best to
move m_extManager.makeReadOnly()
from
AbstractContainer.setupExtensionManager()
to the top of
AbstractContainer.initialize()
(this change is in one of my pending patches)
Then it will be possible to do
initialize()
{
m_extManager.addCreatorExtension( new Foo( m_serviceManager ) );
super.initialize();
}
Unitll that is done (untill makeReadOnly() is moved) the closest
to the ideal that I can think of (yes, it's a temporary dirty
workaround) is override
AbstractContainer.setupExtensionManager( ServiceManager )
copy all the existing code from the original and add your
extensions there.
SC> can ContextManager have "final" taken out
[from ContextManager]
BL> I have both made ContextManager not final
Great :-))
SC> In looking at this further, can the following line be put at the bottom
SC> of ContextManager.initializeServiceManager():
SC> m_childContext.put( SERVICE_MANAGER, manager );
BL> and added that line to initializeServiceManager.
A little bit afraid to protest :-), but ..
this way we'll get not the ServiceManager that drives the
container, but only the DefaultServiceManager created by
ContextManager, a bootstrap ServiceManager I would call it.
It's probably going to have only LoggerManager, Sink, PoolManager,
InastrumentManager, parent LifecycleExtensionManager and
the default source resolver installed in it.
Berin, do you think we could remove the bootstrap service manager
from m_childContext and instead do this?
--- AbstractContainer.orig 2003-06-04 09:27:24.000000000 +0400
+++ AbstractContainer.java 2003-06-04 12:28:13.000000000 +0400
@@ -295,8 +295,7 @@
*/
m_extManager.addCreatorExtension( new InstrumentableCreator(
m_instrumentManager ) );
- // just to be on the safe side
- m_extManager.makeReadOnly();
+ // m_extManager will be made readonly in initialize()
}
/**
@@ -615,6 +614,9 @@
public void initialize()
throws CompositeException, Exception
{
+ // just to be on the safe side
+ m_extManager.makeReadOnly();
+
// go over all components
final Iterator i = m_components.iterator();
final BoundedFifoBuffer buffer = new BoundedFifoBuffer( Math.max(
m_components.size(), 1 ) );
WBR, Anton
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]