diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-13 15:43:49 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-13 15:43:49 +0000 |
commit | f9bf40e621044412c6e5ecc8a435b328e5d135c4 (patch) | |
tree | 64d7ecd5ed08a7e9a5341731815e387574a6ce16 /sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java | |
parent | eede9d93293a288f2aebdd84694fa597fb0e88ff (diff) |
Add methods to Node to replicate whats in DomainNode so i can get rid of that. (We still need to do the refactoring of Node as we started discussing on the ML, i'll start that again next week, just want to get the domain changes a bit more done so adding these here for now)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@898806 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java')
-rw-r--r-- | sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java index a351b7b074..f650268c73 100644 --- a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java +++ b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java @@ -150,6 +150,15 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory { } } + public List<String> getServiceNames() { + try { + return (List<String>)node.getClass().getMethod("getServiceNames").invoke(node); + } catch (Throwable e) { + handleException(e); + return null; + } + } + } /** @@ -297,6 +306,28 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory { return createNode(configuration); } + public final Node createNode(URI configURI, String... locations) { + Contribution[] contributions = getContributions(Arrays.asList(locations)); + NodeConfiguration configuration = createConfiguration(contributions); + configuration.setDomainRegistryURI(configURI.toString()); + configuration.setDomainURI(getDomainName(configURI)); + return createNode(configuration); + } + + public static String getDomainName(URI configURI) { + // no idea if this is needed, do it anyway for now till the Node refactor is done + String s = configURI.getHost(); + if (s == null) { + s = configURI.getSchemeSpecificPart(); + if (s != null) { + if (s.indexOf(':') > -1) { + s = s.substring(s.indexOf(':')+1); + } + } + } + return s; + } + /** * The following methods are used by the node launcher */ |