summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/node-impl
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/node-impl')
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java17
-rw-r--r--java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java2
-rw-r--r--java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml3
3 files changed, 20 insertions, 2 deletions
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
index 889ea6f118..fb16cf461d 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
@@ -57,6 +57,7 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
private static final QName NODE = new QName(SCA11_TUSCANY_NS, "node");
private static final QName CONTRIBUTION = new QName(SCA11_TUSCANY_NS, "contribution");
private static final QName BINDING = new QName(SCA11_TUSCANY_NS, "binding");
+ private static final QName BASE_URI = new QName(SCA11_TUSCANY_NS, "baseURI");
private static final QName DEPLOYMENT_COMPOSITE = new QName(SCA11_TUSCANY_NS, "deploymentComposite");
private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903";
@@ -100,6 +101,7 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
NodeConfiguration node = null;
ContributionConfiguration contribution = null;
DeploymentComposite composite = null;
+ BindingConfiguration binding = null;
// Skip to end element
while (true) {
@@ -117,7 +119,7 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
contribution.setLocation(reader.getAttributeValue(null, "location"));
node.getContributions().add(contribution);
} else if (BINDING.equals(name)) {
- BindingConfiguration binding = nodeConfigurationFactory.createBindingConfiguration();
+ binding = nodeConfigurationFactory.createBindingConfiguration();
binding.setBindingType(getQName(reader, "name"));
String baseURIs = reader.getAttributeValue(null, "baseURIs");
if (baseURIs != null) {
@@ -133,6 +135,15 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
if (contribution != null) {
contribution.getDeploymentComposites().add(composite);
}
+ } else if(BASE_URI.equals(name)) {
+ // We also support <baseURI> element
+ String baseURI = reader.getElementText();
+ if (baseURI != null && binding != null) {
+ baseURI = baseURI.trim();
+ binding.addBaseURI(baseURI);
+ }
+ // getElementText() moves the event to END_ELEMENT
+ continue;
} else if (COMPOSITE.equals(name)) {
/*
Object model = processor.read(reader);
@@ -155,6 +166,10 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
return node;
} else if (CONTRIBUTION.equals(name)) {
contribution = null;
+ } else if (DEPLOYMENT_COMPOSITE.equals(name)) {
+ composite = null;
+ } else if (BINDING.equals(name)) {
+ binding = null;
}
}
if (reader.hasNext()) {
diff --git a/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java b/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java
index 5f1f8373d4..f76aabe034 100644
--- a/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java
+++ b/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessorTestCase.java
@@ -70,7 +70,7 @@ public class NodeConfigurationProcessorTestCase {
XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(sw);
processor.write(config, writer);
writer.flush();
- // System.out.println(sw.toString());
+ System.out.println(sw.toString());
}
/**
diff --git a/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml b/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
index 787cd68a60..40961a22b7 100644
--- a/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
+++ b/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
@@ -27,6 +27,9 @@
<!-- Each base URI is for a protocol supported by the binding -->
<binding name="sca:binding.ws" baseURIs="http://localhost:8080/ws https://localhost:8081/ws"/>
<binding name="tuscany:binding.rmi" baseURIs="rmi://localhost:8080/rmi"/>
+ <binding name="tuscany:binding.jsonrpc">
+ <baseURI>http://localhost:8080/jsonrpc</baseURI>
+ </binding>
<!-- Configure a list of contributions -->
<contribution uri="http://c1" location="file:///a.jar"/>