summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/runtime-standalone/src
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-11-13 20:02:36 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-11-13 20:02:36 +0000
commit4ed0ed906e82c9484b384419fa4ef4c980768731 (patch)
treee0250b6d10349e29522a2b1667d2e1db4d9dab84 /branches/sca-java-1.x/modules/runtime-standalone/src
parentba73f8abcef884936f965c3085b80485bf2b5e1a (diff)
Creating Java SCA 1.x branch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@713805 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/runtime-standalone/src')
-rw-r--r--branches/sca-java-1.x/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java78
-rw-r--r--branches/sca-java-1.x/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java54
-rw-r--r--branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jarbin0 -> 4723 bytes
-rw-r--r--branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/tuscany.properties5
4 files changed, 137 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java b/branches/sca-java-1.x/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java
new file mode 100644
index 0000000000..ae05f0bd29
--- /dev/null
+++ b/branches/sca-java-1.x/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java
@@ -0,0 +1,78 @@
+/*
+ * 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.runtime.standalone;
+
+import java.io.File;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+/**
+ * Strawman for a J2SE standalone launcher
+ * Try it with:
+ *
+ * mvn -o
+ * mvn dependency:copy-dependencies -o
+ * java -Djava.ext.dirs=target/dependency -jar target\tuscany-sca.jar C:\MyTuscanyRepository
+ *
+ * where MyTuscanyRepository is a folder containing SCA contribution jars
+ */
+public class StandaloneLauncher {
+
+ private Launcher launcher;
+
+ public StandaloneLauncher(File repository) {
+ this.launcher = new Launcher(repository);
+ launcher.start();
+ }
+
+ public void stop() {
+ launcher.stop();
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ Options options = new Options();
+ options.addOption("domain", true, "the url of the remote domain this node should connect to");
+ CommandLineParser parser = new PosixParser();
+ CommandLine cmd = parser.parse( options, args);
+ if (cmd.getArgs().length != 1) {
+ System.err.println("missing contributions folder parameter");
+ System.exit(1);
+ }
+ File f = new File(cmd.getArgs()[0]);
+ if (!f.exists()) {
+ System.err.println("repository not found: " + cmd.getArgs()[0]);
+ System.exit(1);
+ }
+
+ StandaloneLauncher launcher = new StandaloneLauncher(f);
+
+ System.out.println("Press enter to exit...");
+ System.in.read();
+
+ launcher.stop();
+
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java b/branches/sca-java-1.x/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java
new file mode 100644
index 0000000000..d29d4a3851
--- /dev/null
+++ b/branches/sca-java-1.x/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * 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.runtime.standalone;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+public class LauncherTestCase extends TestCase {
+
+ private File repo;
+ private Launcher launcher;
+
+ public void test1() throws NodeException, URISyntaxException, InterruptedException, DomainException, MalformedURLException {
+ launcher.start();
+ }
+
+ public void setUp() throws URISyntaxException {
+ URL propsURL = getClass().getClassLoader().getResource("repo/tuscany.properties");
+ repo = new File(propsURL.toURI()).getParentFile();
+ launcher = new Launcher(repo);
+ }
+
+ public void tearDown() throws NodeException, URISyntaxException, InterruptedException, DomainException {
+ if (launcher != null) {
+ launcher.stop();
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar b/branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar
new file mode 100644
index 0000000000..6978bee727
--- /dev/null
+++ b/branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar
Binary files differ
diff --git a/branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/tuscany.properties b/branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/tuscany.properties
new file mode 100644
index 0000000000..2735d130e8
--- /dev/null
+++ b/branches/sca-java-1.x/modules/runtime-standalone/src/test/resources/repo/tuscany.properties
@@ -0,0 +1,5 @@
+nodeName=http://localhost:8080/myNode/
+#domainName=http://localhost:8777/tuscany/foo/
+#startManager=true
+#hotDeployInterval=10000
+#useHotUpdate=true