hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r489635 [1/2] - in /hivemind/branches/branch-2-0-annot: framework/src/java/org/apache/hivemind/definition/ framework/src/java/org/apache/hivemind/definition/construction/ framework/src/java/org/apache/hivemind/definition/impl/ framework/src...
Date Fri, 22 Dec 2006 12:25:22 GMT
Author: ahuegen
Date: Fri Dec 22 04:25:20 2006
New Revision: 489635

URL: http://svn.apache.org/viewvc?view=rev&rev=489635
Log:
Introduced generic ConfigurationParsers in core
Removed all natures

Added:
    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/ConfigurationParserDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/construction/ConfigurationParserConstructor.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaAssignment.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlExtensionResolver.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/
    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/HiveMindSchemaParserConstructor.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlConfigurationPointDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlContributionImpl.java   (contents, props changed)
      - copied, changed from r484592, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlContributionImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlModuleDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/xml/definition/impl/XmlServicePointDefinitionImpl.java
      - copied, changed from r484592, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java
Removed:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryNature.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlContributionImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/natures/
Modified:
    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/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/ExtensionDefinition.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionPointDefinition.java
    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/RegistryDefinition.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/ExtensionDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionPointDefinitionImpl.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/ServiceImplementationDefinitionImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/AbstractExtensionPoint.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.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/RegistryBuilder.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/RegistryInfrastructureImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ConfigurationPoint.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ExtensionPoint.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
    hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructure.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/impl/InvokeFactoryInterceptorConstructor.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestXmlModuleDescriptorProcessor.java

Added: 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=auto&rev=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java (added)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParser.java Fri Dec 22 04:25:20 2006
@@ -0,0 +1,8 @@
+package org.apache.hivemind.definition;
+
+import org.apache.hivemind.definition.construction.ContributionContext;
+
+public interface ConfigurationParser
+{
+    public Object parseContribution(ContributionContext context, Object data);
+}

Added: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParserDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParserDefinition.java?view=auto&rev=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParserDefinition.java (added)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ConfigurationParserDefinition.java Fri Dec 22 04:25:20 2006
@@ -0,0 +1,20 @@
+package org.apache.hivemind.definition;
+
+import org.apache.hivemind.definition.construction.ConfigurationParserConstructor;
+
+/**
+ * Defines a parser for the processing of configuration data that is provided
+ * in a textual format.
+ */
+public interface ConfigurationParserDefinition extends ExtensionDefinition
+{
+    /**
+     * @return  the format of the data the parser can process 
+     */
+    public String getInputFormat();
+    
+    /**
+     * @return  a factory for the construction of a parser instance
+     */
+    public ConfigurationParserConstructor getParserConstructor();
+}

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -1,5 +1,6 @@
 package org.apache.hivemind.definition;
 
+import java.util.Collection;
 import java.util.List;
 
 public interface ConfigurationPointDefinition extends ExtensionPointDefinition
@@ -16,4 +17,9 @@
 
     public void addContribution(ContributionDefinition contribution);
 
+    public void addParser(ConfigurationParserDefinition parser);
+    
+    public ConfigurationParserDefinition getParser(String inputFormat);
+
+    public Collection getParsers();
 }

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -93,4 +93,9 @@
                 contributingModule.getId());
     }
 
+    public static String duplicateParserInputFormat(String inputFormat, String id)
+    {
+        return _formatter.format("duplicate-parser-inputformat", inputFormat, id);
+    }
+
 }

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -15,6 +15,7 @@
 duplicate-module-id=A module with id {0} has already been defined.
 duplicate-service-point=A service point with id {0} has already been defined in module {1}.
 duplicate-configuration-point=A configuration point with id {0} has already been defined in module {1}.
+duplicate-parser-inputformat=A parser for format {0} for configuration point with id {1} has already been defined.
 
 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.

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionDefinition.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionDefinition.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionDefinition.java Fri Dec 22 04:25:20 2006
@@ -4,7 +4,6 @@
 
 public interface ExtensionDefinition
 {
-
     /**
      * @return the id of the module that contributed this extension
      */
@@ -18,9 +17,5 @@
     public Location getLocation();
 
     public void setLocation(Location location);
-
-    public Object getNature(Class natureClass);
-
-    public void addNature(Class natureClass, Object nature);
 
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionPointDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionPointDefinition.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionPointDefinition.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/ExtensionPointDefinition.java Fri Dec 22 04:25:20 2006
@@ -1,7 +1,5 @@
 package org.apache.hivemind.definition;
 
-import java.util.Map;
-
 import org.apache.hivemind.Location;
 
 public interface ExtensionPointDefinition
@@ -24,11 +22,5 @@
     public Visibility getVisibility();
 
     public void setVisibility(Visibility visibility);
-
-    public Object getNature(Class natureClass);
-
-    public Map getNatures();
-
-    public void addNature(Class natureClass, Object nature);
 
 }

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -67,10 +67,15 @@
     public void addContribution(String qualifiedConfigurationPointId,
             ContributionDefinition contribution);
 
+    public void addParser(String qualifiedConfigurationPointId,
+            ConfigurationParserDefinition parser);
+    
     public List getContributions();
 
     public List getImplementations();
 
     public List getInterceptors();
+    
+    public List getParsers();
 
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java Fri Dec 22 04:25:20 2006
@@ -27,8 +27,6 @@
 
     private Map _modules = new HashMap();
 
-    private Map _natures = new HashMap();
-
     private List _postProcessors = new ArrayList();
     
     private List _initializationListeners = new ArrayList();
@@ -88,21 +86,6 @@
     public ModuleDefinition getModule(String id)
     {
         return (ModuleDefinition) _modules.get(id);
-    }
-
-    public Object getNature(Class natureClass)
-    {
-        return _natures.get(natureClass);
-    }
-
-    public void addNature(Class natureClass, Object nature)
-    {
-        _natures.put(natureClass, nature);
-    }
-    
-    public Map getNatures()
-    {
-        return _natures;
     }
 
     public ServicePointDefinition getServicePoint(String qualifiedServicePointId)

Added: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/construction/ConfigurationParserConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/construction/ConfigurationParserConstructor.java?view=auto&rev=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/construction/ConfigurationParserConstructor.java (added)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/construction/ConfigurationParserConstructor.java Fri Dec 22 04:25:20 2006
@@ -0,0 +1,8 @@
+package org.apache.hivemind.definition.construction;
+
+import org.apache.hivemind.definition.ConfigurationParser;
+
+public interface ConfigurationParserConstructor
+{
+    public ConfigurationParser constructParser(ConstructionContext context);
+}

