You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by hl...@apache.org on 2003/07/01 13:28:54 UTC
cvs commit: jakarta-commons-sandbox/hivemind/src/test-data/TestRegistryBuilder/META-INF hivemodule.xml
hlship 2003/07/01 04:28:54
Modified: hivemind/src/java/org/apache/commons/hivemind/service
RemoteExceptionListener.java
hivemind/src/java/org/apache/commons/hivemind/service/impl
EJBProxyFactory.java EJBProxyInvocationHandler.java
LoggingInterceptorFactory.java
hivemind/src/test/hivemind/test/parse
TestDescriptorParser.java TestToString.java
hivemind/src/test/hivemind/test/ant
TestConstructRegistry.java
hivemind/src/test/hivemind/test/config/impl
ConfigElementFactory.java
hivemind/src/META-INF hivemodule.xml
hivemind/src/test-data/TestConstructRegistry testBasic.xml
testUptoDate.xml
hivemind/src/test-data/TestRegistryBuilder/META-INF
hivemodule.xml
Added: hivemind/src/java/org/apache/commons/hivemind/service
NameLookup.java RemoteExceptionCoordinator.java
hivemind/src/java/org/apache/commons/hivemind/service/impl
NameLookupImpl.java
RemoteExceptionCoordinatorImpl.java
Removed: hivemind/src/java/org/apache/commons/hivemind/service
INameLookup.java IRemoteExceptionCoordinator.java
hivemind/src/java/org/apache/commons/hivemind/service/impl
RemoteExceptionCoordinator.java NameLookup.java
Log:
Rename interfaces, stripping leading 'I'.
Rename 'Variables' to 'Symbols'.
Revision Changes Path
1.2 +2 -2 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/RemoteExceptionListener.java
Index: RemoteExceptionListener.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/RemoteExceptionListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RemoteExceptionListener.java 26 Jun 2003 20:31:26 -0000 1.1
+++ RemoteExceptionListener.java 1 Jul 2003 11:28:52 -0000 1.2
@@ -68,7 +68,7 @@
public interface RemoteExceptionListener extends EventListener
{
/**
- * Invoked by {@link IRemoteExceptionCoordinator#sendNotifications(Object, Throwable)}.
+ * Invoked by {@link RemoteExceptionCoordinator#sendNotifications(Object, Throwable)}.
*/
public void remoteException(RemoteExceptionEvent event);
1.1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/NameLookup.java
Index: NameLookup.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.hivemind.service;
/**
* Service interface for performing name lookups. This is typically
* implemented as a wrapper around JNDI. This service is available
* as <code>org.apache.commons.hivemind.NameLookupImpl</code>.
* or {@link HiveMind#NAME_LOOKUP_SERVICE_ID}.
* The default configuration does not include a core implementation,
* but a standard implementation is available as
* {@link org.apache.commons.hivemind.service.impl.NameLookupImpl}.
*
* @author Howard Lewis Ship
* @version $Id: NameLookup.java,v 1.1 2003/07/01 11:28:52 hlship Exp $
*/
public interface NameLookup
{
/**
* Performs the lookup, returning the object that was found.
*
* @param name the name to lookup
* @param expected the expected class of the object; the object found must be assignable
* to this class (which may be a class or interface)
* @throws org.apache.tapestry.ApplicationRuntimeException if an error occurs during
* the lookup, or if the found object can not be assigned to the expected class.
*/
public Object lookup(String name, Class expected);
}
1.1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/RemoteExceptionCoordinator.java
Index: RemoteExceptionCoordinator.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.hivemind.service;
/**
* Coordinates propogation of remote events.
* Manages a list of
* {@link org.apache.commons.hivemind.service.RemoteExceptionListener} and
* will perform notifications on demand. This allows
* objects which cache remote data to discard it after a remote exception.
*
* <p>
* This service is available as
* <code>org.apache.commons.hivemind.RemoteExceptionCoordinatorImpl</code>
* or {@link org.apache.commons.hivemind.HiveMind#REMOTE_EXCEPTION_COORDINATOR_SERVICE_ID}.
*
*
* @author Howard Lewis Ship
* @version $Id: RemoteExceptionCoordinator.java,v 1.1 2003/07/01 11:28:52 hlship Exp $
*/
public interface RemoteExceptionCoordinator
{
public void addRemoteExceptionListener(RemoteExceptionListener listener);
public void removeRemoteExceptionListener(RemoteExceptionListener listener);
/**
* Invoked by an object which has caught a remote exception of some
* form.
*/
public void sendNotifications(Object source, Throwable exception);
}
1.2 +10 -10 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/EJBProxyFactory.java
Index: EJBProxyFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/EJBProxyFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EJBProxyFactory.java 26 Jun 2003 20:31:30 -0000 1.1
+++ EJBProxyFactory.java 1 Jul 2003 11:28:53 -0000 1.2
@@ -61,14 +61,14 @@
import java.lang.reflect.Proxy;
import org.apache.commons.hivemind.HiveMind;
-import org.apache.commons.hivemind.IInitializeService;
-import org.apache.commons.hivemind.IRegistry;
-import org.apache.commons.hivemind.IServiceExtensionPoint;
-import org.apache.commons.hivemind.IServiceImplementationFactory;
+import org.apache.commons.hivemind.InitializeService;
+import org.apache.commons.hivemind.Registry;
+import org.apache.commons.hivemind.ServiceExtensionPoint;
+import org.apache.commons.hivemind.ServiceImplementationFactory;
import org.apache.tapestry.ApplicationRuntimeException;
/**
- * An implementation of {@link org.apache.commons.hivemind.IServiceImplementationFactory}
+ * An implementation of {@link org.apache.commons.hivemind.ServiceImplementationFactory}
* that can create a proxy to a stateless session EJB. Using this factory, it is
* easy to create a HiveMind service wrapper around the actual EJB.
*
@@ -76,12 +76,12 @@
* @author Howard Lewis Ship
* @version $Id$
*/
-public class EJBProxyFactory implements IServiceImplementationFactory, IInitializeService
+public class EJBProxyFactory implements ServiceImplementationFactory, InitializeService
{
private String _serviceId;
public Object createCoreServiceImplementation(
- IServiceExtensionPoint point,
+ ServiceExtensionPoint point,
Object[] parameters)
{
if (parameters.length != 1)
@@ -95,7 +95,7 @@
Class serviceInterface = point.getServiceInterface();
String jndiName = (String) parameters[0];
- IRegistry registry = point.getModule().getRegistry();
+ Registry registry = point.getModule().getRegistry();
InvocationHandler handler =
new EJBProxyInvocationHandler(jndiName, serviceInterface, registry);
@@ -106,7 +106,7 @@
}
- public void initializeService(IServiceExtensionPoint point, Object service)
+ public void initializeService(ServiceExtensionPoint point, Object service)
{
_serviceId = point.getExtensionPointId();
}
1.2 +11 -11 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/EJBProxyInvocationHandler.java
Index: EJBProxyInvocationHandler.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/EJBProxyInvocationHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EJBProxyInvocationHandler.java 26 Jun 2003 20:31:30 -0000 1.1
+++ EJBProxyInvocationHandler.java 1 Jul 2003 11:28:53 -0000 1.2
@@ -65,9 +65,9 @@
import javax.ejb.EJBHome;
import org.apache.commons.hivemind.HiveMind;
-import org.apache.commons.hivemind.IRegistry;
-import org.apache.commons.hivemind.service.INameLookup;
-import org.apache.commons.hivemind.service.IRemoteExceptionCoordinator;
+import org.apache.commons.hivemind.Registry;
+import org.apache.commons.hivemind.service.NameLookup;
+import org.apache.commons.hivemind.service.RemoteExceptionCoordinator;
import org.apache.commons.hivemind.service.RemoteExceptionEvent;
import org.apache.commons.hivemind.service.RemoteExceptionListener;
import org.apache.tapestry.ApplicationRuntimeException;
@@ -81,30 +81,30 @@
*/
public class EJBProxyInvocationHandler implements RemoteExceptionListener, InvocationHandler
{
- private INameLookup _nameLookup;
+ private NameLookup _nameLookup;
private Class _ejbRemoteInterface;
- private IRemoteExceptionCoordinator _coordinator;
+ private RemoteExceptionCoordinator _coordinator;
private String _JNDIName;
private EJBHome _home;
private Object _object;
- protected EJBProxyInvocationHandler(String JNDIName, Class remoteInterface, IRegistry registry)
+ protected EJBProxyInvocationHandler(String JNDIName, Class remoteInterface, Registry registry)
{
_JNDIName = JNDIName;
_ejbRemoteInterface = remoteInterface;
_nameLookup =
- (INameLookup) registry.getService(HiveMind.NAME_LOOKUP_SERVICE_ID, INameLookup.class);
+ (NameLookup) registry.getService(HiveMind.NAME_LOOKUP_SERVICE_ID, NameLookup.class);
if (_nameLookup == null)
throw HiveMind.createMissingServiceException(
HiveMind.NAME_LOOKUP_SERVICE_ID,
- INameLookup.class);
+ NameLookup.class);
_coordinator =
- (IRemoteExceptionCoordinator) registry.getService(
+ (RemoteExceptionCoordinator) registry.getService(
HiveMind.REMOTE_EXCEPTION_COORDINATOR_SERVICE_ID,
- IRemoteExceptionCoordinator.class);
+ RemoteExceptionCoordinator.class);
_coordinator.addRemoteExceptionListener(this);
}
1.2 +5 -5 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/LoggingInterceptorFactory.java
Index: LoggingInterceptorFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/LoggingInterceptorFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LoggingInterceptorFactory.java 26 Jun 2003 20:31:30 -0000 1.1
+++ LoggingInterceptorFactory.java 1 Jul 2003 11:28:53 -0000 1.2
@@ -62,8 +62,8 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import org.apache.commons.hivemind.IInterceptorFactory;
-import org.apache.commons.hivemind.IInterceptorStack;
+import org.apache.commons.hivemind.ServiceInterceptorFactory;
+import org.apache.commons.hivemind.InterceptorStack;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -83,7 +83,7 @@
* @author Howard Lewis Ship
* @version $Id$
*/
-public class LoggingInterceptorFactory implements IInterceptorFactory
+public class LoggingInterceptorFactory implements ServiceInterceptorFactory
{
private static class Handler implements InvocationHandler
{
@@ -182,7 +182,7 @@
}
- public void createInterceptor(IInterceptorStack stack)
+ public void createInterceptor(InterceptorStack stack)
{
String id = stack.getServiceExtensionPoint().getExtensionPointId();
Log log = LogFactory.getLog(id);
1.1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/NameLookupImpl.java
Index: NameLookupImpl.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.hivemind.service.impl;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.commons.hivemind.HiveMind;
import org.apache.commons.hivemind.InitializeService;
import org.apache.commons.hivemind.Registry;
import org.apache.commons.hivemind.ServiceExtensionPoint;
import org.apache.commons.hivemind.service.NameLookup;
import org.apache.commons.hivemind.service.RemoteExceptionCoordinator;
import org.apache.commons.hivemind.service.RemoteExceptionEvent;
import org.apache.commons.hivemind.service.RemoteExceptionListener;
import org.apache.tapestry.ApplicationRuntimeException;
/**
* Standard implementation of the {@link org.apache.commons.hivemind.service.NameLookup}
* service interface.
*
* @author Howard Lewis Ship
* @version $Id: NameLookupImpl.java,v 1.1 2003/07/01 11:28:53 hlship Exp $
*/
public class NameLookupImpl implements NameLookup, InitializeService, RemoteExceptionListener
{
private RemoteExceptionCoordinator _coordinator;
private InitialContext _initialContext;
private String _initialFactory;
private String _URLPackages;
private String _providerURL;
public Object lookup(String name, Class expected)
{
int i = 0;
while (true)
{
Context context = null;
Object raw = null;
try
{
context = getInitialContext();
raw = context.lookup(name);
}
catch (NamingException ex)
{
if (i++ == 0)
_coordinator.sendNotifications(this, ex);
else
throw new ApplicationRuntimeException(
HiveMind.format("NameLookup.unable-to-lookup", name, context),
ex);
continue;
}
if (raw == null)
throw new ApplicationRuntimeException(
HiveMind.format("NameLookup.no-object", name, expected));
if (!expected.isAssignableFrom(raw.getClass()))
throw new ApplicationRuntimeException(
HiveMind.format("NameLookup.wrong-type", name, raw, expected));
return raw;
}
}
protected Context getInitialContext() throws NamingException
{
Hashtable properties = new Hashtable();
if (_initialFactory != null)
properties.put(Context.INITIAL_CONTEXT_FACTORY, _initialFactory);
if (_providerURL != null)
properties.put(Context.PROVIDER_URL, _providerURL);
if (_URLPackages != null)
properties.put(Context.URL_PKG_PREFIXES, _URLPackages);
return constructContext(properties);
}
/**
* Constructs the InitialContext (this is separated out in a standalone
* method so that it may be overridden in a testing subclass).
*/
protected Context constructContext(Hashtable properties) throws NamingException
{
return new InitialContext(properties);
}
public void initializeService(ServiceExtensionPoint point, Object service)
{
Registry registry = point.getModule().getRegistry();
_coordinator =
(RemoteExceptionCoordinator) registry.getService(
HiveMind.REMOTE_EXCEPTION_COORDINATOR_SERVICE_ID,
RemoteExceptionCoordinator.class);
_coordinator.addRemoteExceptionListener(this);
}
/**
* Sets the InitialContext to null.
*/
public void remoteException(RemoteExceptionEvent event)
{
_initialContext = null;
}
public String getInitialFactory()
{
return _initialFactory;
}
public String getProviderURL()
{
return _providerURL;
}
public String getURLPackages()
{
return _URLPackages;
}
/**
* Sets the initial factory used to create the initial JNDI context.
* Equivalent to the system property <code>java.naming.factory.initial</code>.
*/
public void setInitialFactory(String string)
{
_initialFactory = string;
}
/**
* Sets the JNDI provider URL, used to create the initial JNDI context.
* Equivalent to the system property <code>java.naming.provider.url</code>.
*/
public void setProviderURL(String string)
{
_providerURL = string;
}
/**
* Sets the URL packages, used to create the initial JNDI context.
* Equivalent to the system property
* <code>java.naming.factory.url.pkgs</code>
*/
public void setURLPackages(String string)
{
_URLPackages = string;
}
}
1.1 jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/RemoteExceptionCoordinatorImpl.java
Index: RemoteExceptionCoordinatorImpl.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.hivemind.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.hivemind.HiveMind;
import org.apache.commons.hivemind.service.RemoteExceptionCoordinator;
import org.apache.commons.hivemind.service.RemoteExceptionEvent;
import org.apache.commons.hivemind.service.RemoteExceptionListener;
import org.apache.tapestry.ApplicationRuntimeException;
/**
* Core implementation of {@link org.apache.commons.hivemind.service.RemoteExceptionCoordinator}.
*
* @author Howard Lewis Ship
* @version $Id: RemoteExceptionCoordinatorImpl.java,v 1.1 2003/07/01 11:28:53 hlship Exp $
*/
public class RemoteExceptionCoordinatorImpl implements RemoteExceptionCoordinator
{
private boolean _locked;
private List _listeners;
private void checkLocked(String methodName)
{
if (_locked)
throw new ApplicationRuntimeException(
HiveMind.format("RemoteExceptionCoordinator.method-while-locked", methodName));
}
public synchronized void addRemoteExceptionListener(RemoteExceptionListener listener)
{
checkLocked("addRemoteExceptionListener");
if (_listeners == null)
_listeners = new ArrayList();
_listeners.add(listener);
}
public synchronized void removeRemoteExceptionListener(RemoteExceptionListener listener)
{
checkLocked("removeRemoteExceptionListener");
if (_listeners == null)
return;
_listeners.remove(listener);
}
public synchronized void sendNotifications(Object source, Throwable exception)
{
checkLocked("sendNotification");
if (_listeners == null || _listeners.size() == 0)
return;
RemoteExceptionEvent event = new RemoteExceptionEvent(source, exception);
int count = _listeners.size();
_locked = true;
try
{
for (int i = 0; i < count; i++)
{
RemoteExceptionListener listener = (RemoteExceptionListener) _listeners.get(i);
listener.remoteException(event);
}
}
finally
{
_locked = false;
}
}
}
1.9 +7 -7 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestDescriptorParser.java
Index: TestDescriptorParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestDescriptorParser.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestDescriptorParser.java 26 Jun 2003 20:31:30 -0000 1.8
+++ TestDescriptorParser.java 1 Jul 2003 11:28:53 -0000 1.9
@@ -68,7 +68,7 @@
import org.apache.commons.hivemind.parse.CreateInstanceDescriptor;
import org.apache.commons.hivemind.parse.ExpressionDescriptor;
import org.apache.commons.hivemind.parse.FactoryDescriptor;
-import org.apache.commons.hivemind.parse.IInstanceBuilder;
+import org.apache.commons.hivemind.parse.InstanceBuilder;
import org.apache.commons.hivemind.parse.InterceptorDescriptor;
import org.apache.commons.hivemind.parse.ModuleDescriptor;
import org.apache.commons.hivemind.parse.NewDescriptor;
@@ -210,7 +210,7 @@
{
ModuleDescriptor d = parse("ServiceCreateInstance.xml");
ServiceDescriptor s = d.getService("Foo");
- IInstanceBuilder ibd = s.getInstanceBuilder();
+ InstanceBuilder ibd = s.getInstanceBuilder();
assertNotNull(ibd);
assertTrue(ibd instanceof CreateInstanceDescriptor);
@@ -239,7 +239,7 @@
{
ModuleDescriptor d = parse("PropertyValue.xml");
ServiceDescriptor s = d.getService("Foo");
- IInstanceBuilder ibd = s.getInstanceBuilder();
+ InstanceBuilder ibd = s.getInstanceBuilder();
CreateInstanceDescriptor cid = (CreateInstanceDescriptor) ibd;
List l = cid.getConfigurators();
@@ -255,7 +255,7 @@
{
ModuleDescriptor d = parse("PropertyExpression.xml");
ServiceDescriptor s = d.getService("Foo");
- IInstanceBuilder ibd = s.getInstanceBuilder();
+ InstanceBuilder ibd = s.getInstanceBuilder();
CreateInstanceDescriptor cid = (CreateInstanceDescriptor) ibd;
List l = cid.getConfigurators();
@@ -462,7 +462,7 @@
{
ModuleDescriptor d = parse("SetValueExtended.xml");
ServiceDescriptor s = d.getService("Foo");
- IInstanceBuilder ibd = s.getInstanceBuilder();
+ InstanceBuilder ibd = s.getInstanceBuilder();
CreateInstanceDescriptor cid = (CreateInstanceDescriptor) ibd;
List l = cid.getConfigurators();
@@ -478,7 +478,7 @@
{
ModuleDescriptor d = parse("SetExpressionExtended.xml");
ServiceDescriptor s = d.getService("Foo");
- IInstanceBuilder ibd = s.getInstanceBuilder();
+ InstanceBuilder ibd = s.getInstanceBuilder();
CreateInstanceDescriptor cid = (CreateInstanceDescriptor) ibd;
List l = cid.getConfigurators();
1.5 +17 -17 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestToString.java
Index: TestToString.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestToString.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestToString.java 26 Jun 2003 20:31:30 -0000 1.4
+++ TestToString.java 1 Jul 2003 11:28:53 -0000 1.5
@@ -59,15 +59,15 @@
import hivemind.test.HiveMindTestCase;
-import org.apache.commons.hivemind.impl.Attribute;
+import org.apache.commons.hivemind.impl.AttributeImpl;
import org.apache.commons.hivemind.impl.BaseModule;
-import org.apache.commons.hivemind.impl.BaseRegistry;
-import org.apache.commons.hivemind.impl.ConfigurationContribution;
-import org.apache.commons.hivemind.impl.ConfigurationExtensionPoint;
-import org.apache.commons.hivemind.impl.Element;
-import org.apache.commons.hivemind.impl.FactoryContribution;
-import org.apache.commons.hivemind.impl.InterceptorContribution;
-import org.apache.commons.hivemind.impl.ServiceExtensionPoint;
+import org.apache.commons.hivemind.impl.RegistryImpl;
+import org.apache.commons.hivemind.impl.ConfigurationContributionImpl;
+import org.apache.commons.hivemind.impl.ConfigurationExtensionPointImpl;
+import org.apache.commons.hivemind.impl.ElementImpl;
+import org.apache.commons.hivemind.impl.FactoryContributionImpl;
+import org.apache.commons.hivemind.impl.ServiceInterceptorContributionImpl;
+import org.apache.commons.hivemind.impl.ServiceExtensionPointImpl;
import org.apache.commons.hivemind.parse.ConfigurationDescriptor;
import org.apache.commons.hivemind.parse.ContributeConfigurationDescriptor;
import org.apache.commons.hivemind.parse.ContributeServiceDescriptor;
@@ -113,14 +113,14 @@
new InterceptorDescriptor().toString();
new ParametersDescriptor().toString();
- new FactoryContribution().toString();
+ new FactoryContributionImpl().toString();
new BaseModule().toString();
- new BaseRegistry().toString();
- new ConfigurationContribution().toString();
- new ConfigurationExtensionPoint().toString();
- new Element("foo").toString();
- new Attribute("foo", "bar").toString();
- new InterceptorContribution().toString();
- new ServiceExtensionPoint().toString();
+ new RegistryImpl().toString();
+ new ConfigurationContributionImpl().toString();
+ new ConfigurationExtensionPointImpl().toString();
+ new ElementImpl("foo").toString();
+ new AttributeImpl("foo", "bar").toString();
+ new ServiceInterceptorContributionImpl().toString();
+ new ServiceExtensionPointImpl().toString();
}
}
1.3 +2 -2 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/ant/TestConstructRegistry.java
Index: TestConstructRegistry.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/ant/TestConstructRegistry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestConstructRegistry.java 17 Jun 2003 21:13:06 -0000 1.2
+++ TestConstructRegistry.java 1 Jul 2003 11:28:53 -0000 1.3
@@ -145,7 +145,7 @@
Path p = cr.createDescriptors();
p.createPath().setLocation(new File("src/META-INF/hivemodule.xml"));
- p.createPath().setLocation(new File("src/test/hivemind/test/config/ValueVariables.xml"));
+ p.createPath().setLocation(new File("src/test/hivemind/test/config/Symbols.xml"));
File output = File.createTempFile("testBasic-", ".xml");
1.4 +3 -3 jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/impl/ConfigElementFactory.java
Index: ConfigElementFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/impl/ConfigElementFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ConfigElementFactory.java 4 Jun 2003 23:52:50 -0000 1.3
+++ ConfigElementFactory.java 1 Jul 2003 11:28:53 -0000 1.4
@@ -59,7 +59,7 @@
import hivemind.test.config.ConfigElement;
-import org.apache.commons.hivemind.IFactory;
+import org.apache.commons.hivemind.InstanceFactory;
/**
* Creates an instance of {@link hivemind.test.config.ConfigElement}.
@@ -67,7 +67,7 @@
* @author Howard Lewis Ship
* @version $Id$
*/
-public class ConfigElementFactory implements IFactory
+public class ConfigElementFactory implements InstanceFactory
{
public Object createNewInstance()
1.4 +9 -9 jakarta-commons-sandbox/hivemind/src/META-INF/hivemodule.xml
Index: hivemodule.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/META-INF/hivemodule.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- hivemodule.xml 26 Jun 2003 20:31:31 -0000 1.3
+++ hivemodule.xml 1 Jul 2003 11:28:53 -0000 1.4
@@ -7,25 +7,25 @@
<description>
The master module for HiveMind.
</description>
- <configuration id="VariableSource"
- element-type="org.apache.commons.hivemind.VariableSourceContribution">
- <description>Provides a list of sources for substitution variables.</description>
+ <configuration id="SymbolSource"
+ element-type="org.apache.commons.hivemind.SymbolSourceContribution">
+ <description>Provides a list of sources for substitution symbols.</description>
</configuration>
- <service id="LoggingInterceptor" interface="org.apache.commons.hivemind.IInterceptorFactory">
+ <service id="LoggingInterceptor" interface="org.apache.commons.hivemind.ServiceInterceptorFactory">
<description>An interceptor factory for adding method-level logging to a service.</description>
<create-instance class="org.apache.commons.hivemind.service.impl.LoggingInterceptorFactory"/>
</service>
<service id="RemoteExceptionCoordinator"
- interface="org.apache.commons.hivemind.service.IRemoteExceptionCoordinator">
+ interface="org.apache.commons.hivemind.service.RemoteExceptionCoordinator">
<description>Used to coordinate propogation of remote exceptions (typically, to allow
cached remote data to be discarded after a remote exception).</description>
- <create-instance class="org.apache.commons.hivemind.service.impl.RemoteExceptionCoordinator"/>
+ <create-instance class="org.apache.commons.hivemind.service.impl.RemoteExceptionCoordinatorImpl"/>
</service>
<service id="NameLookup"
- interface="org.apache.commons.hivemind.service.INameLookup"
+ interface="org.apache.commons.hivemind.service.NameLookup"
required="false">
<description>
A service which can perform name lookups of objects; typically an implementation based on JNDI is supplied.
@@ -33,7 +33,7 @@
</service>
<service id="EJBProxyFactory"
- interface="org.apache.commons.hivemind.IServiceImplementationFactory">
+ interface="org.apache.commons.hivemind.ServiceImplementationFactory">
<description>
Core service implementation factory that constructs dynamic proxies to EJB stateless session beans. A single parameter, the JNDI name of the proxy, is required.
</description>
1.4 +12 -12 jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/testBasic.xml
Index: testBasic.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/testBasic.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- testBasic.xml 26 Jun 2003 20:31:31 -0000 1.3
+++ testBasic.xml 1 Jul 2003 11:28:53 -0000 1.4
@@ -3,33 +3,33 @@
<module id="org.apache.commons.hivemind" uid="1" version="1.0.0">
<description uid="2"> The master module for HiveMind. </description>
<configuration
- element-type="org.apache.commons.hivemind.VariableSourceContribution"
- id="org.apache.commons.hivemind.VariableSource" uid="3">
- <description>Provides a list of sources for substitution variables.</description>
+ element-type="org.apache.commons.hivemind.SymbolSourceContribution"
+ id="org.apache.commons.hivemind.SymbolSource" uid="3">
+ <description>Provides a list of sources for substitution symbols.</description>
</configuration>
<service id="org.apache.commons.hivemind.LoggingInterceptor"
- interface="org.apache.commons.hivemind.IInterceptorFactory" uid="4">
+ interface="org.apache.commons.hivemind.ServiceInterceptorFactory" uid="4">
<description>An interceptor factory for adding method-level
logging to a service.</description>
<create-instance class="org.apache.commons.hivemind.service.impl.LoggingInterceptorFactory"/>
</service>
<service
id="org.apache.commons.hivemind.RemoteExceptionCoordinator"
- interface="org.apache.commons.hivemind.service.IRemoteExceptionCoordinator" uid="5">
+ interface="org.apache.commons.hivemind.service.RemoteExceptionCoordinator" uid="5">
<description>Used to coordinate propogation of remote
exceptions (typically, to allow cached remote data to
be discarded after a remote exception).</description>
- <create-instance class="org.apache.commons.hivemind.service.impl.RemoteExceptionCoordinator"/>
+ <create-instance class="org.apache.commons.hivemind.service.impl.RemoteExceptionCoordinatorImpl"/>
</service>
<service id="org.apache.commons.hivemind.NameLookup"
- interface="org.apache.commons.hivemind.service.INameLookup"
+ interface="org.apache.commons.hivemind.service.NameLookup"
required="false" uid="6">
<description> A service which can perform name lookups of
objects; typically an implementation based on JNDI is
supplied. </description>
</service>
<service id="org.apache.commons.hivemind.EJBProxyFactory"
- interface="org.apache.commons.hivemind.IServiceImplementationFactory" uid="7">
+ interface="org.apache.commons.hivemind.ServiceImplementationFactory" uid="7">
<description> Core service implementation factory that
constructs dynamic proxies to EJB stateless session
beans. A single parameter, the JNDI name of the proxy,
@@ -39,11 +39,11 @@
</module>
<module id="hivemind.test.config" uid="8" version="1.0.0">
<contribute-configuration
- configuration-id="org.apache.commons.hivemind.VariableSource" uid="9">
- <create-instance class="org.apache.commons.hivemind.VariableSourceContribution">
+ configuration-id="org.apache.commons.hivemind.SymbolSource" uid="9">
+ <new>
<set-create
- class="hivemind.test.external.PropertiesVariableSource" property="source"/>
- </create-instance>
+ class="hivemind.test.external.PropertiesSymbolSource" property="source"/>
+ </new>
</contribute-configuration>
<configuration element-type="java.lang.String"
id="hivemind.test.config.Dogs" uid="10">
1.4 +8 -8 jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/testUptoDate.xml
Index: testUptoDate.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test-data/TestConstructRegistry/testUptoDate.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- testUptoDate.xml 26 Jun 2003 20:31:31 -0000 1.3
+++ testUptoDate.xml 1 Jul 2003 11:28:53 -0000 1.4
@@ -3,33 +3,33 @@
<module id="org.apache.commons.hivemind" uid="1" version="1.0.0">
<description uid="2"> The master module for HiveMind. </description>
<configuration
- element-type="org.apache.commons.hivemind.VariableSourceContribution"
- id="org.apache.commons.hivemind.VariableSource" uid="3">
- <description>Provides a list of sources for substitution variables.</description>
+ element-type="org.apache.commons.hivemind.SymbolSourceContribution"
+ id="org.apache.commons.hivemind.SymbolSource" uid="3">
+ <description>Provides a list of sources for substitution symbols.</description>
</configuration>
<service id="org.apache.commons.hivemind.LoggingInterceptor"
- interface="org.apache.commons.hivemind.IInterceptorFactory" uid="4">
+ interface="org.apache.commons.hivemind.ServiceInterceptorFactory" uid="4">
<description>An interceptor factory for adding method-level
logging to a service.</description>
<create-instance class="org.apache.commons.hivemind.service.impl.LoggingInterceptorFactory"/>
</service>
<service
id="org.apache.commons.hivemind.RemoteExceptionCoordinator"
- interface="org.apache.commons.hivemind.service.IRemoteExceptionCoordinator" uid="5">
+ interface="org.apache.commons.hivemind.service.RemoteExceptionCoordinator" uid="5">
<description>Used to coordinate propogation of remote
exceptions (typically, to allow cached remote data to
be discarded after a remote exception).</description>
- <create-instance class="org.apache.commons.hivemind.service.impl.RemoteExceptionCoordinator"/>
+ <create-instance class="org.apache.commons.hivemind.service.impl.RemoteExceptionCoordinatorImpl"/>
</service>
<service id="org.apache.commons.hivemind.NameLookup"
- interface="org.apache.commons.hivemind.service.INameLookup"
+ interface="org.apache.commons.hivemind.service.NameLookup"
required="false" uid="6">
<description> A service which can perform name lookups of
objects; typically an implementation based on JNDI is
supplied. </description>
</service>
<service id="org.apache.commons.hivemind.EJBProxyFactory"
- interface="org.apache.commons.hivemind.IServiceImplementationFactory" uid="7">
+ interface="org.apache.commons.hivemind.ServiceImplementationFactory" uid="7">
<description> Core service implementation factory that
constructs dynamic proxies to EJB stateless session
beans. A single parameter, the JNDI name of the proxy,
1.2 +4 -4 jakarta-commons-sandbox/hivemind/src/test-data/TestRegistryBuilder/META-INF/hivemodule.xml
Index: hivemodule.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test-data/TestRegistryBuilder/META-INF/hivemodule.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hivemodule.xml 9 Jun 2003 22:23:09 -0000 1.1
+++ hivemodule.xml 1 Jul 2003 11:28:53 -0000 1.2
@@ -5,9 +5,9 @@
xsi:noNamespaceSchemaLocation="http://jakarta.apache.org/commons/hivemind/schema/HiveMind_1.0.xsd"
id="hivemind.test.config"
version="1.0.0">
- <contribute-configuration configuration-id="org.apache.commons.hivemind.VariableSource">
- <create-instance class="org.apache.commons.hivemind.VariableSourceContribution">
- <set-create property="source" class="hivemind.test.external.PropertiesVariableSource"/>
+ <contribute-configuration configuration-id="org.apache.commons.hivemind.SymbolSource">
+ <create-instance class="org.apache.commons.hivemind.SymbolSourceContribution">
+ <set-create property="source" class="hivemind.test.external.PropertiesSymbolSource"/>
</create-instance>
</contribute-configuration>
<configuration id="Dogs" element-type="java.lang.String">
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org