hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r473227 - in /hivemind/branches/branch-2-0-annot: framework/src/java/org/apache/hivemind/impl/ framework/src/java/org/apache/hivemind/internal/ xml/src/java/org/apache/hivemind/ant/ xml/src/java/org/apache/hivemind/impl/ xml/src/java/org/ap...
Date Fri, 10 Nov 2006 07:37:55 GMT
Author: ahuegen
Date: Thu Nov  9 23:37:54 2006
New Revision: 473227

URL: http://svn.apache.org/viewvc?view=rev&rev=473227
Log:
Removed XmlServicePointNature

Added:
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java
      - copied, changed from r472779, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/natures/XmlServicePointNature.java
Removed:
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/natures/XmlServicePointNature.java
Modified:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServicePoint.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/XmlModuleDescriptorProcessor.java
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java

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=473227&r1=473226&r2=473227
==============================================================================
--- 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
Thu Nov  9 23:37:54 2006
@@ -27,7 +27,6 @@
 import org.apache.hivemind.definition.ServiceInterceptorDefinition;
 import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.definition.construction.ImplementationConstructor;
-import org.apache.hivemind.definition.impl.ServiceInterceptorDefinitionImpl;
 import org.apache.hivemind.events.RegistryShutdownListener;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.ServiceModel;

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServicePoint.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServicePoint.java?view=diff&rev=473227&r1=473226&r2=473227
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServicePoint.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/ServicePoint.java
Thu Nov  9 23:37:54 2006
@@ -14,6 +14,8 @@
 
 package org.apache.hivemind.internal;
 
+import org.apache.hivemind.definition.ServicePointDefinition;
+
 /**
  * Sub-interface of {@link org.apache.hivemind.internal.ExtensionPoint} that defines a service
  * extension point. A service may have a single factory contribution, and any number of interceptor
@@ -75,4 +77,7 @@
      */
 
     public void forceServiceInstantiation();
+    
+    public ServicePointDefinition getServicePointDefinition();
+
 }

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=473227&r1=473226&r2=473227
==============================================================================
--- 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
Thu Nov  9 23:37:54 2006
@@ -42,9 +42,9 @@
 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.impl.natures.XmlServicePointNature;
 import org.apache.hivemind.parse.AttributeMappingDescriptor;
 import org.apache.hivemind.parse.ConversionDescriptor;
 import org.apache.hivemind.schema.AttributeModel;
@@ -300,7 +300,8 @@
         if (spd.getVisibility() == Visibility.PRIVATE)
             servicePoint.setAttribute("visibility", "private");
         
-        processServicePointNatures(servicePoint, spd);
+        if (spd instanceof XmlServicePointDefinitionImpl)
+            processXmlServicePoint(servicePoint, (XmlServicePointDefinitionImpl) spd);
         
         ServiceImplementationDefinition ib = spd.getDefaultImplementation();
 
@@ -328,21 +329,13 @@
         return servicePoint;
     }
 
