hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r489659 - in /hivemind/branches/branch-2-0-annot: 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/ant/ ...
Date Fri, 22 Dec 2006 14:17:30 GMT
Author: ahuegen
Date: Fri Dec 22 06:17:28 2006
New Revision: 489659

URL: http://svn.apache.org/viewvc?view=rev&rev=489659
Log:
Cleaned up definition interfaces
Removed setter methods
Moved visibility checks to definition

Modified:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationPointDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ContributionDefinition.java
    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/DefinitionStrings.properties
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceImplementationDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServicePointDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ContributionDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.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/ExtensionResolver.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/ImplStrings.properties
    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/xml/src/java/org/apache/hivemind/ant/RegistrySerializer.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/HiveMindSchemaParser.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlContributionImpl.java

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java
Fri Dec 22 06:17:28 2006
@@ -4,5 +4,5 @@
 
 public interface ConfigurationParser
 {
-    public Object parseContribution(ContributionContext context, Object data);
+    public Object parse(ContributionContext context, Object data);
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationPointDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationPointDefinition.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationPointDefinition.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationPointDefinition.java
Fri Dec 22 06:17:28 2006
@@ -1,7 +1,8 @@
 package org.apache.hivemind.definition;
 
 import java.util.Collection;
-import java.util.List;
+
+import org.apache.hivemind.ApplicationRuntimeException;
 
 public interface ConfigurationPointDefinition extends ExtensionPointDefinition
 {
@@ -11,10 +12,18 @@
 
     public Occurances getExpectedContributions();
 
-    public List getContributions();
+    public Collection getContributions();
 
+    /**
+     * @param contribution
+     * @throws ApplicationRuntimeException  if this point is not visible from contribution
+     */
     public void addContribution(ContributionDefinition contribution);
 
+    /**
+     * @param parser
+     * @throws ApplicationRuntimeException  if this point is not visible from parser
+     */
     public void addParser(ConfigurationParserDefinition parser);
     
     public ConfigurationParserDefinition getParser(String inputFormat);

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ContributionDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ContributionDefinition.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ContributionDefinition.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ContributionDefinition.java
Fri Dec 22 06:17:28 2006
@@ -4,7 +4,7 @@
 
 public interface ContributionDefinition extends ExtensionDefinition
 {
-    public Contribution getContributionConstructor();
+    public Contribution getContribution();
 
     /**
      * @return  true if the contribution is the initial one to be processed first. Only one

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?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- 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
Fri Dec 22 06:17:28 2006
@@ -15,7 +15,6 @@
 package org.apache.hivemind.definition;
 
 import org.apache.hivemind.impl.MessageFormatter;
-import org.apache.hivemind.util.IdUtils;
 
 /**
  * Used to format messages used in errors and log output for classes within the definition
package.
@@ -37,22 +36,21 @@
     public static String wrongNumberOfContributions(ModuleDefinition definingModule, ConfigurationPointDefinition
point, int actualCount,
             Occurances expectation)
     {
-        String fullyQualifiedId = IdUtils.qualify(definingModule.getId(), point.getId());
         return _formatter.format(
                 "wrong-number-of-contributions",
-                fullyQualifiedId,
+                point.getFullyQualifiedId(),
                 contributionCount(actualCount),
                 occurances(expectation));
     }
 
-    public static String duplicateServicePointId(String pointId, String moduleId)
+    public static String duplicateServicePointId(String pointId, ModuleDefinition module)
     {
-        return _formatter.format("duplicate-service-point", pointId, moduleId);
+        return _formatter.format("duplicate-service-point", pointId, module.getId());
     }
 
-    public static String duplicateConfigurationPointId(String pointId, String moduleId)
+    public static String duplicateConfigurationPointId(String pointId, ModuleDefinition module)
     {
-        return _formatter.format("duplicate-configuration-point", pointId, moduleId);
+        return _formatter.format("duplicate-configuration-point", pointId, module.getId());
     }
 
     public static String contributionCount(int count)
@@ -89,13 +87,22 @@
     {
         return _formatter.format(
                 "configuration-point-not-visible",
-                point.getId(),
+                point.getFullyQualifiedId(),
                 contributingModule.getId());
     }
 
-    public static String duplicateParserInputFormat(String inputFormat, String id)
+    public static String duplicateParserInputFormat(String inputFormat, ConfigurationPointDefinition
cp)
     {
-        return _formatter.format("duplicate-parser-inputformat", inputFormat, id);
+        return _formatter.format("duplicate-parser-inputformat", inputFormat, cp.getFullyQualifiedId());
     }
 
+
+    public static String servicePointNotVisible(ServicePointDefinition point, ModuleDefinition
contributingModule)
+    {
+        return _formatter.format(
+                "service-point-not-visible",
+                point.getFullyQualifiedId(),
+                contributingModule.getId());
+    }
+    
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionStrings.properties
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionStrings.properties?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionStrings.properties
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/DefinitionStrings.properties
Fri Dec 22 06:17:28 2006
@@ -20,6 +20,7 @@
 unknown-configuration-extension-point=Module {0} has contributed to unknown configuration
point {1}. The contribution has been ignored.
 unknown-service-extension-point=Module {0} contributed to unknown service point {1}. The
contribution has been ignored.
 configuration-point-not-visible=Configuration point {0} is not visible to module {1}.
+service-point-not-visible=Service point {0} is not visible to module {1}.
 
 occurances.NONE=no contributions
 occurances.OPTIONAL=an optional contribution

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinition.java
Fri Dec 22 06:17:28 2006
@@ -11,24 +11,16 @@
 
     public ClassResolver getClassResolver();
 
-    public void setClassResolver(ClassResolver classResolver);
-
     public Location getLocation();
 
-    public void setLocation(Location location);
-
     public String getId();
 
-    public void setId(String moduleId);
-
     /**
      * 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.
      */
     public String getPackageName();
 
-    public void setPackageName(String packageName);
-
     /**
      * Adds a service point definition to the module.
      * @param servicePoint  the service point
@@ -66,7 +58,7 @@
     public void addContribution(String qualifiedConfigurationPointId,
             ContributionDefinition contribution);
 
-    public void addParser(String qualifiedConfigurationPointId,
+    public void addConfigurationParser(String qualifiedConfigurationPointId,
             ConfigurationParserDefinition parser);
     
     public Collection getContributions();

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ModuleDefinitionHelper.java
Fri Dec 22 06:17:28 2006
@@ -40,6 +40,7 @@
             ImplementationConstructor constructor, String serviceModel
             )
     {
+        // These implementations override the inline implementations, so default is true
here
         ServiceImplementationDefinition result = new ServiceImplementationDefinitionImpl(_module,
_module
                 .getLocation(), constructor, serviceModel, true);
         servicePoint.addImplementation(result);

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceImplementationDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceImplementationDefinition.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceImplementationDefinition.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServiceImplementationDefinition.java
Fri Dec 22 06:17:28 2006
@@ -8,8 +8,6 @@
 
     public boolean isDefault();
 
-    public void setDefault(boolean isDefault);
-
     public ImplementationConstructor getServiceConstructor();
 
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServicePointDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServicePointDefinition.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServicePointDefinition.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ServicePointDefinition.java
Fri Dec 22 06:17:28 2006
@@ -1,19 +1,19 @@
 package org.apache.hivemind.definition;
 
-import java.util.List;
+import java.util.Collection;
 
 public interface ServicePointDefinition extends ExtensionPointDefinition
 {
 
     public String getInterfaceClassName();
 
-    public List getImplementations();
+    public Collection getImplementations();
 
     public ServiceImplementationDefinition getDefaultImplementation();
 
     public void addImplementation(ServiceImplementationDefinition implementation);
 
-    public List getInterceptors();
+    public Collection getInterceptors();
 
     public void addInterceptor(ServiceInterceptorDefinition interceptor);
 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java
Fri Dec 22 06:17:28 2006
@@ -23,11 +23,17 @@
         _parserConstructor = parserConstructor;
     }
     
+    /**
+     * @see org.apache.hivemind.definition.ConfigurationParserDefinition#getInputFormat()
+     */
     public String getInputFormat()
     {
         return _inputFormat;
     }
 
+    /**
+     * @see org.apache.hivemind.definition.ConfigurationParserDefinition#getParserConstructor()
+     */
     public ConfigurationParserConstructor getParserConstructor()
     {
         return _parserConstructor;

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationPointDefinitionImpl.java
Fri Dec 22 06:17:28 2006
@@ -3,7 +3,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.hivemind.ApplicationRuntimeException;
@@ -12,6 +11,7 @@
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.ContributionDefinition;
 import org.apache.hivemind.definition.DefinitionMessages;
+import org.apache.hivemind.definition.ExtensionDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.Occurances;
 import org.apache.hivemind.definition.Visibility;
@@ -22,7 +22,7 @@
 
     private Occurances _expectedContributions;
 
-    private List _contributions = new ArrayList();
+    private Collection _contributions = new ArrayList();
     
     private Map _parsers = new HashMap();
 
@@ -74,7 +74,7 @@
     /**
      * @see org.apache.hivemind.definition.ConfigurationPointDefinition#getContributions()
      */
-    public List getContributions()
+    public Collection getContributions()
     {
         return _contributions;
     }
@@ -84,17 +84,35 @@
      */
     public void addContribution(ContributionDefinition contribution)
     {
+        checkVisibility(contribution);
         _contributions.add(contribution);
     }
 
     /**
+     * Checks if Extension can see this configuration point. 
+     * @throws ApplicationRuntimeException  if not visible
+     */
+    private void checkVisibility(ExtensionDefinition extension)
+    {
+        if (Visibility.PRIVATE.equals(getVisibility())
+                && !extension.getModuleId().equals(getModuleId()))
+        {
+            throw new ApplicationRuntimeException(DefinitionMessages.configurationPointNotVisible(
+                    this,
+                    extension.getModule()));
+        }
+    }
+    
+    /**
      * @see org.apache.hivemind.definition.ConfigurationPointDefinition#addParser(org.apache.hivemind.definition.ConfigurationParserDefinition)
      */
     public void addParser(ConfigurationParserDefinition parser)
     {
+        checkVisibility(parser);
+
         if (_parsers.containsKey(parser.getInputFormat())) {
             throw new ApplicationRuntimeException(DefinitionMessages.duplicateParserInputFormat(parser.getInputFormat(),

-                    getId()));
+                    this));
         }
         _parsers.put(parser.getInputFormat(), parser);
     }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ContributionDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ContributionDefinitionImpl.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ContributionDefinitionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ContributionDefinitionImpl.java
Fri Dec 22 06:17:28 2006
@@ -24,9 +24,9 @@
     }
 
     /**
-     * @see org.apache.hivemind.definition.ContributionDefinition#getContributionConstructor()
+     * @see org.apache.hivemind.definition.ContributionDefinition#getContribution()
      */
-    public Contribution getContributionConstructor()
+    public Contribution getContribution()
     {
         return _contributionConstructor;
     }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ModuleDefinitionImpl.java
Fri Dec 22 06:17:28 2006
@@ -40,7 +40,7 @@
 
     private Collection _unresolvedInterceptors = new ArrayList();
     
-    private Collection _unresolvedParsers = new ArrayList();
+    private Collection _unresolvedConfigurationParsers = new ArrayList();
     
     public ModuleDefinitionImpl()
     {
@@ -132,8 +132,8 @@
     public void addServicePoint(ServicePointDefinition servicePoint)
     {
         if (_servicePoints.containsKey(servicePoint.getId())) {
-            throw new ApplicationRuntimeException(DefinitionMessages.duplicateServicePointId(servicePoint.getId(),

-                    getId()));
+            throw new ApplicationRuntimeException(DefinitionMessages.duplicateServicePointId(servicePoint.getFullyQualifiedId(),

+                    this));
         }
         _servicePoints.put(servicePoint.getId(), servicePoint);
     }
@@ -161,7 +161,7 @@
     {
         if (_configurationPoints.containsKey(configurationPoint.getId())) {
             throw new ApplicationRuntimeException(DefinitionMessages.duplicateConfigurationPointId(configurationPoint.getId(),

-                    getId()));
+                    this));
         }
         _configurationPoints.put(configurationPoint.getId(), configurationPoint);
     }
