diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-14 06:54:03 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-14 06:54:03 +0000 |
commit | 1d6516b79fb3a086b7002bfdda54ac2651ca58be (patch) | |
tree | d2f2a1a78ebe68ea8f44bd0c299c27ff105dc4ad /branches/sca-java-1.5.1/modules/assembly-xml/src/main/java | |
parent | a0cde52968abd25f8d86804b90177c7a44ceb1a5 (diff) |
Remove calls to XMLStreamWriter.setPrefix() as writeNamespace() invokes it internally (TUSCANY-3212)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@804091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
2 files changed, 25 insertions, 35 deletions
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java index aa4980fcb6..0f062dbda5 100644 --- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java +++ b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.xml; @@ -34,8 +34,8 @@ 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.PolicyFactory; import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.policy.PolicyFactory; /** * Processor for dealing with 'operation' elements from composite definitions @@ -43,27 +43,27 @@ import org.apache.tuscany.sca.monitor.Monitor; * @version $Rev$ $Date$ */ public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{ - + private AssemblyFactory assemblyFactory; private PolicyAttachPointProcessor policyProcessor; private PolicyFactory policyFactory; private Monitor monitor; - + public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); this.policyFactory = modelFactories.getFactory(PolicyFactory.class); this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); this.monitor = monitor; } - + public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { ConfiguredOperation configuredOp = assemblyFactory.createConfiguredOperation(); - + //Read an <operation> configuredOp.setName(reader.getAttributeValue(null, NAME)); configuredOp.setContractName(reader.getAttributeValue(null, SERVICE)); configuredOp.setUnresolved(true); - + // Read policies policyProcessor.readPolicies(configuredOp, reader); @@ -73,15 +73,14 @@ public class ConfiguredOperationProcessor implements StAXArtifactProcessor<Confi break; } } - + return configuredOp; } - + public void write(ConfiguredOperation configuredOperation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { // Write an <operation> - policyProcessor.writePolicyPrefixes(configuredOperation, writer); writer.writeStartElement(Constants.SCA10_NS, OPERATION); policyProcessor.writePolicyAttributes(configuredOperation, writer); @@ -91,15 +90,15 @@ public class ConfiguredOperationProcessor implements StAXArtifactProcessor<Confi } writer.writeEndElement(); } - + public void resolve(ConfiguredOperation configuredOperation, ModelResolver resolver) throws ContributionResolveException { } - + public QName getArtifactType() { return OPERATION_QNAME; } - + public Class<ConfiguredOperation> getModelType() { return ConfiguredOperation.class; } diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java index fc4e10654d..44be1b6de1 100644 --- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java +++ b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.xml; @@ -43,9 +43,9 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint; * @version $Rev$ $Date$ */ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implements Constants { - + private PolicyFactory policyFactory; - + public PolicyAttachPointProcessor(PolicyFactory policyFactory) { this.policyFactory = policyFactory; } @@ -123,7 +123,7 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem policySets.add(policySet); } } - + value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS); if (value != null) { List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets(); @@ -140,7 +140,7 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem } } } - + /** * Write policies * @param attachPoint @@ -160,15 +160,6 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem } /** - * Write policies - * @param attachPoint - * @return - */ - public void writePolicyPrefixes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException { - writePolicyPrefixes(attachPoint, (Operation)null, writer); - } - - /** * Write policies associated with an operation * @param attachPoint * @param operation @@ -234,14 +225,14 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem } return new XAttr(Constants.POLICY_SETS, qnames); } - + public void resolvePolicies(Object attachPoint, ModelResolver resolver) { if ( attachPoint instanceof PolicySetAttachPoint ) { PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint; - + List<Intent> requiredIntents = new ArrayList<Intent>(); Intent resolvedIntent = null; - + if ( policySetAttachPoint.getRequiredIntents() != null && policySetAttachPoint.getRequiredIntents().size() > 0 ) { for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) { resolvedIntent = resolver.resolveModel(Intent.class, intent); @@ -250,7 +241,7 @@ public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implem policySetAttachPoint.getRequiredIntents().clear(); policySetAttachPoint.getRequiredIntents().addAll(requiredIntents); } - + if ( policySetAttachPoint.getPolicySets() != null && policySetAttachPoint.getPolicySets().size() > 0 ) { List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>(); PolicySet resolvedPolicySet = null; |