Added: 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=auto&rev=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java (added)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ConfigurationParserDefinitionImpl.java Fri Dec 22 04:25:20 2006
@@ -0,0 +1,35 @@
+package org.apache.hivemind.definition.impl;
+
+import org.apache.hivemind.Location;
+import org.apache.hivemind.definition.ConfigurationParserDefinition;
+import org.apache.hivemind.definition.ModuleDefinition;
+import org.apache.hivemind.definition.construction.ConfigurationParserConstructor;
+
+public class ConfigurationParserDefinitionImpl extends ExtensionDefinitionImpl implements ConfigurationParserDefinition
+{
+    private String _inputFormat;
+    private ConfigurationParserConstructor _parserConstructor;
+
+    public ConfigurationParserDefinitionImpl(ModuleDefinition module)
+    {
+        super(module);
+    }
+    
+    public ConfigurationParserDefinitionImpl(ModuleDefinition module, Location location,
+            String inputFormat, ConfigurationParserConstructor parserConstructor)
+    {
+        super(module, location);
+        _inputFormat = inputFormat;
+        _parserConstructor = parserConstructor;
+    }
+    
+    public String getInputFormat()
+    {
+        return _inputFormat;
+    }
+
+    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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -1,11 +1,17 @@
 package org.apache.hivemind.definition.impl;
 
 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;
 import org.apache.hivemind.Location;
+import org.apache.hivemind.definition.ConfigurationParserDefinition;
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.ContributionDefinition;
+import org.apache.hivemind.definition.DefinitionMessages;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.Occurances;
 import org.apache.hivemind.definition.Visibility;
@@ -17,6 +23,8 @@
     private Occurances _expectedContributions;
 
     private List _contributions = new ArrayList();
+    
+    private Map _parsers = new HashMap();
 
     public ConfigurationPointDefinitionImpl(ModuleDefinition module)
     {
@@ -78,5 +86,34 @@
     {
         _contributions.add(contribution);
     }
+
+    /**
+     * @see org.apache.hivemind.definition.ConfigurationPointDefinition#addParser(org.apache.hivemind.definition.ConfigurationParserDefinition)
+     */
+    public void addParser(ConfigurationParserDefinition parser)
+    {
+        if (_parsers.containsKey(parser.getInputFormat())) {
+            throw new ApplicationRuntimeException(DefinitionMessages.duplicateParserInputFormat(parser.getInputFormat(), 
+                    getId()));
+        }
+        _parsers.put(parser.getInputFormat(), parser);
+    }
+
+    /**
+     * @see org.apache.hivemind.definition.ConfigurationPointDefinition#getParsers()
+     */
+    public Collection getParsers()
+    {
+        return _parsers.values();
+    }
+
+    /**
+     * @see org.apache.hivemind.definition.ConfigurationPointDefinition#getParser(java.lang.String)
+     */
+    public ConfigurationParserDefinition getParser(String inputFormat)
+    {
+        return (ConfigurationParserDefinition) _parsers.get(inputFormat);
+    }
+
 
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionDefinitionImpl.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionDefinitionImpl.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionDefinitionImpl.java Fri Dec 22 04:25:20 2006
@@ -1,8 +1,5 @@
 package org.apache.hivemind.definition.impl;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.hivemind.Location;
 import org.apache.hivemind.definition.ExtensionDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
@@ -12,7 +9,6 @@
 {
     private Location _location;
     private ModuleDefinition _module;
-    private Map _natures = new HashMap();
 
     public ExtensionDefinitionImpl(ModuleDefinition module)
     {
@@ -58,20 +54,4 @@
         _location = location;
     }
 
-    /**
-     * @see org.apache.hivemind.definition.ExtensionDefinition#getNature(java.lang.Class)
-     */
-    public Object getNature(Class natureClass)
-    {
-        return _natures.get(natureClass);
-    }
-
-    /**
-     * @see org.apache.hivemind.definition.ExtensionDefinition#addNature(java.lang.Class, java.lang.Object)
-     */
-    public void addNature(Class natureClass, Object nature)
-    {
-        _natures.put(natureClass, nature);
-    }
-    
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionPointDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionPointDefinitionImpl.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionPointDefinitionImpl.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ExtensionPointDefinitionImpl.java Fri Dec 22 04:25:20 2006
@@ -1,8 +1,5 @@
 package org.apache.hivemind.definition.impl;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.hivemind.Location;
 import org.apache.hivemind.definition.ExtensionPointDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
@@ -19,8 +16,6 @@
 
     private Visibility _visibility;
     
-    private Map _natures = new HashMap();
-
     public ExtensionPointDefinitionImpl(ModuleDefinition module)
     {
         Defense.notNull(module, "module");
@@ -102,30 +97,6 @@
     public void setVisibility(Visibility visibility)
     {
         _visibility = visibility;
-    }
-
-    /**
-     * @see org.apache.hivemind.definition.ExtensionPointDefinitionIF#getNature(java.lang.Class)
-     */
-    public Object getNature(Class natureClass)
-    {
-        return _natures.get(natureClass);
-    }
-    
-    /**
-     * @see org.apache.hivemind.definition.ExtensionPointDefinitionIF#getNatures()
-     */
-    public Map getNatures()
-    {
-        return _natures;
-    }
-
-    /**
-     * @see org.apache.hivemind.definition.ExtensionPointDefinitionIF#addNature(java.lang.Class, java.lang.Object)
-     */
-    public void addNature(Class natureClass, Object nature)
-    {
-        _natures.put(natureClass, nature);
     }
 
 }

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -9,6 +9,7 @@
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.ClassResolver;
 import org.apache.hivemind.Location;
+import org.apache.hivemind.definition.ConfigurationParserDefinition;
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.ContributionDefinition;
 import org.apache.hivemind.definition.DefinitionMessages;
@@ -40,6 +41,8 @@
 
     private List _unresolvedInterceptors = new ArrayList();
     
+    private List _unresolvedParsers = new ArrayList();
+    
     public ModuleDefinitionImpl()
     {
     }
@@ -125,9 +128,9 @@
     }
     
     /**
-     * @see org.apache.hivemind.definition.ModuleDefinition#addServicePoint(org.apache.hivemind.definition.impl.ServicePointDefinition)
+     * @see org.apache.hivemind.definition.ModuleDefinition#addServicePoint(org.apache.hivemind.definition.ServicePointDefinition)
      */
-    public void addServicePoint(ServicePointDefinition servicePoint) throws ApplicationRuntimeException
+    public void addServicePoint(ServicePointDefinition servicePoint)
     {
         if (_servicePoints.containsKey(servicePoint.getId())) {
             throw new ApplicationRuntimeException(DefinitionMessages.duplicateServicePointId(servicePoint.getId(), 
@@ -153,9 +156,9 @@
     }
  
     /**
-     * @see org.apache.hivemind.definition.ModuleDefinition#addConfigurationPoint(org.apache.hivemind.definition.impl.ConfigurationPointDefinition)
+     * @see org.apache.hivemind.definition.ModuleDefinition#addConfigurationPoint(org.apache.hivemind.definition.ConfigurationPointDefinition)
      */
-    public void addConfigurationPoint(ConfigurationPointDefinition configurationPoint) throws ApplicationRuntimeException
+    public void addConfigurationPoint(ConfigurationPointDefinition configurationPoint)
     {
         if (_configurationPoints.containsKey(configurationPoint.getId())) {
             throw new ApplicationRuntimeException(DefinitionMessages.duplicateConfigurationPointId(configurationPoint.getId(), 
@@ -228,7 +231,17 @@
                 qualifiedConfigurationPointId);
         _unresolvedContributions.add(unresolvedExtension);
     }
-
+    
+    /**
+     * @see org.apache.hivemind.definition.ModuleDefinition#addParser(java.lang.String, org.apache.hivemind.definition.ConfigurationParserDefinition)
+     */
+    public void addParser(String qualifiedConfigurationPointId, ConfigurationParserDefinition parser)
+    {
+        UnresolvedExtension unresolvedExtension = new UnresolvedExtension(parser,
+                qualifiedConfigurationPointId);
+        _unresolvedParsers.add(unresolvedExtension);
+    }  
+    
     /**
      * @see org.apache.hivemind.definition.ModuleDefinition#getContributions()
      */
@@ -251,5 +264,12 @@
     public List getInterceptors()
     {
         return _unresolvedInterceptors;
-    }    
+    }
+
+    public List getParsers()
+    {
+        return _unresolvedParsers;
+    }
+
+  
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServiceImplementationDefinitionImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServiceImplementationDefinitionImpl.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServiceImplementationDefinitionImpl.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/impl/ServiceImplementationDefinitionImpl.java Fri Dec 22 04:25:20 2006
@@ -5,18 +5,22 @@
 import org.apache.hivemind.definition.ServiceImplementationDefinition;
 import org.apache.hivemind.definition.construction.ImplementationConstructor;
 
-public class ServiceImplementationDefinitionImpl extends ExtensionDefinitionImpl implements ServiceImplementationDefinition
+public class ServiceImplementationDefinitionImpl extends ExtensionDefinitionImpl implements
+        ServiceImplementationDefinition
 {
     private String _serviceModel;
+
     private ImplementationConstructor _serviceConstructor;
+
     private boolean _isDefault;
-    
+
     public ServiceImplementationDefinitionImpl(ModuleDefinition module)
     {
         super(module);
     }
 
-    public ServiceImplementationDefinitionImpl(ModuleDefinition module, Location location, ImplementationConstructor serviceConstructor, String serviceModel, boolean isDefault)
+    public ServiceImplementationDefinitionImpl(ModuleDefinition module, Location location,
+            ImplementationConstructor serviceConstructor, String serviceModel, boolean isDefault)
     {
         super(module, location);
         _serviceConstructor = serviceConstructor;
@@ -24,10 +28,10 @@
         _isDefault = isDefault;
     }
 
-   /**
- * @see org.apache.hivemind.definition.ServiceImplementationDefinition#getServiceModel()
- */
-public String getServiceModel()
+    /**
+     * @see org.apache.hivemind.definition.ServiceImplementationDefinition#getServiceModel()
+     */
+    public String getServiceModel()
     {
         return _serviceModel;
     }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/AbstractExtensionPoint.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/AbstractExtensionPoint.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/AbstractExtensionPoint.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/AbstractExtensionPoint.java Fri Dec 22 04:25:20 2006
@@ -119,11 +119,6 @@
         return _errorLog;
     }
 
-    public Object getNature(Class natureType)
-    {
-        return _definition.getNature(natureType);
-    }
-
     protected ExtensionPointDefinition getDefinition()
     {
         return _definition;

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java Fri Dec 22 04:25:20 2006
@@ -2,9 +2,11 @@
 
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.HiveMind;
@@ -238,15 +240,19 @@
     {
 
         ConfigurationPointDefinition cpd = helper.addConfigurationPoint("ServiceModels", 
-                List.class.getName());
+                Map.class.getName());
         
         final List serviceModels = getDefaultServiceModels();
         helper.addContributionDefinition(cpd, new Contribution() {
 
             public void contribute(ContributionContext context)
             {
-                List contribution = new ArrayList(); 
-                contribution.addAll(serviceModels);
+                Map contribution = new HashMap(); 
+                for (Iterator iterServiceModels = serviceModels.iterator(); iterServiceModels.hasNext();)
+                {
+                    ServiceModelContribution contrib = (ServiceModelContribution) iterServiceModels.next();
+                    contribution.put(contrib.getName(), contrib);
+                }
                 context.mergeContribution(contribution);
             }});
     }

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -6,6 +6,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.Location;
+import org.apache.hivemind.definition.ConfigurationParserDefinition;
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.ContributionDefinition;
 import org.apache.hivemind.definition.DefinitionMessages;
@@ -38,7 +39,7 @@
     
     private RegistryDefinition _definition;
 
-    public ExtensionResolver(ErrorHandler errorHandler, RegistryDefinition definition)
+    public ExtensionResolver(RegistryDefinition definition, ErrorHandler errorHandler)
     {
         _errorHandler = errorHandler;
         _definition = definition;
@@ -61,6 +62,7 @@
             resolveImplementations(module);
             resolveInterceptors(module);
             resolveContributions(module);
+            resolveConfigurationParsers(module);
         }
     }
 
@@ -162,6 +164,45 @@
                 }
                 
                 configurationPoint.addContribution((ContributionDefinition) unresolved.getExtension());
+            }
+            iter.remove();
+        }
+    }
+    private void resolveConfigurationParsers(ModuleDefinition module)
+    {
+        for (Iterator iter = module.getParsers().iterator(); iter.hasNext();)
+        {
+            UnresolvedExtension unresolved = (UnresolvedExtension) iter.next();
+            String configurationPointId = unresolved.getExtensionPointId();
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Trying to resolve configuration point " + configurationPointId + " referenced by" +
+                        " ConfigurationParser " + logLocation(unresolved.getExtension().getLocation()));
+            }
+            ConfigurationPointDefinition configurationPoint = _definition.getConfigurationPoint(configurationPointId);
+            if (configurationPoint == null)
+            {
+                _errorHandler.error(
+                        LOG,
+                        DefinitionMessages.unknownConfigurationPoint(
+                                IdUtils.extractModule(configurationPointId),
+                                IdUtils.stripModule(configurationPointId)),
+                        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.addParser((ConfigurationParserDefinition) unresolved.getExtension());
             }
             iter.remove();
         }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java Fri Dec 22 04:25:20 2006
@@ -118,7 +118,7 @@
         coreServicesProvider.process(_registryDefinition, _errorHandler);
         
         // Try to resolve all so far unresolved extensions
-        ExtensionResolver extensionResolver = new ExtensionResolver(_errorHandler, _registryDefinition);
+        ExtensionResolver extensionResolver = new ExtensionResolver(_registryDefinition, _errorHandler);
         extensionResolver.resolveExtensions();
         
         checkDependencies(_registryDefinition);

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -17,8 +17,6 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
 
 import org.apache.commons.logging.Log;
 import org.apache.hivemind.ErrorHandler;
@@ -27,7 +25,6 @@
 import org.apache.hivemind.definition.ContributionDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
-import org.apache.hivemind.definition.RegistryNature;
 import org.apache.hivemind.definition.ServiceImplementationDefinition;
 import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServicePointDefinition;
@@ -75,15 +72,6 @@
     public RegistryInfrastructure constructRegistryInfrastructure(RegistryDefinition definition)
     {
         addModules(definition);
-        
-        // Copy natures from registry definition to registry
-        for (Iterator natures = definition.getNatures().entrySet().iterator(); natures.hasNext();)
-        {
-            Map.Entry natureEntry = (Entry) natures.next();
-            RegistryNature nature = (RegistryNature) natureEntry.getValue();
-            nature.setRegistry(_infrastructure);
-            _infrastructure.addNature((Class) natureEntry.getKey(), nature);
-        }
         
         _infrastructure.setShutdownCoordinator(_shutdownCoordinator);
 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java Fri Dec 22 04:25:20 2006
@@ -76,8 +76,6 @@
 
     private ShutdownCoordinator _shutdownCoordinator;
 
-    private Map _natures = new HashMap();
-
     /**
      * Map of {@link org.apache.hivemind.internal.ser.ServiceToken}, keyed on service id.
      * 
@@ -319,7 +317,6 @@
         _serviceModelFactories = null;
         _threadEventNotifier = null;
         _serviceTokens = null;
-        _natures = null;
 
         // It is believed that the cache held by PropertyUtils can affect application shutdown
         // and reload in some servlet containers (such as Tomcat); this should clear that up.
@@ -390,11 +387,11 @@
 
     private void readServiceModelFactories()
     {
-        List l = (List) getConfiguration("hivemind.ServiceModels", null);
+        Map sm = (Map) getConfiguration("hivemind.ServiceModels", null);
 
         _serviceModelFactories = new HashMap();
 
-        Iterator i = l.iterator();
+        Iterator i = sm.values().iterator();
 
         while (i.hasNext())
         {
@@ -541,22 +538,6 @@
 
         }
         return serviceIds;
-    }
-    
-    /**
-     * @see org.apache.hivemind.internal.RegistryInfrastructure#getNature(java.lang.Class)
-     */
-    public Object getNature(Class natureType)
-    {
-        return _natures.get(natureType);
-    }
-
-    /**
-     * @see org.apache.hivemind.internal.RegistryInfrastructure#addNature(java.lang.Class, java.lang.Object)
-     */
-    public void addNature(Class natureType, Object nature)
-    {
-        _natures.put(natureType, nature);
     }
 
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ConfigurationPoint.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ConfigurationPoint.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ConfigurationPoint.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ConfigurationPoint.java Fri Dec 22 04:25:20 2006
@@ -14,6 +14,8 @@
 
 package org.apache.hivemind.internal;
 
+import org.apache.hivemind.definition.ConfigurationPointDefinition;
+
 
 /**
  * An extension point that provides configuration data in the form of a list of elements.
@@ -34,4 +36,5 @@
      */
     public Class getConfigurationType();
 
+    public ConfigurationPointDefinition getConfigurationPointDefinition();
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ExtensionPoint.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ExtensionPoint.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ExtensionPoint.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ExtensionPoint.java Fri Dec 22 04:25:20 2006
@@ -17,7 +17,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.hivemind.ErrorLog;
 import org.apache.hivemind.Locatable;
-import org.apache.hivemind.definition.ExtensionDefinition;
 
 /**
  * Base interface for service and configuration extension points.
@@ -61,10 +60,5 @@
      */
 
     public ErrorLog getErrorLog();
-    
-    /**
-     * Retrieves a nature that has been added to the definition by {@link ExtensionDefinition#addNature(Class, Object)}
-     */
-    public Object getNature(Class natureType);
     
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java Fri Dec 22 04:25:20 2006
@@ -215,16 +215,4 @@
      */
     public Module getModule(String moduleId);
     
-    /**
-     * Adds a new nature to the registry (comparable to an eclipse project nature).
-     * A nature is a decorator class which can store additional information and offer
-     * specific functionality.
-     */
-    public void addNature(Class natureType, Object nature);
-    
-    /**
-     * Retrieves a nature that has been added by {@link #addNature(Class, Object)}
-     */
-    public Object getNature(Class natureType);
-    
 }

Modified: hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructure.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructure.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructure.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestRegistryInfrastructure.java Fri Dec 22 04:25:20 2006
@@ -185,7 +185,7 @@
         cp.visibleToModule( null );
         cpc.setReturnValue( true );
         cp.getConfiguration();
-        cpc.setReturnValue( Collections.EMPTY_LIST );
+        cpc.setReturnValue( Collections.EMPTY_MAP );
         replayControls();
         RegistryInfrastructureImpl r = new RegistryInfrastructureImpl( null, null );
         r.addConfigurationPoint( cp );

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=489635&r1=489634&r2=489635
==============================================================================
--- 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 04:25:20 2006
@@ -42,9 +42,6 @@
 import org.apache.hivemind.impl.ExtensionResolver;
 import org.apache.hivemind.impl.InvokeFactoryServiceConstructor;
 import org.apache.hivemind.impl.RegistryBuilder;
-import org.apache.hivemind.impl.XmlServicePointDefinitionImpl;
-import org.apache.hivemind.impl.natures.XmlConfigurationPointNature;
-import org.apache.hivemind.impl.natures.XmlRegistryNature;
 import org.apache.hivemind.parse.AttributeMappingDescriptor;
 import org.apache.hivemind.parse.ConversionDescriptor;
 import org.apache.hivemind.schema.AttributeModel;
@@ -61,6 +58,7 @@
 import org.apache.hivemind.schema.rules.SetParentRule;
 import org.apache.hivemind.schema.rules.SetPropertyRule;
 import org.apache.hivemind.util.IdUtils;
+import org.apache.hivemind.xml.definition.impl.XmlServicePointDefinitionImpl;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -106,7 +104,7 @@
     public Document createRegistryDocument(RegistryDefinition registryDefinition)
     {
         _registryDefinition = registryDefinition;
-        ExtensionResolver resolver = new ExtensionResolver(_handler, _registryDefinition);
+        ExtensionResolver resolver = new ExtensionResolver(_registryDefinition, _handler);
         resolver.resolveExtensions();
         
         DocumentBuilder builder = getBuilder();
@@ -243,25 +241,25 @@
 //        }
 //    }
 
-    private void processRegistryNatures(Element module)
-    {
-        XmlRegistryNature xmlNature = (XmlRegistryNature) _registryDefinition.getNature(XmlRegistryNature.class);
-        if (xmlNature != null) {
-            addSchemas(module, xmlNature);
-        }
-    }
-
-    private void addSchemas(Element module, XmlRegistryNature xmlNature)
-    {
-        Collection schemas = xmlNature.getSchemas();
-
-        for (Iterator i = schemas.iterator(); i.hasNext();)
-        {
-            SchemaImpl s = (SchemaImpl) i.next();
-
-            addSchema(module, s, "schema");
-        }
-    }
+//    private void processRegistryNatures(Element module)
+//    {
+//        XmlRegistryNature xmlNature = (XmlRegistryNature) _registryDefinition.getNature(XmlRegistryNature.class);
+//        if (xmlNature != null) {
+//            addSchemas(module, xmlNature);
+//        }
+//    }
+//
+//    private void addSchemas(Element module, XmlRegistryNature xmlNature)
+//    {
+//        Collection schemas = xmlNature.getSchemas();
+//
+//        for (Iterator i = schemas.iterator(); i.hasNext();)
+//        {
+//            SchemaImpl s = (SchemaImpl) i.next();
+//
+//            addSchema(module, s, "schema");
+//        }
+//    }
 
 //    private void addSubModules(Element module)
 //    {
@@ -351,7 +349,7 @@
 
 //        configurationPoint.appendChild(_document.createTextNode(cpd.getAnnotation()));
 
-        processConfigurationPointNatures(configurationPoint, cpd);
+//        processConfigurationPointNatures(configurationPoint, cpd);
         
         Collection contributions = cpd.getContributions();
         for (Iterator iter = contributions.iterator(); iter.hasNext();)
@@ -366,21 +364,13 @@
         return configurationPoint;
     }
     
-    private void processConfigurationPointNatures(Element configurationPoint, ConfigurationPointDefinition spd)
-    {
-        XmlConfigurationPointNature xmlNature = (XmlConfigurationPointNature) spd.getNature(XmlConfigurationPointNature.class);
-        if (xmlNature != null) {
-            addConfigurationPointSchemas(configurationPoint, xmlNature);
-        }
-    }
-
-    private void addConfigurationPointSchemas(Element configurationPoint, XmlConfigurationPointNature xmlNature)
-    {
-        if (xmlNature.getSchema() != null)
-            addSchema(configurationPoint, (SchemaImpl) xmlNature.getSchema(), "schema");
-//        else if (cpd.getContributionsSchemaId() != null)
-//            configurationPoint.setAttribute("schema-id", qualify(cpd.getContributionsSchemaId()));
-    }
+//    private void addConfigurationPointSchemas(Element configurationPoint, XmlConfigurationPointNature xmlNature)
+//    {
+//        if (xmlNature.getSchema() != null)
+//            addSchema(configurationPoint, (SchemaImpl) xmlNature.getSchema(), "schema");
+////        else if (cpd.getContributionsSchemaId() != null)
+////            configurationPoint.setAttribute("schema-id", qualify(cpd.getContributionsSchemaId()));
+//    }
 
     private Element getContributionElement(ContributionDefinition cd, String configurationPointId)
     {

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?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- 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 Fri Dec 22 04:25:20 2006
@@ -28,6 +28,7 @@
 import org.apache.hivemind.schema.Schema;
 import org.apache.hivemind.util.Defense;
 import org.apache.hivemind.util.InstanceCreationUtils;
+import org.apache.hivemind.xml.definition.impl.XmlServicePointDefinitionImpl;
 
 /**
  * Constructs a new interceptor by invoking methods on another service (which implements the

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java (original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java Fri Dec 22 04:25:20 2006
@@ -30,6 +30,7 @@
 import org.apache.hivemind.schema.Schema;
 import org.apache.hivemind.util.Defense;
 import org.apache.hivemind.util.InstanceCreationUtils;
+import org.apache.hivemind.xml.definition.impl.XmlServicePointDefinitionImpl;
 
 /**
  * Constructs a new service by invoking methods on another service (which implements the

Added: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaAssignment.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaAssignment.java?view=auto&rev=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaAssignment.java (added)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaAssignment.java Fri Dec 22 04:25:20 2006
@@ -0,0 +1,46 @@
+package org.apache.hivemind.impl;
+
+import org.apache.hivemind.Location;
+
+/**
+ * Helper class used during the processing of xml descriptors.
+ */
+public class SchemaAssignment extends BaseLocatable
+{
+    private String _configurationId;
+    private String _schemaId;
+    
+    public SchemaAssignment(String configurationId, String schemaId, Location location)
+    {
+        super(location);
+        _configurationId = configurationId;
+        _schemaId = schemaId;
+    }
+
+    /**
+     * Returns the id of the configuration the schema should be assigned to
+     */
+    public String getConfigurationId()
+    {
+        return _configurationId;
+    }
+
+    public void setConfigurationId(String string)
+    {
+        _configurationId = string;
+    }
+    
+    /**
+     * @return  the id of the schema that should be assigned to a configuration point.
+     */
+    public String getSchemaId()
+    {
+        return _schemaId;
+    }
+
+    public void setSchemaId(String schemaId)
+    {
+        _schemaId = schemaId;
+    }
+
+}

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java (original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java Fri Dec 22 04:25:20 2006
@@ -1,6 +1,8 @@
 package org.apache.hivemind.impl;
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -59,6 +61,8 @@
         addSymbolSource(moduleDefinition, "ApplicationDefaultsSymbolSource", "ApplicationDefaults");
         
         addSymbolExpander(moduleDefinition, errorHandler);
+        
+        registryDefinition.addPostProcessor(new XmlPostProcessor());
     }
     
     /**
@@ -138,7 +142,8 @@
         // Configuration point for setting defaults for symbol values.
 
         helper.addConfigurationPoint(configurationId, Map.class.getName());
-    }    
+    }  
+    
     /**
      * @see SymbolExpander
      */
@@ -161,4 +166,13 @@
         
     }
 
+}
+
+class XmlPostProcessor implements RegistryPostProcessor
+{
+    public void postprocess(RegistryDefinition registryDefinition, ErrorHandler errorHandler)
+    {
+        XmlExtensionResolver extensionResolver = new XmlExtensionResolver(registryDefinition, errorHandler);
+        extensionResolver.resolveSchemas();
+    }
 }

