diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-15 03:41:05 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-15 03:41:05 +0000 |
commit | f2c134b2c1dfd5fedd472bafe53155db55ad9d70 (patch) | |
tree | b90e132d2337330b8491968a1ffff034f6301837 /java/sca/modules/node-api/src | |
parent | c35965ba40d5bd2fa3f840a4a7878c0313230db7 (diff) |
Integrate the NodeConfiguration with NodeImpl
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@774994 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-api/src')
3 files changed, 29 insertions, 23 deletions
diff --git a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java index 0c1e9bb642..1f30045bd1 100644 --- a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java +++ b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java @@ -225,13 +225,4 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory { * @return The node configuration */ public abstract NodeConfiguration loadConfiguration(InputStream xml); - - public static void main(String args[]) { - NodeFactory factory = NodeFactory.newInstance(); - NodeConfiguration nodeConfiguration = - factory.createNodeConfiguration().setDomainURI("http://d1").setURI("http://node1") - .addContribution("http://c1", "file:/a.jar"); - Node node = factory.createNode(nodeConfiguration).start(); - - } } diff --git a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java index a14a4ac9eb..53e26fc9ad 100644 --- a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java +++ b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java @@ -24,5 +24,5 @@ import org.apache.tuscany.sca.node.configuration.impl.NodeConfigurationFactoryIm /**
* Default NodeConfigurationFactory
*/
-public class DefaultNodeConfigurationFactory extends NodeConfigurationFactoryImpl {
+public class DefaultNodeConfigurationFactory extends NodeConfigurationFactoryImpl implements NodeConfigurationFactory {
}
diff --git a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java index 162918f98d..acbf3d5246 100644 --- a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java +++ b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java @@ -78,33 +78,40 @@ class NodeConfigurationImpl implements NodeConfiguration { }
public NodeConfiguration addBinding(QName bindingType, String... baseURIs) {
- // TODO Auto-generated method stub
- return null;
+ BindingConfiguration binding = new BindingConfigurationImpl().setBindingType(bindingType);
+ for (String u : baseURIs) {
+ binding.addBaseURI(u);
+ }
+ return addBinding(binding);
}
public NodeConfiguration addBinding(QName bindingType, URI... baseURIs) {
- // TODO Auto-generated method stub
- return null;
+ BindingConfiguration binding = new BindingConfigurationImpl().setBindingType(bindingType);
+ for (URI u : baseURIs) {
+ binding.addBaseURI(u.toString());
+ }
+ return addBinding(binding);
}
public NodeConfiguration addContribution(String contributionURI, String location) {
- // TODO Auto-generated method stub
- return null;
+ ContributionConfiguration contribution = new ContributionConfigurationImpl(contributionURI, location);
+ return addContribution(contribution);
}
public NodeConfiguration addContribution(String contributionURI, URL location) {
- // TODO Auto-generated method stub
- return null;
+ return addContribution(contributionURI, location.toString());
}
public NodeConfiguration addContribution(URI contributionURI, URL location) {
- // TODO Auto-generated method stub
- return null;
+ return addContribution(contributionURI.toString(), location.toString());
}
- public NodeConfiguration addContribution(URL... location) {
- // TODO Auto-generated method stub
- return null;
+ public NodeConfiguration addContribution(URL... locations) {
+ for (URL url : locations) {
+ ContributionConfiguration contribution = new ContributionConfigurationImpl(url.toString(), url.toString());
+ addContribution(contribution);
+ }
+ return this;
}
public NodeConfiguration addDeploymentComposite(String contributionURI, InputStream content) {
@@ -131,4 +138,12 @@ class NodeConfigurationImpl implements NodeConfiguration { throw new IllegalArgumentException("Contribution is not found (uri=" + uri + ")");
}
+ public String toString() {
+ if (domainURI != null) {
+ return "{" + domainURI + "}" + uri;
+ } else {
+ return uri;
+ }
+ }
+
}
|