Author: svkrish
Date: Thu Aug 16 03:34:06 2007
New Revision: 566647

URL: http://svn.apache.org/viewvc?view=rev&rev=566647
Log:
added support for metadata related to binding and implemenation types

Added:
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointProcessor.java
      - copied, changed from r565707, 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ExtensionTypeProcessor.java
Removed:
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ExtensionTypeProcessor.java
Modified:
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsBuilderImpl.java
    
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsProcessor.java
    
incubator/tuscany/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java

Modified: 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java?view=diff&rev=566647&r1=566646&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
 Thu Aug 16 03:34:06 2007
@@ -20,45 +20,22 @@
 package org.apache.tuscany.sca.policy.xml;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.policy.BindingType;
-import org.apache.tuscany.sca.policy.ExtensionTypeFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
 
 /* 
  * Processor for handling xml models of BindingType meta data definitions
  */
-public class BindingTypeProcessor extends ExtensionTypeProcessor<BindingType> {
+public class BindingTypeProcessor extends IntentAttachPointProcessor {
 
-    public BindingTypeProcessor(PolicyFactory policyFactory, 
ExtensionTypeFactory extnTypeFactory, StAXArtifactProcessor<Object> 
extensionProcessor) {
-        super(policyFactory, extnTypeFactory, extensionProcessor);
+    public BindingTypeProcessor(PolicyFactory policyFactory, 
IntentAttachPointTypeFactory intentAttachPointTypeFactory, 
StAXArtifactProcessor<Object> extensionProcessor) {
+        super(policyFactory, intentAttachPointTypeFactory, extensionProcessor);
     }
 
-    public BindingType read(XMLStreamReader reader) throws 
ContributionReadException {
-        QName type = getQName(reader, TYPE);
-        
-        if ( type != null ) {
-            BindingType bindingType = extnTypeFactory.createBindingType();
-            bindingType.setTypeName(type);
-            
-            readAlwaysProvidedIntents(bindingType, reader);
-            readMayProvideIntents(bindingType, reader);
-            return bindingType;
-        } else { 
-            throw new ContributionReadException("Required attribute '" + TYPE 
+ 
-                                                "' missing from BindingType 
Definition");
-        }
-    }
-    
     public QName getArtifactType() {
         return BINDING_TYPE_QNAME;
-    }
-    
-    public Class<BindingType> getModelType() {
-        return BindingType.class;
     }
 }

Modified: 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java?view=diff&rev=566647&r1=566646&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
 Thu Aug 16 03:34:06 2007
@@ -20,45 +20,22 @@
 package org.apache.tuscany.sca.policy.xml;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.policy.ExtensionTypeFactory;
-import org.apache.tuscany.sca.policy.ImplementationType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
 
 /* 
  * Processor for handling xml models of ImplementationType meta data 
definitions
  */
-public class ImplementationTypeProcessor extends 
ExtensionTypeProcessor<ImplementationType> {
+public class ImplementationTypeProcessor extends IntentAttachPointProcessor {
 
-    public ImplementationTypeProcessor(PolicyFactory policyFactory, 
ExtensionTypeFactory extnTypeFactory, StAXArtifactProcessor<Object> 
extensionProcessor) {
-        super(policyFactory, extnTypeFactory, extensionProcessor);
+    public ImplementationTypeProcessor(PolicyFactory policyFactory, 
IntentAttachPointTypeFactory intentAttachPointTypeFactory, 
StAXArtifactProcessor<Object> extensionProcessor) {
+        super(policyFactory, intentAttachPointTypeFactory, extensionProcessor);
     }
 
-    public ImplementationType read(XMLStreamReader reader) throws 
ContributionReadException {
-        QName type = getQName(reader, TYPE);
-        
-        if ( type != null ) {
-            ImplementationType implType = 
extnTypeFactory.createImplementationType();
-            implType.setTypeName(type);
-            
-            readAlwaysProvidedIntents(implType, reader);
-            readMayProvideIntents(implType, reader);
-            return implType;
-        } else { 
-            throw new ContributionReadException("Required attribute '" + TYPE 
+ 
-                                                "' missing from 
ImplementationType Definition");
-        }
-    }
-    
     public QName getArtifactType() {
         return IMPLEMENTATION_TYPE_QNAME;
-    }
-    
-    public Class<ImplementationType> getModelType() {
-        return ImplementationType.class;
     }
 }

Copied: 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointProcessor.java
 (from r565707, 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ExtensionTypeProcessor.java)
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointProcessor.java?view=diff&rev=566647&p1=incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ExtensionTypeProcessor.java&r1=565707&p2=incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointProcessor.java&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ExtensionTypeProcessor.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointProcessor.java
 Thu Aug 16 03:34:06 2007
@@ -30,33 +30,61 @@
 
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import 
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.BindingType;
-import org.apache.tuscany.sca.policy.ExtensionType;
-import org.apache.tuscany.sca.policy.ExtensionTypeFactory;
-import org.apache.tuscany.sca.policy.ImplementationType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
 
 
 /* 
  * Processor for handling xml models of ExtensionType meta data definitions
  */
-public abstract class ExtensionTypeProcessor<T extends ExtensionType> 
implements StAXArtifactProcessor<T>, PolicyConstants {
+public abstract class IntentAttachPointProcessor implements 
StAXArtifactProcessor<IntentAttachPointType>, PolicyConstants {
 
-    protected ExtensionTypeFactory extnTypeFactory;
+    protected IntentAttachPointTypeFactory extnTypeFactory;
     protected PolicyFactory policyFactory; 
     protected StAXArtifactProcessor<Object> extensionProcessor;
     
 
-    public ExtensionTypeProcessor(PolicyFactory policyFactory, 
ExtensionTypeFactory extnTypeFactory, StAXArtifactProcessor<Object> 
extensionProcessor) {
+    public IntentAttachPointProcessor(PolicyFactory policyFactory, 
IntentAttachPointTypeFactory extnTypeFactory, StAXArtifactProcessor<Object> 
extensionProcessor) {
         this.policyFactory = policyFactory;
         this.extnTypeFactory = extnTypeFactory;
         this.extensionProcessor = extensionProcessor;
     }
+    
+    public IntentAttachPointType read(XMLStreamReader reader) throws 
ContributionReadException {
+        QName type = getQName(reader, TYPE);
+        
+        if ( type != null ) {
+            if ( type.getLocalPart().startsWith(BINDING) ) {
+                IntentAttachPointType bindingType = 
extnTypeFactory.createBindingType();
+                bindingType.setName(type);
+                
+                readAlwaysProvidedIntents(bindingType, reader);
+                readMayProvideIntents(bindingType, reader);
+                return bindingType; 
+            } else if ( type.getLocalPart().startsWith(IMPLEMENTATION) ) {
+                IntentAttachPointType implType = 
extnTypeFactory.createImplementationType();
+                implType.setName(type);
+                
+                readAlwaysProvidedIntents(implType, reader);
+                readMayProvideIntents(implType, reader);
+                return implType;
+            } else {
+                throw new ContributionReadException("Unrecognized 
IntentAttachPointType - " + type);
+            }
+        } else { 
+            throw new ContributionReadException("Required attribute '" + TYPE 
+ 
+                                                "' missing from BindingType 
Definition");
+        }
+    }
 
-    protected void readAlwaysProvidedIntents(ExtensionType extnType, 
XMLStreamReader reader) {
+    protected void readAlwaysProvidedIntents(IntentAttachPointType extnType, 
XMLStreamReader reader) {
         String value = reader.getAttributeValue(null, ALWAYS_PROVIDES);
         if (value != null) {
             List<Intent> alwaysProvided = extnType.getAlwaysProvidedIntents();
@@ -69,7 +97,7 @@
         }
     }
     
-    protected void readMayProvideIntents(ExtensionType extnType, 
XMLStreamReader reader) {
+    protected void readMayProvideIntents(IntentAttachPointType extnType, 
XMLStreamReader reader) {
         String value = reader.getAttributeValue(null, MAY_PROVIDE);
         if (value != null) {
             List<Intent> mayProvide = extnType.getMayProvideIntents();
@@ -82,12 +110,12 @@
         }
     }
   
-    public void write(T extnType, XMLStreamWriter writer) throws 
ContributionWriteException {
+    public void write(IntentAttachPointType extnType, XMLStreamWriter writer) 
throws ContributionWriteException {
         try {
             // Write an <sca:bindingType or sca:implementationType>
-            if ( extnType instanceof BindingType ) {
+            if ( extnType instanceof BindingTypeImpl ) {
                 writer.writeStartElement(SCA10_NS, BINDING_TYPE);
-            } else if ( extnType instanceof ImplementationType ) {
+            } else if ( extnType instanceof ImplementationTypeImpl ) {
                 writer.writeStartElement(SCA10_NS, IMPLEMENATION_TYPE);
             }
             
@@ -101,7 +129,7 @@
         }
     }
     
-    protected void writeMayProvideIntentsAttribute(ExtensionType extnType, 
XMLStreamWriter writer) throws XMLStreamException {
+    protected void writeMayProvideIntentsAttribute(IntentAttachPointType 
extnType, XMLStreamWriter writer) throws XMLStreamException {
         StringBuffer sb  = new StringBuffer();
         for ( Intent intent : extnType.getMayProvideIntents() ) {
             writer.writeNamespace(intent.getName().getPrefix(), 
intent.getName().getNamespaceURI());
@@ -114,7 +142,7 @@
         }
     }
     
-    protected void writeAlwaysProvidesIntentsAttribute(ExtensionType extnType, 
XMLStreamWriter writer) throws XMLStreamException {
+    protected void writeAlwaysProvidesIntentsAttribute(IntentAttachPointType 
extnType, XMLStreamWriter writer) throws XMLStreamException {
         StringBuffer sb  = new StringBuffer();
         for ( Intent intent : extnType.getAlwaysProvidedIntents() ) {
             writer.writeNamespace(intent.getName().getPrefix(), 
intent.getName().getNamespaceURI());
@@ -128,12 +156,12 @@
         }
     }
     
-    private void resolveExtensionType(T extnType, ModelResolver resolver) 
throws ContributionResolveException {
+    private void resolveExtensionType(IntentAttachPointType extnType, 
ModelResolver resolver) throws ContributionResolveException {
         //FIXME: need to resolve the binding and implementations across the 
assembly model
         extnType.setUnresolved(false);
     }
     
-    public void resolve(T extnType, ModelResolver resolver) throws 
ContributionResolveException {
+    public void resolve(IntentAttachPointType extnType, ModelResolver 
resolver) throws ContributionResolveException {
         resolveExtensionType(extnType, resolver);
 
         if ( !extnType.isUnresolved() ) {
@@ -141,7 +169,7 @@
         }
     }
 
-    private void resolveAlwaysProvidedIntents(ExtensionType extnType, 
ModelResolver resolver) throws ContributionResolveException {
+    private void resolveAlwaysProvidedIntents(IntentAttachPointType extnType, 
ModelResolver resolver) throws ContributionResolveException {
         boolean isUnresolved = false;
         if (extnType != null && extnType.isUnresolved()) {
             //resolve alwaysProvided Intents
@@ -161,7 +189,7 @@
         extnType.setUnresolved(isUnresolved);
     }
     
-    private void resolveMayProvideIntents(ExtensionType extnType, 
ModelResolver resolver) throws ContributionResolveException {
+    private void resolveMayProvideIntents(IntentAttachPointType extnType, 
ModelResolver resolver) throws ContributionResolveException {
         boolean isUnresolved = false;
         if (extnType != null && extnType.isUnresolved()) {
             //resolve may provide Intents
@@ -204,5 +232,9 @@
 
     protected String getString(XMLStreamReader reader, String name) {
         return reader.getAttributeValue(null, name);
+    }
+    
+    public Class<IntentAttachPointType> getModelType() {
+        return IntentAttachPointType.class;
     }
 }

Modified: 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java?view=diff&rev=566647&r1=566646&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
 Thu Aug 16 03:34:06 2007
@@ -51,6 +51,8 @@
     String BINDING_TYPE = "bindingType";
     QName IMPLEMENTATION_TYPE_QNAME = new QName(SCA10_NS, IMPLEMENATION_TYPE);
     QName BINDING_TYPE_QNAME = new QName(SCA10_NS, BINDING_TYPE);
+    String BINDING = "binding";
+    String IMPLEMENTATION = "implementation";
     
     QName POLICY_INTENT_QNAME = new QName(SCA10_NS, INTENT);
     QName POLICY_SET_QNAME = new QName(SCA10_NS, POLICY_SET);

Modified: 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsBuilderImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsBuilderImpl.java?view=diff&rev=566647&r1=566646&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsBuilderImpl.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsBuilderImpl.java
 Thu Aug 16 03:34:06 2007
@@ -26,10 +26,8 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.sca.policy.BindingType;
-import org.apache.tuscany.sca.policy.ExtensionType;
-import org.apache.tuscany.sca.policy.ImplementationType;
 import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.Policy;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.ProfileIntent;
@@ -53,14 +51,14 @@
             definedPolicySets.put(policySet.getName(), policySet);
         }
         
-        Map<QName, BindingType> definedBindingTypes = new HashMap<QName, 
BindingType>();
-        for (BindingType bindingType : scaDefns.getBindingTypes()) {
-            definedBindingTypes.put(bindingType.getTypeName(), bindingType);
+        Map<QName, IntentAttachPointType> definedBindingTypes = new 
HashMap<QName, IntentAttachPointType>();
+        for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+            definedBindingTypes.put(bindingType.getName(), bindingType);
         }
         
-        Map<QName, ImplementationType> definedImplTypes = new HashMap<QName, 
ImplementationType>();
-        for (ImplementationType implType : scaDefns.getImplementationTypes()) {
-            definedImplTypes.put(implType.getTypeName(), implType);
+        Map<QName, IntentAttachPointType> definedImplTypes = new 
HashMap<QName, IntentAttachPointType>();
+        for (IntentAttachPointType implType : 
scaDefns.getImplementationTypes()) {
+            definedImplTypes.put(implType.getName(), implType);
         }
         
         buildPolicyIntents(scaDefns, definedIntents);
@@ -70,9 +68,9 @@
     }
     
     private void buildBindingTypes(SCADefinitions scaDefns, 
-                                   Map<QName, BindingType> 
definedBindingTypes, 
+                                   Map<QName, IntentAttachPointType> 
definedBindingTypes, 
                                    Map<QName, Intent> definedIntents) throws 
SCADefinitionsBuilderException {
-        for (BindingType bindingType : scaDefns.getBindingTypes()) {
+        for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
             buildAlwaysProvidedIntents(bindingType, definedIntents);
             buildMayProvideIntents(bindingType, definedIntents);
         }
@@ -80,9 +78,9 @@
     }
     
     private void buildImplementationTypes(SCADefinitions scaDefns, 
-                                   Map<QName, ImplementationType> 
definedImplTypes, 
+                                   Map<QName, IntentAttachPointType> 
definedImplTypes, 
                                    Map<QName, Intent> definedIntents) throws 
SCADefinitionsBuilderException {
-        for (ImplementationType implType : scaDefns.getImplementationTypes()) {
+        for (IntentAttachPointType implType : 
scaDefns.getImplementationTypes()) {
             buildAlwaysProvidedIntents(implType, definedIntents);
             buildMayProvideIntents(implType, definedIntents);
         }
@@ -166,7 +164,7 @@
     }
     
     
-    private void buildAlwaysProvidedIntents(ExtensionType extensionType,
+    private void buildAlwaysProvidedIntents(IntentAttachPointType 
extensionType,
                                             Map<QName, Intent> definedIntents) 
throws SCADefinitionsBuilderException {
         if (extensionType != null) {
             // resolve all provided intents
@@ -192,7 +190,7 @@
         }
     }
     
-    private void buildMayProvideIntents(ExtensionType extensionType,
+    private void buildMayProvideIntents(IntentAttachPointType extensionType,
                                             Map<QName, Intent> definedIntents) 
throws SCADefinitionsBuilderException {
         if (extensionType != null) {
             // resolve all provided intents

Modified: 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsProcessor.java?view=diff&rev=566647&r1=566646&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsProcessor.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SCADefinitionsProcessor.java
 Thu Aug 16 03:34:06 2007
@@ -36,9 +36,8 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import 
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.BindingType;
-import org.apache.tuscany.sca.policy.ImplementationType;
 import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.SCADefinitions;
@@ -139,11 +138,14 @@
                                     
scaDefns.getPolicyIntents().add((Intent)extension);
                                 } else if ( extension instanceof PolicySet ) {
                                     
scaDefns.getPolicySets().add((PolicySet)extension);
-                                } else if ( extension instanceof BindingType ) 
{
-                                    
scaDefns.getBindingTypes().add((BindingType)extension);
-                                } else if ( extension instanceof 
ImplementationType ) {
-                                    
scaDefns.getImplementationTypes().add((ImplementationType)extension);
-                                }
+                                } else if ( extension instanceof 
IntentAttachPointType ) {
+                                    IntentAttachPointType type = 
(IntentAttachPointType)extension;
+                                    if ( 
type.getName().getLocalPart().startsWith(BINDING)) {
+                                        
scaDefns.getBindingTypes().add((IntentAttachPointType)extension);
+                                    } else if ( 
type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
+                                        
scaDefns.getImplementationTypes().add((IntentAttachPointType)extension);
+                                    }
+                                } 
                                 
                                 if ( getDefinitionsResolver() != null ) {
                                     
getDefinitionsResolver().addModel(extension);
@@ -246,11 +248,11 @@
                 extensionProcessor.write(policySet, writer);
             }
             
-            for (BindingType bindingType : scaDefns.getBindingTypes()) {
+            for (IntentAttachPointType bindingType : 
scaDefns.getBindingTypes()) {
                 extensionProcessor.write(bindingType, writer);
             }
             
-            for (ImplementationType implType : 
scaDefns.getImplementationTypes()) {
+            for (IntentAttachPointType implType : 
scaDefns.getImplementationTypes()) {
                 extensionProcessor.write(implType, writer);
             }
 
@@ -273,12 +275,12 @@
         }
         
         for (int count = 0, size = scaDefns.getBindingTypes().size(); count < 
size; count++) {
-            BindingType bindingType = scaDefns.getBindingTypes().get(count);
+            IntentAttachPointType bindingType = 
scaDefns.getBindingTypes().get(count);
             extensionProcessor.resolve(bindingType, resolver);
         }
         
         for (int count = 0, size = scaDefns.getImplementationTypes().size(); 
count < size; count++) {
-            ImplementationType implType = 
scaDefns.getImplementationTypes().get(count);
+            IntentAttachPointType implType = 
scaDefns.getImplementationTypes().get(count);
             extensionProcessor.resolve(implType, resolver);
         }
     }

Modified: 
incubator/tuscany/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java?view=diff&rev=566647&r1=566646&r2=566647
==============================================================================
--- 
incubator/tuscany/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
 Thu Aug 16 03:34:06 2007
@@ -34,17 +34,16 @@
 import 
org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
 import 
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.policy.BindingType;
 import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.ExtensionTypeFactory;
-import org.apache.tuscany.sca.policy.ImplementationType;
 import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.ProfileIntent;
 import org.apache.tuscany.sca.policy.QualifiedIntent;
 import org.apache.tuscany.sca.policy.SCADefinitions;
-import org.apache.tuscany.sca.policy.impl.DefaultExtensionTypeFactory;
+import 
org.apache.tuscany.sca.policy.impl.DefaultIntentAttachPointTypeFactoryImpl;
 
 /**
  * Test reading SCA XML assembly documents.
@@ -60,8 +59,8 @@
     private SCADefinitions scaDefinitions;
     Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
     Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
-    Map<QName, BindingType> bindingTypesTable = new Hashtable<QName, 
BindingType>();
-    Map<QName, ImplementationType> implTypesTable = new Hashtable<QName, 
ImplementationType>();
+    Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, 
IntentAttachPointType>();
+    Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, 
IntentAttachPointType>();
     public static final String namespace = "http://www.osoa.org/xmlns/sca/1.0";;
     
     private static final QName confidentiality = new QName(namespace, 
"confidentiality");
@@ -80,7 +79,7 @@
     public void setUp() throws Exception {
         XMLInputFactory inputFactory = XMLInputFactory.newInstance();
         PolicyFactory policyFactory = new DefaultPolicyFactory();
-        ExtensionTypeFactory extnTypeFactory = new 
DefaultExtensionTypeFactory();
+        IntentAttachPointTypeFactory intentAttachPointFactory = new 
DefaultIntentAttachPointTypeFactoryImpl();
         this.resolver = new SCADefinitionsResolver();
         this.builder = new SCADefinitionsBuilderImpl();
         
@@ -96,8 +95,8 @@
         staxProcessors.addArtifactProcessor(new 
ProfileIntentProcessor(policyFactory, staxProcessor));
         staxProcessors.addArtifactProcessor(new 
QualifiedIntentProcessor(policyFactory, staxProcessor));
         staxProcessors.addArtifactProcessor(new 
PolicySetProcessor(policyFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new 
ImplementationTypeProcessor(policyFactory, extnTypeFactory, staxProcessor));
-        staxProcessors.addArtifactProcessor(new 
BindingTypeProcessor(policyFactory, extnTypeFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new 
ImplementationTypeProcessor(policyFactory, intentAttachPointFactory, 
staxProcessor));
+        staxProcessors.addArtifactProcessor(new 
BindingTypeProcessor(policyFactory, intentAttachPointFactory, staxProcessor));
         staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
         
         URL url = getClass().getResource("definitions.xml");
@@ -112,12 +111,12 @@
             policySetTable.put(policySet.getName(), policySet);
         }
         
-        for ( BindingType bindingType : scaDefinitions.getBindingTypes() ) {
-            bindingTypesTable.put(bindingType.getTypeName(), bindingType);
+        for ( IntentAttachPointType bindingType : 
scaDefinitions.getBindingTypes() ) {
+            bindingTypesTable.put(bindingType.getName(), bindingType);
         }
         
-        for ( ImplementationType implType : 
scaDefinitions.getImplementationTypes() ) {
-            implTypesTable.put(implType.getTypeName(), implType);
+        for ( IntentAttachPointType implType : 
scaDefinitions.getImplementationTypes() ) {
+            implTypesTable.put(implType.getName(), implType);
         }
     }
 
@@ -172,11 +171,11 @@
         assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
         
assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
         
-        BindingType wsBindingType = bindingTypesTable.get(wsBinding);
+        IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
         
assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
         
assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
         
-        ImplementationType javaImplType = implTypesTable.get(javaImpl);
+        IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
         
assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
         
assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
         



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to