Added: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlExtensionResolver.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlExtensionResolver.java?view=auto&rev=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlExtensionResolver.java (added)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlExtensionResolver.java Fri Dec 22 04:25:20 2006
@@ -0,0 +1,206 @@
+package org.apache.hivemind.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.ErrorHandler;
+import org.apache.hivemind.Location;
+import org.apache.hivemind.definition.ConfigurationParserDefinition;
+import org.apache.hivemind.definition.ConfigurationPointDefinition;
+import org.apache.hivemind.definition.ModuleDefinition;
+import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.definition.ServicePointDefinition;
+import org.apache.hivemind.definition.UnresolvedExtension;
+import org.apache.hivemind.definition.impl.ConfigurationParserDefinitionImpl;
+import org.apache.hivemind.schema.Schema;
+import org.apache.hivemind.util.IdUtils;
+import org.apache.hivemind.util.UniqueHashMap;
+import org.apache.hivemind.xml.definition.impl.HiveMindSchemaParser;
+import org.apache.hivemind.xml.definition.impl.HiveMindSchemaParserConstructor;
+import org.apache.hivemind.xml.definition.impl.XmlModuleDefinitionImpl;
+import org.apache.hivemind.xml.definition.impl.XmlServicePointDefinitionImpl;
+
+/**
+ * Resolves the {@link UnresolvedExtension unresolved extensions} in all
+ * xml modules of a {@link RegistryDefinition}.
+
+ * @author Achim Huegen
+ */
+public class XmlExtensionResolver
+{
+    private static final Log LOG = LogFactory.getLog(XmlExtensionResolver.class);
+
+    private ErrorHandler _errorHandler;
+    
+    private RegistryDefinition _definition;
+    
+    /**
+     * Global map of all schemas defined in any model. Key is the qualified schema id, value
+     * is an instance of {@link Schema}.
+     */
+    private Map _schemas = new HashMap();
+
+    public XmlExtensionResolver(RegistryDefinition definition, ErrorHandler errorHandler)
+    {
+        _errorHandler = errorHandler;
+        _definition = definition;
+        buildGlobalSchemaMap();
+    }
+
+    /**
+     * Resolves schema references via id from configuration points and services.
+     * All added module descriptors are processed.
+     */
+    public void resolveSchemas()
+    {
+        Collection modules = _definition.getModules();
+        
+        for (Iterator iterModules = modules.iterator(); iterModules.hasNext();)
+        {
+            ModuleDefinition module = (ModuleDefinition) iterModules.next();
+            if (module instanceof XmlModuleDefinitionImpl) {
+                XmlModuleDefinitionImpl xmlModule = (XmlModuleDefinitionImpl) module;
+                resolveServicePointSchemas(xmlModule);
+                resolveSchemaAssignments(xmlModule);
+            }
+        }
+    }
+    
+    /**
+     * Builds a map that contains all schemas of all defined xml modules.
+     */
+    public void buildGlobalSchemaMap()
+    {
+        Collection modules = _definition.getModules();
+        for (Iterator iterModules = modules.iterator(); iterModules.hasNext();)
+        {
+            ModuleDefinition module = (ModuleDefinition) iterModules.next();
+            if (module instanceof XmlModuleDefinitionImpl) {
+                XmlModuleDefinitionImpl xmlModule = (XmlModuleDefinitionImpl) module;
+                Collection schemas = xmlModule.getSchemas();
+                for (Iterator iterSchemas = schemas.iterator(); iterSchemas.hasNext();)
+                {
+                    Schema schema = (Schema) iterSchemas.next();
+                    String schemaId = IdUtils.qualify(module.getId(), schema.getId());
+                    _schemas.put(schemaId, schema);
+                }
+            }
+        }
+    }
+
+    private void resolveServicePointSchemas(ModuleDefinition sourceModule)
+    {
+        Collection points = sourceModule.getServicePoints();
+
+        for (Iterator iterSp = points.iterator(); iterSp.hasNext();)
+        {
+            ServicePointDefinition spd = (ServicePointDefinition) iterSp.next();
+            
+            // Check type. In case of the hivemind core module non xml service points exist
+            if (spd instanceof XmlServicePointDefinitionImpl) {
+                XmlServicePointDefinitionImpl xspd = (XmlServicePointDefinitionImpl) spd;
+    
+                if (xspd.getParametersSchemaId() != null) {
+                    ServicePointDefinition point = sourceModule.getServicePoint(xspd.getId());
+    
+                    XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl) point;
+                    Schema schema = findSchema(sourceModule, xspd.getParametersSchemaId(), xspd.getLocation());
+                    if (schema == null) {
+                        // Error-Handling has been done in findSchema already
+                    } else {
+                        xmlServicePoint.setParametersSchema(schema);
+                        xmlServicePoint.setParametersCount(xspd.getParametersCount());
+                    }
+                }
+            }
+        }
+    }
+    
+    /**
+     * Adds schemas to configuration points for schemas that were assigned
+     * to the configuration point subsequently by use of the "schema-assignment" attribute.
+     * This is used if the original configuration point was defined in a non-xml module.
+     */
+    private void resolveSchemaAssignments(XmlModuleDefinitionImpl sourceModule)
+    {
+        Collection schemaAssignments = sourceModule.getSchemaAssignments();
+
+        for (Iterator iterSa = schemaAssignments.iterator(); iterSa.hasNext();)
+        {
+            SchemaAssignment schemaAssignment = (SchemaAssignment) iterSa.next();
+
+            String configurationPointId = IdUtils.qualify(sourceModule.getId(), schemaAssignment.getConfigurationId());
+            ConfigurationPointDefinition cpd = _definition.getConfigurationPoint(configurationPointId);
+            if (cpd == null) {
+                // TODO annotations: Exception handling
+                throw new ApplicationRuntimeException("Unknown configuration point");
+            }
+            
+            String schemaId = IdUtils.qualify(sourceModule.getId(), schemaAssignment.getSchemaId());
+            Schema schema = getSchema(schemaId, sourceModule.getId(), schemaAssignment.getLocation());
+            
+            if (schema != null) {
+                // TODO: check if schema has already been set
+                // TODO: more type related error handling, check root type of schema
+                // TODO: set parser here instead of schema
+                
+                // Add parser constructor with direct reference to schema
+                ConfigurationParserDefinition parserDef = new ConfigurationParserDefinitionImpl(
+                        sourceModule, schemaAssignment.getLocation(), HiveMindSchemaParser.INPUT_FORMAT_NAME, 
+                        new HiveMindSchemaParserConstructor(schema));
+                
+                cpd.addParser(parserDef);
+                
+                // For backward compatibility
+                if (HashMap.class.getName().equals(schema.getRootElementClassName())
+                        || UniqueHashMap.class.getName().equals(schema.getRootElementClassName())) {
+                    cpd.setConfigurationTypeName(Map.class.getName());
+                }
+                
+            }
+        }
+    }
+    
+    private Schema findSchema(ModuleDefinition module, String schemaId, Location location)
+    {
+        if (schemaId == null)
+            return null;
+
+        String moduleId = module.getId();
+        String qualifiedId = IdUtils.qualify(moduleId, schemaId);
+
+        return getSchema(qualifiedId, moduleId, location);
+    }
+    
+    /**
+     * @param qualifiedSchemaId
+     * @param referencingModule the id of the module referencing the schema
+     * @param location  the location the schema is referenced from
+     * @return  null if schema wasn't found or is not visible
+     */
+    private Schema getSchema(String qualifiedSchemaId, String referencingModule, Location location)
+    {
+        Schema schema = (Schema) _schemas.get(qualifiedSchemaId);
+
+        if (schema == null)
+            _errorHandler
+                    .error(LOG, XmlImplMessages.unableToResolveSchema(qualifiedSchemaId), location, null);
+        else if (!schema.visibleToModule(referencingModule))
+        {
+            _errorHandler.error(
+                    LOG,
+                    XmlImplMessages.schemaNotVisible(qualifiedSchemaId, referencingModule),
+                    location,
+                    null);
+            schema = null;
+        }
+
+        return schema;
+    }
+    
+}

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?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- 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 Fri Dec 22 04:25:20 2006
@@ -8,25 +8,20 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.conditional.EvaluationContextImpl;
 import org.apache.hivemind.conditional.Node;
 import org.apache.hivemind.conditional.Parser;
