FELIX-1266: maven build for gogo

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@789948 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/aQute.osgi.launcher.bnd b/gogo/aQute.osgi.launcher.bnd
deleted file mode 100644
index 1034392..0000000
--- a/gogo/aQute.osgi.launcher.bnd
+++ /dev/null
@@ -1,4 +0,0 @@
-Private-Package: org.apache.felix.gogo.launcher, org.apache.felix.gogo.shell.runtime, org.apache.felix.gogo.shell.osgi, org.apache.felix.gogo.threadio, \
- org.osgi.service.shell, org.osgi.service.threadio, org.apache.felix.gogo.shell.console, org.osgi.framework
-Main-Class: org.apache.felix.gogo.launcher.Launcher
-
diff --git a/gogo/aQute.shell.equinox.bnd b/gogo/aQute.shell.equinox.bnd
deleted file mode 100644
index 333c98a..0000000
--- a/gogo/aQute.shell.equinox.bnd
+++ /dev/null
@@ -1,6 +0,0 @@
--include: ~default.bnd
-Service-Component: org.apache.felix.gogo.shell.equinox.Equinox; \
-   pka=org.osgi.service.packageadmin.PackageAdmin?; \
-   lrs=org.osgi.service.log.LogReaderService?; \
-   sls=org.osgi.service.startlevel.StartLevel?
-Private-Package: org.apache.felix.gogo.shell.equinox
diff --git a/gogo/aQute.shell.runtime.bnd b/gogo/aQute.shell.runtime.bnd
deleted file mode 100644
index 097d57d..0000000
--- a/gogo/aQute.shell.runtime.bnd
+++ /dev/null
@@ -1,9 +0,0 @@
--include: ~default.bnd
-Bundle-Name: Command Shell Service
-Bundle-Description: Provides a shell service
-Private-Package: org.apache.felix.gogo.shell.osgi, org.apache.felix.gogo.shell.runtime
-Export-Package: org.osgi.service.command
-Service-Component: org.apache.felix.gogo.shell.osgi.OSGiShell; \
-  provide:=org.osgi.service.command.CommandProcessor; \
-  threadio=org.osgi.service.threadio.ThreadIO; \
-  converter=org.osgi.service.command.Converter*
diff --git a/gogo/aQute.shell.stdio.bnd b/gogo/aQute.shell.stdio.bnd
deleted file mode 100644
index 56b1285..0000000
--- a/gogo/aQute.shell.stdio.bnd
+++ /dev/null
@@ -1,4 +0,0 @@
--include: ~default.bnd
-Service-Component: org.apache.felix.gogo.shell.stdio.StdioConsole; \
-   processor=org.osgi.service.command.CommandProcessor
-Private-Package: org.apache.felix.gogo.shell.stdio,org.apache.felix.gogo.shell.console
diff --git a/gogo/aQute.shell.support.bnd b/gogo/aQute.shell.support.bnd
deleted file mode 100644
index f7917a0..0000000
--- a/gogo/aQute.shell.support.bnd
+++ /dev/null
@@ -1,6 +0,0 @@
--include: ~default.bnd
-Bundle-Name: aQute Shell Support
-Bundle-Description: Commands for the shell that turn it into a programming language
-Private-Package: org.apache.felix.gogo.shell.lang
-Service-Component: org.apache.felix.gogo.shell.lang.Support; \
-  provide:=org.osgi.service.command.Converter
\ No newline at end of file
diff --git a/gogo/aQute.shell.telnet.bnd b/gogo/aQute.shell.telnet.bnd
deleted file mode 100644
index 1f42a80..0000000
--- a/gogo/aQute.shell.telnet.bnd
+++ /dev/null
@@ -1,7 +0,0 @@
--include: ~default.bnd
-
-Bundle-Name: Telnet Shell Service
-Bundle-Description: Listens to port 2019 (unless overridden with configuration "port" for pid=org.apache.felix.gogo.shell.telnet.TelnetShell)
-Private-Package: org.apache.felix.gogo.shell.telnet, org.apache.felix.gogo.shell.console
-Service-Component: org.apache.felix.gogo.shell.telnet.TelnetShell; \
-  processor=org.osgi.service.command.CommandProcessor
diff --git a/gogo/aQute.threadio.bnd b/gogo/aQute.threadio.bnd
deleted file mode 100644
index cd614f8..0000000
--- a/gogo/aQute.threadio.bnd
+++ /dev/null
@@ -1,8 +0,0 @@
--include: ~default.bnd
-
-Bundle-Name: Thread IO
-Bundle-Description: Multiplexes input/output/error streams based on the thread.
-Private-Package: org.apache.felix.gogo.threadio
-Export-Package: org.osgi.service.threadio
-Service-Component: org.apache.felix.gogo.threadio.ThreadIOImpl;\
-  provide:=org.osgi.service.threadio.ThreadIO
diff --git a/gogo/default.bnd b/gogo/default.bnd
deleted file mode 100644
index e9347ae..0000000
--- a/gogo/default.bnd
+++ /dev/null
@@ -1,3 +0,0 @@
--output: work
--sources: true
-Bundle-Version: 0.0.12
\ No newline at end of file
diff --git a/gogo/gogo-console/pom.xml b/gogo/gogo-console/pom.xml
new file mode 100644
index 0000000..a34384d
--- /dev/null
+++ b/gogo/gogo-console/pom.xml
@@ -0,0 +1,96 @@
+<!--
+ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.felix.gogo</groupId>
+        <artifactId>gogo</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>bundle</packaging>
+    <name>Apache Felix Gogo Shell Console</name>
+    <artifactId>org.apache.felix.gogo.console</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix.gogo</groupId>
+            <artifactId>org.apache.felix.gogo.runtime</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.0.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                        </Export-Package>
+                        <Import-Package>
+                            org.osgi.service.component*; resolution:=optional,
+                            org.osgi.service.log*; resolution:=optional,
+                            org.osgi.service.packageadmin*; resolution:=optional,
+                            org.osgi.service.startlevel*; resolution:=optional,
+                            *
+                        </Import-Package>
+                        <Private-Package>org.apache.felix.gogo.*</Private-Package>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-Activator>org.apache.felix.gogo.console.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>rat-maven-plugin</artifactId>
+                <configuration>
+                    <excludeSubProjects>false</excludeSubProjects>
+                    <useEclipseDefaultExcludes>true</useEclipseDefaultExcludes>
+                    <useMavenDefaultExcludes>true</useMavenDefaultExcludes>
+                    <excludes>
+                        <param>doc/*</param>
+                        <param>maven-eclipse.xml</param>
+                        <param>.checkstyle</param>
+                        <param>.externalToolBuilders/*</param>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/Activator.java b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/Activator.java
new file mode 100644
index 0000000..dc865cc
--- /dev/null
+++ b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/Activator.java
@@ -0,0 +1,72 @@
+/*
+ * 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.felix.gogo.console;
+
+import org.apache.felix.gogo.console.stdio.StdioConsole;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.command.CommandProcessor;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator
+{
+
+    private ServiceTracker commandProcessorTracker;
+    private StdioConsole console;
+
+    public void start(final BundleContext context) throws Exception
+    {
+        commandProcessorTracker = new ServiceTracker(context, CommandProcessor.class.getName(), null) {
+            @Override
+            public Object addingService(ServiceReference reference)
+            {
+                CommandProcessor processor = (CommandProcessor) super.addingService(reference);
+                startConsole(processor);
+                return processor;
+            }
+
+            @Override
+            public void removedService(ServiceReference reference, Object service)
+            {
+                if (console != null) {
+                    console.close();
+                    console = null;
+                }
+                super.removedService(reference, service);
+            }
+        };
+        commandProcessorTracker.open();
+    }
+
+    protected void startConsole(final CommandProcessor processor) {
+        console = new StdioConsole();
+        console.setProcessor(processor);
+        console.start();
+    }
+
+    public void stop(BundleContext context) throws Exception
+    {
+        if (console != null) {
+            console.close();
+        }
+        commandProcessorTracker.close();
+    }
+
+}
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/console/Console.java b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/stdio/Console.java
similarity index 98%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/console/Console.java
rename to gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/stdio/Console.java
index fc978d0..96ba5c3 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/console/Console.java
+++ b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/stdio/Console.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.felix.gogo.shell.console;
+package org.apache.felix.gogo.console.stdio;
 
 import org.osgi.service.command.CommandSession;
 import org.osgi.service.command.Converter;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/stdio/StdioConsole.java b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/stdio/StdioConsole.java
similarity index 84%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/stdio/StdioConsole.java
rename to gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/stdio/StdioConsole.java
index e0eb102..15c1ed1 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/stdio/StdioConsole.java
+++ b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/stdio/StdioConsole.java
@@ -16,9 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.stdio;
+package org.apache.felix.gogo.console.stdio;
 
-import org.apache.felix.gogo.shell.console.Console;
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.component.ComponentContext;
 
@@ -31,12 +30,7 @@
         super("StdioConsole");
     }
 
-    protected void activate(ComponentContext context)
-    {
-        start();
-    }
-
-    protected void deactivate(ComponentContext context)
+    public void close()
     {
         console.close();
         interrupt();
@@ -51,5 +45,4 @@
     {
         console.run();
     }
-}
-
+}
\ No newline at end of file
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/telnet/Handler.java b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/telnet/Handler.java
similarity index 94%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/telnet/Handler.java
rename to gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/telnet/Handler.java
index 4f60c61..4b12381 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/telnet/Handler.java
+++ b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/telnet/Handler.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.telnet;
+package org.apache.felix.gogo.console.telnet;
 
-import org.apache.felix.gogo.shell.console.Console;
+import org.apache.felix.gogo.console.stdio.Console;
 import org.osgi.service.command.CommandSession;
 
 import java.io.IOException;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/telnet/TelnetShell.java b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/telnet/TelnetShell.java
similarity index 98%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/telnet/TelnetShell.java
rename to gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/telnet/TelnetShell.java
index 74921d4..4b02d74 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/telnet/TelnetShell.java
+++ b/gogo/gogo-console/src/main/java/org/apache/felix/gogo/console/telnet/TelnetShell.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.telnet;
+package org.apache.felix.gogo.console.telnet;
 
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.command.CommandSession;
diff --git a/gogo/gogo-launcher/pom.xml b/gogo/gogo-launcher/pom.xml
new file mode 100644
index 0000000..273e922
--- /dev/null
+++ b/gogo/gogo-launcher/pom.xml
@@ -0,0 +1,99 @@
+<!--
+ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.felix.gogo</groupId>
+        <artifactId>gogo</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>bundle</packaging>
+    <name>Apache Felix Gogo Shell Launcher</name>
+    <artifactId>org.apache.felix.gogo.launcher</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix.gogo</groupId>
+            <artifactId>org.apache.felix.gogo.console</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.0.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.osgi.service.command; version=1.0.0,
+                            org.osgi.service.threadio; version=1.0.0,
+                            org.apache.felix.gogo.commands; version=${project.version}
+                        </Export-Package>
+                        <Import-Package>
+                            org.osgi.service.component*; resolution:=optional,
+                            org.osgi.service.log*; resolution:=optional,
+                            org.osgi.service.packageadmin*; resolution:=optional,
+                            org.osgi.service.startlevel*; resolution:=optional,
+                            *
+                        </Import-Package>
+                        <Private-Package>org.apache.felix.gogo.*</Private-Package>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-Activator>org.apache.felix.gogo.runtime.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>rat-maven-plugin</artifactId>
+                <configuration>
+                    <excludeSubProjects>false</excludeSubProjects>
+                    <useEclipseDefaultExcludes>true</useEclipseDefaultExcludes>
+                    <useMavenDefaultExcludes>true</useMavenDefaultExcludes>
+                    <excludes>
+                        <param>doc/*</param>
+                        <param>maven-eclipse.xml</param>
+                        <param>.checkstyle</param>
+                        <param>.externalToolBuilders/*</param>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/gogo/src/main/java/org/apache/felix/gogo/launcher/Launcher.java b/gogo/gogo-launcher/src/main/java/org/apache/felix/gogo/launcher/Launcher.java
similarity index 96%
rename from gogo/src/main/java/org/apache/felix/gogo/launcher/Launcher.java
rename to gogo/gogo-launcher/src/main/java/org/apache/felix/gogo/launcher/Launcher.java
index f3bc3ee..af44cd1 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/launcher/Launcher.java
+++ b/gogo/gogo-launcher/src/main/java/org/apache/felix/gogo/launcher/Launcher.java
@@ -18,9 +18,9 @@
  */
 package org.apache.felix.gogo.launcher;
 