@@ -232,13 +232,13 @@
     }
     
     /**
-     * @see org.apache.hivemind.definition.ModuleDefinition#addParser(java.lang.String, org.apache.hivemind.definition.ConfigurationParserDefinition)
+     * @see org.apache.hivemind.definition.ModuleDefinition#addConfigurationParser(java.lang.String,
org.apache.hivemind.definition.ConfigurationParserDefinition)
      */
-    public void addParser(String qualifiedConfigurationPointId, ConfigurationParserDefinition
parser)
+    public void addConfigurationParser(String qualifiedConfigurationPointId, ConfigurationParserDefinition
parser)
     {
         UnresolvedExtension unresolvedExtension = new UnresolvedExtension(parser,
                 qualifiedConfigurationPointId);
-        _unresolvedParsers.add(unresolvedExtension);
+        _unresolvedConfigurationParsers.add(unresolvedExtension);
     }  
     
     /**
@@ -270,7 +270,7 @@
      */
     public Collection getParsers()
     {
-        return _unresolvedParsers;
+        return _unresolvedConfigurationParsers;
     }
 
   

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServicePointDefinitionImpl.java
Fri Dec 22 06:17:28 2006
@@ -1,10 +1,13 @@
 package org.apache.hivemind.definition.impl;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
-import java.util.List;
 