-import org.apache.hivemind.definition.ConfigurationPointDefinition;
+import org.apache.hivemind.definition.ConfigurationParserDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.RegistryDefinition;
 import org.apache.hivemind.definition.ServiceImplementationDefinition;
-import org.apache.hivemind.definition.ServicePointDefinition;
-import org.apache.hivemind.definition.impl.ConfigurationPointDefinitionImpl;
+import org.apache.hivemind.definition.impl.ConfigurationParserDefinitionImpl;
 import org.apache.hivemind.definition.impl.ContributionDefinitionImpl;
-import org.apache.hivemind.definition.impl.ModuleDefinitionImpl;
 import org.apache.hivemind.definition.impl.ServiceImplementationDefinitionImpl;
 import org.apache.hivemind.definition.impl.ServiceInterceptorDefinitionImpl;
 import org.apache.hivemind.definition.impl.ServicePointDefinitionImpl;
-import org.apache.hivemind.impl.natures.XmlConfigurationPointNature;
-import org.apache.hivemind.impl.natures.XmlRegistryNature;
 import org.apache.hivemind.parse.ConfigurationPointDescriptor;
 import org.apache.hivemind.parse.ContributionDescriptor;
 import org.apache.hivemind.parse.DependencyDescriptor;
@@ -36,10 +31,15 @@
 import org.apache.hivemind.parse.ModuleDescriptor;
 import org.apache.hivemind.parse.SchemaAssignmentDescriptor;
 import org.apache.hivemind.parse.ServicePointDescriptor;
