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/27 20:34:14 UTC

svn commit: r500598 - in /hivemind/hivemind2/trunk: framework/src/java/org/apache/hivemind/definition/ framework/src/java/org/apache/hivemind/definition/impl/ framework/src/java/org/apache/hivemind/impl/ xml/src/java/org/apache/hivemind/impl/

Author: ahuegen
Date: Sat Jan 27 11:34:13 2007
New Revision: 500598

URL: http://svn.apache.org/viewvc?view=rev&rev=500598
Log:
Some more javadoc
Made some collections immutable

Modified:
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java
    hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java
    hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java Sat Jan 27 11:34:13 2007
@@ -6,18 +6,35 @@
 import org.apache.hivemind.ClassResolver;
 import org.apache.hivemind.Location;
 
+/**
+ * Defines a module of a {@link RegistryDefinition}. 
+ * A module has its own namespace in which configuration points and service
+ * points are defined.
+ * It can provide extension to extension points in other modules.
+ * 
+ * @author Huegen
+ */
 public interface ModuleDefinition
 {
-
+    /**
+     * @return  the id of the module. It can contain dots.
+     */
+    public String getId();
+    
+    /**
+     * @return  the {@link ClassResolver} used to resolve all classes referenced from 
+     *          elements inside this module.
+     */
     public ClassResolver getClassResolver();
 
+    /** 
+     * @return the location of the module
+     */
     public Location getLocation();
 
-    public String getId();
-
     /**
      * Returns the name of the package to search for class names within. By default, the package
-     * name will match the module id, but this can be overridden in the module descriptor.
+     * name will match the module id.
      */
     public String getPackageName();
 
@@ -29,8 +46,16 @@
     public void addServicePoint(ServicePointDefinition servicePoint)
             throws ApplicationRuntimeException;
 
+    /**
+     * Returns a service point that is identified by its id.
+     * @param id  the service point id (unqualified, without module id)
+     * @return the service point definition
+     */
     public ServicePointDefinition getServicePoint(String id);
 
+    /**
+     * @return  all {@link ServicePointDefinition service points} defined in this module
+     */
     public Collection getServicePoints();
 
     /**
@@ -41,32 +66,93 @@
     public void addConfigurationPoint(ConfigurationPointDefinition configurationPoint)
             throws ApplicationRuntimeException;
 
+    /**
+     * Returns a configuration point that is identified by its id.
+     * @param id  the configuration point id (unqualified, without module id)
+     * @return the configuration point definition
+     */
     public ConfigurationPointDefinition getConfigurationPoint(String id);
 
+    /**
+     * @return  all {@link ConfigurationPointDefinition configuration points} defined in this module
+     */
     public Collection getConfigurationPoints();
 
-    public Collection getDependencies();
-
+    /**
+     * Defines a dependency on another module. The presence of that module
+     * is checked during registry construction.
+     * 
+     * @param dependsOnModuleId  the id of the module this module depends on
+     */
     public void addDependency(String dependsOnModuleId);
 
-    public void addServiceImplementation(String qualifiedServicePointId,
+    /**
+     * @return  the ids of all modules this module depends on
+     */
+    public Collection getDependencies();
+    
+    /**
+     * Adds a implementation for a service point which can be defined in this
+     * module or another module.
+     * 
+     * @param qualifiedServicePointId  the fully qualified service point id
+     * @param implementation  the implementation definition
+     */
+    public void addImplementation(String qualifiedServicePointId,
             ImplementationDefinition implementation);
 
-    public void addServiceInterceptor(String qualifiedServicePointId,
+    /**
+     * @return  all {@link ImplementationDefinition implementations} defined in this module
+     *    by a call to {@link #addServiceImplementation}.
+     */
+    public Collection getImplementations();
+
+    /**
+     * Adds a interceptor for a service point which can be defined in this
+     * module or another module.
+     * 
+     * @param qualifiedServicePointId  the fully qualified service point id
+     * @param interceptor  the interceptor definition
+     */
+    public void addInterceptor(String qualifiedServicePointId,
             InterceptorDefinition interceptor);
 
+    /**
+     * @return  all {@link InterceptorDefinition interceptors} defined in this module
+     *    by a call to {@link #addServiceInterceptor}.
+     */
+    public Collection getInterceptors();
+
+    /**
+     * Adds a contribution for a configuration point which can be defined in this
+     * module or another module.
+     * 
+     * @param qualifiedServicePointId  the fully qualified configuration point id
+     * @param contribution  the contribution definition
+     */
     public void addContribution(String qualifiedConfigurationPointId,
             ContributionDefinition contribution);
-
-    public void addConfigurationParser(String qualifiedConfigurationPointId,
-            ConfigurationParserDefinition parser);
     
+    /**
+     * @return  all {@link ContributionDefinition contributions} defined in this module
+     *    by a call to {@link #addContribution}.
+     */
     public Collection getContributions();
 
-    public Collection getImplementations();
-
-    public Collection getInterceptors();
+    /**
+     * Adds a configuration parser for a configuration point which can be defined in this
+     * module or another module.
+     * 
+     * @param qualifiedServicePointId  the fully qualified configuration point id
+     * @param parser  the parser definition
+     */
+    public void addConfigurationParser(String qualifiedConfigurationPointId,
+            ConfigurationParserDefinition parser);
     
-    public Collection getParsers();
+    /**
+     * @return  all {@link ConfigurationParserDefinition parsers} defined in this module
+     *    by a call to {@link #addConfigurationParser}.
+     */
+    public Collection getConfigurationParsers();
 
 }

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java Sat Jan 27 11:34:13 2007
@@ -7,6 +7,14 @@
 import org.apache.hivemind.impl.CreateClassServiceConstructor;
 import org.apache.hivemind.internal.ServiceModel;
 
+/**
+ * Helper class that offers convenience functions for the definition of modules
+ * and its extension points. All instances created are 
+ * {@link org.apache.hivemind.definition.impl standard implementations} 
+ * of the definition interfaces.
+ * 
+ * @author Achim Huegen
+ */
 public class ModuleDefinitionHelper
 {
     private ModuleDefinition _module;

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/UnresolvedExtension.java Sat Jan 27 11:34:13 2007
@@ -28,6 +28,9 @@
         return _extensionPointId;
     }
 
+    /**
+     * @return  the extension
+     */
     public ExtensionDefinition getExtension()
     {
         return _extension;

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java Sat Jan 27 11:34:13 2007
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -76,7 +77,7 @@
      */
     public Collection getContributions()
     {
-        return _contributions;
+        return Collections.unmodifiableCollection(_contributions);
     }
 
     /**
@@ -122,7 +123,7 @@
      */
     public Collection getParsers()
     {
-        return _parsers.values();
+        return Collections.unmodifiableCollection(_parsers.values());
     }
 
     /**

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java Sat Jan 27 11:34:13 2007
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -151,7 +152,7 @@
      */
     public Collection getServicePoints()
     {
-        return _servicePoints.values();
+        return Collections.unmodifiableCollection(_servicePoints.values());
     }
  
     /**
@@ -179,7 +180,7 @@
      */
     public Collection getConfigurationPoints()
     {
-        return _configurationPoints.values();
+        return Collections.unmodifiableCollection(_configurationPoints.values());
     }
 
     /**
@@ -187,7 +188,7 @@
      */
     public Collection getDependencies()
     {
-        return _dependencies;
+        return Collections.unmodifiableCollection(_dependencies);
     }
     
     /**
@@ -199,9 +200,9 @@
     }
    
     /**
-     * @see org.apache.hivemind.definition.ModuleDefinition#addServiceImplementation(java.lang.String, org.apache.hivemind.definition.ImplementationDefinition)
+     * @see org.apache.hivemind.definition.ModuleDefinition#addImplementation(java.lang.String, org.apache.hivemind.definition.ImplementationDefinition)
      */
-    public void addServiceImplementation(String qualifiedServicePointId,
+    public void addImplementation(String qualifiedServicePointId,
             ImplementationDefinition implementation)
     {
         UnresolvedExtension unresolvedExtension = new UnresolvedExtension(implementation,
@@ -210,9 +211,9 @@
     }
 
     /**
-     * @see org.apache.hivemind.definition.ModuleDefinition#addServiceInterceptor(java.lang.String, org.apache.hivemind.definition.InterceptorDefinition)
+     * @see org.apache.hivemind.definition.ModuleDefinition#addInterceptor(java.lang.String, org.apache.hivemind.definition.InterceptorDefinition)
      */
-    public void addServiceInterceptor(String qualifiedServicePointId,
+    public void addInterceptor(String qualifiedServicePointId,
             InterceptorDefinition interceptor)
     {
         UnresolvedExtension unresolvedExtension = new UnresolvedExtension(interceptor,
@@ -266,9 +267,9 @@
     }
 
     /**
-     * @see org.apache.hivemind.definition.ModuleDefinition#getParsers()
+     * @see org.apache.hivemind.definition.ModuleDefinition#getConfigurationParsers()
      */
-    public Collection getParsers()
+    public Collection getConfigurationParsers()
     {
         return _unresolvedConfigurationParsers;
     }

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/RegistryDefinitionImpl.java Sat Jan 27 11:34:13 2007
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -72,7 +73,7 @@
      */
     public List getPostProcessors()
     {
-        return _postProcessors;
+        return Collections.unmodifiableList(_postProcessors);
     }
 
     /**
@@ -88,7 +89,7 @@
      */
     public List getRegistryInitializationListeners()
     {
-        return _initializationListeners;
+        return Collections.unmodifiableList(_initializationListeners);
     }
     
     /**
@@ -96,7 +97,7 @@
      */
     public Collection getModules()
     {
-        return _modules.values();
+        return Collections.unmodifiableCollection(_modules.values());
     }
 
     /**

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java Sat Jan 27 11:34:13 2007
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 
 import org.apache.hivemind.ApplicationRuntimeException;
@@ -54,7 +55,7 @@
      */
     public Collection getImplementations()
     {
-        return _implementations;
+        return Collections.unmodifiableCollection(_implementations);
     }
     
     /**
@@ -106,7 +107,7 @@
      */
     public Collection getInterceptors()
     {
-        return _interceptors;
+        return Collections.unmodifiableCollection(_interceptors);
     }
 
     /**

Modified: hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java (original)
+++ hivemind/hivemind2/trunk/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java Sat Jan 27 11:34:13 2007
@@ -158,7 +158,7 @@
     
     private void resolveConfigurationParsers(ModuleDefinition module)
     {
-        for (Iterator iter = module.getParsers().iterator(); iter.hasNext();)
+        for (Iterator iter = module.getConfigurationParsers().iterator(); iter.hasNext();)
         {
             UnresolvedExtension unresolved = (UnresolvedExtension) iter.next();
             String configurationPointId = unresolved.getExtensionPointId();

Modified: hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java?view=diff&rev=500598&r1=500597&r2=500598
==============================================================================
--- hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java (original)
+++ hivemind/hivemind2/trunk/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java Sat Jan 27 11:34:13 2007
@@ -197,7 +197,7 @@
             ServiceImplementationDefinitionImpl implementation = new ServiceImplementationDefinitionImpl(
                     sourceModule, builder.getLocation(), builder.createConstructor(sourceModule.getId()),
                     builder.getServiceModel(), false);
-            sourceModule.addServiceImplementation(qualifiedPointId, implementation); 
+            sourceModule.addImplementation(qualifiedPointId, implementation); 
         }
         
         int count = size(interceptors);
@@ -319,7 +319,7 @@
         constructor.setFollowingInterceptorIds(id.getBefore());
         ServiceInterceptorDefinitionImpl interceptor = new ServiceInterceptorDefinitionImpl(
                 module, id.getName(), id.getLocation(), constructor);
-        module.addServiceInterceptor(qualifiedPointId, interceptor);
+        module.addInterceptor(qualifiedPointId, interceptor);
     }
 
     /**