hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r438434 - in /hivemind/branches/branch-2-0-annot: framework/src/java/org/apache/hivemind/definition/ framework/src/java/org/apache/hivemind/impl/ framework/src/java/org/apache/hivemind/impl/servicemodel/ framework/src/java/org/apache/hivemi...
Date Wed, 30 Aug 2006 09:36:18 GMT
Author: ahuegen
Date: Wed Aug 30 02:36:17 2006
New Revision: 438434

URL: http://svn.apache.org/viewvc?rev=438434&view=rev
Log:
ServicePointImpl keeps a reference to ServiceInterceptorDefinitions
ServiceInterceptorConstructor reduced to one mehod.
Naming and ordering move from interceptor constructor to definition.

Added:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/OrderedServiceInterceptorDefinition.java
Modified:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionMessages.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceInterceptorDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/AbstractServiceInterceptorConstructor.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServiceInterceptorConstructor.java
    hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/StringHolderModule.java
    hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/TestServices.java
    hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestInterceptors.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryInterceptorConstructor.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionMessages.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionMessages.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionMessages.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionMessages.java
Wed Aug 30 02:36:17 2006
@@ -17,8 +17,6 @@
 import org.apache.hivemind.Location;
 import org.apache.hivemind.Occurances;
 import org.apache.hivemind.impl.MessageFormatter;
-import org.apache.hivemind.internal.ConfigurationPoint;
-import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.util.IdUtils;
 
 /**

Added: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/OrderedServiceInterceptorDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/OrderedServiceInterceptorDefinition.java?rev=438434&view=auto
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/OrderedServiceInterceptorDefinition.java
(added)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/OrderedServiceInterceptorDefinition.java
Wed Aug 30 02:36:17 2006
@@ -0,0 +1,38 @@
+/**
+ * 
+ */
+package org.apache.hivemind.definition;
+
+import org.apache.hivemind.Location;
+import org.apache.hivemind.Orderable;
+import org.apache.hivemind.internal.ServiceInterceptorConstructor;
+
+/**
+ * Specialization of {@link ServiceInterceptorDefinition} that implements the {@link Orderable}
+ * interface.
+ */
+public class OrderedServiceInterceptorDefinition extends ServiceInterceptorDefinition implements
Orderable
+{
+
+    private String _precedingInterceptorIds;
+    private String _followingInterceptorIds;
+
+    public OrderedServiceInterceptorDefinition(ModuleDefinition module, String name, Location
location, ServiceInterceptorConstructor interceptorConstructor,
+            String precedingInterceptorIds, String followingInterceptorIds)
+    {
+        super(module, name, location, interceptorConstructor);
+        _precedingInterceptorIds = precedingInterceptorIds;
+        _followingInterceptorIds = followingInterceptorIds;
+    }
+
+    public String getFollowingNames()
+    {
+        return _followingInterceptorIds;
+    }
+
+    public String getPrecedingNames()
+    {
+        return _precedingInterceptorIds;
+    }
+
+}
\ No newline at end of file

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceInterceptorDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceInterceptorDefinition.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceInterceptorDefinition.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceInterceptorDefinition.java
Wed Aug 30 02:36:17 2006
@@ -3,29 +3,46 @@
 import org.apache.hivemind.Location;
 import org.apache.hivemind.internal.ServiceInterceptorConstructor;
 