+import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Location;
+import org.apache.hivemind.definition.DefinitionMessages;
+import org.apache.hivemind.definition.ExtensionDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.ServiceImplementationDefinition;
 import org.apache.hivemind.definition.ServiceInterceptorDefinition;
@@ -15,9 +18,9 @@
 {
     private String _interfaceClassName;
     
-    private List _implementations = new ArrayList();
+    private Collection _implementations = new ArrayList();
 
-    private List _interceptors = new ArrayList(); 
+    private Collection _interceptors = new ArrayList(); 
 
     public ServicePointDefinitionImpl(ModuleDefinition module)
     {
@@ -49,7 +52,7 @@
     /**
      * @see org.apache.hivemind.definition.ServicePointDefinition#getImplementations()
      */
-    public List getImplementations()
+    public Collection getImplementations()
     {
         return _implementations;
     }
@@ -75,17 +78,33 @@
     }
 
     /**
+     * Checks if Extension can see this service point. 
+     * @throws ApplicationRuntimeException  if not visible
+     */
+    private void checkVisibility(ExtensionDefinition extension)
+    {
+        if (Visibility.PRIVATE.equals(getVisibility())
+                && !extension.getModuleId().equals(getModuleId()))
+        {
+            throw new ApplicationRuntimeException(DefinitionMessages.servicePointNotVisible(
+                    this,
+                    extension.getModule()));
+        }
+    }
+    
+    /**
      * @see org.apache.hivemind.definition.ServicePointDefinition#addImplementation(org.apache.hivemind.definition.ServiceImplementationDefinition)
      */
     public void addImplementation(ServiceImplementationDefinition implementation)
     {
+        checkVisibility(implementation);
         _implementations.add(implementation);
     }
     
     /**
      * @see org.apache.hivemind.definition.ServicePointDefinition#getInterceptors()
      */
-    public List getInterceptors()
+    public Collection getInterceptors()
     {
         return _interceptors;
     }
@@ -95,6 +114,7 @@
      */
     public void addInterceptor(ServiceInterceptorDefinition interceptor)
     {
+        checkVisibility(interceptor);
         _interceptors.add(interceptor);
     }
 }

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?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- 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
Fri Dec 22 06:17:28 2006
@@ -19,6 +19,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -82,7 +83,7 @@
         builder.append("expectedCount", _expectedCount);
     }
     
