You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by hl...@apache.org on 2004/05/17 23:14:23 UTC
cvs commit: jakarta-hivemind/xdocs services.xml
hlship 2004/05/17 14:14:23
Modified: framework/src/java/org/apache/hivemind
HiveMindMessages.properties PoolManageable.java
framework/src/java/org/apache/hivemind/methodmatch
MethodMatcher.java
framework/src/java/org/apache/hivemind/impl
RegistryBuilder.java ProxyUtils.java
ConfigurationPointImpl.java
ConstructableServiceExtensionPoint.java
ElementsProxyList.java
ServiceExtensionPointImpl.java RegistryImpl.java
framework/xdocs navigation.xml BuilderFactory.xml
framework/src/test/hivemind/test/services TestShutdown.java
TestServices.java TestBuilderFactory.java
Shutdown.xml
framework/src/test/hivemind/test/services/impl
RegistryShutdownStringHolderImpl.java
RunnableImpl.java
framework/src/java/org/apache/hivemind/impl/servicemodel
PrimitiveServiceModel.java
SingletonServiceModel.java
AbstractServiceModelImpl.java
PooledServiceModel.java ThreadedServiceModel.java
framework/src/test/hivemind/test/util
TestShutdownCoordinator.java
framework/src/java/org/apache/hivemind/service/impl
DefaultsSymbolSource.java BuilderFactory.java
BuilderParameter.java
framework/src/descriptor/META-INF hivemodule.sdl
xdocs services.xml
Added: framework/src/java/org/apache/hivemind
ShutdownCoordinator.java
framework/src/java/org/apache/hivemind/impl
ShutdownCoordinatorImpl.java
framework/xdocs ShutdownCoordinator.xml
framework/src/test/hivemind/test/services
InitializeMethodFailure.sdl
framework/src/test/hivemind/test/services/impl
MockRunnable.java
framework/src/java/org/apache/hivemind/service
ServiceMessages.java
framework/src/java/org/apache/hivemind/events
RegistryShutdownListener.java
Removed: framework/src/java/org/apache/hivemind Initializable.java
RegistryShutdownListener.java
framework/src/java/org/apache/hivemind/impl
ShutdownCoordinator.java
framework/src/test/hivemind/test/services
CheckInitializeService.java Initialize.xml
framework/src/test/hivemind/test/services/impl
CheckInitializeServiceImpl.java
Log:
Split ShutdownCoordinator into an interface and an implementation.
Remove Initializable interface.
Extend BuilderFactory to support an initialize-method attribute.
Move RegistryShutdownListener interface into the org.apache.hivemind.events package.
Revision Changes Path
1.12 +3 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.properties
Index: HiveMindMessages.properties
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.properties,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- HiveMindMessages.properties 17 May 2004 19:44:09 -0000 1.11
+++ HiveMindMessages.properties 17 May 2004 21:14:21 -0000 1.12
@@ -178,6 +178,8 @@
# service.impl package
+service.unable-to-initialize-service=Unable to initialize service {0} (by invoking method {1} on {2}, at {3}): {4}
+
RemoteExceptionCoordinator.method-while-locked=RemoteExceptionCoordinator method {0} was invoked during a notification.
NameLookup.unable-to-lookup=Unable to lookup ''{0}'' in JNDI context {1}.
1.2 +14 -15 jakarta-hivemind/framework/src/java/org/apache/hivemind/PoolManageable.java
Index: PoolManageable.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/PoolManageable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PoolManageable.java 26 Feb 2004 23:07:56 -0000 1.1
+++ PoolManageable.java 17 May 2004 21:14:22 -0000 1.2
@@ -24,18 +24,17 @@
public interface PoolManageable
{
- /**
- * Invoked just after a service is either created, or just after it is removed
- * from the service pool and bound to a new thread. This will also be invoked
- * after {@link Initializable#initializeService()}.
- */
- public void activateService();
-
- /**
- * Invoked when a service is unbound from a thread, just before being returned to
- * the service pool. It is <em>not</em> guaranteed that this will be invoked
- * when the Registry is shutdown.
- */
-
- public void passivateService();
+ /**
+ * Invoked just after a service is either created, or just after it is removed
+ * from the service pool and bound to a new thread.
+ */
+ public void activateService();
+
+ /**
+ * Invoked when a service is unbound from a thread, just before being returned to
+ * the service pool. It is <em>not</em> guaranteed that this will be invoked
+ * when the Registry is shutdown.
+ */
+
+ public void passivateService();
}
1.1 jakarta-hivemind/framework/src/java/org/apache/hivemind/ShutdownCoordinator.java
Index: ShutdownCoordinator.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind;
import org.apache.hivemind.events.RegistryShutdownListener;
/**
* The coordinator is used by other services to determine when the registry was shutdown.
*
* @author Howard Lewis Ship
* @version $Id: ShutdownCoordinator.java,v 1.1 2004/05/17 21:14:22 hlship Exp $
*/
public interface ShutdownCoordinator
{
public abstract void addRegistryShutdownListener(RegistryShutdownListener s);
public abstract void removeRegistryShutdownListener(RegistryShutdownListener s);
public abstract void shutdown();
}
1.2 +2 -2 jakarta-hivemind/framework/src/java/org/apache/hivemind/methodmatch/MethodMatcher.java
Index: MethodMatcher.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/methodmatch/MethodMatcher.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MethodMatcher.java 17 May 2004 16:57:46 -0000 1.1
+++ MethodMatcher.java 17 May 2004 21:14:22 -0000 1.2
@@ -53,7 +53,7 @@
* <ul>
* <li><code>perform()</code> -- method with no parameters
* <li><code>perform(2)</code> -- method with two parameters
- * <li><code>perform(java.util.List, int) - method taking a List and an int parameter
+ * <li><code>perform(java.util.List, int)</code> - method taking a List and an int parameter
* </ul>
*
* @author Howard Lewis Ship
1.7 +3 -2 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
Index: RegistryBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RegistryBuilder.java 13 May 2004 11:04:42 -0000 1.6
+++ RegistryBuilder.java 17 May 2004 21:14:22 -0000 1.7
@@ -27,6 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.*;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.HiveMind;
@@ -147,7 +148,7 @@
* Shutdown coordinator shared by all objects.
*/
- private ShutdownCoordinator _shutdownCoordinator = new ShutdownCoordinator();
+ private ShutdownCoordinator _shutdownCoordinator = new ShutdownCoordinatorImpl();
/**
* RegistryAssembly used by the module descriptor parser(s).
1.4 +3 -2 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ProxyUtils.java
Index: ProxyUtils.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ProxyUtils.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProxyUtils.java 13 May 2004 11:04:42 -0000 1.3
+++ ProxyUtils.java 17 May 2004 21:14:22 -0000 1.4
@@ -17,8 +17,9 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
+import org.apache.hivemind.*;
import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
import org.apache.hivemind.internal.ServiceExtensionPoint;
import org.apache.hivemind.internal.ServiceModel;
import org.apache.hivemind.service.BodyBuilder;
1.3 +2 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
Index: ConfigurationPointImpl.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConfigurationPointImpl.java 13 May 2004 11:04:42 -0000 1.2
+++ ConfigurationPointImpl.java 17 May 2004 21:14:22 -0000 1.3
@@ -20,6 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.*;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Occurances;
import org.apache.hivemind.internal.ConfigurationPoint;
1.4 +2 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ConstructableServiceExtensionPoint.java
Index: ConstructableServiceExtensionPoint.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ConstructableServiceExtensionPoint.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ConstructableServiceExtensionPoint.java 13 May 2004 11:04:42 -0000 1.3
+++ ConstructableServiceExtensionPoint.java 17 May 2004 21:14:22 -0000 1.4
@@ -16,6 +16,7 @@
import java.util.List;
+import org.apache.hivemind.*;
import org.apache.hivemind.internal.ServiceExtensionPoint;
import org.apache.hivemind.internal.ServiceImplementationConstructor;
1.2 +2 -2 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ElementsProxyList.java
Index: ElementsProxyList.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ElementsProxyList.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElementsProxyList.java 26 Feb 2004 23:07:40 -0000 1.1
+++ ElementsProxyList.java 17 May 2004 21:14:22 -0000 1.2
@@ -18,7 +18,7 @@
import java.util.List;
import org.apache.hivemind.HiveMind;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
/**
* The List implementation visible to the client code. It defers
1.4 +2 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ServiceExtensionPointImpl.java
Index: ServiceExtensionPointImpl.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ServiceExtensionPointImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceExtensionPointImpl.java 13 May 2004 11:04:42 -0000 1.3
+++ ServiceExtensionPointImpl.java 17 May 2004 21:14:22 -0000 1.4
@@ -20,6 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.*;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.HiveMind;
1.5 +12 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
Index: RegistryImpl.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RegistryImpl.java 17 May 2004 19:44:10 -0000 1.4
+++ RegistryImpl.java 17 May 2004 21:14:22 -0000 1.5
@@ -23,6 +23,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.*;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
@@ -360,6 +361,16 @@
*/
public void shutdown()
{
+ // Allow service implementations and such to shutdown.
+
+ ShutdownCoordinator coordinatorService =
+ (ShutdownCoordinator) getService("hivemind.ShutdownCoordinator",
+ ShutdownCoordinator.class);
+
+ coordinatorService.shutdown();
+
+ // Shutdown infrastructure items, such as proxies.
+
_shutdownCoordinator.shutdown();
_modules = null;
1.1 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ShutdownCoordinatorImpl.java
Index: ShutdownCoordinatorImpl.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.impl;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.*;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.events.RegistryShutdownListener;
import org.apache.hivemind.util.EventListenerList;
/**
* Manages a list of objects that implement the
* {@link org.apache.hivemind.RegistryShutdownListener} interface.
*
* @author Howard Lewis Ship
* @version $Id: ShutdownCoordinatorImpl.java,v 1.1 2004/05/17 21:14:22 hlship Exp $
*/
public final class ShutdownCoordinatorImpl implements ShutdownCoordinator
{
private final Log _log;
public ShutdownCoordinatorImpl()
{
this(LogFactory.getLog(ShutdownCoordinatorImpl.class));
}
public ShutdownCoordinatorImpl(Log log)
{
_log = log;
}
private EventListenerList _listenerList;
public synchronized void addRegistryShutdownListener(RegistryShutdownListener s)
{
if (_listenerList == null)
_listenerList = new EventListenerList();
_listenerList.addListener(s);
}
public synchronized void removeRegistryShutdownListener(RegistryShutdownListener s)
{
if (_listenerList != null)
_listenerList.removeListener(s);
}
public void shutdown()
{
if (_listenerList == null)
return;
Iterator i = _listenerList.getListeners();
_listenerList = null;
while (i.hasNext())
{
RegistryShutdownListener s = (RegistryShutdownListener) i.next();
shutdown(s);
}
_listenerList = null;
}
private void shutdown(RegistryShutdownListener s)
{
try
{
s.registryDidShutdown();
}
catch (RuntimeException ex)
{
_log.error(HiveMind.format("ShutdownCoordinator.failure", s, ex.getMessage()), ex);
}
}
}
1.9 +2 -1 jakarta-hivemind/framework/xdocs/navigation.xml
Index: navigation.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/xdocs/navigation.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- navigation.xml 17 May 2004 16:57:46 -0000 1.8
+++ navigation.xml 17 May 2004 21:14:22 -0000 1.9
@@ -33,6 +33,7 @@
<item name="BuilderFactory" href="/BuilderFactory.html"/>
<item name="ClassFactory" href="/ClassFactory.html"/>
<item name="LoggingInterceptor" href="/LoggingInterceptor.html"/>
+ <item name="ShutdownCoordinator" href="/ShutdownCoordinator.html"/>
<item name="ThreadEventNotifier" href="/ThreadEventNotifier.html"/>
<item name="ThreadLocalStorage" href="/ThreadLocalStorage.html"/>
</menu>
1.10 +9 -2 jakarta-hivemind/framework/xdocs/BuilderFactory.xml
Index: BuilderFactory.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/xdocs/BuilderFactory.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BuilderFactory.xml 17 May 2004 16:57:46 -0000 1.9
+++ BuilderFactory.xml 17 May 2004 21:14:22 -0000 1.10
@@ -41,7 +41,7 @@
<source>
invoke-factory (service-id=hivemind.BuilderFactory)
{
- construct (class=... log-property=... messages-property=... service-id-property=...)
+ construct (class=... log-property=... messages-property=... service-id-property=... initialize-method=...)
{
log
messages
@@ -80,6 +80,13 @@
</tr>
<tr>
<td>class</td> <td>yes</td> <td>The fully qualified name of the class to instantiate.</td>
+ </tr>
+ <tr>
+ <td>initialize-method</td> <td>no</td>
+ <td>
+ The name of a method (public, no parameters) to invoke after the service is constructed, to allow it
+ to perform any final initializion before being put into use.
+ </td>
</tr>
<tr>
<td>log-property</td>
1.1 jakarta-hivemind/framework/xdocs/ShutdownCoordinator.xml
Index: ShutdownCoordinator.xml
===================================================================
<?xml version="1.0"?>
<!-- $Id: ShutdownCoordinator.xml,v 1.1 2004/05/17 21:14:22 hlship Exp $ -->
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE document [
<!ENTITY projectroot '../'>
<!ENTITY % common-links SYSTEM "../../common/links.xml">
%common-links;
]>
<document>
<properties>
<title>hivemind.ShutdownCoordinator Service</title>
<author email="hlship@apache.org">Howard M. Lewis Ship</author>
</properties>
<body>
<section name="hivemind.ShutdownCoordinator">
<p>
Service implementations that need to perform any special shutdown logic should implement the
<a href="&apiroot;/events/RegistryShutdownListener.html">RegistryShutdownListener</a> interface, and let the
<a href="BuilderFactory.html">BuilderFactory</a> register them for notifications.
</p>
</section>
</body>
</document>
1.6 +4 -2 jakarta-hivemind/framework/src/test/hivemind/test/services/TestShutdown.java
Index: TestShutdown.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestShutdown.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestShutdown.java 13 May 2004 11:04:47 -0000 1.5
+++ TestShutdown.java 17 May 2004 21:14:22 -0000 1.6
@@ -69,9 +69,11 @@
try
{
r.shutdown();
+ unreachable();
}
- catch (NullPointerException ex)
+ catch (ApplicationRuntimeException ex)
{
+ assertExceptionSubstring(ex, "The HiveMind Registry has been shutdown.");
}
}
1.13 +5 -17 jakarta-hivemind/framework/src/test/hivemind/test/services/TestServices.java
Index: TestServices.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestServices.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestServices.java 17 May 2004 16:57:47 -0000 1.12
+++ TestServices.java 17 May 2004 21:14:22 -0000 1.13
@@ -111,18 +111,6 @@
}
- public void testInitialize() throws Exception
- {
- Registry r = buildFrameworkRegistry("Initialize.xml");
-
- CheckInitializeService c =
- (CheckInitializeService) r.getService(
- "hivemind.test.services.CheckInitialize",
- CheckInitializeService.class);
-
- assertEquals(true, c.didInitialize());
- }
-
public void testLogging() throws Exception
{
interceptLogging("hivemind.test.services.Demo");
@@ -161,9 +149,9 @@
}
- /**
- * Test the filters; where we include "no*" but exclude "always*".
- */
+ /**
+ * Test the filters; where we include "no*" but exclude "always*".
+ */
public void testLoggingMethodFilters() throws Exception
{
interceptLogging("hivemind.test.services.Demo");
@@ -291,7 +279,7 @@
{
Registry r = buildFrameworkRegistry("BuilderAccessFailure.xml");
- interceptLogging("hivemind.BuilderFactory");
+ interceptLogging("hivemind.test.services.BuilderAccessFailure");
BuilderAccess s =
(BuilderAccess) r.getService(
1.2 +18 -1 jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java
Index: TestBuilderFactory.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestBuilderFactory.java 29 Feb 2004 20:57:09 -0000 1.1
+++ TestBuilderFactory.java 17 May 2004 21:14:22 -0000 1.2
@@ -34,4 +34,21 @@
assertEquals(99, s.add(1, 1));
}
+
+ public void testInitializeMethodFailure() throws Exception
+ {
+ Registry r = buildFrameworkRegistry("InitializeMethodFailure.sdl");
+
+ Runnable s = (Runnable) r.getService("hivemind.test.services.Runnable", Runnable.class);
+
+ interceptLogging("hivemind.test.services.Runnable");
+
+ s.run();
+
+ assertLoggedMessagePattern(
+ "Unable to initialize service hivemind\\.test\\.services\\.Runnable "
+ + "\\(by invoking method doesNotExist on "
+ + "hivemind\\.test\\.services\\.impl\\.MockRunnable, at .*?\\):");
+
+ }
}
1.4 +4 -2 jakarta-hivemind/framework/src/test/hivemind/test/services/Shutdown.xml
Index: Shutdown.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/Shutdown.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Shutdown.xml 7 Apr 2004 20:03:09 -0000 1.3
+++ Shutdown.xml 17 May 2004 21:14:22 -0000 1.4
@@ -22,6 +22,7 @@
<invoke-factory service-id="hivemind.BuilderFactory" model="primitive">
<construct class="hivemind.test.services.impl.RunnableImpl" log-property="log">
<set property="type" value="Primitive"/>
+ <event-listener service-id="hivemind.ShutdownCoordinator"/>
</construct>
</invoke-factory>
</service-point>
@@ -29,7 +30,8 @@
<service-point id="Singleton" interface="java.lang.Runnable">
<invoke-factory service-id="hivemind.BuilderFactory">
<construct class="hivemind.test.services.impl.RunnableImpl" log-property="log">
- <set property="type" value="Singleton"/>
+ <set property="type" value="Singleton"/>
+ <event-listener service-id="hivemind.ShutdownCoordinator"/>
</construct>
</invoke-factory>
</service-point>
1.1 jakarta-hivemind/framework/src/test/hivemind/test/services/InitializeMethodFailure.sdl
Index: InitializeMethodFailure.sdl
===================================================================
module (id=hivemind.test.services version="1.0.0")
{
service-point (id=Runnable interface=java.lang.Runnable)
{
invoke-factory (service-id=hivemind.BuilderFactory)
{
construct (class=hivemind.test.services.impl.MockRunnable initialize-method=doesNotExist)
}
}
}
1.4 +2 -2 jakarta-hivemind/framework/src/test/hivemind/test/services/impl/RegistryShutdownStringHolderImpl.java
Index: RegistryShutdownStringHolderImpl.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/impl/RegistryShutdownStringHolderImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RegistryShutdownStringHolderImpl.java 26 Feb 2004 23:07:35 -0000 1.3
+++ RegistryShutdownStringHolderImpl.java 17 May 2004 21:14:22 -0000 1.4
@@ -16,7 +16,7 @@
import hivemind.test.services.TestThreadedModel;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
/**
* Used to check that the threaded model does <em>not</em>
1.5 +2 -2 jakarta-hivemind/framework/src/test/hivemind/test/services/impl/RunnableImpl.java
Index: RunnableImpl.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/impl/RunnableImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RunnableImpl.java 26 Feb 2004 23:07:35 -0000 1.4
+++ RunnableImpl.java 17 May 2004 21:14:22 -0000 1.5
@@ -15,7 +15,7 @@
package hivemind.test.services.impl;
import org.apache.commons.logging.Log;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
/**
1.1 jakarta-hivemind/framework/src/test/hivemind/test/services/impl/MockRunnable.java
Index: MockRunnable.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hivemind.test.services.impl;
/**
* Used by {@link hivemind.test.services.TestBuilderFactory}.
*
* @author Howard Lewis Ship
* @version $Id: MockRunnable.java,v 1.1 2004/05/17 21:14:22 hlship Exp $
*/
public class MockRunnable implements Runnable
{
public void run()
{
}
}
1.2 +1 -14 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PrimitiveServiceModel.java
Index: PrimitiveServiceModel.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PrimitiveServiceModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PrimitiveServiceModel.java 13 May 2004 11:04:45 -0000 1.1
+++ PrimitiveServiceModel.java 17 May 2004 21:14:22 -0000 1.2
@@ -43,17 +43,4 @@
return _constructedService;
}
-
- /**
- * Overrides the super implementation to see if the
- * core service implementation implements
- * {@link org.apache.hivemind.RegistryShutdownListener}.
- */
- protected void initializeCoreServiceImplementation(Object core)
- {
- super.initializeCoreServiceImplementation(core);
-
- registerForShutdownNotification(core);
- }
-
}
1.2 +2 -14 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/SingletonServiceModel.java
Index: SingletonServiceModel.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/SingletonServiceModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SingletonServiceModel.java 13 May 2004 11:04:45 -0000 1.1
+++ SingletonServiceModel.java 17 May 2004 21:14:22 -0000 1.2
@@ -18,7 +18,7 @@
import java.lang.reflect.Modifier;
import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
import org.apache.hivemind.impl.ConstructableServiceExtensionPoint;
import org.apache.hivemind.impl.ProxyBuilder;
import org.apache.hivemind.internal.ServiceExtensionPoint;
@@ -68,18 +68,6 @@
_constructedService = constructServiceImplementation();
return _constructedService;
- }
-
- /**
- * Overrides the super implementation to see if the
- * core service implementation implements {@link RegistryShutdownListener}.
- */
-
- protected void initializeCoreServiceImplementation(Object core)
- {
- super.initializeCoreServiceImplementation(core);
-
- registerForShutdownNotification(core);
}
/**
1.2 +3 -20 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
Index: AbstractServiceModelImpl.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractServiceModelImpl.java 13 May 2004 11:04:45 -0000 1.1
+++ AbstractServiceModelImpl.java 17 May 2004 21:14:22 -0000 1.2
@@ -20,8 +20,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.HiveMind;
-import org.apache.hivemind.Initializable;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
import org.apache.hivemind.impl.ConstructableServiceExtensionPoint;
import org.apache.hivemind.impl.ImplMessages;
import org.apache.hivemind.impl.InterceptorStackImpl;
@@ -121,25 +120,11 @@
}
/**
- * Invoked after the service has been constructed to utilize
- * the {@link Initializable} call back interface, if the
- * core implementation implements it.
- */
- protected void initializeCoreServiceImplementation(Object core)
- {
- if (core instanceof Initializable)
- {
- Initializable initializeCore = (Initializable) core;
- initializeCore.initializeService();
- }
- }
-
- /**
* Registers a core service implemntation with
* the {@link ShutdownCoordinator} if it implements
* {@link RegistryShutdownListener}.
*/
- protected void registerForShutdownNotification(Object core)
+ protected void l(Object core)
{
if (core instanceof RegistryShutdownListener)
_servicePoint.getShutdownCoordinator().addRegistryShutdownListener(
@@ -178,8 +163,6 @@
Object core = constructCoreServiceImplementation();
Object intercepted = addInterceptors(core);
-
- initializeCoreServiceImplementation(core);
return intercepted;
}
1.2 +1 -5 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PooledServiceModel.java
Index: PooledServiceModel.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PooledServiceModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PooledServiceModel.java 13 May 2004 11:04:45 -0000 1.1
+++ PooledServiceModel.java 17 May 2004 21:14:22 -0000 1.2
@@ -190,10 +190,6 @@
Object core = constructCoreServiceImplementation();
Object intercepted = addInterceptors(core);
- initializeCoreServiceImplementation(core);
-
- registerForShutdownNotification(core);
-
return new PooledService(intercepted, core);
}
catch (Exception ex)
1.2 +2 -4 jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/ThreadedServiceModel.java
Index: ThreadedServiceModel.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/ThreadedServiceModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ThreadedServiceModel.java 13 May 2004 11:04:45 -0000 1.1
+++ ThreadedServiceModel.java 17 May 2004 21:14:22 -0000 1.2
@@ -18,7 +18,7 @@
import org.apache.hivemind.Discardable;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Registry;
-import org.apache.hivemind.RegistryShutdownListener;
+import org.apache.hivemind.events.RegistryShutdownListener;
import org.apache.hivemind.impl.ConstructableServiceExtensionPoint;
import org.apache.hivemind.impl.ProxyUtils;
import org.apache.hivemind.service.ThreadCleanupListener;
@@ -144,8 +144,6 @@
{
Object core = constructCoreServiceImplementation();
Object result = addInterceptors(core);
-
- initializeCoreServiceImplementation(core);
if (core instanceof RegistryShutdownListener)
_log.error(
1.4 +26 -6 jakarta-hivemind/framework/src/test/hivemind/test/util/TestShutdownCoordinator.java
Index: TestShutdownCoordinator.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/util/TestShutdownCoordinator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestShutdownCoordinator.java 26 Feb 2004 23:08:04 -0000 1.3
+++ TestShutdownCoordinator.java 17 May 2004 21:14:22 -0000 1.4
@@ -15,8 +15,11 @@
package hivemind.test.util;
import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.hivemind.RegistryShutdownListener;
-import org.apache.hivemind.impl.ShutdownCoordinator;
+import org.apache.hivemind.Registry;
+import org.apache.hivemind.ShutdownCoordinator;
+import org.apache.hivemind.events.RegistryShutdownListener;
+import org.apache.hivemind.impl.RegistryBuilder;
+import org.apache.hivemind.impl.ShutdownCoordinatorImpl;
import hivemind.test.FrameworkTestCase;
@@ -46,7 +49,7 @@
public void testShutdownCoordinator()
{
- ShutdownCoordinator c = new ShutdownCoordinator();
+ ShutdownCoordinator c = new ShutdownCoordinatorImpl();
Fixture f = new Fixture();
@@ -61,9 +64,27 @@
c.shutdown();
}
+ public void testShutdownCoordinatorService()
+ {
+ Registry r = RegistryBuilder.constructDefaultRegistry();
+
+ ShutdownCoordinator c =
+ (ShutdownCoordinator) r.getService(
+ "hivemind.ShutdownCoordinator",
+ ShutdownCoordinator.class);
+
+ Fixture f = new Fixture();
+
+ c.addRegistryShutdownListener(f);
+
+ c.shutdown();
+
+ assertEquals(true, f.isShutdown());
+ }
+
public void testShutdownFailure() throws Exception
{
- ShutdownCoordinator c = new ShutdownCoordinator();
+ ShutdownCoordinator c = new ShutdownCoordinatorImpl();
c.addRegistryShutdownListener(new RegistryShutdownListener()
{
@@ -78,7 +99,6 @@
c.shutdown();
assertLoggedMessagePattern("Unable to shutdown .*: I'm just not in the mood\\.");
-
}
}
1.1 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/ServiceMessages.java
Index: ServiceMessages.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.service;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
/**
* Messages for the service and service.impl packages.
*
* @author Howard Lewis Ship
* @version $Id: ServiceMessages.java,v 1.1 2004/05/17 21:14:22 hlship Exp $
*/
public class ServiceMessages
{
public static String unableToInitializeService(
String serviceId,
String methodName,
Class serviceClass,
Location location,
Throwable ex)
{
return HiveMind.format(
"service.unable-to-initialize-service",
new Object[] {
serviceId,
methodName,
serviceClass.getName(),
location,
ex.getMessage()});
}
}
1.2 +2 -3 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/DefaultsSymbolSource.java
Index: DefaultsSymbolSource.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/DefaultsSymbolSource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultsSymbolSource.java 26 Feb 2004 23:07:45 -0000 1.1
+++ DefaultsSymbolSource.java 17 May 2004 21:14:22 -0000 1.2
@@ -20,7 +20,6 @@
import org.apache.commons.logging.Log;
import org.apache.hivemind.HiveMind;
-import org.apache.hivemind.Initializable;
import org.apache.hivemind.Location;
import org.apache.hivemind.SymbolSource;
import org.apache.hivemind.impl.BaseLocatable;
@@ -32,7 +31,7 @@
* @author Howard Lewis Ship
* @version $Id$
*/
-public class DefaultsSymbolSource extends BaseLocatable implements SymbolSource, Initializable
+public class DefaultsSymbolSource extends BaseLocatable implements SymbolSource
{
private Log _log;
private List _defaults;
1.5 +42 -14 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java
Index: BuilderFactory.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BuilderFactory.java 13 May 2004 11:04:46 -0000 1.4
+++ BuilderFactory.java 17 May 2004 21:14:22 -0000 1.5
@@ -14,15 +14,18 @@
package org.apache.hivemind.service.impl;
+import java.lang.reflect.Method;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.ServiceImplementationFactory;
import org.apache.hivemind.internal.Module;
import org.apache.hivemind.service.EventLinker;
+import org.apache.hivemind.service.ServiceMessages;
import org.apache.hivemind.util.ConstructorUtils;
import org.apache.hivemind.util.PropertyUtils;
@@ -31,14 +34,6 @@
* that can instantiate an object and then configure its properties.
*
* <p>
- * This service exists to allow a service to be fully configured without
- * the implementation having to implement {@link org.apache.hivemind.Initializable},
- * which allows for a more IoC (Inversion of Control) feel. A service
- * implements <code>Initializable</code> typically to access
- * its module's messages, or its own extension point id, but BuilderFactory
- * is capable of providing the service with this information.
- *
- * <p>
* Some thought has been given to using bytecode generation to create properties
* for messages, extension point id, and so forth. This is being avoided because it
* undermines the ability to test service implemenations as POJOs, outside the
@@ -55,8 +50,6 @@
{
private static final String POINT_ID = "hivemind.BuilderFactory";
- private static final Log LOG = LogFactory.getLog(POINT_ID);
-
private EventLinker _eventLinker = new EventLinkerImpl();
public Object createCoreServiceImplementation(
@@ -67,14 +60,18 @@
{
HiveMind.checkFactoryParameterCount(POINT_ID, parameters, 1);
+ Log log = LogFactory.getLog(serviceId);
+
BuilderParameter parameter = (BuilderParameter) parameters.get(0);
Object result = instantiateCoreServiceInstance(serviceId, invokingModule, parameter);
- setProperties(serviceId, invokingModule, parameter, result);
+ setProperties(serviceId, invokingModule, parameter, result, log);
registerForEvents(parameter, result);
+ invokeInitializer(parameter, result, serviceId, log);
+
return result;
}
@@ -100,7 +97,8 @@
String serviceId,
Module invokingModule,
BuilderParameter parameter,
- Object target)
+ Object target,
+ Log log)
{
List properties = parameter.getProperties();
int count = properties.size();
@@ -128,7 +126,7 @@
}
catch (Exception ex)
{
- LOG.error(ex.getMessage());
+ log.error(ex.getMessage());
}
}
}
@@ -171,5 +169,35 @@
}
return result;
+ }
+
+ private void invokeInitializer(
+ BuilderParameter parameters,
+ Object service,
+ String serviceId,
+ Log log)
+ {
+ String methodName = parameters.getInitializeMethod();
+
+ if (HiveMind.isBlank(methodName))
+ return;
+
+ try
+ {
+ Class serviceClass = service.getClass();
+ Method m = serviceClass.getMethod(methodName, null);
+
+ m.invoke(service, null);
+ }
+ catch (Exception ex)
+ {
+ log.error(
+ ServiceMessages.unableToInitializeService(
+ serviceId,
+ methodName,
+ service.getClass(),
+ parameters.getLocation(),
+ ex));
+ }
}
}
1.3 +12 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderParameter.java
Index: BuilderParameter.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderParameter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BuilderParameter.java 28 Feb 2004 00:34:38 -0000 1.2
+++ BuilderParameter.java 17 May 2004 21:14:22 -0000 1.3
@@ -31,6 +31,7 @@
private List _properties = new ArrayList();
private List _parameters = new ArrayList();
private List _events = new ArrayList();
+ private String _initializeMethod;
public String getClassName()
{
@@ -70,6 +71,16 @@
public List getEventRegistrations()
{
return _events;
+ }
+
+ public String getInitializeMethod()
+ {
+ return _initializeMethod;
+ }
+
+ public void setInitializeMethod(String string)
+ {
+ _initializeMethod = string;
}
}
1.1 jakarta-hivemind/framework/src/java/org/apache/hivemind/events/RegistryShutdownListener.java
Index: RegistryShutdownListener.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.events;
import java.util.EventListener;
/**
* Lifecycle interface that may be implemented by objects
* that need to know when the {@link org.apache.hivemind.Registry}
* has shutdown. Typically, this is implemented by core service implementations
* (as well as many proxies created by HiveMind).
*
* <p>
* A core service implementation that implements this interface will
* automatically be registered for notifications (exception: not if the service
* uses the threaded service model).
*
* <p>Using this notification is
* preferrable to implementing a <code>finalize()</code> since it will be invoked
* at a known time.
*
* <p>
* The order in which listeners will be invoked is
* not well known. In the future, some form of dependency system may
* be instituted.
*
*
* @author Howard Lewis Ship
* @version $Id: RegistryShutdownListener.java,v 1.1 2004/05/17 21:14:22 hlship Exp $
*/
public interface RegistryShutdownListener extends EventListener
{
/**
* Invoked when a service is being shutdown, and should release any external resources.
* A service should <em>not</em> attempt to use any resources or configurations, doing
* so may result in a runtime exception.
*/
public void registryDidShutdown();
}
1.5 +36 -12 jakarta-hivemind/framework/src/descriptor/META-INF/hivemodule.sdl
Index: hivemodule.sdl
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/descriptor/META-INF/hivemodule.sdl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- hivemodule.sdl 17 May 2004 19:44:09 -0000 1.4
+++ hivemodule.sdl 17 May 2004 21:14:22 -0000 1.5
@@ -95,35 +95,36 @@
description { <<Extension point for setting "factory defaults" for symbol values.>> }
}
- configuration-point (id=ApplicationDefaults schema-id=Defaults)
- {
- description
- {
- "Extension point for setting application defaults; these defaults will override "
- "factory defaults specified in the FactoryDefaults configuration point."
- }
- }
-
service-point (id=FactoryDefaultsSymbolSource interface=org.apache.hivemind.SymbolSource)
{
description { "SymbolSource implementation driven by the FactoryDefaults configuration point." }
invoke-factory (service-id=BuilderFactory)
{
- construct (class=org.apache.hivemind.service.impl.DefaultsSymbolSource log-property=log)
+ construct (class=org.apache.hivemind.service.impl.DefaultsSymbolSource log-property=log initialize-method=initializeService)
{
set-configuration (configuration-id=FactoryDefaults property=defaults)
+ event-listener (service-id=ShutdownCoordinator)
}
}
}
+ configuration-point (id=ApplicationDefaults schema-id=Defaults)
+ {
+ description
+ {
+ "Extension point for setting application defaults; these defaults will override "
+ "factory defaults specified in the FactoryDefaults configuration point."
+ }
+ }
+
service-point (id=ApplicationDefaultsSymbolSource interface=org.apache.hivemind.SymbolSource)
{
description { "SymbolSource implementation driven by the ApplicationDefaults configuration point." }
invoke-factory (service-id=BuilderFactory)
{
- construct (class=org.apache.hivemind.service.impl.DefaultsSymbolSource log-property=log)
+ construct (class=org.apache.hivemind.service.impl.DefaultsSymbolSource log-property=log initialize-method=initializeService)
{
set-configuration (configuration-id=ApplicationDefaults property=defaults)
}
@@ -239,10 +240,20 @@
description { "The name of a property to assign the configuration point id of the service to." }
}
+ attribute (name=initialize-method)
+ {
+ description
+ {
+ "The name of a public instance method (taking no parameters) to be invoked after "
+ "the service is constructed."
+ }
+ }
+
rules
{
create-object (class=org.apache.hivemind.service.impl.BuilderParameter)
read-attribute (property=className attribute=class)
+ read-attribute (property=initializeMethod attribute=initialize-method)
invoke-parent (method=addElement)
create-object (class=org.apache.hivemind.service.impl.BuilderMessagesFacet)
@@ -642,5 +653,18 @@
translator (name=long class=org.apache.hivemind.schema.rules.LongTranslator)
translator (name=double class=org.apache.hivemind.schema.rules.DoubleTranslator)
translator (name=smart class=org.apache.hivemind.schema.rules.SmartTranslator)
+ }
+
+ service-point (id=ShutdownCoordinator interface=org.apache.hivemind.ShutdownCoordinator)
+ {
+ description { "A source of event notifications for when the Registry is shutdown." }
+
+ invoke-factory (service-id=BuilderFactory)
+ {
+ construct (class=org.apache.hivemind.impl.ShutdownCoordinatorImpl)
+ {
+ log
+ }
+ }
}
}
1.38 +6 -20 jakarta-hivemind/xdocs/services.xml
Index: services.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/xdocs/services.xml,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- services.xml 17 May 2004 16:57:47 -0000 1.37
+++ services.xml 17 May 2004 21:14:23 -0000 1.38
@@ -146,7 +146,7 @@
interface).
The most common example is the
- <a href="jakarta-hivemind/BuilderFactory.html">hivemind.BuilderFactory</a>
+ <a href="hivemind/BuilderFactory.html">hivemind.BuilderFactory</a>
service.
</p>
@@ -178,7 +178,7 @@
<p>
The most common service factory is
- <a href="&hivedoc;/service/hivemind.BuilderFactory.html">hivemind.BuilderFactory</a>.
+ <a href="hivemind/BuilderFactory.html">hivemind.BuilderFactory</a>.
It is used to construct a service and then set properties of the service implementation object.
</p>
@@ -482,14 +482,6 @@
has been created (to perform any final initializations) or when the Registry has been shut down.
</p>
-<p>
-The
- <a href="&apiroot;/Initializable.html">Initializable</a>
- interface may be implemented by the core service implementation.
- The <code>initializeService()</code> method is invoked after the service implementation is fully constructed, including
- any interceptors, and after all properties of the core service instance have been configured
- (including properties which are themselves other services). The interface is optional.
- </p>
<p>
A core service implementation may also implement the
@@ -524,7 +516,7 @@
<p>
It is fairly common that some services will produce events and other services will consume events.
The use of the
- <a href="jakarta-hivemind/BuilderFactory.html">hivemind.BuilderFactory</a>
+ <a href="hivemind/BuilderFactory.html">hivemind.BuilderFactory</a>
to construct a service simplifies this, using the
<code><event-listener></code> element. The BuilderFactory can register a
core service implementation as a <em>listener</em> of events produced by some
@@ -572,14 +564,8 @@
core service implementations constructor (for instance, if
the initializations are based on properties set after the service implementation object
is instantiated), then
- your class should implement the
-
- <a href="&apiroot;/Initializable.html">Initializable</a>
- interface (in addition to the service interface).
- This interface defines a callback that occurs only after
- the core service has been constructed and configured, and the interceptor stack
- (if any)
- has been assembled.
+ your class should use the <a href="hivemind/BuilderFactory.html">hivemind.BuilderFactory</a> to
+ invoke an initializer method.
</p>
</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org