-import org.apache.felix.gogo.shell.console.Console;
-import org.apache.felix.gogo.shell.osgi.OSGiShell;
-import org.apache.felix.gogo.threadio.ThreadIOImpl;
+import org.apache.felix.gogo.runtime.osgi.OSGiShell;
+import org.apache.felix.gogo.runtime.threadio.ThreadIOImpl;
+import org.apache.felix.gogo.console.stdio.Console;
 import org.osgi.framework.Bundle;
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.command.CommandSession;
diff --git a/gogo/gogo-runtime/pom.xml b/gogo/gogo-runtime/pom.xml
new file mode 100644
index 0000000..22c6dfb
--- /dev/null
+++ b/gogo/gogo-runtime/pom.xml
@@ -0,0 +1,77 @@
+<!--
+ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.felix.gogo</groupId>
+        <artifactId>gogo</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>bundle</packaging>
+    <name>Apache Felix Gogo Shell Runtime</name>
+    <artifactId>org.apache.felix.gogo.runtime</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.0.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.osgi.service.command; version=1.0.0,
+                            org.osgi.service.threadio; version=1.0.0
+                        </Export-Package>
+                        <Import-Package>
+                            org.osgi.service.component*; resolution:=optional,
+                            org.osgi.service.log*; resolution:=optional,
+                            org.osgi.service.packageadmin*; resolution:=optional,
+                            org.osgi.service.startlevel*; resolution:=optional,
+                            *
+                        </Import-Package>
+                        <Private-Package>org.apache.felix.gogo.*</Private-Package>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-Activator>org.apache.felix.gogo.runtime.Activator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/Activator.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/Activator.java
new file mode 100644
index 0000000..4b9d215
--- /dev/null
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/Activator.java
@@ -0,0 +1,127 @@
+/*
+ * 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.felix.gogo.runtime;
+
+import org.apache.felix.gogo.runtime.lang.Support;
+import org.apache.felix.gogo.runtime.osgi.OSGiShell;
+import org.apache.felix.gogo.runtime.threadio.ThreadIOImpl;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.command.CommandProcessor;
+import org.osgi.service.command.Converter;
+import org.osgi.service.threadio.ThreadIO;
+import org.osgi.util.tracker.ServiceTracker;
+
+import java.util.Hashtable;
+
+public class Activator implements BundleActivator
+{
+
+    private OSGiShell shell;
+    private ThreadIOImpl threadio;
+    private ServiceRegistration shellRegistration;
+    private ServiceRegistration threadioRegistration;
+    private ServiceTracker converterTracker;
+    private ServiceTracker commandTracker;
+
+    public void start(final BundleContext context) throws Exception
+    {
+        Hashtable props = new Hashtable();
+        props.put("osgi.command.scope", "log");
+        props.put("osgi.command.function", "display");
+
+        threadio = new ThreadIOImpl();
+        threadio.start();
+        shell = new OSGiShell();
+        shell.setBundle(context.getBundle());
+        shell.setThreadio(threadio);
+        shell.setConverter(new Support());
+        shell.start();
+        converterTracker = new ServiceTracker(context, Converter.class.getName(), null) {
+            @Override
+            public Object addingService(ServiceReference reference)
+            {
+                Converter converter = (Converter) super.addingService(reference);
+                shell.setConverter(converter);
+                return converter;
+            }
+
+            @Override
+            public void removedService(ServiceReference reference, Object service)
+            {
+                shell.unsetConverter((Converter) service);
+                super.removedService(reference, service);
+            }
+        };
+        converterTracker.open();
+        commandTracker = new ServiceTracker(context, context.createFilter("(&(osgi.command.scope=*)(osgi.command.function=*))"), null) {
+            @Override
+            public Object addingService(ServiceReference reference)
+            {
+                Object scope = reference.getProperty("osgi.command.scope");
+                Object function = reference.getProperty("osgi.command.function");
+                if(scope != null && function != null)
+                {
+                    Object target = context.getService(reference);
+                    if (function.getClass().isArray())
+                    {
+                        for (Object f : ((Object[]) function))
+                        {
+                            shell.addCommand(scope.toString(), target, f.toString());
+                        }
+                    }
+                    else
+                    {
+                        shell.addCommand(scope.toString(), target, function.toString());
+                    }
+                    return target;
+                }
+                return null;
+            }
+
+            @Override
+            public void removedService(ServiceReference reference, Object service)
+            {
+                super.removedService(reference, service);
+            }
+        };
+        commandTracker.open();
+        threadioRegistration = context.registerService(ThreadIO.class.getName(), threadio, new Hashtable());
+        shellRegistration = context.registerService(CommandProcessor.class.getName(), shell, new Hashtable());
+    }
+
+    private String getProperty(BundleContext context, String name, String def) {
+        String v = context.getProperty(name);
+        if (v == null) {
+            v = def;
+        }
+        return v;
+    }
+
+    public void stop(BundleContext context) throws Exception
+    {
+        shellRegistration.unregister();
+        threadioRegistration.unregister();
+        threadio.stop();
+        converterTracker.close();
+        commandTracker.close();
+    }
+}
diff --git a/gogo/src/main/java/org/apache/felix/gogo/cpeg/Procedural.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/cpeg/Procedural.java
similarity index 97%
rename from gogo/src/main/java/org/apache/felix/gogo/cpeg/Procedural.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/cpeg/Procedural.java
index 615221e..a9ea63b 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/cpeg/Procedural.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/cpeg/Procedural.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.cpeg;
+package org.apache.felix.gogo.runtime.cpeg;
 
 
 import org.osgi.framework.Bundle;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/equinox/Equinox.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/equinox/Equinox.java
similarity index 99%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/equinox/Equinox.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/equinox/Equinox.java
index 7bd570b..8187496 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/equinox/Equinox.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/equinox/Equinox.java
@@ -1,4 +1,4 @@
-package org.apache.felix.gogo.shell.equinox;
+package org.apache.felix.gogo.runtime.equinox;
 
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/lang/Support.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/lang/Support.java
similarity index 97%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/lang/Support.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/lang/Support.java
index 18521b3..2ab6bbe 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/lang/Support.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/lang/Support.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.lang;
+package org.apache.felix.gogo.runtime.lang;
 
 import org.osgi.service.command.Converter;
 import org.osgi.service.command.Function;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/osgi/OSGiCommands.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/OSGiCommands.java
similarity index 99%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/osgi/OSGiCommands.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/OSGiCommands.java
index 45bdb5c..21197d6 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/osgi/OSGiCommands.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/OSGiCommands.java
@@ -18,7 +18,7 @@
  */
 // DWB1: osgi:each too verbose (formats reults to System.out)
 // DWB2: ClassNotFoundException should be caught in convert() method