-import org.apache.hivemind.schema.Schema;
 import org.apache.hivemind.schema.impl.SchemaImpl;
 import org.apache.hivemind.util.IdUtils;
 import org.apache.hivemind.util.UniqueHashMap;
+import org.apache.hivemind.xml.definition.impl.HiveMindSchemaParser;
+import org.apache.hivemind.xml.definition.impl.HiveMindSchemaParserConstructor;
+import org.apache.hivemind.xml.definition.impl.XmlConfigurationPointDefinitionImpl;
+import org.apache.hivemind.xml.definition.impl.XmlContributionImpl;
+import org.apache.hivemind.xml.definition.impl.XmlModuleDefinitionImpl;
+import org.apache.hivemind.xml.definition.impl.XmlServicePointDefinitionImpl;
 
 /**
  * Adds the modules held by instances of {@link org.apache.hivemind.parse.ModuleDescriptor}
@@ -68,8 +68,6 @@
     {
         _registryDefinition = registryDefinition;
         _errorHandler = errorHandler;
-        _registryDefinition.addPostProcessor(new XmlPostProcessor());
-        initXmlRegistryNature();
     }
 
     public void processModuleDescriptor(ModuleDescriptor md)
@@ -81,9 +79,11 @@
 
         _moduleDescriptors.put(id, md);
 
-        ModuleDefinition module = new ModuleDefinitionImpl(id, md.getLocation(), md.getClassResolver(), md.getPackageName());
+        XmlModuleDefinitionImpl module = new XmlModuleDefinitionImpl(id, md.getLocation(), md.getClassResolver(), md.getPackageName());
         
         addSchemas(module, md);
+        
+        addSchemaAssignments(module, md);
 
         addServicePoints(module, md);
 
@@ -99,18 +99,6 @@
         
     }
     
-    /**
-     * Check if XmlRegistryNature has been established already by an earlier call
-     * of this method or by another instance of this class. 
-     * If not then create a new nature and register ist.
-     */
-    private void initXmlRegistryNature()
-    {
-        if (getXmlRegistryNature() == null) {
-            _registryDefinition.addNature(XmlRegistryNature.class, new XmlRegistryNature());
-        }
-    }
-
     private void addDependencies(ModuleDefinition module, ModuleDescriptor md)
     {
         int count = size(md.getDependencies());
@@ -122,24 +110,31 @@
         }
     }
 