-    public List getContributions()
+    public Collection getContributions()
     {
         return getConfigurationPointDefinition().getContributions();
     }
@@ -188,20 +189,19 @@
         if (LOG.isDebugEnabled())
             LOG.debug("Constructing extension point " + getExtensionPointId());
 
-        List contributions = getContributions();
+        Collection contributions = getContributions();
         
-        int count = 0;
-        if (contributions != null)
-            count = contributions.size();
+        if (contributions == null)
+            return;
 
         try
         {
-            for (int i = 0; i < count; i++)
+            for (Iterator iterContrib = contributions.iterator(); iterContrib.hasNext();)
             {
-                ContributionDefinition cd = (ContributionDefinition) contributions.get(i);
+                ContributionDefinition cd = (ContributionDefinition) iterContrib.next();
                 Module definingModule = getModule().getRegistry().getModule(cd.getModuleId());
                 ContributionContext context = new ContributionContextImpl(definingModule,
this);
-                cd.getContributionConstructor().contribute(context);
+                cd.getContribution().contribute(context);
             }
             // For backward compatibility create empty collections if nothing was contributed
             if (_configuration == null) {

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ExtensionResolver.java
Fri Dec 22 06:17:28 2006
@@ -150,24 +150,12 @@
                         unresolved.getExtension().getLocation(),
                         null);
             } else {
-                if (Visibility.PRIVATE.equals(configurationPoint.getVisibility())
-                   && !module.getId().equals(IdUtils.extractModule(configurationPointId)))
{
-                    // TODO: Ids are not qualified
-                    _errorHandler.error(
-                            LOG,
-                            DefinitionMessages.configurationPointNotVisible(
-                                    configurationPoint,
-                                    module),
-                            unresolved.getExtension().getLocation(),
-                            null);
-                    
-                }
-                
                 configurationPoint.addContribution((ContributionDefinition) unresolved.getExtension());
             }
             iter.remove();
         }
     }