-package org.apache.felix.gogo.shell.osgi;
+package org.apache.felix.gogo.runtime.osgi;
 
 import org.osgi.framework.*;
 import org.osgi.service.command.CommandSession;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/osgi/OSGiShell.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/OSGiShell.java
similarity index 97%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/osgi/OSGiShell.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/OSGiShell.java
index 3755593..75bdcf6 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/osgi/OSGiShell.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/OSGiShell.java
@@ -18,9 +18,9 @@
  */
 // DWB3: dynamically load optional framework components to reduce dependencies
 // DWB4: get() with trailing colon causes org.osgi.framework.InvalidSyntaxException
-package org.apache.felix.gogo.shell.osgi;
+package org.apache.felix.gogo.runtime.osgi;
 
-import org.apache.felix.gogo.shell.runtime.CommandShellImpl;
+import org.apache.felix.gogo.runtime.shell.CommandShellImpl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.InvalidSyntaxException;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/osgi/ServiceCommand.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/ServiceCommand.java
similarity index 91%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/osgi/ServiceCommand.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/ServiceCommand.java
index 0425a8e..c285d6b 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/osgi/ServiceCommand.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/osgi/ServiceCommand.java
@@ -16,10 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.osgi;
+package org.apache.felix.gogo.runtime.osgi;
 