+/**
+ * Implementations of this interface may additionally implement the {@link org.apache.hivemind.Orderable}
+ * interface if a certain interceptor order is required.
+ */
 public class ServiceInterceptorDefinition extends ExtensionDefinition
 {
     private ServiceInterceptorConstructor _interceptorConstructor;
+    private String _name;
 
     public ServiceInterceptorDefinition(ModuleDefinition module)
     {
         super(module);
     }
 
-    public ServiceInterceptorDefinition(ModuleDefinition module, Location location,
+    public ServiceInterceptorDefinition(ModuleDefinition module, String name, Location location,
             ServiceInterceptorConstructor interceptorConstructor)
     {
         super(module, location);
+        _name = name;
         _interceptorConstructor = interceptorConstructor;
     }
 
-    public ServiceInterceptorConstructor getServiceConstructor()
+    public ServiceInterceptorConstructor getInterceptorConstructor()
     {
         return _interceptorConstructor;
     }
 
-    public void setServiceConstructor(ServiceInterceptorConstructor serviceConstructor)
+    public void setInterceptorConstructor(ServiceInterceptorConstructor serviceConstructor)
     {
         _interceptorConstructor = serviceConstructor;
     }
+
+    public String getName()
+    {
+        return _name;
+    }
+
+    public void setName(String name)
+    {
+        _name = name;
+    }
+    
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java
Wed Aug 30 02:36:17 2006
@@ -1,7 +1,7 @@
 package org.apache.hivemind.definition;
 
 
-public class UnresolvedExtension
+class UnresolvedExtension
 {
     private String _extensionPointId;
     private ExtensionDefinition _extension;

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
Wed Aug 30 02:36:17 2006
@@ -22,6 +22,7 @@
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Occurances;
 import org.apache.hivemind.ShutdownCoordinator;
+import org.apache.hivemind.definition.ContributionDefinition;
 import org.apache.hivemind.internal.ConfigurationConstructor;
 import org.apache.hivemind.internal.ConfigurationPoint;
 import org.apache.hivemind.internal.Contribution;
@@ -77,12 +78,12 @@
         return _contributions.size();
     }
 
-    public void addContribution(Contribution c)
+    public void addContribution(ContributionDefinition cd)
     {
         if (_contributions == null)
             _contributions = new ArrayList();
 
-        _contributions.add(c);
+        _contributions.add(cd);
     }
 
     public Occurances getExpectedCount()
@@ -136,7 +137,7 @@
                 
                 _container = createContainerInstance();
 
-                processContributionElements();
+                processContributions();
             }
 
             // Now that we have the real list, we don't need the proxy anymore, either.
@@ -154,7 +155,7 @@
     /**
      * Adds all contributions to the configuration container.
      */
-    private void processContributionElements()
+    private void processContributions()
     {
         if (LOG.isDebugEnabled())
             LOG.debug("Constructing extension point " + getExtensionPointId());
@@ -167,9 +168,8 @@
         {
             for (int i = 0; i < count; i++)
             {
-                Contribution extension = (Contribution) _contributions.get(i);
-
-                extension.contribute(this, _container);
+                ContributionDefinition cd = (ContributionDefinition) _contributions.get(i);
+                cd.getContributionConstructor().contribute(this, _container);
             }
         }
         catch (Exception ex)

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
Wed Aug 30 02:36:17 2006
@@ -21,11 +21,11 @@
 import org.apache.hivemind.ClassResolver;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.Resource;
+import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.events.RegistryShutdownListener;
 import org.apache.hivemind.internal.ConfigurationPoint;
 import org.apache.hivemind.internal.ExtensionPoint;
 import org.apache.hivemind.internal.Module;
-import org.apache.hivemind.internal.ServiceInterceptorConstructor;
 import org.apache.hivemind.internal.ServicePoint;
 
 /**
@@ -74,18 +74,18 @@
         return _formatter.format("unable-to-load-class", name, loader, cause);
     }
 
-    static String nullInterceptor(ServiceInterceptorConstructor constructor,
+    static String nullInterceptor(ServiceInterceptorDefinition interceptor,
             ServicePoint point)
     {
-        return _formatter.format("null-interceptor", constructor.getName(), point
+        return _formatter.format("null-interceptor", interceptor.getName(), point
                 .getExtensionPointId());
     }
 
     static String interceptorDoesNotImplementInterface(Object interceptor,
-            ServiceInterceptorConstructor constructor, ServicePoint point, Class serviceInterface)
+            ServiceInterceptorDefinition interceptorDefinition, ServicePoint point, Class
serviceInterface)
     {
         return _formatter.format("interceptor-does-not-implement-interface", new Object[]
-        { interceptor, constructor.getName(), point.getExtensionPointId(),
+        { interceptor, interceptorDefinition.getName(), point.getExtensionPointId(),
                 serviceInterface.getName() });
     }
 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java
Wed Aug 30 02:36:17 2006
@@ -17,8 +17,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.InterceptorStack;
+import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.internal.Module;
-import org.apache.hivemind.internal.ServiceInterceptorConstructor;
 import org.apache.hivemind.internal.ServicePoint;
 import org.apache.hivemind.util.ToStringBuilder;
 
@@ -32,7 +32,7 @@
 {
     private final Log _log;
 
-    private ServiceInterceptorConstructor _constructor;
+    private ServiceInterceptorDefinition _interceptorDefinition;
     private ServicePoint _sep;
     private Class _interfaceClass;
     private Object _top;
@@ -48,7 +48,7 @@
     public String toString()
     {
         ToStringBuilder builder = new ToStringBuilder(this);
-        builder.append("contribution", _constructor);
+        builder.append("contribution", _interceptorDefinition);
         builder.append("interfaceClass", _interfaceClass);
         builder.append("top", _top);
 
@@ -79,18 +79,18 @@
     {
         if (interceptor == null)
             throw new ApplicationRuntimeException(
-                ImplMessages.nullInterceptor(_constructor, _sep),
-                _constructor.getLocation(),
+                ImplMessages.nullInterceptor(_interceptorDefinition, _sep),
+                _interceptorDefinition.getLocation(),
                 null);
 
         if (!_interfaceClass.isAssignableFrom(interceptor.getClass()))
             throw new ApplicationRuntimeException(
                 ImplMessages.interceptorDoesNotImplementInterface(
                     interceptor,
-                    _constructor,
+                    _interceptorDefinition,
                     _sep,
                     _interfaceClass),
-                _constructor.getLocation(),
+                _interceptorDefinition.getLocation(),
                 null);
 
         _top = interceptor;
@@ -102,21 +102,21 @@
      * 
      */
 
-    public void process(ServiceInterceptorConstructor constructor)
+    public void process(ServiceInterceptorDefinition interceptorDefinition)
     {
         if (_log.isDebugEnabled())
-            _log.debug("Applying interceptor factory " + constructor.getName());
+            _log.debug("Applying interceptor factory " + interceptorDefinition.getName());
 
         // And now we can finally do this!
         try
         {
-            _constructor = constructor;
-            Module contributingModule = getServiceModule().getModule(constructor.getContributingModuleId());
-            _constructor.constructServiceInterceptor(this, contributingModule);
+            _interceptorDefinition = interceptorDefinition;
+            Module contributingModule = getServiceModule().getModule(interceptorDefinition.getModuleId());
+            _interceptorDefinition.getInterceptorConstructor().constructServiceInterceptor(this,
contributingModule);
         }
         finally
         {
-            _constructor = null;
+            _interceptorDefinition = null;
         }
     }
 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureConstructor.java
Wed Aug 30 02:36:17 2006
@@ -252,7 +252,7 @@
 //            if (_log.isDebugEnabled())
 //                _log.debug("Adding interceptor " + id. + " to service extension point "
+ pointId);
 
-            String sourceModuleId = sourceModule.getModuleId();
+//            String sourceModuleId = sourceModule.getModuleId();
     
             if (!point.visibleToModule(sourceModule))
             {
@@ -261,7 +261,7 @@
                 return;
             }
     
-            point.addContribution(cd.getContributionConstructor());
+            point.addContribution(cd);
         }
         
     }
