diff options
23 files changed, 281 insertions, 52 deletions
diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java index e7aa06755b..2c32575098 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java @@ -98,6 +98,7 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement protected ExtensionFactory extensionFactory; protected PolicyFactory policyFactory; protected StAXArtifactProcessor<Object> extensionProcessor; + protected StAXAttributeProcessor<Object> extensionAttributeProcessor; protected PolicyAttachPointProcessor policyProcessor; private DocumentBuilderFactory documentBuilderFactory; protected IntentAttachPointTypeFactory intentAttachPointTypeFactory; @@ -115,11 +116,13 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement ExtensionFactory extensionFactory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { this.assemblyFactory = assemblyFactory; this.extensionFactory = extensionFactory; this.policyFactory = policyFactory; this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor; + this.extensionAttributeProcessor = extensionAttributeProcessor; this.contributionFactory = contribFactory; this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); this.intentAttachPointTypeFactory = new IntentAttachPointTypeFactoryImpl(); @@ -136,11 +139,13 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement ExtensionFactory extensionFactory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { this.assemblyFactory = assemblyFactory; this.extensionFactory = extensionFactory; this.policyFactory = policyFactory; this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor; + this.extensionAttributeProcessor = extensionAttributeProcessor; this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); this.monitor = monitor; } @@ -862,16 +867,16 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement } + /** * * @param reader - * @param elementName * @param estensibleElement - * @param extensionAttributeProcessor * @throws ContributionReadException * @throws XMLStreamException */ - protected void readExtendedAttributes(XMLStreamReader reader, QName elementName, Extensible estensibleElement, StAXAttributeProcessor extensionAttributeProcessor) throws ContributionReadException, XMLStreamException { + protected void readExtendedAttributes(XMLStreamReader reader, Extensible estensibleElement) throws ContributionReadException, XMLStreamException { + QName elementName = reader.getName(); for (int a = 0; a < reader.getAttributeCount(); a++) { QName attributeName = reader.getAttributeName(a); if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { @@ -892,7 +897,6 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement /** * - * @param attributeModel * @param writer * @param extensibleElement * @param extensionAttributeProcessor diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java index ec355e069e..6a4bc2ba23 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java @@ -56,7 +56,7 @@ public class ComponentTypeDocumentProcessor extends BaseAssemblyProcessor implem public ComponentTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory, Monitor monitor) { - super(null, null, null, staxProcessor, monitor); + super(null, null, null, staxProcessor, null, monitor); this.inputFactory = inputFactory; } @@ -68,7 +68,7 @@ public class ComponentTypeDocumentProcessor extends BaseAssemblyProcessor implem public ComponentTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor staxProcessor, Monitor monitor) { - super(null, null, null, staxProcessor, monitor); + super(null, null, null, staxProcessor, null, monitor); this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class); } diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java index 7a95062ff0..c6cfd90bd4 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java @@ -69,8 +69,10 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA public ComponentTypeProcessor(AssemblyFactory factory, ExtensionFactory extensionFactory, PolicyFactory policyFactory, - StAXArtifactProcessor extensionProcessor, StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { - super(factory, extensionFactory, policyFactory, extensionProcessor, monitor); + StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, + Monitor monitor) { + super(factory, extensionFactory, policyFactory, extensionProcessor, extensionAttributeProcessor, monitor); } /** @@ -87,6 +89,7 @@ public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StA modelFactories.getFactory(ExtensionFactory.class), modelFactories.getFactory(PolicyFactory.class), extensionProcessor, + extensionAttributeProcessor, monitor); } diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java index 98564062d6..64f5bf7b99 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java @@ -66,8 +66,10 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements * @param staxProcessor */ public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor, - XMLInputFactory inputFactory, List scaDefnsSink, Monitor monitor) { - super(null, null, null, staxProcessor, monitor); + XMLInputFactory inputFactory, + List scaDefnsSink, + Monitor monitor) { + super(null, null, null, staxProcessor, null, monitor); this.inputFactory = inputFactory; this.scaDefnSink = scaDefnsSink; } @@ -78,8 +80,9 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements * @param staxProcessor */ public CompositeDocumentProcessor(ModelFactoryExtensionPoint modelFactories, - StAXArtifactProcessor staxProcessor, Monitor monitor) { - super(null, null, null, staxProcessor, monitor); + StAXArtifactProcessor staxProcessor, + Monitor monitor) { + super(null, null, null, staxProcessor, null, monitor); this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class); } diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index fa45585640..36ac771c66 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -90,8 +90,6 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt // FIXME: to be refactored private XPathFactory xPathFactory = XPathFactory.newInstance(); - protected StAXAttributeProcessor<Object> extensionAttributeProcessor; - /** * Construct a new composite processor * @@ -128,6 +126,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt modelFactories.getFactory(ExtensionFactory.class), modelFactories.getFactory(PolicyFactory.class), extensionProcessor, + extensionAttributeProcessor, monitor); this.extensionAttributeProcessor = extensionAttributeProcessor; @@ -149,7 +148,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt StAXArtifactProcessor extensionProcessor, StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { - super(contributionFactory, assemblyFactory, extensionFactory, policyFactory, extensionProcessor, monitor); + super(contributionFactory, assemblyFactory, extensionFactory, policyFactory, extensionProcessor, extensionAttributeProcessor, monitor); } public Composite read(XMLStreamReader reader) throws ContributionReadException { @@ -192,7 +191,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt } //handle extension attributes - this.readExtendedAttributes(reader, name, composite, extensionAttributeProcessor); + this.readExtendedAttributes(reader, composite); composite.setLocal(getBoolean(reader, LOCAL)); composite.setConstrainingType(readConstrainingType(reader)); @@ -216,7 +215,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt componentService.setName(getString(reader, NAME)); //handle extension attributes - this.readExtendedAttributes(reader, name, componentService, extensionAttributeProcessor); + this.readExtendedAttributes(reader, componentService); component.getServices().add(componentService); policyProcessor.readPolicies(contract, reader); @@ -252,7 +251,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt } //handle extension attributes - this.readExtendedAttributes(reader, name, compositeService, extensionAttributeProcessor); + this.readExtendedAttributes(reader, compositeService); composite.getServices().add(compositeService); policyProcessor.readPolicies(contract, reader); @@ -272,7 +271,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL)); //handle extension attributes - this.readExtendedAttributes(reader, name, componentReference, extensionAttributeProcessor); + this.readExtendedAttributes(reader, componentReference); component.getReferences().add(componentReference); policyProcessor.readPolicies(contract, reader); @@ -296,7 +295,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL)); //handle extension attributes - this.readExtendedAttributes(reader, name, compositeReference, extensionAttributeProcessor); + this.readExtendedAttributes(reader, compositeReference); composite.getReferences().add(compositeReference); policyProcessor.readPolicies(contract, reader); @@ -340,7 +339,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt componentProperty.setFile(getString(reader, FILE)); //handle extension attributes - this.readExtendedAttributes(reader, name, componentProperty, extensionAttributeProcessor); + this.readExtendedAttributes(reader, componentProperty); policyProcessor.readPolicies(property, reader); readAbstractProperty(componentProperty, reader); @@ -384,7 +383,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt } //handle extension attributes - this.readExtendedAttributes(reader, name, component, extensionAttributeProcessor); + this.readExtendedAttributes(reader, component); component.setConstrainingType(readConstrainingType(reader)); composite.getComponents().add(component); @@ -405,7 +404,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt wire.setTarget(target); //handle extension attributes - this.readExtendedAttributes(reader, name, wire, extensionAttributeProcessor); + this.readExtendedAttributes(reader, wire); composite.getWires().add(wire); policyProcessor.readPolicies(wire, reader); @@ -417,7 +416,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt contract.setCallback(callback); //handle extension attributes - this.readExtendedAttributes(reader, name, callback, extensionAttributeProcessor); + this.readExtendedAttributes(reader, callback); policyProcessor.readPolicies(callback, reader); @@ -453,7 +452,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt implementation.setUnresolved(true); //handle extension attributes - this.readExtendedAttributes(reader, name, implementation, extensionAttributeProcessor); + this.readExtendedAttributes(reader, implementation); component.setImplementation(implementation); policyProcessor.readPolicies(implementation, reader); diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java index 546679ddc1..8a6090b441 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java @@ -56,7 +56,7 @@ public class ConstrainingTypeDocumentProcessor extends BaseAssemblyProcessor imp public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory, Monitor monitor) { - super(null, null, null, staxProcessor, monitor); + super(null, null, null, staxProcessor, null, monitor); this.inputFactory = inputFactory; } @@ -68,7 +68,7 @@ public class ConstrainingTypeDocumentProcessor extends BaseAssemblyProcessor imp public ConstrainingTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor staxProcessor, Monitor monitor) { - super(null, null, null, staxProcessor, monitor); + super(null, null, null, staxProcessor, null, monitor); this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class); } diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java index 21742a7d9c..1108cd32e0 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java @@ -36,6 +36,7 @@ import org.apache.tuscany.sca.assembly.ConstrainingType; import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; @@ -63,9 +64,10 @@ public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements public ConstrainingTypeProcessor(AssemblyFactory assemblyFactory, ExtensionFactory extensionFactory, PolicyFactory policyFactory, - StAXArtifactProcessor extensionProcessor, + StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { - super(assemblyFactory, extensionFactory, policyFactory, extensionProcessor, monitor); + super(assemblyFactory, extensionFactory, policyFactory, extensionProcessor, extensionAttributeProcessor, monitor); } /** @@ -76,11 +78,13 @@ public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements */ public ConstrainingTypeProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { super(modelFactories.getFactory(AssemblyFactory.class), modelFactories.getFactory(ExtensionFactory.class), modelFactories.getFactory(PolicyFactory.class), extensionProcessor, + extensionAttributeProcessor, monitor); } diff --git a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java index 34878a9f53..9c9dfd7114 100644 --- a/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java +++ b/branches/sca-java-1.3.3/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java @@ -67,7 +67,7 @@ public class DefaultBeanModelProcessor extends BaseAssemblyProcessor implements Class<Implementation> modelClass, Object modelFactory, Monitor monitor) { - super(assemblyFactory, extensionFactory, policyFactory, null, monitor); + super(assemblyFactory, extensionFactory, policyFactory, null, null, monitor); this.artifactType = artifactType; this.modelClass = modelClass; this.modelFactory = modelFactory; diff --git a/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java b/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java index 271a113429..ae9d11d112 100644 --- a/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java +++ b/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java @@ -22,6 +22,7 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.Base; import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Extensible; import org.apache.tuscany.sca.assembly.xml.Constants; /** @@ -29,7 +30,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants; * * @version $Rev$ $Date$ */ -public interface EJBBinding extends Binding, Base { +public interface EJBBinding extends Binding, Extensible, Base { // Constants used when describing the EJB binding // model and for setting up defaults String BINDING_EJB = "binding.ejb"; diff --git a/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java b/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java index e601ea28f8..912df7c666 100644 --- a/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java +++ b/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.binding.ejb.impl; +import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl; import org.apache.tuscany.sca.binding.ejb.EJBBinding; /** @@ -25,7 +26,7 @@ import org.apache.tuscany.sca.binding.ejb.EJBBinding; * * @version $Rev$ $Date$ */ -public class EJBBindingImpl implements EJBBinding { +public class EJBBindingImpl extends ExtensibleImpl implements EJBBinding { /** * CORBA location For example, diff --git a/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java b/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java index 9a487e02d1..f4392de7ce 100644 --- a/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java +++ b/branches/sca-java-1.3.3/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java @@ -23,18 +23,25 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Extension; +import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; import org.apache.tuscany.sca.binding.ejb.EJBBinding; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; 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.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.policy.PolicyFactory; import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; @@ -60,13 +67,24 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; */ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl> { private PolicyFactory policyFactory; + private ExtensionFactory extensionFactory; private PolicyAttachPointProcessor policyProcessor; + private StAXAttributeProcessor<Object> extensionAttributeProcessor; private Monitor monitor; - public EJBBindingProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + public EJBBindingProcessor(ExtensionPointRegistry extensionPoints) { + ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + this.policyFactory = modelFactories.getFactory(PolicyFactory.class); + this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); - this.monitor = monitor; + this.extensionAttributeProcessor = extensionPoints.getExtensionPoint(ExtensibleStAXAttributeProcessor.class); + + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + if (monitorFactory != null) { + this.monitor = monitorFactory.createMonitor(); + } } /** @@ -151,6 +169,24 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl ejbBinding.setRequires(requires); } + // Handle extended attributes + QName elementName = reader.getName(); + for (int a = 0; a < reader.getAttributeCount(); a++) { + QName attributeName = reader.getAttributeName(a); + if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { + if( ! elementName.getNamespaceURI().equals(attributeName.getNamespaceURI()) ) { + Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); + Extension attributeExtension; + if (attributeValue instanceof Extension) { + attributeExtension = (Extension) attributeValue; + } else { + attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true); + } + ejbBinding.getAttributeExtensions().add(attributeExtension); + } + } + } + return ejbBinding; } @@ -167,6 +203,11 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl writer.writeAttribute(EJBBinding.URI, ejbBinding.getURI()); } + for(Extension extension : ejbBinding.getAttributeExtensions()) { + if(extension.isAttribute()) { + extensionAttributeProcessor.write(extension, writer); + } + } // FIXME Implement the rest diff --git a/branches/sca-java-1.3.3/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/branches/sca-java-1.3.3/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java index c472caac3a..f7d6ef6bff 100644 --- a/branches/sca-java-1.3.3/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java +++ b/branches/sca-java-1.3.3/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java @@ -23,6 +23,7 @@ import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; import java.util.Map; + import javax.wsdl.Binding; import javax.wsdl.Port; import javax.wsdl.PortType; @@ -33,6 +34,8 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; import org.apache.tuscany.sca.assembly.ConfiguredOperation; +import org.apache.tuscany.sca.assembly.Extension; +import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.assembly.OperationsConfigurator; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor; @@ -42,7 +45,9 @@ import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; @@ -73,25 +78,26 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ private WSDLFactory wsdlFactory; private WebServiceBindingFactory wsFactory; private PolicyFactory policyFactory; + private ExtensionFactory extensionFactory; private PolicyAttachPointProcessor policyProcessor; private IntentAttachPointTypeFactory intentAttachPointTypeFactory; private ConfiguredOperationProcessor configuredOperationProcessor; + private StAXAttributeProcessor<Object> extensionAttributeProcessor; private Monitor monitor; - public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints) { + public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) { + this.extensionPoints = extensionPoints; ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); this.policyFactory = modelFactories.getFactory(PolicyFactory.class); this.wsFactory = new DefaultWebServiceBindingFactory(); this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - if (monitorFactory != null) { - this.monitor = monitorFactory.createMonitor(); - } + this.monitor = monitor; this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor); + this.extensionAttributeProcessor = extensionPoints.getExtensionPoint(ExtensibleStAXAttributeProcessor.class); } /** @@ -208,6 +214,26 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ // Read wsdlLocation wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION)); + + // Handle extended attributes + QName elementName = reader.getName(); + for (int a = 0; a < reader.getAttributeCount(); a++) { + QName attributeName = reader.getAttributeName(a); + if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI() != WSDLI_NS && attributeName.getNamespaceURI().length() > 0) { + if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && + (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) { + Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); + Extension attributeExtension; + if (attributeValue instanceof Extension) { + attributeExtension = (Extension) attributeValue; + } else { + attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true); + } + wsBinding.getAttributeExtensions().add(attributeExtension); + } + } + } + ConfiguredOperation confOp = null; // Skip to end element @@ -307,6 +333,13 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsBinding.getLocation()); } + // Write extended attributes + for(Extension extension : wsBinding.getAttributeExtensions()) { + if(extension.isAttribute()) { + extensionAttributeProcessor.write(extension, writer); + } + } + if (wsBinding.getEndPointReference() != null) { EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer); } diff --git a/branches/sca-java-1.3.3/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java b/branches/sca-java-1.3.3/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java index 0e519af9d3..7ab9b19a56 100644 --- a/branches/sca-java-1.3.3/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java +++ b/branches/sca-java-1.3.3/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java @@ -27,12 +27,13 @@ import javax.xml.stream.XMLOutputFactory; import junit.framework.TestCase; -import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; /** @@ -52,6 +53,7 @@ public class WriteTestCase extends TestCase { inputFactory = XMLInputFactory.newInstance(); outputFactory = XMLOutputFactory.newInstance(); StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); + StAXAttributeProcessorExtensionPoint staxAttributeProcessors = new DefaultStAXAttributeProcessorExtensionPoint(extensionPoints); staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null); } /* diff --git a/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java b/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java index 0d07a55a14..9e1a261dcf 100644 --- a/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java +++ b/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java @@ -24,6 +24,7 @@ import javax.wsdl.Service; import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Extensible; import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; @@ -35,7 +36,7 @@ import org.w3c.dom.Element; * * @version $Rev$ $Date$ */ -public interface WebServiceBinding extends Binding, BindingBuilderExtension { +public interface WebServiceBinding extends Binding, BindingBuilderExtension, Extensible { /** * Sets the WSDL location. diff --git a/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java b/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java index 8a60e847c3..88d0228220 100644 --- a/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java +++ b/branches/sca-java-1.3.3/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java @@ -29,7 +29,6 @@ import javax.wsdl.Service; import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.Extensible; import org.apache.tuscany.sca.assembly.Extension; import org.apache.tuscany.sca.assembly.OperationsConfigurator; import org.apache.tuscany.sca.assembly.builder.BindingBuilder; @@ -49,7 +48,7 @@ import org.w3c.dom.Element; * * @version $Rev$ $Date$ */ -class WebServiceBindingImpl implements WebServiceBinding, PolicySetAttachPoint, Extensible, OperationsConfigurator { +class WebServiceBindingImpl implements WebServiceBinding, PolicySetAttachPoint, OperationsConfigurator { private String name; private String uri; private boolean unresolved; diff --git a/branches/sca-java-1.3.3/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/branches/sca-java-1.3.3/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java index 11934ec6bb..d72beca52e 100644 --- a/branches/sca-java-1.3.3/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java +++ b/branches/sca-java-1.3.3/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java @@ -36,6 +36,8 @@ import javax.xml.stream.XMLStreamWriter; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.ConfiguredOperation; +import org.apache.tuscany.sca.assembly.Extension; +import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.assembly.OperationsConfigurator; import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.assembly.Reference; @@ -46,6 +48,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; @@ -71,22 +74,29 @@ import org.apache.tuscany.sca.policy.PolicyFactory; public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaImplementation>, JavaImplementationConstants { - private JavaImplementationFactory javaFactory; private AssemblyFactory assemblyFactory; private PolicyFactory policyFactory; + private ExtensionFactory extensionFactory; + private JavaImplementationFactory javaFactory; private PolicyAttachPointProcessor policyProcessor; private IntentAttachPointTypeFactory intentAttachPointTypeFactory; private ConfiguredOperationProcessor configuredOperationProcessor; + private StAXAttributeProcessor<Object> extensionAttributeProcessor; private Monitor monitor; - public JavaImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + public JavaImplementationProcessor(ModelFactoryExtensionPoint modelFactories, + StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, + Monitor monitor) { this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); this.policyFactory = modelFactories.getFactory(PolicyFactory.class); + this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); this.javaFactory = modelFactories.getFactory(JavaImplementationFactory.class); this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); this.monitor = monitor; this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor); + this.extensionAttributeProcessor = extensionAttributeProcessor; } /** @@ -135,6 +145,24 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm // Read policies policyProcessor.readPolicies(javaImplementation, reader); + // Handle extended attributes + for (int a = 0; a < reader.getAttributeCount(); a++) { + QName attributeName = reader.getAttributeName(a); + if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { + if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && + (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) { + Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); + Extension attributeExtension; + if (attributeValue instanceof Extension) { + attributeExtension = (Extension) attributeValue; + } else { + attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true); + } + javaImplementation.getAttributeExtensions().add(attributeExtension); + } + } + } + // read operation elements if exists or skip unto end element int event; ConfiguredOperation confOp = null; @@ -171,6 +199,13 @@ public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaIm writer.writeAttribute(CLASS, javaImplementation.getName()); } + // Write extended attributes + for(Extension extension : javaImplementation.getAttributeExtensions()) { + if(extension.isAttribute()) { + extensionAttributeProcessor.write(extension, writer); + } + } + writer.writeEndElement(); } diff --git a/branches/sca-java-1.3.3/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java b/branches/sca-java-1.3.3/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java index ae5bf4c56d..b8f7a4b93b 100644 --- a/branches/sca-java-1.3.3/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java +++ b/branches/sca-java-1.3.3/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java @@ -26,10 +26,13 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Extension; +import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; @@ -50,10 +53,17 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants { private JavaInterfaceFactory javaFactory; + private ExtensionFactory extensionFactory; + private StAXAttributeProcessor<Object> extensionAttributeProcessor; private Monitor monitor; - public JavaInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + public JavaInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, + StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, + Monitor monitor) { this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); + this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); + this.extensionAttributeProcessor = extensionAttributeProcessor; this.monitor = monitor; } @@ -108,6 +118,23 @@ public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfa javaInterfaceContract.setCallbackInterface(javaCallbackInterface); } + // Handle extended attributes + for (int a = 0; a < reader.getAttributeCount(); a++) { + QName attributeName = reader.getAttributeName(a); + if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { + if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && + (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) { + Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); + Extension attributeExtension; + if (attributeValue instanceof Extension) { + attributeExtension = (Extension) attributeValue; + } else { + attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true); + } + javaInterfaceContract.getAttributeExtensions().add(attributeExtension); + } + } + } // Skip to end element while (reader.hasNext()) { if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) { @@ -131,6 +158,13 @@ public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfa if (javaCallbackInterface != null && javaCallbackInterface.getName() != null) { writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName()); } + + // Write extended attributes + for(Extension extension : javaInterfaceContract.getAttributeExtensions()) { + if(extension.isAttribute()) { + extensionAttributeProcessor.write(extension, writer); + } + } writer.writeEndElement(); } diff --git a/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java b/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java index e3a84c63f0..ac747d579d 100644 --- a/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java +++ b/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.interfacedef.java; +import org.apache.tuscany.sca.assembly.Extensible; import org.apache.tuscany.sca.interfacedef.InterfaceContract; /** @@ -27,6 +28,6 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; * * @version $Rev$ $Date$ */ -public interface JavaInterfaceContract extends InterfaceContract { +public interface JavaInterfaceContract extends InterfaceContract, Extensible { } diff --git a/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java b/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java index d43ebe558b..009eaf90c9 100644 --- a/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java +++ b/branches/sca-java-1.3.3/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java @@ -18,6 +18,10 @@ */ package org.apache.tuscany.sca.interfacedef.java.impl; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.sca.assembly.Extension; import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; @@ -27,6 +31,8 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; * @version $Rev$ $Date$ */ public class JavaInterfaceContractImpl extends InterfaceContractImpl implements JavaInterfaceContract { + private List<Object> extensions = new ArrayList<Object>(); + private List<Extension> attributeExtensions = new ArrayList<Extension>(); protected JavaInterfaceContractImpl() { } @@ -36,4 +42,13 @@ public class JavaInterfaceContractImpl extends InterfaceContractImpl implements return (JavaInterfaceContractImpl) super.clone(); } + public List<Object> getExtensions() { + return extensions; + } + + public List<Extension> getAttributeExtensions() { + return attributeExtensions; + } + + } diff --git a/branches/sca-java-1.3.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/branches/sca-java-1.3.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index e04a4d6743..5afbcb6d2b 100644 --- a/branches/sca-java-1.3.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/branches/sca-java-1.3.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -27,10 +27,13 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Extension; +import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; @@ -52,10 +55,17 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants { private WSDLFactory wsdlFactory; + private ExtensionFactory extensionFactory; + private StAXAttributeProcessor<Object> extensionAttributeProcessor; private Monitor monitor; - public WSDLInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + public WSDLInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, + StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, + Monitor monitor) { this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); + this.extensionAttributeProcessor = extensionAttributeProcessor; this.monitor = monitor; } @@ -150,6 +160,24 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa if (wsdlCallbackInterface != null) wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface); } + + // Handle extended attributes + for (int a = 0; a < reader.getAttributeCount(); a++) { + QName attributeName = reader.getAttributeName(a); + if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { + if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && + (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) { + Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); + Extension attributeExtension; + if (attributeValue instanceof Extension) { + attributeExtension = (Extension) attributeValue; + } else { + attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true); + } + wsdlInterfaceContract.getAttributeExtensions().add(attributeExtension); + } + } + } // Skip to end element while (reader.hasNext()) { @@ -184,6 +212,13 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsdlInterfaceContract.getLocation()); } + // Write extended attributes + for(Extension extension : wsdlInterfaceContract.getAttributeExtensions()) { + if(extension.isAttribute()) { + extensionAttributeProcessor.write(extension, writer); + } + } + writer.writeEndElement(); } diff --git a/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java b/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java index 59db17116b..2ef21a50cf 100644 --- a/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java +++ b/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.interfacedef.wsdl; +import org.apache.tuscany.sca.assembly.Extensible; import org.apache.tuscany.sca.interfacedef.InterfaceContract; @@ -26,7 +27,7 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; * * @version $Rev$ $Date$ */ -public interface WSDLInterfaceContract extends InterfaceContract { +public interface WSDLInterfaceContract extends InterfaceContract, Extensible { /** * Sets the WSDL location. diff --git a/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java b/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java index e10bc0d178..e116f567c1 100644 --- a/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java +++ b/branches/sca-java-1.3.3/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java @@ -18,6 +18,10 @@ */ package org.apache.tuscany.sca.interfacedef.wsdl.impl; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.sca.assembly.Extension; import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; @@ -28,6 +32,9 @@ import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; */ public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements WSDLInterfaceContract { private String location; + private List<Object> extensions = new ArrayList<Object>(); + private List<Extension> attributeExtensions = new ArrayList<Extension>(); + protected WSDLInterfaceContractImpl() { } @@ -39,6 +46,16 @@ public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements public void setLocation(String location) { this.location = location; } + + + public List<Object> getExtensions() { + return extensions; + } + + public List<Extension> getAttributeExtensions() { + return attributeExtensions; + } + @Override public WSDLInterfaceContractImpl clone() throws CloneNotSupportedException { diff --git a/branches/sca-java-1.3.3/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java b/branches/sca-java-1.3.3/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java index 263c766948..718b68d408 100644 --- a/branches/sca-java-1.3.3/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java +++ b/branches/sca-java-1.3.3/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java @@ -56,11 +56,11 @@ public class WSPolicyProcessor extends BaseStAXArtifactProcessor implements StAX public final static QName WS_POLICY_QNAME =new QName(WS_POLICY_NS, WS_POLICY); public WSPolicyProcessor() { - System.out.println(">>>Initializing WSPolicyProcessor"); + //System.out.println(">>>Initializing WSPolicyProcessor"); } public WSPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - System.out.println(">>>Initializing WSPolicyProcessor"); + //System.out.println(">>>Initializing WSPolicyProcessor"); } public QName getArtifactType() { |