-import org.apache.felix.gogo.shell.runtime.CommandShellImpl;
-import org.apache.felix.gogo.shell.runtime.Reflective;
+import org.apache.felix.gogo.runtime.shell.CommandShellImpl;
+import org.apache.felix.gogo.runtime.shell.Reflective;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.command.CommandSession;
 import org.osgi.service.command.Function;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Closure.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
similarity index 99%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Closure.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
index 11ebc9f..e479bac 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Closure.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Closure.java
@@ -19,7 +19,7 @@
 // DWB5: session.err is not redirected when creating pipeline
 // DWB6: add 'set -x' trace feature if echo is set
 // DWB7: removing variable via 'execute("name=") throws OutOfBoundsException
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import org.osgi.service.command.CommandSession;
 import org.osgi.service.command.Function;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Command.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Command.java
similarity index 96%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Command.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Command.java
index e591d40..2d5f7d0 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Command.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Command.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import org.osgi.service.command.CommandSession;
 import org.osgi.service.command.Function;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/CommandSessionImpl.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/CommandSessionImpl.java
similarity index 99%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/CommandSessionImpl.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/CommandSessionImpl.java
index d87e662..c56142e 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/CommandSessionImpl.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/CommandSessionImpl.java
@@ -19,7 +19,7 @@
 // DWB8: throw IllegatlStateException if session used after closed (as per rfc132)
 // DWB9: there is no API to list all variables: https://www.osgi.org/bugzilla/show_bug.cgi?id=49
 // DWB10: add SCOPE support: https://www.osgi.org/bugzilla/show_bug.cgi?id=51
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import org.osgi.service.command.CommandSession;
 import org.osgi.service.command.Converter;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/CommandShellImpl.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/CommandShellImpl.java
