diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-16 15:38:34 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-16 15:38:34 +0000 |
commit | e6e918ef537c4aa9802ca27b92e1dc566c2cffda (patch) | |
tree | 7e713405c13ac6bb12a30d330cfa4e171bb334c1 /sca-java-2.x/tags/2.0-Beta3-RC1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java | |
parent | 6a5618b2741471546e0b0885e1758c391837dff6 (diff) |
Delete old RC tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1245033 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/tags/2.0-Beta3-RC1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java')
-rw-r--r-- | sca-java-2.x/tags/2.0-Beta3-RC1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java b/sca-java-2.x/tags/2.0-Beta3-RC1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java deleted file mode 100644 index bbc812582e..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/SCABindingProcessor.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.xml; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.WireFormat; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.policy.ExtensionType; -import org.apache.tuscany.sca.policy.PolicyFactory; -import org.apache.tuscany.sca.policy.PolicySubject; - -/** - * A processor to read the XML that describes the SCA binding. - * - * @version $Rev$ $Date$ - */ - -public class SCABindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCABinding> { - private static final String NAME = "name"; - private static final String URI = "uri"; - - private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; - private static final String BINDING_SCA = "binding.sca"; - private static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA); - - private PolicyFactory policyFactory; - private SCABindingFactory scaBindingFactory; - private PolicySubjectProcessor policyProcessor; - private PolicyFactory intentAttachPointTypeFactory; - private StAXArtifactProcessor<Object> extensionProcessor; - - - public SCABindingProcessor(FactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor) { - this.policyFactory = modelFactories.getFactory(PolicyFactory.class); - this.scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - policyProcessor = new PolicySubjectProcessor(policyFactory); - this.intentAttachPointTypeFactory = modelFactories.getFactory(PolicyFactory.class); - this.extensionProcessor = extensionProcessor; - } - - public QName getArtifactType() { - return BINDING_SCA_QNAME; - } - - public Class<SCABinding> getModelType() { - return SCABinding.class; - } - - public SCABinding read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException { - SCABinding scaBinding = scaBindingFactory.createSCABinding(); - ExtensionType bindingType = intentAttachPointTypeFactory.createBindingType(); - bindingType.setType(getArtifactType()); - bindingType.setUnresolved(true); - ((PolicySubject)scaBinding).setExtensionType(bindingType); - - // Read policies - policyProcessor.readPolicies(scaBinding, reader); - - // Read binding name - String name = reader.getAttributeValue(null, NAME); - if (name != null) { - scaBinding.setName(name); - } - - // Read binding URI - String uri = getURIString(reader, URI); - if (uri != null) { - scaBinding.setURI(uri); - } - - // Read any sub-elements - boolean endFound = false; - while (reader.hasNext() && endFound == false) { - int nextElementType = reader.next(); - switch (nextElementType) { - case START_ELEMENT: - Object extension = extensionProcessor.read(reader, context); - if (extension != null) { - if (extension instanceof WireFormat) { - scaBinding.setRequestWireFormat((WireFormat)extension); - } - } - break; - case END_ELEMENT: - QName endElementName = reader.getName(); - if(endElementName.equals(endElementName)){ - endFound = true; - } - break; - } - } - return scaBinding; - } - - public void resolve(SCABinding model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { - policyProcessor.resolvePolicies(model, resolver, context); - } - - public void write(SCABinding scaBinding, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { - - // Write <binding.sca> - writer.writeStartElement(SCA11_NS, BINDING_SCA); - policyProcessor.writePolicyAttributes(scaBinding, writer); - - // Write binding name - if (scaBinding.getName() != null) { - writer.writeAttribute(NAME, scaBinding.getName()); - } - - // Write binding URI - if (scaBinding.getURI() != null) { - writer.writeAttribute(URI, scaBinding.getURI()); - } - - // write wireFormat - extensionProcessor.write(scaBinding.getRequestWireFormat(), writer, context); - - writer.writeEndElement(); - } - -} |