+    
     private void resolveConfigurationParsers(ModuleDefinition module)
     {
         for (Iterator iter = module.getParsers().iterator(); iter.hasNext();)

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?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- 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
Fri Dec 22 06:17:28 2006
@@ -230,14 +230,6 @@
                 convertModule(module));
     }
 
-    static String servicePointNotVisible(ServicePoint point, Module contributingModule)
-    {
-        return _formatter.format(
-                "service-point-not-visible",
-                point.getExtensionPointId(),
-                contributingModule.getModuleId());
-    }
-
     static String unableToMapConfiguration(ConfigurationPoint point)
     {
         return _formatter.format("unable-to-map-configuration", point.getExtensionPointId());

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
Fri Dec 22 06:17:28 2006
@@ -47,8 +47,6 @@
 service-not-visible=Service point {0} is not visible to {1}.
 configuration-not-visible=Configuration point {0} is not visible to {1}.
 
-service-point-not-visible=Service point {0} is not visible to module {1}.
-
 unable-to-map-configuration=Unable to map the contributions to configuration point {0}. All
top-level schema elements must define a key attribute.
 unable-to-convert-type=Unable to convert type ''{0}'' to a Java class, either as is, or in
package {1}.
 

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?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- 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
Fri Dec 22 06:17:28 2006
@@ -14,7 +14,6 @@
 
 package org.apache.hivemind.impl;
 
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.Locale;
 
@@ -22,11 +21,8 @@
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.ShutdownCoordinator;
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
-import org.apache.hivemind.definition.ContributionDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
-import org.apache.hivemind.definition.ServiceImplementationDefinition;
-import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.definition.impl.ModuleDefinitionImpl;
 import org.apache.hivemind.internal.Module;
@@ -151,9 +147,6 @@
 
             point.setShutdownCoordinator(_shutdownCoordinator);
 
-            addImplementation(sd, point, module);
-            addInterceptors(sd, point, module);
-            
             _infrastructure.addServicePoint(point);
         }
     }
@@ -174,87 +167,9 @@
 
             point.setShutdownCoordinator(_shutdownCoordinator);
 
-            addContributions(cpd, point, module);
-            
             _infrastructure.addConfigurationPoint(point);
 
         }
     }
 