similarity index 98%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/CommandShellImpl.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/CommandShellImpl.java
index 27ea020..5b8d6b1 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/CommandShellImpl.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/CommandShellImpl.java
@@ -19,7 +19,7 @@
 // DWB11: add removeCommand: https://www.osgi.org/bugzilla/show_bug.cgi?id=49
 // DWB12: there is no API to list commands: https://www.osgi.org/bugzilla/show_bug.cgi?id=49
 // DWB13: addCommand() fails to add static methods (if target is Class)
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.command.CommandSession;
diff --git a/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Context.java
similarity index 92%
rename from gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Context.java
index c1747ca..c14a790 100644
--- a/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Context.java
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
-import org.apache.felix.gogo.threadio.ThreadIOImpl;
+import org.apache.felix.gogo.runtime.threadio.ThreadIOImpl;
 
 public class Context extends CommandShellImpl
 {
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Parser.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
similarity index 99%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Parser.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
index 163e938..6d6e7cd 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Parser.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Parser.java
@@ -18,7 +18,7 @@
  */
 // DWB14: parser loops if // comment at start of program
 // DWB15: allow program to have trailing ';'
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Pipe.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Pipe.java
similarity index 97%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Pipe.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Pipe.java
index 1538444..3b1b253 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Pipe.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Pipe.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 // DWB16: redirect System.err when creating pipe
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import org.osgi.service.command.Converter;
 
@@ -60,6 +60,7 @@
     public Pipe connect(Pipe next) throws IOException
     {
         next.setOut(out);
+        next.setErr(err);
         pout = new PipedOutputStream();
         next.setIn(new PipedInputStream(pout));
         out = new PrintStream(pout);
diff --git a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Reflective.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Reflective.java
similarity index 99%
rename from gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Reflective.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Reflective.java
index 9ae544e..eeab41a 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/shell/runtime/Reflective.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/shell/Reflective.java
@@ -20,7 +20,7 @@
 // DWB17: coerce() doesn't support static void main(String[]) in rfc132
 // DWB18: coerce() doesn't extract cause from InvocationTargetException
 // DWB19: coerce() won't add empty array to satisfy Object[] argument
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import org.osgi.service.command.CommandSession;
 
diff --git a/gogo/src/main/java/org/apache/felix/gogo/threadio/Marker.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/Marker.java
similarity index 96%
rename from gogo/src/main/java/org/apache/felix/gogo/threadio/Marker.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/Marker.java
index 6501356..95c50e5 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/threadio/Marker.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/Marker.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.threadio;
+package org.apache.felix.gogo.runtime.threadio;
 
 import java.io.InputStream;
 import java.io.PrintStream;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadIOImpl.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadIOImpl.java
similarity index 98%
rename from gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadIOImpl.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadIOImpl.java
index babd71b..b9cab7a 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadIOImpl.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadIOImpl.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 // DWB20: ThreadIO should check and reset IO if something (e.g. jetty) overrides
-package org.apache.felix.gogo.threadio;
+package org.apache.felix.gogo.runtime.threadio;
 
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.threadio.ThreadIO;
diff --git a/gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadInputStream.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java
similarity index 91%
rename from gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadInputStream.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java
index 9910c91..8d869ac 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadInputStream.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadInputStream.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations

  * under the License.

  */

-package org.apache.felix.gogo.threadio;

+package org.apache.felix.gogo.runtime.threadio;

 

 import java.io.IOException;

 import java.io.InputStream;

@@ -73,8 +73,14 @@
         map.remove();

     }

 

-    InputStream getRoot()

+    /**

+     * Access to the root stream through reflection

+     *

+     * @return

+     */

+    public InputStream getRoot()

     {

         return dflt;

     }

+

 }

