You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by ah...@apache.org on 2007/01/25 18:03:17 UTC

svn commit: r499850 - in /hivemind/hivemind2/trunk: annotations/src/java/org/apache/hivemind/annotations/ annotations/src/test/org/apache/hivemind/annotations/ framework/src/java/org/apache/hivemind/definition/ framework/src/java/org/apache/hivemind/de...

Author: ahuegen
Date: Thu Jan 25 09:03:15 2007
New Revision: 499850

URL: http://svn.apache.org/viewvc?view=rev&rev=499850
Log:
RegistryDefinition is now an interface.

Added:
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java
      - copied, changed from r499837, hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java
Modified:
    hivemind/hivemind2/trunk/annotations/src/java/org/apache/hivemind/annotations/AnnotatedRegistryBuilder.java
    hivemind/hivemind2/trunk/annotations/src/test/org/apache/hivemind/annotations/AnnotationTestCase.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java
    hivemind/hivemind2/trunk/framework/src/test/hivemind/test/TestRegistryBuilder.java
    hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructureConstructor.java
    hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/service/impl/TestLoggingInterceptorFactory.java
    hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/impl/TestXmlModuleDescriptorProcessor.java

Modified: hivemind/hivemind2/trunk/annotations/src/java/org/apache/hivemind/annotations/AnnotatedRegistryBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/annotations/src/java/org/apache/hivemind/annotations/AnnotatedRegistryBuilder.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/annotations/src/java/org/apache/hivemind/annotations/AnnotatedRegistryBuilder.java (original)
+++ hivemind/hivemind2/trunk/annotations/src/java/org/apache/hivemind/annotations/AnnotatedRegistryBuilder.java Thu Jan 25 09:03:15 2007
@@ -6,6 +6,7 @@
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.impl.DefaultClassResolver;
 import org.apache.hivemind.impl.DefaultErrorHandler;
 import org.apache.hivemind.impl.RegistryBuilder;