-    private void processServicePointNatures(Element servicePoint, ServicePointDefinition
spd)
+    private void processXmlServicePoint(Element servicePointElement, XmlServicePointDefinitionImpl
xmlServicePoint)
     {
-        XmlServicePointNature xmlNature = (XmlServicePointNature) spd.getNature(XmlServicePointNature.class);
-        if (xmlNature != null) {
-            addParametersSchemas(servicePoint, xmlNature);
-        }
-    }
-
-    private void addParametersSchemas(Element servicePoint, XmlServicePointNature xmlNature)
-    {
-        if (xmlNature.getParametersCount() != Occurances.REQUIRED)
-            servicePoint.setAttribute("parameters-occurs", xmlNature.getParametersCount().getName()
+        if (xmlServicePoint.getParametersCount() != Occurances.REQUIRED)
+            servicePointElement.setAttribute("parameters-occurs", xmlServicePoint.getParametersCount().getName()
                     .toLowerCase());
-        if (xmlNature.getParametersSchema() != null)
-            addSchema(servicePoint, (SchemaImpl) xmlNature.getParametersSchema(), "parameters-schema");
+        if (xmlServicePoint.getParametersSchema() != null)
+            addSchema(servicePointElement, (SchemaImpl) xmlServicePoint.getParametersSchema(),
"parameters-schema");
 //        else if (xmlNature.getParametersSchemaId() != null)
 //            servicePoint.setAttribute("parameters-schema-id", qualify(spd.getParametersSchemaId()));
         

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=473227&r1=473226&r2=473227
==============================================================================
--- 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
Thu Nov  9 23:37:54 2006
@@ -21,8 +21,7 @@
 import org.apache.hivemind.Location;
 import org.apache.hivemind.Orderable;
 import org.apache.hivemind.ServiceInterceptorFactory;
-import org.apache.hivemind.TranslatorManager;
-import org.apache.hivemind.impl.natures.XmlServicePointNature;
+import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.internal.AbstractServiceInterceptorConstructor;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.ServicePoint;
@@ -84,12 +83,13 @@
             _factory = (ServiceInterceptorFactory) factoryPoint
                     .getService(ServiceInterceptorFactory.class);
 
-            XmlServicePointNature xmlNature = (XmlServicePointNature) factoryPoint.getNature(XmlServicePointNature.class);
-            if (xmlNature == null) {
+            ServicePointDefinition spd = factoryPoint.getServicePointDefinition();
+            if (!(spd instanceof XmlServicePointDefinitionImpl)) {
                 // TODO annotations: Externalize message
-                throw new ApplicationRuntimeException("ServicePoint has no xml nature");
+                throw new ApplicationRuntimeException("ServicePoint used as InterceptorFactory
must be of type XmlServicePointDefinitionImpl");
             }
-            Schema schema = xmlNature.getParametersSchema();
+            XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl)
spd;
+            Schema schema = xmlServicePoint.getParametersSchema();
             if (schema != null) {
 
                 SchemaProcessorImpl processor = new SchemaProcessorImpl(factoryPoint.getErrorLog(),

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=473227&r1=473226&r2=473227
==============================================================================
--- 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
Thu Nov  9 23:37:54 2006
@@ -22,9 +22,8 @@
 import org.apache.hivemind.Occurances;
 import org.apache.hivemind.ServiceImplementationFactory;
 import org.apache.hivemind.ServiceImplementationFactoryParameters;
-import org.apache.hivemind.TranslatorManager;
+import org.apache.hivemind.definition.ServicePointDefinition;
 import org.apache.hivemind.definition.construction.ImplementationConstructionContext;
-import org.apache.hivemind.impl.natures.XmlServicePointNature;
 import org.apache.hivemind.internal.AbstractServiceImplementationConstructor;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.ServicePoint;
@@ -84,19 +83,21 @@
             ServicePoint factoryPoint = contributingModule.getServicePoint(_factoryServiceId);
 
             ErrorLog errorLog = servicePoint.getErrorLog();
+            
+            _factory = (ServiceImplementationFactory) factoryPoint
+                .getService(ServiceImplementationFactory.class);
 
-            XmlServicePointNature xmlNature = (XmlServicePointNature) factoryPoint.getNature(XmlServicePointNature.class);
-            if (xmlNature == null) {
-                // TODO annotations:
-                throw new ApplicationRuntimeException("ServicePoint has no xml nature");
+            ServicePointDefinition spd = factoryPoint.getServicePointDefinition();
+            if (!(spd instanceof XmlServicePointDefinitionImpl)) {
+                // TODO annotations: Externalize message
+                throw new ApplicationRuntimeException("ServicePoint used as ServiceImplementationFactory
must be of type XmlServicePointDefinitionImpl");
             }
-            _factory = (ServiceImplementationFactory) factoryPoint
-                    .getService(ServiceImplementationFactory.class);
+            XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl)
spd;
 
-            Schema schema = xmlNature.getParametersSchema();
+            Schema schema = xmlServicePoint.getParametersSchema();
             if (schema != null) {
                 
-                Occurances expected = xmlNature.getParametersCount();
+                Occurances expected = xmlServicePoint.getParametersCount();
                 checkParameterCounts(errorLog, expected);
 
                 SchemaProcessorImpl processor = new SchemaProcessorImpl(errorLog, 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=473227&r1=473226&r2=473227
==============================================================================
--- 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
Thu Nov  9 23:37:54 2006
@@ -27,7 +27,6 @@
 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.impl.natures.XmlServicePointNature;
 import org.apache.hivemind.parse.ConfigurationPointDescriptor;
 import org.apache.hivemind.parse.ContributionDescriptor;
 import org.apache.hivemind.parse.DependencyDescriptor;
@@ -148,20 +147,17 @@
         for (int i = 0; i < count; i++)
         {
             ServicePointDescriptor sd = (ServicePointDescriptor) services.get(i);
-            ServicePointDefinitionImpl servicePoint = new ServicePointDefinitionImpl(module,
sd.getId(), sd.getLocation(), 
+            XmlServicePointDefinitionImpl servicePoint = new XmlServicePointDefinitionImpl(module,
sd.getId(), sd.getLocation(), 
                     sd.getVisibility(), sd.getInterfaceClassName());
-            module.addServicePoint(servicePoint);
-
-            // Add the xml nature for the storage of the schema
-            XmlServicePointNature xmlNature = new XmlServicePointNature();
-            servicePoint.addNature(XmlServicePointNature.class, xmlNature);
 
-            // Store the schema in the nature
+            // Store the schema 
             // Schemas are for service factories only
             if (sd.getParametersSchema() != null) {
-                xmlNature.setParametersSchema(sd.getParametersSchema());
-                xmlNature.setParametersCount(sd.getParametersCount());
+                servicePoint.setParametersSchema(sd.getParametersSchema());
+                servicePoint.setParametersCount(sd.getParametersCount());
             }
+            
+            module.addServicePoint(servicePoint);
                 
             addInternalImplementations(module, servicePoint, sd);
         }
@@ -389,14 +385,14 @@
             if (spd.getParametersSchemaId() != null) {
                 ServicePointDefinition point = sourceModule.getServicePoint(spd.getId());
 
-                XmlServicePointNature xmlNature = (XmlServicePointNature) point.getNature(XmlServicePointNature.class);
+                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 {
-                    xmlNature.setParametersSchema(schema);
-                    xmlNature.setParametersCount(spd.getParametersCount());
+                    xmlServicePoint.setParametersSchema(schema);
+                    xmlServicePoint.setParametersCount(spd.getParametersCount());
                 }
             }
         }

Copied: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java
(from r472779, hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/natures/XmlServicePointNature.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java?view=diff&rev=473227&p1=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/natures/XmlServicePointNature.java&r1=472779&p2=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java&r2=473227
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/natures/XmlServicePointNature.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlServicePointDefinitionImpl.java
Thu Nov  9 23:37:54 2006
@@ -1,12 +1,31 @@
-package org.apache.hivemind.impl.natures;
+package org.apache.hivemind.impl;
 
+import org.apache.hivemind.Location;
 import org.apache.hivemind.Occurances;
+import org.apache.hivemind.definition.ModuleDefinition;
+import org.apache.hivemind.definition.Visibility;
+import org.apache.hivemind.definition.impl.ServicePointDefinitionImpl;
 import org.apache.hivemind.schema.Schema;
 
-public class XmlServicePointNature
+/**
+ * Specialization of {@link ServicePointDefinitionImpl} for service points defined in xml.
+ * 
+ * @author Achim Huegen
+ */
+public class XmlServicePointDefinitionImpl extends ServicePointDefinitionImpl
 {
     private Schema _parametersSchema;
     private Occurances _parametersCount = Occurances.REQUIRED;
+
+    public XmlServicePointDefinitionImpl(ModuleDefinition module)
+    {
+        super(module);
+    }
+    
+    public XmlServicePointDefinitionImpl(ModuleDefinition module, String id, Location location,
Visibility visibility, String interfaceClassName)
+    {
+        super(module, id, location, visibility, interfaceClassName);
+    }
 
     /**
      * Returns the {@link Schema} used to process any parameters passed to the service. Service

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java?view=diff&rev=473227&r1=473226&r2=473227
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
Thu Nov  9 23:37:54 2006
@@ -26,8 +26,8 @@
 import org.apache.hivemind.Occurances;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.ServiceImplementationFactory;
+import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.construction.ImplementationConstructionContext;
-import org.apache.hivemind.impl.natures.XmlServicePointNature;
 import org.apache.hivemind.internal.ImplementationConstructionContextImpl;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.ServicePoint;
@@ -60,9 +60,10 @@
         SchemaImpl schema = new SchemaImpl("module");
         schema.setRootElementClassName(ArrayList.class.getName());
         
-        XmlServicePointNature xmlNature = new XmlServicePointNature();
-        xmlNature.setParametersCount(Occurances.REQUIRED);
-        xmlNature.setParametersSchema(schema);
+        ModuleDefinition md = createModuleDefinition("test");
+        XmlServicePointDefinitionImpl xmlSpd = new XmlServicePointDefinitionImpl(md);
+        xmlSpd.setParametersCount(Occurances.REQUIRED);
+        xmlSpd.setParametersSchema(schema);
         
         Location location = newLocation();
         InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor(location,
"module");
@@ -74,9 +75,6 @@
         point.getErrorLog();
         pointControl.setReturnValue(log);
 
-        factoryPoint.getNature(XmlServicePointNature.class);
-        factoryPointControl.setReturnValue(xmlNature);
-       
         module.getServicePoint("foo.bar.Baz");
         moduleControl.setReturnValue(factoryPoint);
         
@@ -85,6 +83,9 @@
 
         factoryPoint.getService(ServiceImplementationFactory.class);
         factoryPointControl.setReturnValue(factory);
+
+        factoryPoint.getServicePointDefinition();
+        factoryPointControl.setReturnValue(xmlSpd);
         
         factoryPoint.getModule();
         factoryPointControl.setReturnValue(module);



Mime
View raw message