-    private void addImplementation(ServicePointDefinition sd, ServicePointImpl point, Module
sourceModule)
-    {
-        ServiceImplementationDefinition impl = sd.getDefaultImplementation();
-
-        if (impl == null) {
-            // This is possible if a module defines the service interface only and no implementation
-            // is contributed. It's handled in ServicePointImpl
-        } else {
-            if (_log.isDebugEnabled())
-                _log.debug("Adding implementation to service extension point " + point.getExtensionPointId());
-    
-            // TODO annotations: Visibility
-            if (!point.visibleToModule(sourceModule))
-            {
-                _errorHandler.error(
-                        _log,
-                        ImplMessages.servicePointNotVisible(point, sourceModule),
-                        sd.getLocation(),
-                        null);
-                return;
-            }
-    
-        }
-    }
-    
-    private void addContributions(ConfigurationPointDefinition cpd, ConfigurationPointImpl
point, Module sourceModule)
-    {
-        for (Iterator contributions = cpd.getContributions().iterator(); contributions.hasNext();)
-        {
-            ContributionDefinition cd = (ContributionDefinition) contributions.next();
-    
-//            if (_log.isDebugEnabled())
-//                _log.debug("Adding interceptor " + id. + " to service extension point "
+ pointId);
-
-//            String sourceModuleId = sourceModule.getModuleId();
-    
-            // TODO annotations: move error handling to configuration point definition
-            if (!point.visibleToModule(sourceModule))
-            {
-                _errorHandler.error(_log, ImplMessages.configurationNotVisible(point.getExtensionPointId(),
sourceModule), cpd
-                        .getLocation(), null);
-                return;
-            }
-    
-        }
-        
-    }
-
-    private void addInterceptors(ServicePointDefinition sd, ServicePointImpl point, Module
sourceModule)
-    {
-        String pointId = point.getExtensionPointId();
-
-        for (Iterator interceptors = sd.getInterceptors().iterator(); interceptors.hasNext();)
-        {
-            ServiceInterceptorDefinition id = (ServiceInterceptorDefinition) interceptors.next();
-    
-//            if (_log.isDebugEnabled())
-//                _log.debug("Adding interceptor " + id. + " to service extension point "
+ pointId);
-
-//            String sourceModuleId = sourceModule.getModuleId();
-    
-            // TODO annotations: move error handling to service point definition
-            if (!point.visibleToModule(sourceModule))
-            {
-                _errorHandler.error(_log, ImplMessages.servicePointNotVisible(point, sourceModule),
id
-                        .getLocation(), null);
-                continue;
-            }
-    
-        }
-    }
-
-    private static int size(Collection c)
-    {
-        return c == null ? 0 : c.size();
-    }
 }

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?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- 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
Fri Dec 22 06:17:28 2006
@@ -14,6 +14,7 @@
 
 package org.apache.hivemind.impl;
 
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
@@ -222,7 +223,7 @@
      */
     private List orderInterceptors()
     {
-        List interceptorDefinitions = getServicePointDefinition().getInterceptors();
+        Collection interceptorDefinitions = getServicePointDefinition().getInterceptors();
         if (HiveMind.isEmpty(interceptorDefinitions))
             return null;
 

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/ant/RegistrySerializer.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/ant/RegistrySerializer.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/ant/RegistrySerializer.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/ant/RegistrySerializer.java
Fri Dec 22 06:17:28 2006
@@ -81,6 +81,21 @@
  * <li>Unqualified ids are converted to qualified ids (whereever possible).
  * </ul>
  * 
+ * HINT: In Version 2.0 this class is broken. 
+ * Since registry definitions are no longer xml centric and a lot of other concepts are generalized
too
+ * (for example schemas are hidden by ConfigurationParsers now) it's much more difficult
to
+ * build a visualization of a registry. 
+ * A possible solution: Build up a registry of renderers. Each renderer is responsible for

+ * rendering a certain type of definition object (ConfigurationPointDefinition, COnfigurationParserDefinition)
+ * The renderers are contributed by the core modules (framework, xml, annotation) for example
+ * via the manifest. 
+ * The serializer then traverses a registry definition and searches for the renderer best
+ * fitting the current element. The XmlContributionImpl could be rendered by a standard 
+ * contribution renderer or if registered by a specialized xml contribution renderer.
+ * All renderers must adhere to some general xml structur, they can't introduce new elements
+ * because the xslt wouldn't know how to deal with them. 
+ *  
+ *   
  * @author Knut Wannheden
  * @since 1.1
  */
@@ -310,7 +325,7 @@
             servicePoint.appendChild(instanceBuilder);
         }
 
-        List interceptors = spd.getInterceptors();
+        Collection interceptors = spd.getInterceptors();
 
         if (interceptors != null)
         {

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/HiveMindSchemaParser.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/HiveMindSchemaParser.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/HiveMindSchemaParser.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/HiveMindSchemaParser.java
Fri Dec 22 06:17:28 2006
@@ -42,9 +42,9 @@
 
     /**
      * @param  a list of {@link Element}s
-     * @see org.apache.hivemind.definition.ConfigurationParser#parseContribution(org.apache.hivemind.definition.construction.ContributionContext,
java.lang.Object)
+     * @see org.apache.hivemind.definition.ConfigurationParser#parse(org.apache.hivemind.definition.construction.ContributionContext,
java.lang.Object)
      */
-    public Object parseContribution(ContributionContext context, Object data)
+    public Object parse(ContributionContext context, Object data)
     {
         SchemaProcessorImpl processor = new SchemaProcessorImpl(context.getConfigurationPoint()
                 .getErrorLog(), _schema);

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlContributionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlContributionImpl.java?view=diff&rev=489659&r1=489658&r2=489659
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlContributionImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlContributionImpl.java
Fri Dec 22 06:17:28 2006
@@ -81,7 +81,7 @@
         } else {
             // Construct and execute the parser
             ConfigurationParser parser = parserDef.getParserConstructor().constructParser(context);
-            Object contribution = parser.parseContribution(context, getElements());
+            Object contribution = parser.parse(context, getElements());
             context.mergeContribution(contribution);
         }
     }



Mime
View raw message