summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-node-runtime
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-14 18:00:05 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-14 18:00:05 +0000
commit6f5177c379df8f30e1002065881845abf39b8931 (patch)
tree37ecd3bc1e5fefc7e55844adb5144ccf7b46256e /java/sca/modules/implementation-node-runtime
parentae60ec5e5c598de4d05cb1a44a38df2c9622d146 (diff)
Start to integrate the node configuration with NodeImpl
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@774854 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-node-runtime')
-rw-r--r--java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java21
-rw-r--r--java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java27
2 files changed, 25 insertions, 23 deletions
diff --git a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
index 202514d89e..e4e88003c7 100644
--- a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
+++ b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.implementation.node.launcher;
@@ -28,7 +28,7 @@ import org.oasisopen.sca.ServiceReference;
/**
* Bootstrap class for the SCA node daemon.
- *
+ *
* @version $Rev$ $Date$
*/
public class NodeImplementationDaemonBootstrap {
@@ -41,12 +41,12 @@ public class NodeImplementationDaemonBootstrap {
private ClassLoader threadContextClassLoader;
private ClassLoader runtimeClassLoader;
private Node daemon;
-
+
private NodeFacade() {
runtimeClassLoader = Thread.currentThread().getContextClassLoader();
}
-
- public void start() {
+
+ public Node start() {
threadContextClassLoader = Thread.currentThread().getContextClassLoader();
boolean started = false;
try {
@@ -55,13 +55,14 @@ public class NodeImplementationDaemonBootstrap {
String contribution = ContributionLocationHelper.getContributionLocation(getClass());
daemon = factory.createNode("NodeDaemon.composite", new Contribution("node-runtime", contribution));
started = true;
+ return this;
} finally {
if (!started) {
Thread.currentThread().setContextClassLoader(threadContextClassLoader);
}
}
}
-
+
public void stop() {
try {
Thread.currentThread().setContextClassLoader(runtimeClassLoader);
@@ -92,14 +93,14 @@ public class NodeImplementationDaemonBootstrap {
throw new UnsupportedOperationException();
}
}
-
+
/**
* Constructs a new daemon bootstrap.
*/
public NodeImplementationDaemonBootstrap() throws Exception {
node = new NodeFacade();
}
-
+
/**
* Returns the node representing the daemon.
* @return
diff --git a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
index 2daab36796..a26f63f9d0 100644
--- a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
+++ b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.implementation.node.launcher;
@@ -28,7 +28,7 @@ import org.oasisopen.sca.ServiceReference;
/**
* Bootstrap class for standalone SCA nodes.
- *
+ *
* @version $Rev$ $Date$
*/
public class NodeImplementationLauncherBootstrap {
@@ -42,26 +42,27 @@ public class NodeImplementationLauncherBootstrap {
private ClassLoader threadContextClassLoader;
private ClassLoader runtimeClassLoader;
private Node delegate;
-
+
private NodeFacade(Node delegate) {
runtimeClassLoader = Thread.currentThread().getContextClassLoader();
this.delegate = delegate;
}
-
- public void start() {
+
+ public Node start() {
threadContextClassLoader = Thread.currentThread().getContextClassLoader();
boolean started = false;
try {
Thread.currentThread().setContextClassLoader(runtimeClassLoader);
delegate.start();
started = true;
+ return this;
} finally {
if (!started) {
Thread.currentThread().setContextClassLoader(threadContextClassLoader);
}
}
}
-
+
public void stop() {
try {
Thread.currentThread().setContextClassLoader(runtimeClassLoader);
@@ -92,10 +93,10 @@ public class NodeImplementationLauncherBootstrap {
return (ServiceReference<B>)((Client)delegate).getServiceReference(businessInterface, referenceName);
}
}
-
+
/**
* Bootstrap a new SCA node.
- *
+ *
* @param configurationURI
*/
public NodeImplementationLauncherBootstrap(String configurationURI) throws Exception {
@@ -105,7 +106,7 @@ public class NodeImplementationLauncherBootstrap {
/**
* Bootstrap a new SCA node.
- *
+ *
* @param compositeURI
* @param uris
* @param locations
@@ -121,7 +122,7 @@ public class NodeImplementationLauncherBootstrap {
/**
* Bootstrap a new SCA node.
- *
+ *
* @param compositeURI
* @param uris
* @param locations
@@ -137,7 +138,7 @@ public class NodeImplementationLauncherBootstrap {
/**
* Returns the SCA node.
- *
+ *
* @return
*/
public Node getNode() {