summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-11-19 10:47:02 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-11-19 10:47:02 +0000
commit0e7d64a2d83676bcef0b34c02af656db32942605 (patch)
tree109891bb505c37ec09273e73c818f68cbccabfc7 /sca-java-2.x/trunk/modules
parenta1f4429dc7ae29b0fd22493db12372ec65baa4bf (diff)
Update to support passing in an intial contribution to install and start, and also to support pointing at a Maven project contribution without needing to have the target/classes suffix
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1036795 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java41
1 files changed, 39 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
index 33859f3abb..d91d94219a 100644
--- a/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
+++ b/sca-java-2.x/trunk/modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java
@@ -23,11 +23,15 @@ import static java.lang.System.in;
import static java.lang.System.out;
import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -70,14 +74,25 @@ public class Shell {
public static void main(final String[] args) throws Exception {
boolean useJline = true;
String domainURI = "default";
+
+ String contribution = null;
for (String s : args) {
if ("-nojline".equals(s)) {
useJline = false;
} else {
- domainURI = s;
+ File f = new File(s);
+ if (f.exists()) {
+ contribution = s;
+ } else {
+ domainURI = s;
+ }
}
}
- new Shell(domainURI, useJline).run();
+ Shell shell = new Shell(domainURI, useJline);
+ if (contribution != null) {
+ shell.install(Arrays.asList(new String[]{"install", contribution, "-start"}));
+ }
+ shell.run();
}
public Shell(String domainURI, boolean useJLine) {
@@ -152,12 +167,34 @@ public class Shell {
} else {
curl = first;
}
+
+ curl = mavenProject(curl);
String uri = getNode().installContribution(curi, curl, metaDataURL, duris, startDeployables);
out.println("installed at: " + uri);
return true;
}
+ /**
+ * Try to simplify pointing at a Maven project contribution without needing target/classes suffix
+ */
+ private String mavenProject(String curl) {
+ File f = new File(curl);
+ if (!f.exists()) {
+ return curl;
+ }
+ f = new File(f, "target");
+ if (!f.exists()) {
+ return curl;
+ }
+ f = new File(f, "classes");
+ if (f.exists()) {
+ return f.toURI().toString();
+ }
+ // TODO: look for .zip or .jar in target?
+ return curl;
+ }
+
boolean installed(final List<String> toks) {
List<String> curis;
if (toks.size() > 1) {