Initial commit of Sigil contribution. (FELIX-1142)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@793581 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/build.properties b/sigil/bld-ivy/test/multi-project/projects/console/build.properties
new file mode 100644
index 0000000..1b54925
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/build.properties
@@ -0,0 +1,21 @@
+# ***************************************************************
+# * 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.
+# ***************************************************************
+projects.dir = ${basedir}/..
+wkspace.dir = ${projects.dir}/..
+common.dir = ${wkspace.dir}/common
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/build.xml b/sigil/bld-ivy/test/multi-project/projects/console/build.xml
new file mode 100644
index 0000000..5c02cba
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/build.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0">
+<!--
+ 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.
+-->
+<project name="console" default="compile">
+ <property file="build.properties"/>
+
+ <import file="${common.dir}/common.xml"/>
+</project>
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml b/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml
new file mode 100644
index 0000000..93b5ee5
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/ivy.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<ivy-module version="1.0">
+ <info
+ organisation="org.apache.ivy.example"
+ module="console"
+ status="integration"/>
+ <dependencies>
+ <!--
+ <dependency name="version" rev="latest.integration" conf="default" />
+ <dependency name="list" rev="latest.integration" conf="default->standalone" />
+ <dependency name="find" rev="latest.integration" conf="default->standalone" />
+ <dependency name="sizewhere" rev="latest.integration" conf="default->standalone" />
+ -->
+ </dependencies>
+</ivy-module>
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties b/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties
new file mode 100644
index 0000000..1d4bb13
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/sigil.properties
@@ -0,0 +1,6 @@
+
+-bundles: console
+
+-exports: console
+
+-requires: org.example.list
diff --git a/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java b/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java
new file mode 100644
index 0000000..678f3ca
--- /dev/null
+++ b/sigil/bld-ivy/test/multi-project/projects/console/src/console/Main.java
@@ -0,0 +1,79 @@
+/*
+ * 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 console;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.Arrays;
+import java.lang.reflect.Method;
+
+
+public class Main {
+ private static Collection QUIT_COMMANDS = Arrays.asList(new String[] {"quit", "q", "exit"});
+ private static Collection HELP_COMMANDS = Arrays.asList(new String[] {"help", "h", "?"});
+
+ public static void main(String[] a) throws Exception {
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+ while (true) {
+ System.out.print("> ");
+ String command = in.readLine().trim();
+ if (QUIT_COMMANDS.contains(command)) {
+ return;
+ }
+ if (HELP_COMMANDS.contains(command)) {
+ help();
+ continue;
+ }
+ String[] split = command.split(" ");
+ if (split.length == 0) {
+ error(command);
+ continue;
+ }
+
+ try {
+ String[] args = new String[split.length - 1];
+ System.arraycopy(split, 1, args, 0, args.length);
+ Class cl = Class.forName(split[0]+".Main");
+ Method m = cl.getMethod("main", new Class[] {String[].class});
+ m.invoke(null, new Object[] {args});
+ } catch (Exception ex) {
+ error(command);
+ continue;
+ }
+ }
+ }
+
+ private static void help() {
+ System.out.println("available commands:");
+ System.out.println("\tquit: quit the console");
+ System.out.println("\thelp: displays this message");
+ System.out.println("\tlist -dir <dir>: list files in given directory");
+ System.out.println("\tfind -dir <dir> -name <name>: list files with given name in given dir");
+ System.out.println("\tsizewhere -dir <dir> -name <name>: compute total size of files with given name in given dir");
+ System.out.println("\thelp: displays this message");
+ }
+
+ private static void error(String command) {
+ System.out.println("unknown command "+command);
+ System.out.println("type ? for help");
+ }
+
+}