From 6b614afbc3f08ded00a70bf9cf976d9bad12b4a7 Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 2 Sep 2009 22:45:54 +0000 Subject: Merge from 1.5.1: 1) Fix for TUSCANY-3238 2) Remove calls to XMLStreamWriter.setPrefix() as writeNamespace() invokes it internally (TUSCANY-3212) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810726 13f79535-47bb-0310-9956-ffa450edef68 --- .../pojo/impl/POJOImplementationProcessor.java | 51 +++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'branches/sca-java-1.x/samples/implementation-pojo-extension') diff --git a/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java index 44a2cc0aa8..5476c80cdd 100644 --- a/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java +++ b/branches/sca-java-1.x/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.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 pojo.impl; @@ -48,25 +48,25 @@ import pojo.POJOImplementationFactory; /** * Implements a STAX based artifact processor for POJO implementations. - * + * * The artifact processor is responsible for processing * elements in SCA assembly XML composite files and populating the POJO * implementation model, resolving its references to other artifacts in the SCA - * contribution, and optionally write the model back to SCA assembly XML. + * contribution, and optionally write the model back to SCA assembly XML. */ public class POJOImplementationProcessor implements StAXArtifactProcessor { private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo"); - + private AssemblyFactory assemblyFactory; private JavaInterfaceFactory javaFactory; private POJOImplementationFactory pojoImplementationFactory; private PolicyFactory policyFactory; private PolicyAttachPointProcessor policyProcessor; - + public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - + // Get the assembly and Java interface factories as we'll need them to - // create model objects + // create model objects assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); policyFactory = modelFactories.getFactory(PolicyFactory.class); @@ -85,36 +85,36 @@ public class POJOImplementationProcessor implements StAXArtifactProcessor element POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation(); - + // Read policies policyProcessor.readPolicies(implementation, reader); - + // Read the POJO class attribute. String className = reader.getAttributeValue(null, "class"); implementation.setPOJOName(className); - + // Mark the POJO model unresolved to track the fact that it's not // completely initialized, its class is not loaded yet and services // and references not initialized either implementation.setUnresolved(true); - + // Skip to end element while (reader.hasNext()) { if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) { break; } } - + return implementation; } public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException { - + // Resolve the POJO implementation - + // First resolve its class ClassReference classReference = new ClassReference(implementation.getPOJOName()); classReference = resolver.resolveModel(ClassReference.class, classReference); @@ -123,21 +123,21 @@ public class POJOImplementationProcessor implements StAXArtifactProcessor element - policyProcessor.writePolicyPrefixes(implementation, writer); writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart()); policyProcessor.writePolicyAttributes(implementation, writer); - + if (implementation.getPOJOName() != null) { writer.writeAttribute("class", implementation.getPOJOName()); } - + writer.writeEndElement(); } } -- cgit v1.2.3