@@ -286,7 +286,7 @@
                 return;
             }
     
-            point.addInterceptor(id.getServiceConstructor());
+            point.addInterceptor(id);
         }
     }
 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java
Wed Aug 30 02:36:17 2006
@@ -25,10 +25,10 @@
 import org.apache.hivemind.Orderable;
 import org.apache.hivemind.ShutdownCoordinator;
 import org.apache.hivemind.definition.ServiceImplementationDefinition;
+import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.events.RegistryShutdownListener;
 import org.apache.hivemind.internal.ServiceImplementationConstructor;
-import org.apache.hivemind.internal.ServiceInterceptorConstructor;
 import org.apache.hivemind.internal.ServiceModel;
 import org.apache.hivemind.internal.ServiceModelFactory;
 import org.apache.hivemind.order.Orderer;
@@ -53,7 +53,7 @@
 
     private Class _declaredInterface;
 
-    private List _interceptorConstructors;
+    private List _interceptorDefinitions;
 
     private boolean _interceptorsOrdered;
 
@@ -73,19 +73,19 @@
 
         builder.append("serviceInterfaceName", getServiceInterfaceClassName());
         builder.append("serviceConstructor", getServiceConstructor());
-        builder.append("interceptorConstructors", _interceptorConstructors);
+        builder.append("interceptorDefinitions", _interceptorDefinitions);
         builder.append("serviceModel", getServiceModel());
 
         if (_building)
             builder.append("building", _building);
     }
 
