From 72a503ad27ee1cff61943650d6a62a28e98e1b1d Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 26 Jul 2012 18:33:33 +0000 Subject: Keep the composite object into the RemoteEndpoints git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1366136 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/node/configuration/xml/RemoteEndpoints.java | 12 +++++++++++- .../node/configuration/xml/RemoteEndpointsProcessor.java | 13 ++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpoints.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpoints.java index b4e631c08e..c1020a49af 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpoints.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpoints.java @@ -20,10 +20,20 @@ package org.apache.tuscany.sca.node.configuration.xml; import java.util.ArrayList; -import java.util.List; +import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.Endpoint; public class RemoteEndpoints extends ArrayList { private static final long serialVersionUID = -9045949145596529956L; + + private Composite composite; + + public Composite getComposite() { + return composite; + } + + public void setComposite(Composite composite) { + this.composite = composite; + } } diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java index dc4b79e099..640b84119b 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/RemoteEndpointsProcessor.java @@ -47,8 +47,8 @@ import org.apache.tuscany.sca.policy.PolicySet; * A StaX processor for remote endpoints */ public class RemoteEndpointsProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor { - private final static String ENDPOINT = "remoteEndpoints"; - private final static QName ENDPOINT_QNAME = new QName(Constants.SCA11_TUSCANY_NS, ENDPOINT); + private final static String REMOTE_ENDPOINTS = "remoteEndpoints"; + private final static QName REMOTE_ENDPOINTS_QNAME = new QName(Constants.SCA11_TUSCANY_NS, REMOTE_ENDPOINTS); private ExtensionPointRegistry registry; @@ -71,7 +71,7 @@ public class RemoteEndpointsProcessor extends BaseAssemblyProcessor implements S } public QName getArtifactType() { - return ENDPOINT_QNAME; + return REMOTE_ENDPOINTS_QNAME; } public RemoteEndpoints read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, @@ -80,13 +80,14 @@ public class RemoteEndpointsProcessor extends BaseAssemblyProcessor implements S if (reader.getEventType() == XMLStreamConstants.START_DOCUMENT) { reader.nextTag(); } - if (reader.getEventType() == XMLStreamConstants.START_ELEMENT && ENDPOINT_QNAME.equals(reader.getName())) { + if (reader.getEventType() == XMLStreamConstants.START_ELEMENT && REMOTE_ENDPOINTS_QNAME.equals(reader.getName())) { // Skip the "endpoint" element wrapper reader.nextTag(); } Object model = extensionProcessor.read(reader, context); if (model instanceof Composite) { Composite composite = (Composite)model; + endpoints.setComposite(composite); for (Component component : composite.getComponents()) { if (component.getURI() == null) { // Default to the component name as the uri @@ -113,7 +114,9 @@ public class RemoteEndpointsProcessor extends BaseAssemblyProcessor implements S public void write(RemoteEndpoints model, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { - + writeStart(writer, REMOTE_ENDPOINTS_QNAME.getNamespaceURI(), REMOTE_ENDPOINTS_QNAME.getLocalPart()); + extensionProcessor.write(model.getComposite(), writer, context); + writeEnd(writer); } public Class getModelType() { -- cgit v1.2.3