@@ -50,7 +51,7 @@
     
     private RegistryDefinition constructRegistryDefinition(String ... moduleClassNames)
     {
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         for (int i = 0; i < moduleClassNames.length; i++)
         {
@@ -64,7 +65,7 @@
     
     private RegistryDefinition constructRegistryDefinition(Class ... moduleClasses)
     {
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         for (int i = 0; i < moduleClasses.length; i++)
         {

Modified: hivemind/hivemind2/trunk/annotations/src/test/org/apache/hivemind/annotations/AnnotationTestCase.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/annotations/src/test/org/apache/hivemind/annotations/AnnotationTestCase.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/annotations/src/test/org/apache/hivemind/annotations/AnnotationTestCase.java (original)
+++ hivemind/hivemind2/trunk/annotations/src/test/org/apache/hivemind/annotations/AnnotationTestCase.java Thu Jan 25 09:03:15 2007
@@ -4,6 +4,7 @@
 import org.apache.hivemind.annotations.AnnotatedModuleReader;
 import org.apache.hivemind.annotations.AnnotatedRegistryBuilder;
 import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.impl.DefaultErrorHandler;
 import org.apache.hivemind.test.HiveMindTestCase;
 
@@ -23,7 +24,7 @@
 
     protected RegistryDefinition constructRegistryDefinition(Class ... moduleClasses)
     {
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         for (int i = 0; i < moduleClasses.length; i++)
         {

Added: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java?view=auto&rev=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java (added)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java Thu Jan 25 09:03:15 2007
@@ -0,0 +1,39 @@
+package org.apache.hivemind.definition;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.events.RegistryInitializationListener;
+import org.apache.hivemind.impl.RegistryPostProcessor;
+
+public interface RegistryDefinition
+{
+
+    /**
+     * Adds a module definition.
+     * @param module  the module 
+     * @throws ApplicationRuntimeException  if another module with the same id already exists.
+     */
+    public void addModule(ModuleDefinition module) throws ApplicationRuntimeException;
+
+    public void addPostProcessor(RegistryPostProcessor postProcessor);
+
+    public List getPostProcessors();
+
+    /**
+     * @see RegistryInitializationListener
+     */
+    public void addRegistryInitializationListener(RegistryInitializationListener listener);
+
+    public List getRegistryInitializationListeners();
+
+    public Collection getModules();
+
+    public ModuleDefinition getModule(String id);
+
+    public ServicePointDefinition getServicePoint(String qualifiedServicePointId);
+
+    public ConfigurationPointDefinition getConfigurationPoint(String qualifiedConfigurationPointId);
+
+}
\ No newline at end of file

Copied: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java (from r499837, hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java)
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java?view=diff&rev=499850&p1=hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java&r1=499837&p2=hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java Thu Jan 25 09:03:15 2007
@@ -1,4 +1,4 @@
-package org.apache.hivemind.definition;
+package org.apache.hivemind.definition.impl;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -9,11 +9,17 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.definition.ConfigurationPointDefinition;
+import org.apache.hivemind.definition.DefinitionMessages;
+import org.apache.hivemind.definition.ModuleDefinition;
+import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.events.RegistryInitializationListener;
 import org.apache.hivemind.impl.RegistryPostProcessor;
 import org.apache.hivemind.util.IdUtils;
 
 /**
+ * Implementation of {@link RegistryDefinition}.
  * 
  * The order of additions of 
  * registry parts is arbitrary. For example there is no guarantee that a configuration
@@ -21,9 +27,9 @@
  * 
  * @author Achim Huegen
  */
-public class RegistryDefinition
+public class RegistryDefinitionImpl implements RegistryDefinition
 {
-    private static final Log LOG = LogFactory.getLog(RegistryDefinition.class);
+    private static final Log LOG = LogFactory.getLog(RegistryDefinitionImpl.class);
 
     private Map _modules = new HashMap();
 
@@ -31,14 +37,12 @@
     
     private List _initializationListeners = new ArrayList();
 
-    public RegistryDefinition()
+    public RegistryDefinitionImpl()
     {
     }
     
     /**
-     * Adds a module definition.
-     * @param module  the module 
-     * @throws ApplicationRuntimeException  if another module with the same id already exists.
+     * @see org.apache.hivemind.definition.RegistryDefinition#addModule(org.apache.hivemind.definition.ModuleDefinition)
      */
     public void addModule(ModuleDefinition module) throws ApplicationRuntimeException
     {
@@ -55,39 +59,57 @@
         }
     }
     
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#addPostProcessor(org.apache.hivemind.impl.RegistryPostProcessor)
+     */
     public void addPostProcessor(RegistryPostProcessor postProcessor)
     {
         _postProcessors.add(postProcessor);
     }
 
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#getPostProcessors()
+     */
     public List getPostProcessors()
     {
         return _postProcessors;
     }
 
     /**
-     * @see RegistryInitializationListener
+     * @see org.apache.hivemind.definition.RegistryDefinition#addRegistryInitializationListener(org.apache.hivemind.events.RegistryInitializationListener)
      */
     public void addRegistryInitializationListener(RegistryInitializationListener listener)
     {
         _initializationListeners.add(listener);
     }
 
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#getRegistryInitializationListeners()
+     */
     public List getRegistryInitializationListeners()
     {
         return _initializationListeners;
     }
     
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#getModules()
+     */
     public Collection getModules()
     {
         return _modules.values();
     }
 
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#getModule(java.lang.String)
+     */
     public ModuleDefinition getModule(String id)
     {
         return (ModuleDefinition) _modules.get(id);
     }
 
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#getServicePoint(java.lang.String)
+     */
     public ServicePointDefinition getServicePoint(String qualifiedServicePointId)
     {
         String moduleId = IdUtils.extractModule(qualifiedServicePointId);
@@ -102,6 +124,9 @@
         return servicePoint;
     }
 
+    /**
+     * @see org.apache.hivemind.definition.RegistryDefinition#getConfigurationPoint(java.lang.String)
+     */
     public ConfigurationPointDefinition getConfigurationPoint(String qualifiedConfigurationPointId)
     {
         String moduleId = IdUtils.extractModule(qualifiedConfigurationPointId);

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java Thu Jan 25 09:03:15 2007
@@ -27,12 +27,12 @@
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.Occurances;
 import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.events.RegistryInitializationListener;
 import org.apache.hivemind.internal.RegistryInfrastructure;
 
 /**
- * Class used to build a {@link org.apache.hivemind.Registry} from individual
- * {@link org.apache.hivemind.definition.RegistryDefinition}. 
+ * Class used to build a {@link org.apache.hivemind.Registry} from a {@link org.apache.hivemind.definition.RegistryDefinition}. 
  * A note about threadsafety: The assumption is that a single thread will access the RegistryBuilder
  * at one time (typically, a startup class within some form of server or application). Code here and
  * in many of the related classes is divided into construction-time logic and runtime logic. Runtime
@@ -84,7 +84,7 @@
 
     public RegistryBuilder()
     {
-        this(new RegistryDefinition(), new DefaultErrorHandler());
+        this(new RegistryDefinitionImpl(), new DefaultErrorHandler());
     }
     
     public RegistryBuilder(RegistryDefinition registryDefinition)
@@ -94,7 +94,7 @@
 
     public RegistryBuilder(ErrorHandler errorHandler)
     {
-        this(new RegistryDefinition(), errorHandler);
+        this(new RegistryDefinitionImpl(), errorHandler);
     }
     
     public RegistryBuilder(RegistryDefinition registryDefinition, ErrorHandler errorHandler)

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java Thu Jan 25 09:03:15 2007
@@ -30,6 +30,7 @@
 import org.apache.hivemind.Resource;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.impl.DefaultClassResolver;
 import org.apache.hivemind.impl.LocationImpl;
 import org.apache.hivemind.impl.RegistryBuilder;
@@ -411,7 +412,7 @@
      */
     protected Registry buildFrameworkRegistry(ModuleDefinition[] customModules)
     {
-        RegistryDefinition registryDefinition = new RegistryDefinition();
+        RegistryDefinition registryDefinition = new RegistryDefinitionImpl();
         for (int i = 0; i < customModules.length; i++)
         {
             ModuleDefinition module = customModules[i];

Modified: hivemind/hivemind2/trunk/framework/src/test/hivemind/test/TestRegistryBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/test/hivemind/test/TestRegistryBuilder.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/test/hivemind/test/TestRegistryBuilder.java (original)
+++ hivemind/hivemind2/trunk/framework/src/test/hivemind/test/TestRegistryBuilder.java Thu Jan 25 09:03:15 2007
@@ -18,6 +18,7 @@
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.impl.RegistryBuilder;
 import org.apache.hivemind.service.ClassFactory;
 
@@ -44,7 +45,7 @@
     {
         String duplicateModuleId = "non.unique.module";
 
-        RegistryDefinition registryDefinition = new RegistryDefinition();
+        RegistryDefinition registryDefinition = new RegistryDefinitionImpl();
         registryDefinition.addModule(createModuleDefinition(duplicateModuleId));
         try
         {

Modified: hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructureConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructureConstructor.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructureConstructor.java (original)
+++ hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructureConstructor.java Thu Jan 25 09:03:15 2007
@@ -20,6 +20,7 @@
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.definition.impl.ServicePointDefinitionImpl;
 import org.apache.hivemind.internal.ConfigurationPoint;
 import org.apache.hivemind.internal.RegistryInfrastructure;
@@ -37,7 +38,7 @@
     {
         DefaultErrorHandler errorHandler = new DefaultErrorHandler();
 
-    	RegistryDefinition definition = new RegistryDefinition();
+    	RegistryDefinition definition = new RegistryDefinitionImpl();
     	
         ModuleDefinition fooBar = createModuleDefinition("foo.bar");
 

Modified: hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/service/impl/TestLoggingInterceptorFactory.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/service/impl/TestLoggingInterceptorFactory.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/service/impl/TestLoggingInterceptorFactory.java (original)
+++ hivemind/hivemind2/trunk/framework/src/test/org/apache/hivemind/service/impl/TestLoggingInterceptorFactory.java Thu Jan 25 09:03:15 2007
@@ -25,6 +25,7 @@
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
 import org.apache.hivemind.definition.ImplementationDefinition;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.definition.impl.ServiceImplementationDefinitionImpl;
 import org.apache.hivemind.definition.impl.ServicePointDefinitionImpl;
 import org.apache.hivemind.impl.InterceptorStackImpl;
@@ -124,7 +125,7 @@
      */
     private Registry createRegistry(ImplementationConstructor constructor)
     {
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         ModuleDefinition module = createModuleDefinition("hivemind.tests.serviceByInterface");
         definition.addModule(module);

Modified: hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/impl/TestXmlModuleDescriptorProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/impl/TestXmlModuleDescriptorProcessor.java?view=diff&rev=499850&r1=499849&r2=499850
==============================================================================
--- hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/impl/TestXmlModuleDescriptorProcessor.java (original)
+++ hivemind/hivemind2/trunk/xml/src/test/org/apache/hivemind/impl/TestXmlModuleDescriptorProcessor.java Thu Jan 25 09:03:15 2007
@@ -25,6 +25,7 @@
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
 import org.apache.hivemind.definition.Visibility;
+import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
 import org.apache.hivemind.parse.ConfigurationPointDescriptor;
 import org.apache.hivemind.parse.ContributionDescriptor;
 import org.apache.hivemind.parse.ModuleDescriptor;
@@ -54,7 +55,7 @@
         schema.setId("Baz");
 
         DefaultErrorHandler errorHandler = new DefaultErrorHandler();
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         ModuleDescriptor fooBar = new ModuleDescriptor(null, errorHandler);
         fooBar.setModuleId("foo.bar");
@@ -104,7 +105,7 @@
         schema.setId("Baz");
         schema.setVisibility(Visibility.PRIVATE);
 
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         Location l = newLocation();
 
@@ -148,7 +149,7 @@
 
         Log log = LogFactory.getLog(XmlModuleDescriptorProcessor.class);
 
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         Location l = newLocation();
 
@@ -189,7 +190,7 @@
     {
         ErrorHandler errorHandler = new DefaultErrorHandler();
 
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         replayControls();
 
@@ -229,7 +230,7 @@
     {
         ErrorHandler errorHandler = new DefaultErrorHandler();
 
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         replayControls();
 
@@ -270,7 +271,7 @@
         MockControl ehControl = newControl(ErrorHandler.class);
         ErrorHandler eh = (ErrorHandler) ehControl.getMock();
 
-        RegistryDefinition definition = new RegistryDefinition();
+        RegistryDefinition definition = new RegistryDefinitionImpl();
 
         Log log = LogFactory.getLog(XmlModuleDescriptorProcessor.class);