-    public void addInterceptor(ServiceInterceptorConstructor constructor)
+    public void addInterceptor(ServiceInterceptorDefinition definition)
     {
-        if (_interceptorConstructors == null)
-            _interceptorConstructors = new ArrayList();
+        if (_interceptorDefinitions == null)
+            _interceptorDefinitions = new ArrayList();
 
-        _interceptorConstructors.add(constructor);
+        _interceptorDefinitions.add(definition);
     }
 
     public synchronized Class getServiceInterface()
@@ -108,6 +108,9 @@
 
     public String getServiceInterfaceClassName()
     {
+        if (_definition == null)
+            return null;
+        
         return _definition.getInterfaceClassName();
     }
 
@@ -196,30 +199,39 @@
 
     public String getServiceModel()
     {
+        if (_definition == null)
+            return null;
+
         return getImplementationDefinition().getServiceModel();
     }
 
     public void clearConstructorInformation()
     {
-        _interceptorConstructors = null;
+        _interceptorDefinitions = null;
     }
 
     // Hm. Does this need to be synchronized?
 
-    public List getOrderedInterceptorContributions()
+    /**
+     * @return  Ordered list of {@link ServiceInterceptorDefinition}s 
+     */
+   public List getOrderedInterceptorContributions()
     {
         if (!_interceptorsOrdered)
         {
-            _interceptorConstructors = orderInterceptors();
+            _interceptorDefinitions = orderInterceptors();
             _interceptorsOrdered = true;
         }
 
-        return _interceptorConstructors;
+        return _interceptorDefinitions;
     }
 
