summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/itest/scaclient-api/pom.xml2
-rw-r--r--java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFinder.java42
-rw-r--r--java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java2
-rw-r--r--java/sca/modules/node-impl/META-INF/MANIFEST.MF1
-rw-r--r--java/sca/modules/node-impl/pom.xml7
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java21
-rw-r--r--java/sca/modules/sca-client-impl/pom.xml2
-rw-r--r--java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java15
8 files changed, 55 insertions, 37 deletions
diff --git a/java/sca/itest/scaclient-api/pom.xml b/java/sca/itest/scaclient-api/pom.xml
index 54151c5ce7..795221292c 100644
--- a/java/sca/itest/scaclient-api/pom.xml
+++ b/java/sca/itest/scaclient-api/pom.xml
@@ -31,7 +31,7 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
+ <artifactId>tuscany-sca-client-impl</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
diff --git a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFinder.java b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFinder.java
new file mode 100644
index 0000000000..f81906af89
--- /dev/null
+++ b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFinder.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+public class NodeFinder {
+
+ private static Map<URI, Node> nodes = new HashMap<URI, Node>();
+
+ public static void addNode(URI domainName, Node node) {
+ nodes.put(domainName, node);
+ }
+
+ public static Node removeNode(URI domainName) {
+ return nodes.remove(domainName);
+ }
+
+ public static Node getNode(URI domainURI) {
+ return nodes.get(domainURI);
+ }
+
+}
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 e9bd791f96..867e46ee75 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
@@ -37,7 +37,7 @@ import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
*/
public class NodeConfigurationImpl implements NodeConfiguration {
private String uri;
- private String domainURI;
+ private String domainURI = "default";
private List<ContributionConfiguration> contributions = new ArrayList<ContributionConfiguration>();
private List<BindingConfiguration> bindings = new ArrayList<BindingConfiguration>();
diff --git a/java/sca/modules/node-impl/META-INF/MANIFEST.MF b/java/sca/modules/node-impl/META-INF/MANIFEST.MF
index 5feccbf81d..fcf9d25ad0 100644
--- a/java/sca/modules/node-impl/META-INF/MANIFEST.MF
+++ b/java/sca/modules/node-impl/META-INF/MANIFEST.MF
@@ -22,7 +22,6 @@ Import-Package: javax.xml.namespace,
org.apache.tuscany.sca.assembly;version="2.0.0",
org.apache.tuscany.sca.assembly.builder;version="2.0.0",
org.apache.tuscany.sca.assembly.xml;version="2.0.0",
- org.apache.tuscany.sca.client.impl;version="2.0.0",
org.apache.tuscany.sca.contribution;version="2.0.0",
org.apache.tuscany.sca.contribution.processor;version="2.0.0",
org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
diff --git a/java/sca/modules/node-impl/pom.xml b/java/sca/modules/node-impl/pom.xml
index 5231d40b65..7918805412 100644
--- a/java/sca/modules/node-impl/pom.xml
+++ b/java/sca/modules/node-impl/pom.xml
@@ -71,13 +71,6 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-client-impl</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 15794d9581..c6f1df2086 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -52,7 +52,6 @@ import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint;
-import org.apache.tuscany.sca.client.impl.SCAClientImpl;
import org.apache.tuscany.sca.contribution.Artifact;
import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.ContributionFactory;
@@ -92,6 +91,7 @@ import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
import org.apache.tuscany.sca.node.Client;
import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFinder;
import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
import org.apache.tuscany.sca.node.configuration.DeploymentComposite;
import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
@@ -140,6 +140,8 @@ public class NodeImpl implements Node, Client, SCAClient {
private WorkScheduler workScheduler;
private Contribution systemContribution;
private Definitions systemDefinitions;
+
+ private URI domainURI;
NodeImpl(NodeConfiguration configuration) {
logger.log(Level.INFO, "Creating node: " + configuration.getURI());
@@ -284,6 +286,9 @@ public class NodeImpl implements Node, Client, SCAClient {
}
private void configureNode(NodeConfiguration configuration) throws Exception {
+
+ domainURI = URI.create(configuration.getDomainURI());
+
List<Contribution> contributions = new ArrayList<Contribution>();
// Load the specified contributions
@@ -548,7 +553,7 @@ public class NodeImpl implements Node, Client, SCAClient {
compositeActivator.start(composite);
}
- SCAClientImpl.addDomain(getDomainName(), this);
+ NodeFinder.addNode(domainURI, this);
return this;
@@ -563,7 +568,7 @@ public class NodeImpl implements Node, Client, SCAClient {
try {
- SCAClientImpl.removeDomain(getDomainName());
+ NodeFinder.removeNode(domainURI);
List<Composite> composites = compositeActivator.getDomainComposite().getIncludes();
for (Composite composite : composites) {
@@ -582,16 +587,6 @@ public class NodeImpl implements Node, Client, SCAClient {
}
- private URI getDomainName() {
- URI domainName;
- if (configurationName != null) {
- domainName = URI.create(configurationName);
- } else {
- domainName = URI.create("default");
- }
- return domainName;
- }
-
public void destroy() {
// Stop the runtime modules
for (ModuleActivator moduleActivator : moduleActivators) {
diff --git a/java/sca/modules/sca-client-impl/pom.xml b/java/sca/modules/sca-client-impl/pom.xml
index 07475d8553..9a0fe91a7c 100644
--- a/java/sca/modules/sca-client-impl/pom.xml
+++ b/java/sca/modules/sca-client-impl/pom.xml
@@ -38,7 +38,7 @@
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
+ <artifactId>tuscany-node-impl</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
diff --git a/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java b/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java
index e49f5faf2f..0f4c661f35 100644
--- a/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java
+++ b/java/sca/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientImpl.java
@@ -20,28 +20,17 @@
package org.apache.tuscany.sca.client.impl;
import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFinder;
import org.oasisopen.sca.NoSuchDomainException;
import org.oasisopen.sca.NoSuchServiceException;
import org.oasisopen.sca.client.SCAClient;
public class SCAClientImpl implements SCAClient {
- private static Map<URI, Node> nodes = new HashMap<URI, Node>();
-
- public static void addDomain(URI domainName, Node node) {
- nodes.put(domainName, node);
- }
-
- public static Node removeDomain(URI domainName) {
- return nodes.remove(domainName);
- }
-
public <T> T getService(Class<T> serviceInterface, String serviceName, URI domainURI) throws NoSuchServiceException, NoSuchDomainException {
- Node node = nodes.get(domainURI);
+ Node node = NodeFinder.getNode(domainURI);
if (node == null) {
throw new NoSuchDomainException(domainURI.toString());
}