diff --git a/gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadPrintStream.java b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java
similarity index 88%
rename from gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadPrintStream.java
rename to gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java
index 9e8c418..0a8c529 100644
--- a/gogo/src/main/java/org/apache/felix/gogo/threadio/ThreadPrintStream.java
+++ b/gogo/gogo-runtime/src/main/java/org/apache/felix/gogo/runtime/threadio/ThreadPrintStream.java
@@ -16,10 +16,11 @@
  * specific language governing permissions and limitations

  * under the License.

  */

-package org.apache.felix.gogo.threadio;

+package org.apache.felix.gogo.runtime.threadio;

 

 import java.io.IOException;

 import java.io.PrintStream;

+import java.io.InputStream;

 

 public class ThreadPrintStream extends PrintStream

 {

@@ -74,5 +75,14 @@
         map.remove();

     }

 

+    /**

+     * Access to the root stream through reflection

+     * 

+     * @return

+     */

+    public PrintStream getRoot()

+    {

+        return dflt;

+    }

 

 }

diff --git a/gogo/src/main/java/org/osgi/service/command/CommandProcessor.java b/gogo/gogo-runtime/src/main/java/org/osgi/service/command/CommandProcessor.java
similarity index 100%
rename from gogo/src/main/java/org/osgi/service/command/CommandProcessor.java
rename to gogo/gogo-runtime/src/main/java/org/osgi/service/command/CommandProcessor.java
diff --git a/gogo/src/main/java/org/osgi/service/command/CommandSession.java b/gogo/gogo-runtime/src/main/java/org/osgi/service/command/CommandSession.java
similarity index 100%
rename from gogo/src/main/java/org/osgi/service/command/CommandSession.java
rename to gogo/gogo-runtime/src/main/java/org/osgi/service/command/CommandSession.java
diff --git a/gogo/src/main/java/org/osgi/service/command/Converter.java b/gogo/gogo-runtime/src/main/java/org/osgi/service/command/Converter.java
similarity index 100%
rename from gogo/src/main/java/org/osgi/service/command/Converter.java
rename to gogo/gogo-runtime/src/main/java/org/osgi/service/command/Converter.java
diff --git a/gogo/src/main/java/org/osgi/service/command/Function.java b/gogo/gogo-runtime/src/main/java/org/osgi/service/command/Function.java
similarity index 100%
rename from gogo/src/main/java/org/osgi/service/command/Function.java
rename to gogo/gogo-runtime/src/main/java/org/osgi/service/command/Function.java
diff --git a/gogo/src/main/java/org/osgi/service/threadio/ThreadIO.java b/gogo/gogo-runtime/src/main/java/org/osgi/service/threadio/ThreadIO.java
similarity index 100%
rename from gogo/src/main/java/org/osgi/service/threadio/ThreadIO.java
rename to gogo/gogo-runtime/src/main/java/org/osgi/service/threadio/ThreadIO.java
diff --git a/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java b/gogo/gogo-runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
similarity index 98%
rename from gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java
rename to gogo/gogo-runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
index 1a885a0..aea28f1 100644
--- a/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java
+++ b/gogo/gogo-runtime/src/test/java/org/apache/felix/gogo/runtime/shell/TestParser.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.shell.runtime;
+package org.apache.felix.gogo.runtime.shell;
 
 import junit.framework.TestCase;
 import org.osgi.service.command.CommandSession;