+    /**
+     * @return  Ordered list of {@link ServiceInterceptorDefinition}s 
+     */
     private List orderInterceptors()
     {
-        if (HiveMind.isEmpty(_interceptorConstructors))
+        if (HiveMind.isEmpty(_interceptorDefinitions))
             return null;
 
         // Any error logging should go to the extension point
@@ -230,10 +242,10 @@
         Orderer orderer = new Orderer(log, getModule().getErrorHandler(), ImplMessages
                 .interceptorContribution());
 
-        Iterator i = _interceptorConstructors.iterator();
+        Iterator i = _interceptorDefinitions.iterator();
         while (i.hasNext())
         {
-            ServiceInterceptorConstructor sic = (ServiceInterceptorConstructor) i.next();
+            ServiceInterceptorDefinition sid = (ServiceInterceptorDefinition) i.next();
 
             // Sort them into runtime excecution order. When we build
             // the interceptor stack we'll apply them in reverse order,
@@ -242,13 +254,13 @@
             String precedingNames = null;
             String followingNames = null;
             // Check if info about ordering is available
-            if (sic instanceof Orderable) {
-                Orderable orderable = (Orderable) sic;
+            if (sid instanceof Orderable) {
+                Orderable orderable = (Orderable) sid;
                 precedingNames = orderable.getPrecedingNames();
                 followingNames = orderable.getFollowingNames();
             }
             
-            orderer.add(sic, sic.getName(), precedingNames, followingNames);
+            orderer.add(sid, sid.getName(), precedingNames, followingNames);
         }
 
         return orderer.getOrderedObjects();
@@ -280,6 +292,9 @@
 
     public ServiceImplementationConstructor getServiceConstructor()
     {
+        if (_definition == null)
+            return null;
+
         return getImplementationDefinition().getServiceConstructor();
     }
 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
Wed Aug 30 02:36:17 2006
@@ -22,6 +22,7 @@
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.ShutdownCoordinator;
 import org.apache.hivemind.definition.ServiceImplementationDefinition;
+import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.events.RegistryShutdownListener;
 import org.apache.hivemind.impl.ConstructableServicePoint;
 import org.apache.hivemind.impl.InterceptorStackImpl;
@@ -81,10 +82,10 @@
 
         for (int i = count - 1; i >= 0; i--)
         {
-            ServiceInterceptorConstructor ic = (ServiceInterceptorConstructor) interceptors
+            ServiceInterceptorDefinition id = (ServiceInterceptorDefinition) interceptors
                     .get(i);
 
-            stack.process(ic);
+            stack.process(id);
         }
 
         // Whatever's on top is the final service.

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/AbstractServiceInterceptorConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/AbstractServiceInterceptorConstructor.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/AbstractServiceInterceptorConstructor.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/AbstractServiceInterceptorConstructor.java
Wed Aug 30 02:36:17 2006
@@ -6,37 +6,17 @@
 
 /**
  * Ancestor for implementions of {@link ServiceInterceptorConstructor}.
- * Reduces the number of methods to implement to one.
  * 
  * @author Achim Huegen
  */
 public abstract class AbstractServiceInterceptorConstructor extends BaseLocatable implements
ServiceInterceptorConstructor
 {
 
-    private String _contributingModuleId;
-    private String _name;
-
-    public AbstractServiceInterceptorConstructor(Location location, String contributingModuleId,
String name)
+    public AbstractServiceInterceptorConstructor(Location location)
     {
         super(location);
-        _contributingModuleId = contributingModuleId;
-        _name = name;
     }
     
     public abstract void constructServiceInterceptor(InterceptorStack interceptorStack, Module
contributingModule);
 
-    public String getContributingModuleId()
-    {
-        return _contributingModuleId;
-    }
-
-    public void setContributingModuleId(String moduleId)
-    {
-        _contributingModuleId = moduleId;
-    }
-    
-    public String getName()
-    {
-        return _name;
-    }
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServiceInterceptorConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServiceInterceptorConstructor.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServiceInterceptorConstructor.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServiceInterceptorConstructor.java
Wed Aug 30 02:36:17 2006
@@ -18,18 +18,10 @@
 import org.apache.hivemind.Locatable;
 
 /**
- * Implementations of this interface may additionally implement the {@link org.apache.hivemind.Orderable}
- * interface if a certain interceptor order is required.
+ * Creates an service interceptor
  */
 public interface ServiceInterceptorConstructor extends Locatable
 {
-    /**
-     * @return Returns the name of the interceptor.
-     */
-    public String getName();
-    
-    public String getContributingModuleId();
-    
     /**
      * Creates a new core service implementation.
      * @param interceptedMethods TODO

Modified: hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/StringHolderModule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/StringHolderModule.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/StringHolderModule.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/StringHolderModule.java
Wed Aug 30 02:36:17 2006
@@ -29,8 +29,7 @@
         ServicePointDefinition sp = helper.addServicePoint("StringHolder", StringHolder.class.getName());
         helper.addSimpleServiceImplementation(sp, StringHolderImpl.class.getName(), serviceModel);
         
-        ServiceInterceptorConstructor constructor = new AbstractServiceInterceptorConstructor(getLocation(),

-                this.getId(), "hivemind.LoggingInterceptor") {
+        ServiceInterceptorConstructor constructor = new AbstractServiceInterceptorConstructor(getLocation())
{
 
             public void constructServiceInterceptor(InterceptorStack interceptorStack, Module
contributingModule)
             {
@@ -38,7 +37,7 @@
                 factory.setFactory((ClassFactory) contributingModule.getService(ClassFactory.class));
                 factory.createInterceptor(interceptorStack, contributingModule, Collections.emptyList());
             }};
-        ServiceInterceptorDefinition interceptor = new ServiceInterceptorDefinition(helper.getModule(),
getLocation(), constructor);
+        ServiceInterceptorDefinition interceptor = new ServiceInterceptorDefinition(helper.getModule(),
"hivemind.LoggingInterceptor", getLocation(), constructor);
         sp.addInterceptor(interceptor);
     }
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/TestServices.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/TestServices.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/TestServices.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/test/hivemind/test/services/TestServices.java
Wed Aug 30 02:36:17 2006
@@ -28,10 +28,10 @@
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.InterceptorStack;
 import org.apache.hivemind.Location;
-import org.apache.hivemind.Orderable;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.ModuleDefinitionHelper;
+import org.apache.hivemind.definition.OrderedServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.internal.AbstractServiceImplementationConstructor;
@@ -92,9 +92,12 @@
         ModuleDefinition module = new SimpleModule();
         ServicePointDefinition servicePoint = module.getServicePoint("Simple");
         
-        servicePoint.addInterceptor(new ServiceInterceptorDefinition(module, newLocation(),
new TrackerServiceInterceptorConstructor("Fred", null, "Barney")));
-        servicePoint.addInterceptor(new ServiceInterceptorDefinition(module, newLocation(),
new TrackerServiceInterceptorConstructor("Barney", null, null)));
-        servicePoint.addInterceptor(new ServiceInterceptorDefinition(module, newLocation(),
new TrackerServiceInterceptorConstructor("Wilma", "Barney", null)));
+        ServiceInterceptorDefinition interceptor1 = new OrderedServiceInterceptorDefinition(module,
"Fred", newLocation(), new TrackerServiceInterceptorConstructor("Fred"), "Barney", null);
+        servicePoint.addInterceptor(interceptor1);
+        ServiceInterceptorDefinition interceptor2 = new OrderedServiceInterceptorDefinition(module,
"Barney", newLocation(), new TrackerServiceInterceptorConstructor("Barney"), null, null);
+        servicePoint.addInterceptor(interceptor2);
+        ServiceInterceptorDefinition interceptor3 = new OrderedServiceInterceptorDefinition(module,
"Wilma", newLocation(), new TrackerServiceInterceptorConstructor("Wilma"), null, "Barney");
+        servicePoint.addInterceptor(interceptor3);
         
         Registry r =
             buildFrameworkRegistry(module);
@@ -112,23 +115,21 @@
 
     }
     
-    class TrackerServiceInterceptorConstructor extends AbstractServiceInterceptorConstructor
implements Orderable
+    class TrackerServiceInterceptorConstructor extends AbstractServiceInterceptorConstructor

     {
-        private String _before;
-        private String _after;
-
-        public TrackerServiceInterceptorConstructor(String name, String before, String after)
+        String _name;
+        
+        public TrackerServiceInterceptorConstructor(String name)
         {
-            super(null, "hivemind.test.services", name);
-            _before = before;
-            _after = after;
+            super(null);
+            _name = name;
         }
 
         public void constructServiceInterceptor(InterceptorStack interceptorStack,
                 Module contributingModule)
         {
             TrackerFactory factory = new TrackerFactory();
-            factory.setName(getName());
+            factory.setName(_name);
             factory.createInterceptor(interceptorStack, contributingModule, null);
         }
 
@@ -137,16 +138,6 @@
             return newLocation();
         }
 
-        public String getFollowingNames()
-        {
-            return _before;
-        }
-
-        public String getPrecedingNames()
-        {
-            return _after;
-        }
-
     }
     
     public void testLogging() throws Exception
@@ -202,8 +193,7 @@
         helper.addSimpleServiceImplementation(sp, implementationClass, ServiceModel.SINGLETON);
         
         // Add logging interceptor
-        ServiceInterceptorConstructor constructor = new AbstractServiceInterceptorConstructor(module.getLocation(),

-                module.getId(), "hivemind.LoggingInterceptor") {
+        ServiceInterceptorConstructor constructor = new AbstractServiceInterceptorConstructor(module.getLocation())
{
 
             public void constructServiceInterceptor(InterceptorStack interceptorStack, Module
contributingModule)
             {
@@ -211,7 +201,7 @@
                 factory.setFactory((ClassFactory) contributingModule.getService(ClassFactory.class));
                 factory.createInterceptor(interceptorStack, contributingModule, interceptedMethods);
             }};
-        ServiceInterceptorDefinition interceptor = new ServiceInterceptorDefinition(module,
module.getLocation(), constructor);
+        ServiceInterceptorDefinition interceptor = new ServiceInterceptorDefinition(module,
"hivemind.LoggingInterceptor", module.getLocation(), constructor);
         sp.addInterceptor(interceptor);
         return buildFrameworkRegistry(module);
     }

Modified: hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestInterceptors.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestInterceptors.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestInterceptors.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestInterceptors.java
Wed Aug 30 02:36:17 2006
@@ -19,11 +19,11 @@
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.hivemind.InterceptorStack;
 import org.apache.hivemind.Location;
-import org.apache.hivemind.Orderable;
+import org.apache.hivemind.definition.ModuleDefinition;
+import org.apache.hivemind.definition.OrderedServiceInterceptorDefinition;
+import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServicePointDefinition;
-import org.apache.hivemind.internal.AbstractServiceInterceptorConstructor;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.Visibility;
 
@@ -65,11 +65,12 @@
 
         ServicePointImpl sp = newServicePoint(l, module);
         
-        final DummyServiceInterceptorConstructor interceptor1 = new DummyServiceInterceptorConstructor(
-                module.getModuleId(), "Interceptor1", null, null);
+        ModuleDefinition moduleDef = createModuleDefinition("module");
+        ServiceInterceptorDefinition interceptor1 = new OrderedServiceInterceptorDefinition(moduleDef,
"Interceptor1", null, null,
+                null, null);
         sp.addInterceptor(interceptor1);
-        final DummyServiceInterceptorConstructor interceptor2 = new DummyServiceInterceptorConstructor(
-                module.getModuleId(), "Interceptor2", null, null);
+        ServiceInterceptorDefinition interceptor2 = new OrderedServiceInterceptorDefinition(moduleDef,
"Interceptor2", null, null,
+                null, null);
         sp.addInterceptor(interceptor2);
         sp.setExtensionPointId("ExtensionPointId");
         final List ordered = sp.getOrderedInterceptorContributions();
@@ -89,11 +90,12 @@
 
         ServicePointImpl sp = newServicePoint(l, module);
         
-        final DummyServiceInterceptorConstructor interceptor1 = new DummyServiceInterceptorConstructor(
-                module.getModuleId(), "Interceptor1", null, null);
+        ModuleDefinition moduleDef = createModuleDefinition("module");
+        ServiceInterceptorDefinition interceptor1 = new OrderedServiceInterceptorDefinition(moduleDef,
"Interceptor1", null, null,
+                null, null);
         sp.addInterceptor(interceptor1);
-        final DummyServiceInterceptorConstructor interceptor2 = new DummyServiceInterceptorConstructor(
-                module.getModuleId(), "Interceptor2", null, "Interceptor1");
+        ServiceInterceptorDefinition interceptor2 = new OrderedServiceInterceptorDefinition(moduleDef,
"Interceptor2", null, null,
+                null, "Interceptor1");
         sp.addInterceptor(interceptor2);
         sp.setExtensionPointId("ExtensionPointId");
         final List ordered = sp.getOrderedInterceptorContributions();
@@ -102,33 +104,5 @@
         assertEquals(interceptor2, ordered.get(0));
         assertEquals(interceptor1, ordered.get(1));
         verifyControls();
-    }
-
-    class DummyServiceInterceptorConstructor extends AbstractServiceInterceptorConstructor
implements Orderable
-    {
-        private String _precedingInterceptorIds;
-        private String _followingInterceptorIds;
-
-        public DummyServiceInterceptorConstructor(String contributingModuleId, String name,
String precedingInterceptorIds, String followingInterceptorIds)
-        {
-            super(null, contributingModuleId, name);
-            _precedingInterceptorIds = precedingInterceptorIds;
-            _followingInterceptorIds = followingInterceptorIds;
-        }
-
-        public void constructServiceInterceptor(InterceptorStack interceptorStack, Module
contributingModule)
-        {
-        }
-
-        public String getFollowingNames()
-        {
-            return _followingInterceptorIds;
-        }
-
-        public String getPrecedingNames()
-        {
-            return _precedingInterceptorIds;
-        }
-
     }
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryInterceptorConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryInterceptorConstructor.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryInterceptorConstructor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryInterceptorConstructor.java
Wed Aug 30 02:36:17 2006
@@ -52,9 +52,9 @@
 
     private String _followingInterceptorIds;
     
-    public InvokeFactoryInterceptorConstructor(Location location, String contributingModuleId,
String name)
+    public InvokeFactoryInterceptorConstructor(Location location)
     {
-        super(location, contributingModuleId, name);
+        super(location);
     }
 
     /**
@@ -62,11 +62,7 @@
      */
     public String getName()
     {
-        if(super.getName() == null )
-        {
-            return _factoryServiceId;
-        }
-        return super.getName();
+        return _factoryServiceId;
     }
     
     public void constructServiceInterceptor(InterceptorStack stack, Module contributingModule)

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java?rev=438434&r1=438433&r2=438434&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
Wed Aug 30 02:36:17 2006
@@ -300,14 +300,13 @@
             _log.debug("Adding " + id + " to service extension point " + qualifiedPointId);
         
         // TODO annotations: generic container for parameter 
-        InvokeFactoryInterceptorConstructor constructor = new InvokeFactoryInterceptorConstructor(id.getLocation(),
-                module.getId(), id.getName());
+        InvokeFactoryInterceptorConstructor constructor = new InvokeFactoryInterceptorConstructor(id.getLocation());
         constructor.setFactoryServiceId(id.getFactoryServiceId());
         constructor.setParameters(id.getParameters());
         constructor.setPrecedingInterceptorIds(id.getAfter());
         constructor.setFollowingInterceptorIds(id.getBefore());
         ServiceInterceptorDefinition interceptor = new ServiceInterceptorDefinition(
-                module, id.getLocation(), constructor);
+                module, id.getName(), id.getLocation(), constructor);
         module.addServiceInterceptor(qualifiedPointId, interceptor);
     }
 



Mime
View raw message