-    private XmlRegistryNature getXmlRegistryNature()
-    {
-        return (XmlRegistryNature) _registryDefinition.getNature(XmlRegistryNature.class);
-    }
-
-    private void addSchemas(ModuleDefinition module, ModuleDescriptor md)
+    private void addSchemas(XmlModuleDefinitionImpl module, ModuleDescriptor md)
     {
         for (Iterator schemas = md.getSchemas().iterator(); schemas.hasNext();)
         {
             SchemaImpl schema = (SchemaImpl) schemas.next();
 
-            String schemaId = IdUtils.qualify(module.getId(), schema.getId());
-            
-            getXmlRegistryNature().addSchema(schemaId, schema);
+            module.addSchema(schema.getId(), schema);
+        }
+    }
+    
+    private void addSchemaAssignments(XmlModuleDefinitionImpl module, ModuleDescriptor md)
+    {
+        if (md.getSchemaAssignment() == null)
+            return;
+        
+        for (Iterator assignments = md.getSchemaAssignment().iterator(); assignments.hasNext();)
+        {
+            SchemaAssignmentDescriptor sad = (SchemaAssignmentDescriptor) assignments.next();
+
+            SchemaAssignment schemaAssignment = new SchemaAssignment(sad.getConfigurationId(), sad.getSchemaId(), sad.getLocation());
+            module.addSchemaAssignment(schemaAssignment);
         }
     }
     