@@ -153,7 +153,7 @@
         c.addCommand("echo", this);
 
         assertEquals("", c.execute("echo ${very.likely.that.this.does.not.exist}").toString());
-        assertNotNull(c.execute("echo ${java.runtime.name}"));
+        assertNotNull(c.execute("echo ${java.shell.name}"));
     }
 
     public void testFunny() throws Exception
diff --git a/gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java b/gogo/gogo-runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java
similarity index 97%
rename from gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java
rename to gogo/gogo-runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java
index 4725d3f..32ea917 100644
--- a/gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java
+++ b/gogo/gogo-runtime/src/test/java/org/apache/felix/gogo/runtime/threadio/TestThreadIO.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.felix.gogo.threadio;
+package org.apache.felix.gogo.runtime.threadio;
 
 import junit.framework.TestCase;
 
diff --git a/gogo/pom.xml b/gogo/pom.xml
index ae763cb..9694a8c 100644
--- a/gogo/pom.xml
+++ b/gogo/pom.xml
@@ -25,62 +25,59 @@
         <relativePath>../pom/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-    <packaging>bundle</packaging>
+    <packaging>pom</packaging>
     <name>Apache Felix Gogo Shell</name>
-    <artifactId>org.apache.felix.gogo</artifactId>
+    <groupId>org.apache.felix.gogo</groupId>
+    <artifactId>gogo</artifactId>
     <version>1.0.0-SNAPSHOT</version>
