diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-15 18:36:42 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-15 18:36:42 +0000 |
commit | 73ffdb3c639f918474bc0df9dac57af8b121f3ab (patch) | |
tree | 3b9301fb26221936bbb6b7e1bccacc5498953bc3 /java/sca/modules/node-impl/src/main | |
parent | 80f7efa886898658571776162c633bd5399d43e6 (diff) |
Push down some of the createNode() methods to NodeFactory and only require the createNode(NodeConfiguration) to be implemented by subclasses
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775283 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/node-impl/src/main')
-rw-r--r-- | java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java index 38376a584f..24836c67fb 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java @@ -19,11 +19,7 @@ package org.apache.tuscany.sca.node.impl; -import static org.apache.tuscany.sca.node.impl.NodeUtil.openStream; - -import java.io.IOException; import java.io.InputStream; -import java.net.URL; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLOutputFactory; @@ -31,12 +27,9 @@ import javax.xml.stream.XMLStreamReader; import org.apache.tuscany.sca.extensibility.ServiceDeclaration; import org.apache.tuscany.sca.extensibility.ServiceDiscovery; -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; import org.apache.tuscany.sca.node.configuration.NodeConfiguration; -import org.apache.tuscany.sca.node.configuration.NodeConfigurationFactory; import org.apache.tuscany.sca.node.configuration.xml.NodeConfigurationProcessor; import org.oasisopen.sca.ServiceRuntimeException; @@ -50,61 +43,6 @@ public class NodeFactoryImpl extends NodeFactory { } @Override - public Node createNode(String configurationURI) { - try { - URL url = new URL(configurationURI); - InputStream is = openStream(url); - NodeConfiguration configuration = loadConfiguration(is); - is.close(); - return new NodeImpl(configuration); - } catch (IOException e) { - throw new ServiceRuntimeException(e); - } - } - - @Override - public Node createNode(String compositeURI, Contribution... contributions) { - NodeConfigurationFactory factory = this; - NodeConfiguration configuration = factory.createNodeConfiguration(); - for (Contribution c : contributions) { - configuration.addContribution(c.getURI(), c.getLocation()); - } - if (compositeURI != null && configuration.getContributions().size() > 0) { - configuration.getContributions().get(0).addDeploymentComposite(NodeUtil.createURI(compositeURI)); - } - return new NodeImpl(configuration); - } - - @Override - public Node createNode(String compositeURI, String compositeContent, Contribution... contributions) { - NodeConfigurationFactory factory = this; - NodeConfiguration configuration = factory.createNodeConfiguration(); - for (Contribution c : contributions) { - configuration.addContribution(c.getURI(), c.getLocation()); - } - if (compositeContent != null && configuration.getContributions().size() > 0) { - configuration.getContributions().get(0).addDeploymentComposite(compositeContent); - } - return new NodeImpl(configuration); - } - - @Override - public Node createNode() { - String location = - ContributionLocationHelper - .getContributionLocation(org.apache.tuscany.sca.contribution.Contribution.SCA_CONTRIBUTION_META); - if (location == null) { - location = - ContributionLocationHelper - .getContributionLocation(org.apache.tuscany.sca.contribution.Contribution.SCA_CONTRIBUTION_GENERATED_META); - } - if (location == null) { - throw new ServiceRuntimeException("No SCA contributions are found on the classpath"); - } - return createNode(null, new Contribution("http://contributions/default", location)); - } - - @Override public Node createNode(NodeConfiguration configuration) { return new NodeImpl(configuration); } |