-    private void addServicePoints(ModuleDefinition module, ModuleDescriptor md)
+    private void addServicePoints(XmlModuleDefinitionImpl module, ModuleDescriptor md)
     {
         List services = md.getServicePoints();
         int count = size(services);
@@ -150,12 +145,16 @@
             XmlServicePointDefinitionImpl servicePoint = new XmlServicePointDefinitionImpl(module, sd.getId(), sd.getLocation(), 
                     sd.getVisibility(), sd.getInterfaceClassName());
 
-            // Store the schema 
+            // Store the schema if embedded,
             // Schemas are for service factories only
             if (sd.getParametersSchema() != null) {
                 servicePoint.setParametersSchema(sd.getParametersSchema());
                 servicePoint.setParametersCount(sd.getParametersCount());
+            } else if (sd.getParametersSchemaId() != null ) {
+                // referenced schemas are resolved in post processing
+                servicePoint.setParametersSchemaId(sd.getParametersSchemaId());
             }
+                
             
             module.addServicePoint(servicePoint);
                 
@@ -243,7 +242,7 @@
         }
     }
 
-    private void addConfigurationPoints(ModuleDefinition module, ModuleDescriptor md)
+    private void addConfigurationPoints(XmlModuleDefinitionImpl module, ModuleDescriptor md)
     {
         List points = md.getConfigurationPoints();
         int count = size(points);
@@ -252,16 +251,12 @@
         {
             ConfigurationPointDescriptor cpd = (ConfigurationPointDescriptor) points.get(i);
 
-            ConfigurationPointDefinitionImpl configurationPoint = new ConfigurationPointDefinitionImpl(
+            XmlConfigurationPointDefinitionImpl configurationPoint = new XmlConfigurationPointDefinitionImpl(
                     module, cpd.getId(), cpd.getLocation(), cpd.getVisibility(), 
                     cpd.getContainerClassName(), cpd.getCount());
             module.addConfigurationPoint(configurationPoint);
             
-            // Add the xml nature
-            XmlConfigurationPointNature xmlNature = new XmlConfigurationPointNature();
-            configurationPoint.addNature(XmlConfigurationPointNature.class, xmlNature);
-
-            // If schema is embedded we can process it now, otherwise it must
+            // If schema is embedded we can add a parser now, otherwise it must
             // be resolved and processed later
             if (cpd.getContributionsSchema() != null) {
                 // TODO: compare container class name and rootElementClassName
@@ -270,7 +265,18 @@
                     configurationPoint.setConfigurationTypeName(Map.class.getName());
                 }
 
-                xmlNature.setSchema(cpd.getContributionsSchema());
+                // Add parser constructor with direct reference to schema
+                ConfigurationParserDefinition parserDef = new ConfigurationParserDefinitionImpl(
+                        module, cpd.getContributionsSchema().getLocation(), HiveMindSchemaParser.INPUT_FORMAT_NAME, 
+                        new HiveMindSchemaParserConstructor(cpd.getContributionsSchema()));
+                
+                configurationPoint.addParser(parserDef);
+            } else if (cpd.getContributionsSchemaId() != null) {
+                // Add schema assignment and resolve in post processing
+                String qualifiedId = IdUtils.qualify(module.getId(), cpd.getId());
+                SchemaAssignment schemaAssignment = new SchemaAssignment(qualifiedId, 
+                        cpd.getContributionsSchemaId(), cpd.getLocation());
+                module.addSchemaAssignment(schemaAssignment);
             }
         }
     }
