Adding support for <baseURI> element of binding base uri configuration
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775370 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bfc5133237
commit
9f501ca231
3 changed files with 20 additions and 2 deletions
|
@ -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 NODE = new QName(SCA11_TUSCANY_NS, "node");
|
||||||
private static final QName CONTRIBUTION = new QName(SCA11_TUSCANY_NS, "contribution");
|
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 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 QName DEPLOYMENT_COMPOSITE = new QName(SCA11_TUSCANY_NS, "deploymentComposite");
|
||||||
|
|
||||||
private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903";
|
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;
|
NodeConfiguration node = null;
|
||||||
ContributionConfiguration contribution = null;
|
ContributionConfiguration contribution = null;
|
||||||
DeploymentComposite composite = null;
|
DeploymentComposite composite = null;
|
||||||
|
BindingConfiguration binding = null;
|
||||||
|
|
||||||
// Skip to end element
|
// Skip to end element
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -117,7 +119,7 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
|
||||||
contribution.setLocation(reader.getAttributeValue(null, "location"));
|
contribution.setLocation(reader.getAttributeValue(null, "location"));
|
||||||
node.getContributions().add(contribution);
|
node.getContributions().add(contribution);
|
||||||
} else if (BINDING.equals(name)) {
|
} else if (BINDING.equals(name)) {
|
||||||
BindingConfiguration binding = nodeConfigurationFactory.createBindingConfiguration();
|
binding = nodeConfigurationFactory.createBindingConfiguration();
|
||||||
binding.setBindingType(getQName(reader, "name"));
|
binding.setBindingType(getQName(reader, "name"));
|
||||||
String baseURIs = reader.getAttributeValue(null, "baseURIs");
|
String baseURIs = reader.getAttributeValue(null, "baseURIs");
|
||||||
if (baseURIs != null) {
|
if (baseURIs != null) {
|
||||||
|
@ -133,6 +135,15 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
|
||||||
if (contribution != null) {
|
if (contribution != null) {
|
||||||
contribution.getDeploymentComposites().add(composite);
|
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)) {
|
} else if (COMPOSITE.equals(name)) {
|
||||||
/*
|
/*
|
||||||
Object model = processor.read(reader);
|
Object model = processor.read(reader);
|
||||||
|
@ -155,6 +166,10 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
|
||||||
return node;
|
return node;
|
||||||
} else if (CONTRIBUTION.equals(name)) {
|
} else if (CONTRIBUTION.equals(name)) {
|
||||||
contribution = null;
|
contribution = null;
|
||||||
|
} else if (DEPLOYMENT_COMPOSITE.equals(name)) {
|
||||||
|
composite = null;
|
||||||
|
} else if (BINDING.equals(name)) {
|
||||||
|
binding = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reader.hasNext()) {
|
if (reader.hasNext()) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class NodeConfigurationProcessorTestCase {
|
||||||
XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(sw);
|
XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(sw);
|
||||||
processor.write(config, writer);
|
processor.write(config, writer);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
// System.out.println(sw.toString());
|
System.out.println(sw.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
<!-- Each base URI is for a protocol supported by the binding -->
|
<!-- 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="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.rmi" baseURIs="rmi://localhost:8080/rmi"/>
|
||||||
|
<binding name="tuscany:binding.jsonrpc">
|
||||||
|
<baseURI>http://localhost:8080/jsonrpc</baseURI>
|
||||||
|
</binding>
|
||||||
|
|
||||||
<!-- Configure a list of contributions -->
|
<!-- Configure a list of contributions -->
|
||||||
<contribution uri="http://c1" location="file:///a.jar"/>
|
<contribution uri="http://c1" location="file:///a.jar"/>
|
||||||
|
|
Loading…
Add table
Reference in a new issue