-    <dependencies>
-        <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>1.2.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <version>1.2.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.5</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
+
+    <modules>
+        <module>gogo-runtime</module>
+        <module>gogo-launcher</module>
+        <module>gogo-console</module>
+    </modules>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>org.osgi.core</artifactId>
+                <version>1.2.0</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>org.osgi.compendium</artifactId>
+                <version>1.2.0</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>4.5</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.felix.gogo</groupId>
+                <artifactId>org.apache.felix.gogo.runtime</artifactId>
+                <version>${pom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.felix.gogo</groupId>
+                <artifactId>org.apache.felix.gogo.console</artifactId>
+                <version>${pom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.felix.gogo</groupId>
+                <artifactId>org.apache.felix.gogo.launcher</artifactId>
+                <version>${pom.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.0.0</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Export-Package>org.osgi.service.command; version=1.0.0</Export-Package>
-                        <Private-Package>org.apache.felix.gogo.*</Private-Package>
-                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-                    </instructions>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>rat-maven-plugin</artifactId>
-                <configuration>
-                    <excludeSubProjects>false</excludeSubProjects>
-                    <useEclipseDefaultExcludes>true</useEclipseDefaultExcludes>
-                    <useMavenDefaultExcludes>true</useMavenDefaultExcludes>
-                    <excludes>
-                        <param>doc/*</param>
-                        <param>maven-eclipse.xml</param>
-                        <param>.checkstyle</param>
-                        <param>.externalToolBuilders/*</param>
-                    </excludes>
-                </configuration>
-            </plugin>
-            <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
                     <source>1.5</source>
diff --git a/gogo/proc.bnd b/gogo/proc.bnd
deleted file mode 100644
index 6a7609f..0000000
--- a/gogo/proc.bnd
+++ /dev/null
@@ -1,5 +0,0 @@
--output: work
-Private-Package: org.apache.felix.gogo.cpeg
-Service-Component: org.apache.felix.gogo.cpeg.Procedural; \
-  provide:=org.apache.felix.gogo.cpeg.Procedural; \
-  properties:="osgi.command.scope=proc,osgi.command.function=new"