@@ -316,159 +322,6 @@
     }
 
     /**
-     * Resolves schema references via id from configuration points and services.
-     * All added module descriptors are processed.
-     */
-    public void resolveSchemas()
-    {
-        for (Iterator i = _moduleDescriptors.values().iterator(); i.hasNext();)
-        {
-            ModuleDescriptor md = (ModuleDescriptor) i.next();
-
-            resolveConfigurationPointSchemas(md);
-            resolveServicePointSchemas(md);
-            resolveSchemaAssignments(md);
-        }
-    }
-
-    private void resolveConfigurationPointSchemas(ModuleDescriptor md)
-    {
-        ModuleDefinition sourceModule = _registryDefinition.getModule(md.getModuleId());
-
-        List points = md.getConfigurationPoints();
-        int count = size(points);
-
-        for (int i = 0; i < count; i++)
-        {
-            ConfigurationPointDescriptor cpd = (ConfigurationPointDescriptor) points.get(i);
-
-            if (cpd.getContributionsSchemaId() != null) {
-                ConfigurationPointDefinition point = sourceModule.getConfigurationPoint(cpd.getId());
-
-                XmlConfigurationPointNature xmlNature = (XmlConfigurationPointNature) point.getNature(XmlConfigurationPointNature.class);
-                // Store the schema in the nature
-                Schema schema = findSchema(sourceModule, cpd.getContributionsSchemaId(), cpd.getLocation());
-                
-                if (schema == null) {
-                    // Error-Handling has been done in findSchema already
-                } else {
-                    // TODO: check if schema has already been set (by resolveSubsequentSchemaAssociations)
-                    xmlNature.setSchema(schema);
-
-                    if (HashMap.class.getName().equals(schema.getRootElementClassName())
-                       || UniqueHashMap.class.getName().equals(schema.getRootElementClassName())) {
-                        point.setConfigurationTypeName(Map.class.getName());
-                    }
-                }
-            }
-        }
-    }
-
-    private void resolveServicePointSchemas(ModuleDescriptor md)
-    {
-        ModuleDefinition sourceModule = _registryDefinition.getModule(md.getModuleId());
-
-        List points = md.getServicePoints();
-        int count = size(points);
-
-        for (int i = 0; i < count; i++)
-        {
-            ServicePointDescriptor spd = (ServicePointDescriptor) points.get(i);
-
-            if (spd.getParametersSchemaId() != null) {
-                ServicePointDefinition point = sourceModule.getServicePoint(spd.getId());
-
-                XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl) point;
-                // Store the schema in the nature
-                Schema schema = findSchema(sourceModule, spd.getParametersSchemaId(), spd.getLocation());
-                if (schema == null) {
-                    // Error-Handling has been done in findSchema already
-                } else {
-                    xmlServicePoint.setParametersSchema(schema);
-                    xmlServicePoint.setParametersCount(spd.getParametersCount());
-                }
-            }
-        }
-    }
-    
-    /**
-     * Adds schemas to configuration points for schemas that were assigned
-     * to the configuration point subsequently by use of the "schema-assignment" attribute.
-     * This is used if the original configuration point was defined in a non-xml module.
-     */
-    private void resolveSchemaAssignments(ModuleDescriptor md)
-    {
-        List schemaAssignments = md.getSchemaAssignment();
-        int count = size(schemaAssignments);
-
-        for (int i = 0; i < count; i++)
-        {
-            SchemaAssignmentDescriptor schemaAssignment = (SchemaAssignmentDescriptor) schemaAssignments.get(i);
-
-            String configurationPointId = IdUtils.qualify(md.getModuleId(), schemaAssignment.getConfigurationId());
-            ConfigurationPointDefinition cpd = _registryDefinition.getConfigurationPoint(configurationPointId);
-            if (cpd == null) {
-                // TODO annotations: Exception handling
-                throw new ApplicationRuntimeException("Unknown configuration point");
-            }
-            
-            String schemaId = IdUtils.qualify(md.getModuleId(), schemaAssignment.getSchemaId());
-            Schema schema = getSchema(schemaId, md.getModuleId(), schemaAssignment.getLocation());
-            
-            if (schema != null) {
-                XmlConfigurationPointNature xmlNature = (XmlConfigurationPointNature) cpd.getNature(XmlConfigurationPointNature.class);
-                // Add the xml nature if not already there. This can happen if configuration 
-                // point wasn't defined in a xml module
-                if (xmlNature == null) {
-                    xmlNature = new XmlConfigurationPointNature();
-                    cpd.addNature(XmlConfigurationPointNature.class, xmlNature);
-                }
-    
-                // TODO: check if schema has already been set
-                // TODO: more type related error handling, check root type of schema
-                xmlNature.setSchema(schema);
-            }
-        }
-    }
-
-    private Schema findSchema(ModuleDefinition module, String schemaId, Location location)
-    {
-        if (schemaId == null)
-            return null;
-
-        String moduleId = module.getId();
-        String qualifiedId = IdUtils.qualify(moduleId, schemaId);
-
-        return getSchema(qualifiedId, moduleId, location);
-    }
-    
-    /**
-     * @param schemaId
-     * @param referencingModule
-     * @param location  the location the schema is referenced from
-     * @return  null if schema wasn't found or is not visible
-     */
-    private Schema getSchema(String schemaId, String referencingModule, Location location)
-    {
-        Schema schema = (Schema) getXmlRegistryNature().getSchema(schemaId);
-
-        if (schema == null)
-            _errorHandler
-                    .error(_log, XmlImplMessages.unableToResolveSchema(schemaId), location, null);
-        else if (!schema.visibleToModule(referencingModule))
-        {
-            _errorHandler.error(
-                    _log,
-                    XmlImplMessages.schemaNotVisible(schemaId, referencingModule),
-                    location,
-                    null);
-            schema = null;
-        }
-
-        return schema;
-    }
-
-    /**
      * Filters a contribution based on an expression. Returns true if the expression is null, or
      * evaluates to true. Returns false if the expression if non-null and evaluates to false, or an
      * exception occurs evaluating the expression.
@@ -504,16 +357,6 @@
     private static int size(Collection c)
     {
         return c == null ? 0 : c.size();
-    }
-
-    
-    class XmlPostProcessor implements RegistryPostProcessor
-    {
-        public void postprocess(RegistryDefinition registryDefinition, ErrorHandler errorHandler)
-        {
-            // resolve extension which were referenced by id
-            resolveSchemas();
-        }
     }
 
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java (original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/Schema.java Fri Dec 22 04:25:20 2006
@@ -76,4 +76,6 @@
     
     public String getRootElementClassName();
     
+    public String getFullyQualifiedId();
+    
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java?view=diff&rev=489635&r1=489634&r2=489635
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java (original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/impl/SchemaImpl.java Fri Dec 22 04:25:20 2006
@@ -70,6 +70,11 @@
     {
         return _id;
     }
+    
+    public String getFullyQualifiedId()
+    {
+        return getModuleId() + "." + _id;
+    }
 
     /**
      * @since 1.1



Mime
View raw message