servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r584225 [1/2] - in /incubator/servicemix/branches/servicemix-4.0: ./ gshell/ gshell/gshell-core/ gshell/gshell-core/src/ gshell/gshell-core/src/main/ gshell/gshell-core/src/main/java/ gshell/gshell-core/src/main/java/org/ gshell/gshell-core...
Date Fri, 12 Oct 2007 18:29:19 GMT
Author: gnodet
Date: Fri Oct 12 11:27:49 2007
New Revision: 584225

URL: http://svn.apache.org/viewvc?rev=584225&view=rev
Log:
Integrate gshell

Added:
    incubator/servicemix/branches/servicemix-4.0/gshell/   (with props)
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/   (with props)
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/pom.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/Main.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/osgi/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/EnvironmentTargetSource.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/IOTargetSource.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandExecutor.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandLineBuilder.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-local.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/gshell-remote.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/test/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/test/java/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/test/resources/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/   (with props)
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/pom.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandSupport.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-commands.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/pax-runner.txt
    incubator/servicemix/branches/servicemix-4.0/gshell/pom.xml
    incubator/servicemix/branches/servicemix-4.0/gshell/src/
    incubator/servicemix/branches/servicemix-4.0/gshell/src/test/
    incubator/servicemix/branches/servicemix-4.0/gshell/src/test/configs/
    incubator/servicemix/branches/servicemix-4.0/gshell/src/test/configs/services/
    incubator/servicemix/branches/servicemix-4.0/gshell/src/test/configs/services/org.ops4j.pax.logging.properties
Modified:
    incubator/servicemix/branches/servicemix-4.0/pom.xml

Propchange: incubator/servicemix/branches/servicemix-4.0/gshell/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 12 11:27:49 2007
@@ -0,0 +1,2 @@
+target
+runner

Propchange: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 12 11:27:49 2007
@@ -0,0 +1 @@
+target

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/pom.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/pom.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/pom.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev: 580839 $ $Date: 2007-10-01 06:55:10 +0200 (Mon, 01 Oct 2007) $ -->
+
+<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">
+    
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.servicemix</groupId>
+        <artifactId>gshell</artifactId>
+        <version>4.0-SNAPSHOT</version>
+    </parent>
+    
+    <groupId>org.apache.servicemix.gshell</groupId>
+    <artifactId>gshell-core</artifactId>
+    <packaging>bundle</packaging>
+    <name>GShell Core</name>
+    
+    <description>
+        Provides the OSGi GShell integration
+    </description>
+
+    <properties>
+        <gshell.osgi.import>
+            com.thoughtworks.xstream*;resolution:=optional,
+            javax.xml.stream*;resolution:=optional,
+            junit.framework*;resolution:=optional,
+            nu.xom*;resolution:=optional,
+            net.sf.cglib*;resolution:=optional,
+            org.codehaus.jettison*;resolution:=optional,
+            org.codehaus.plexus*;resolution:=optional,
+            org.dom4j*;resolution:=optional,
+            org.joda*;resolution:=optional,
+            org.jdom*;resolution:=optional,
+            sun.*;resolution:=optional,
+            *
+        </gshell.osgi.import>
+        <gshell.osgi.export>
+            org.apache.geronimo.gshell.command*,
+            org.apache.geronimo.gshell.clp*
+        </gshell.osgi.export>
+        <gshell.osgi.private>
+            jline*,
+            org.apache.commons.jexl*,
+            org.apache.geronimo.gshell*,
+            org.codehaus.plexus.personality.plexus.lifecycle.phase*,
+            org.codehaus.plexus.util*,
+            META-INF.spring*
+        </gshell.osgi.private>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell</groupId>
+            <artifactId>gshell-core</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.commands</groupId>
+            <artifactId>gshell-builtins</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell</groupId>
+            <artifactId>gshell-command-api</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-common</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-ansi</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-i18n</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-clp</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.gshell</groupId>
+            <artifactId>gshell-parser</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-jexl</groupId>
+            <artifactId>commons-jexl</artifactId>
+            <version>1.1</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-logging</groupId>
+                    <artifactId>commons-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>jline</groupId>
+            <artifactId>jline</artifactId>
+            <version>0.9.91</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-component-api</artifactId>
+            <version>1.0-alpha-32</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-utils</artifactId>
+            <version>1.4.5</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-aop</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-nodep</artifactId>
+            <version>2.1_3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <version>1.4.3</version>
+        </dependency>
+        <dependency>
+		    <groupId>org.ops4j.pax.runner</groupId>
+		    <artifactId>pax-runner</artifactId>
+            <version>0.5.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>Main</mainClass>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.0.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Name>${artifactId}</Bundle-Name>
+                        <Bundle-SymbolicName>${groupId}-${artifactId}</Bundle-SymbolicName>
+                        <Import-Package>${gshell.osgi.import}</Import-Package>
+                        <Export-Package>${gshell.osgi.export}</Export-Package>
+                        <Private-Package>${gshell.osgi.private}</Private-Package>
+                        <Implementation-Title>Apache GShell</Implementation-Title>
+                        <Implementation-Version>${project.version}</Implementation-Version>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/Main.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/Main.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/Main.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/Main.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,27 @@
+import java.util.Map;
+
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.registry.CommandRegistry;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 11, 2007
+ * Time: 3:03:06 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Main {
+
+    public static void main(String[] args) throws Exception {
+        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+                new String[] {"../resources/META-INF/spring/gshell.xml", "../resources/META-INF/spring/gshell-local.xml", "../resources/META-INF/spring/gshell-commands.xml"});
+
+        CommandRegistry registry = (CommandRegistry) context.getBean("commandRegistry");
+        Map<String, Command> commands = (Map<String, Command>) context.getBeansOfType(Command.class);
+        for (Command cmd : commands.values()) {
+            registry.register(cmd);
+        }
+
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/EnvironmentTargetSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/EnvironmentTargetSource.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/EnvironmentTargetSource.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/EnvironmentTargetSource.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.geronimo.gshell.spring;
+
+import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.shell.Environment;
+import org.springframework.aop.TargetSource;
+
+/**
+ * A TargetSource that provides an Environment that has to be
+ * previously set in a thread local storage.
+ */
+public class EnvironmentTargetSource implements TargetSource {
+
+    private static ThreadLocal<Environment> tls = new ThreadLocal<Environment>();
+
+    public static void setEnvironment(Environment env) {
+        tls.set(env);
+    }
+
+    public Class getTargetClass() {
+        return Environment.class;
+    }
+
+    public boolean isStatic() {
+        return false;
+    }
+
+    public Object getTarget() throws Exception {
+        return tls.get();
+    }
+
+    public void releaseTarget(Object o) throws Exception {
+    }
+}
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.geronimo.gshell.spring;
+
+import org.apache.geronimo.gshell.DefaultEnvironment;
+import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.shell.InteractiveShell;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 11, 2007
+ * Time: 10:20:37 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class GShell implements Runnable {
+
+    private InteractiveShell shell;
+    private Thread thread;
+    private IO io;
+    private Environment env;
+    private boolean start;
+
+    public GShell(InteractiveShell shell) {
+        this.shell = shell;
+        this.io = new IO(System.in, System.out, System.err);
+        this.env = new DefaultEnvironment(io);
+    }
+
+    public void setStart(boolean start) {
+        this.start = start;
+    }
+
+    public void start() {
+        if (start) {
+            thread = new Thread(this);
+            thread.start();
+        }
+    }
+
+    public void stop() throws InterruptedException {
+        if (thread != null) {
+            thread.interrupt();
+            thread.join();
+            thread = null;
+        }
+    }
+
+    public void run() {
+        IOTargetSource.setIO(io);
+        EnvironmentTargetSource.setEnvironment(env);
+        try {
+            Thread.sleep(5000);
+            shell.run();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/IOTargetSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/IOTargetSource.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/IOTargetSource.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/IOTargetSource.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.geronimo.gshell.spring;
+
+import org.apache.geronimo.gshell.command.IO;
+import org.springframework.aop.TargetSource;
+
+/**
+ * A TargetSource that provides an IO that has to be 
+ * previously set in a thread local storage.
+ */
+public class IOTargetSource implements TargetSource {
+
+    private static ThreadLocal<IO> tls = new ThreadLocal<IO>();
+
+    public static void setIO(IO io) {
+        tls.set(io);
+    }
+
+    public Class getTargetClass() {
+        return IO.class;
+    }
+
+    public boolean isStatic() {
+        return false;
+    }
+
+    public Object getTarget() throws Exception {
+        return tls.get();
+    }
+
+    public void releaseTarget(Object o) throws Exception {
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandExecutor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandExecutor.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandExecutor.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandExecutor.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.geronimo.gshell.spring;
+
+import org.apache.geronimo.gshell.CommandLineBuilder;
+import org.apache.geronimo.gshell.DefaultCommandExecutor;
+import org.apache.geronimo.gshell.command.CommandExecutor;
+import org.apache.geronimo.gshell.layout.LayoutManager;
+import org.apache.geronimo.gshell.shell.Environment;
+
+/**
+ * A simple wrapper around the DefaultCommandExecutor to avoid
+ * using constructor injection which causes a circular dependency
+ * in spring.
+ */
+public class SpringCommandExecutor implements CommandExecutor {
+
+    private CommandExecutor executor;
+    private LayoutManager layoutManager;
+    private CommandLineBuilder commandLineBuilder;
+    private Environment env;
+
+    public void setLayoutManager(LayoutManager layoutManager) {
+        this.layoutManager = layoutManager;
+    }
+
+    public void setCommandLineBuilder(CommandLineBuilder commandLineBuilder) {
+        this.commandLineBuilder = commandLineBuilder;
+    }
+
+    public void setEnv(Environment env) {
+        this.env = env;
+    }
+    
+    public void init() {
+        executor = new DefaultCommandExecutor(layoutManager, commandLineBuilder, env);
+    }
+
+    public Object execute(String s) throws Exception {
+        return executor.execute(s);
+    }
+
+    public Object execute(String s, Object[] objects) throws Exception {
+        return executor.execute(s, objects);
+    }
+
+    public Object execute(Object... objects) throws Exception {
+        return executor.execute(objects);
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandLineBuilder.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandLineBuilder.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandLineBuilder.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandLineBuilder.java Fri Oct 12 11:27:49 2007
@@ -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.
+ */
+package org.apache.geronimo.gshell.spring;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.apache.geronimo.gshell.CommandLine;
+import org.apache.geronimo.gshell.CommandLineBuilder;
+import org.apache.geronimo.gshell.ErrorNotification;
+import org.apache.geronimo.gshell.ExecutingVisitor;
+import org.apache.geronimo.gshell.command.CommandExecutor;
+import org.apache.geronimo.gshell.parser.ASTCommandLine;
+import org.apache.geronimo.gshell.parser.CommandLineParser;
+import org.apache.geronimo.gshell.parser.ParseException;
+import org.apache.geronimo.gshell.shell.Environment;
+
+/**
+ * A CommandLineBuilder that uses a single executor and environment, expecting
+ * those to be proxies to some thread local instances.  Use setter injection to
+ * avoid a circular dependency with the SpringCommandExecutor.
+ */
+public class SpringCommandLineBuilder implements CommandLineBuilder {
+
+    private CommandLineParser parser = new CommandLineParser();
+    private CommandExecutor executor;
+    private Environment environment;
+
+    public SpringCommandLineBuilder() {
+    }
+
+    public void setExecutor(CommandExecutor executor) {
+        this.executor = executor;
+    }
+
+    public void setEnvironment(Environment environment) {
+        this.environment = environment;
+    }
+
+    private ASTCommandLine parse(final String input) throws ParseException {
+         assert input != null;
+
+         Reader reader = new StringReader(input);
+         ASTCommandLine cl;
+         try {
+             cl = parser.parse(reader);
+         }
+         finally {
+             try {
+                 reader.close();
+             } catch (IOException e) {
+                 // Ignore
+             }
+         }
+
+         return cl;
+     }
+
+     public CommandLine create(final String commandLine) throws ParseException {
+         assert commandLine != null;
+
+         if (commandLine.trim().length() == 0) {
+             throw new IllegalArgumentException("Command line is empty");
+         }
+
+         try {
+             final ExecutingVisitor visitor = new ExecutingVisitor(executor, environment);
+             final ASTCommandLine root = parse(commandLine);
+
+             return new CommandLine() {
+                 public Object execute() throws Exception {
+                     return root.jjtAccept(visitor, null);
+                 }
+             };
+         }
+         catch (Exception e) {
+             throw new ErrorNotification(e);
+         }
+     }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringCommandRegistry.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.geronimo.gshell.spring;
+
+import java.util.Map;
+
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.registry.DefaultCommandRegistry;
+import org.apache.geronimo.gshell.registry.NotRegisteredException;
+import org.apache.geronimo.gshell.registry.DuplicateRegistrationException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 11, 2007
+ * Time: 3:47:24 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringCommandRegistry extends DefaultCommandRegistry {
+
+    public void register(final Command command, Map<String, ?> properties) throws DuplicateRegistrationException {
+        register(command);
+    }
+
+    public void unregister(final Command command, Map<String, ?> properties) throws NotRegisteredException {
+        unregister(command);
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <bean id="echo" class="org.apache.geronimo.gshell.commands.builtins.EchoCommand" />
+
+    <bean id="exit" class="org.apache.geronimo.gshell.commands.builtins.ExitCommand" />
+
+    <bean id="help" class="org.apache.geronimo.gshell.commands.builtins.HelpCommand">
+        <constructor-arg ref="commandRegistry" />
+        <constructor-arg ref="layoutManager" />
+        <constructor-arg ref="branding" />
+    </bean>
+
+    <bean id="set" class="org.apache.geronimo.gshell.commands.builtins.SetCommand" />
+
+    <bean id="source" class="org.apache.geronimo.gshell.commands.builtins.SourceCommand" />
+
+    <bean id="unset" class="org.apache.geronimo.gshell.commands.builtins.UnsetCommand" />
+
+</beans>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-local.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-local.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-local.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-local.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <bean id="gshell" class="org.apache.geronimo.gshell.spring.GShell"
+                      init-method="start" destroy-method="stop">
+        <constructor-arg ref="interactiveShell" />
+        <property name="start" value="true" />
+    </bean>
+    
+
+</beans>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+    <osgi:list id="commands" interface="org.apache.geronimo.gshell.command.Command" cardinality="0..N">
+        <osgi:listener ref="commandRegistry" bind-method="register" unbind-method="unregister" />
+    </osgi:list>
+
+    <osgi:service ref="help" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="exit" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="set" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="unset" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="source" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="echo" interface="org.apache.geronimo.gshell.command.Command" />
+
+</beans>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <bean id="branding" class="org.apache.geronimo.gshell.branding.DefaultBranding">
+        <constructor-arg ref="versionLoader" />
+        <constructor-arg ref="terminal" />
+    </bean>
+
+    <bean id="versionLoader" class="org.apache.geronimo.gshell.branding.PropertiesVersionLoader">
+        <constructor-arg value="version.properties" />
+    </bean>
+
+    <bean id="terminal" class="jline.Terminal" factory-method="getTerminal" />
+
+    <bean id="promptReader" class="org.apache.geronimo.gshell.console.PromptReader">
+        <constructor-arg ref="terminal" />
+        <constructor-arg ref="io" />
+    </bean>
+
+    <bean id="commandExecutor" class="org.apache.geronimo.gshell.spring.SpringCommandExecutor" init-method="init">
+        <property name="commandLineBuilder" ref="commandLineBuilder" />
+        <property name="env" ref="environment" />
+        <property name="layoutManager" ref="layoutManager" />
+    </bean>
+
+    <bean id="interactiveShell" class="org.apache.geronimo.gshell.DefaultShell">
+        <constructor-arg ref="shellInfo" />
+        <constructor-arg ref="branding" />
+        <constructor-arg ref="commandExecutor" />
+        <constructor-arg ref="terminal" />
+        <constructor-arg ref="environment" />
+        <constructor-arg ref="io" />
+    </bean>
+
+    <bean id="shellInfo" class="org.apache.geronimo.gshell.DefaultShellInfo" init-method="initialize">
+        <constructor-arg ref="branding" />
+    </bean>
+
+    <bean id="layoutManager" class="org.apache.geronimo.gshell.layout.DefaultLayoutManager">
+        <constructor-arg ref="commandRegistry" />
+        <constructor-arg ref="layoutLoader" />
+        <constructor-arg ref="environment" />
+    </bean>
+
+    <bean id="layoutLoader" class="org.apache.geronimo.gshell.layout.loader.XMLLayoutLoader">
+        <constructor-arg ref="shellInfo" />
+    </bean>
+
+    <bean id="commandRegistry" class="org.apache.geronimo.gshell.spring.SpringCommandRegistry" />
+
+    <bean id="commandLineBuilder" class="org.apache.geronimo.gshell.spring.SpringCommandLineBuilder">
+        <property name="environment" ref="environment" />
+        <property name="executor" ref="commandExecutor" />
+    </bean>
+
+    
+    <bean id="environment" class="org.springframework.aop.framework.ProxyFactoryBean">
+      <property name="targetSource">
+          <bean class="org.apache.geronimo.gshell.spring.EnvironmentTargetSource" />
+      </property>
+    </bean>
+
+    <bean id="io" class="org.springframework.aop.framework.ProxyFactoryBean">
+      <property name="targetSource">
+          <bean class="org.apache.geronimo.gshell.spring.IOTargetSource" />
+      </property>
+    </bean>
+
+</beans>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/gshell-remote.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/gshell-remote.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/gshell-remote.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-core/src/main/resources/gshell-remote.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <bean id="remoteShell" class="org.apache.geronimo.gshell.remote.server.DefaultRemoteShell">
+        <constructor-arg ref="shellInfo" />
+        <constructor-arg ref="commandExecutor" />
+        <constructor-arg ref="environment" />
+    </bean>
+
+    <bean id="rshServer" class="org.apache.geronimo.gshell.remote.server.RshServer">
+        <constructor-arg ref="timeoutManager" />
+        <constructor-arg ref="transportFactoryLocator" />
+        <constructor-arg>
+            <list>
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.CloseShellHandler" />
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.ConnectHandler">
+                    <constructor-arg ref="cryptoContext" />
+                    <constructor-arg ref="timeoutManager" />
+                </bean>
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.EchoHandler" />
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.ExecuteHandler" />
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.LoginHandler">
+                    <constructor-arg ref="timeoutManager" />
+                </bean>
+                <bean class="org.apache.geronimo.gshell.remote.server.handler.OpenShellHandler">
+                    <!-- todo: plexus container -->
+                </bean>
+            </list>
+        </constructor-arg>
+    </bean>
+
+    <bean id="timeoutManager" class="org.apache.geronimo.gshell.remote.server.timeout.DefaultTimeoutManager" />
+
+    <bean id="sslContextFactory" class="org.apache.geronimo.gshell.whisper.ssl.BogusSSLContextFactory" />
+
+    <bean id="sslAddressFactory" class="org.apache.geronimo.gshell.whisper.transport.ssl.SslAddressFactory" />
+
+    <bean id="sslTransport" class="org.apache.geronimo.gshell.whisper.transport.ssl.SslTransport">
+        
+    </bean>
+
+    
+
+</beans>
\ No newline at end of file

Propchange: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct 12 11:27:49 2007
@@ -0,0 +1 @@
+target

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/pom.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/pom.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/pom.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev: 580839 $ $Date: 2007-10-01 06:55:10 +0200 (Mon, 01 Oct 2007) $ -->
+
+<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">
+    
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.servicemix</groupId>
+        <artifactId>gshell</artifactId>
+        <version>4.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.gshell</groupId>
+    <artifactId>gshell-osgi</artifactId>
+    <packaging>bundle</packaging>
+    <name>GShell OSGi Commands</name>
+    
+    <description>
+        Provides the OSGi GShell commands
+    </description>
+
+    <dependencies>
+	    <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>${felix.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell</groupId>
+            <artifactId>gshell-command-api</artifactId>
+            <version>${gshell.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.osgi</groupId>
+            <artifactId>spring-osgi-core</artifactId>
+            <version>${spring.osgi.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>${felix.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Name>${artifactId}</Bundle-Name>
+                        <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
+                        <Export-Package>org.apache.geronimo.gshell.osgi*;version=${project.version}</Export-Package>
+                        <Import-Package>*</Import-Package>
+                        <Private-Package>!*</Private-Package>
+                        <Implementation-Title>Apache GShell</Implementation-Title>
+                        <Implementation-Version>${project.version}</Implementation-Version>
+			            <DynamicImport-Package>*</DynamicImport-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/BundleCommand.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.geronimo.gshell.osgi.OsgiCommandSupport;
+import org.osgi.framework.Bundle;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:10:32 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class BundleCommand extends OsgiCommandSupport {
+
+    @Argument(required = true)
+    long id;
+
+    protected Object doExecute() throws Exception {
+        Bundle bundle = getBundleContext().getBundle(id);
+        if (bundle == null) {
+            io.out.println("Bundle " + id + " not found");
+            return FAILURE;
+        }
+        doExecute(bundle);
+        return SUCCESS;
+    }
+
+    protected abstract void doExecute(Bundle bundle) throws Exception;
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ListBundles.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,144 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.clp.Option;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.startlevel.StartLevel;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 9:44:20 AM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="lb", description="List bundles")
+public class ListBundles extends OsgiCommandSupport {
+
+    @Option(name = "-l", description = "Show locations")
+    boolean showLoc;
+
+    @Option(name = "-s", description = "Show symbolic name")
+    boolean showSymbolic;
+
+    @Option(name = "-u", description = "Show update")
+    boolean showUpdate;
+
+    protected Object doExecute() throws Exception {
+        ServiceReference ref = getBundleContext().getServiceReference(StartLevel.class.getName());
+        StartLevel sl = null;
+        if (ref != null) {
+            sl = (StartLevel) getBundleContext().getService(ref);
+        }
+        if (sl == null) {
+            io.out.println("StartLevel service is unavailable.");
+        }
+        try {
+            Bundle[] bundles = getBundleContext().getBundles();
+            if (bundles != null) {
+                // Display active start level.
+                if (sl != null) {
+                    io.out.println("START LEVEL " + sl.getStartLevel());
+                }
+
+                // Print column headers.
+                String msg = " Name";
+                if (showLoc) {
+                   msg = " Location";
+                }
+                else if (showSymbolic) {
+                   msg = " Symbolic name";
+                }
+                else if (showUpdate) {
+                   msg = " Update location";
+                }
+                String level = (sl == null) ? "" : "  Level ";
+                io.out.println("   ID " + "  State       " + level + msg);
+                for (int i = 0; i < bundles.length; i++) {
+                    // Get the bundle name or location.
+                    String name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_NAME);
+                    // If there is no name, then default to symbolic name.
+                    name = (name == null) ? bundles[i].getSymbolicName() : name;
+                    // If there is no symbolic name, resort to location.
+                    name = (name == null) ? bundles[i].getLocation() : name;
+
+                    // Overwrite the default value is the user specifically
+                    // requested to display one or the other.
+                    if (showLoc) {
+                        name = bundles[i].getLocation();
+                    }
+                    else if (showSymbolic) {
+                        name = bundles[i].getSymbolicName();
+                        name = (name == null) ? "<no symbolic name>" : name;
+                    }
+                    else if (showUpdate) {
+                        name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
+                        name = (name == null) ? bundles[i].getLocation() : name;
+                    }
+                    // Show bundle version if not showing location.
+                    String version = (String) bundles[i].getHeaders().get(Constants.BUNDLE_VERSION);
+                    name = (!showLoc && !showUpdate && (version != null)) ? name + " (" + version + ")" : name;
+                    long l = bundles[i].getBundleId();
+                    String id = String.valueOf(l);
+                    if (sl == null) {
+                        level = "1";
+                    }
+                    else {
+                        level = String.valueOf(sl.getBundleStartLevel(bundles[i]));
+                    }
+                    while (level.length() < 5) {
+                        level = " " + level;
+                    }
+                    while (id.length() < 4) {
+                        id = " " + id;
+                    }
+                    io.out.println("[" + id + "] ["
+                        + getStateString(bundles[i].getState())
+                        + "] [" + level + "] " + name);
+                }
+            }
+            else {
+                io.out.println("There are no installed bundles.");
+            }
+            return SUCCESS;
+        }
+        finally {
+            if (ref != null) {
+                getBundleContext().ungetService(ref);
+            }
+        }
+    }
+
+    public String getStateString(int i)
+    {
+        if (i == Bundle.ACTIVE)
+            return "Active     ";
+        else if (i == Bundle.INSTALLED)
+            return "Installed  ";
+        else if (i == Bundle.RESOLVED)
+            return "Resolved   ";
+        else if (i == Bundle.STARTING)
+            return "Starting   ";
+        else if (i == Bundle.STOPPING)
+            return "Stopping   ";
+        return "Unknown    ";
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandSupport.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandSupport.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/OsgiCommandSupport.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.CommandSupport;
+import org.osgi.framework.BundleContext;
+import org.springframework.osgi.context.BundleContextAware;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 9:44:39 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class OsgiCommandSupport extends CommandSupport implements BundleContextAware {
+
+    private BundleContext bundleContext;
+
+    public void setBundleContext(BundleContext context) {
+        bundleContext = context;
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/RefreshBundle.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,68 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="refresh", description="Refresh bundle")
+public class RefreshBundle extends OsgiCommandSupport {
+
+    @Argument(required = false)
+    Long id;
+
+    protected Object doExecute() throws Exception {
+        // Get package admin service.
+        ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
+        if (ref == null) {
+            io.out.println("PackageAdmin service is unavailable.");
+            return FAILURE;
+        }
+        try {
+            PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
+            if (pa == null) {
+                io.out.println("PackageAdmin service is unavailable.");
+                return FAILURE;
+            }
+            if (id == null) {
+                pa.refreshPackages(null);
+            }
+            else {
+                Bundle bundle = getBundleContext().getBundle(id);
+                if (bundle == null) {
+                    io.out.println("Bundle " + id + " not found");
+                    return FAILURE;
+                }
+                pa.refreshPackages(new Bundle[] { bundle });
+            }
+        }
+        finally {
+            getBundleContext().ungetService(ref);
+        }
+        return SUCCESS;
+    }
+}
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/ResolveBundle.java Fri Oct 12 11:27:49 2007
@@ -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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="resolve", description="Resolve bundle")
+public class ResolveBundle extends BundleCommand {
+
+    protected void doExecute(Bundle bundle) throws Exception {
+        // Get package admin service.
+        ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
+        if (ref == null) {
+            io.out.println("PackageAdmin service is unavailable.");
+            return;
+        }
+        try {
+            PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
+            if (pa == null) {
+                io.out.println("PackageAdmin service is unavailable.");
+                return;
+            }
+            pa.resolveBundles(new Bundle[] { bundle });
+        }
+        finally {
+            getBundleContext().ungetService(ref);
+        }
+    }
+
+}
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/Shutdown.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.osgi.framework.Bundle;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 1:59:04 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="shutdown", description="Shutdown")
+public class Shutdown extends OsgiCommandSupport {
+
+    protected Object doExecute() throws Exception {
+        Bundle bundle = getBundleContext().getBundle(0);
+        bundle.stop();
+        return SUCCESS;
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartBundle.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.osgi.framework.Bundle;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:10:15 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="start", description="Start bundle")
+public class StartBundle extends BundleCommand {
+
+    protected void doExecute(Bundle bundle) throws Exception {
+        bundle.start();
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StartLevel.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+import org.apache.geronimo.gshell.clp.Argument;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="startlevel", description="Get or set the start level")
+public class StartLevel extends BundleCommand {
+
+    @Argument
+    Integer level;
+
+    protected void doExecute(Bundle bundle) throws Exception {
+        // Get package admin service.
+        ServiceReference ref = getBundleContext().getServiceReference(org.osgi.service.startlevel.StartLevel.class.getName());
+        if (ref == null) {
+            io.out.println("StartLevel service is unavailable.");
+            return;
+        }
+        try {
+            org.osgi.service.startlevel.StartLevel sl = (org.osgi.service.startlevel.StartLevel) getBundleContext().getService(ref);
+            if (sl == null) {
+                io.out.println("StartLevel service is unavailable.");
+                return;
+            }
+
+            if (level == null) {
+                io.out.println("Level " + sl.getStartLevel());
+            }
+            else {
+                sl.setStartLevel(level);
+            }
+        }
+        finally {
+            getBundleContext().ungetService(ref);
+        }
+    }
+
+}
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/StopBundle.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.osgi.framework.Bundle;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:10:15 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="stop", description="Stop bundle")
+public class StopBundle extends BundleCommand {
+
+    protected void doExecute(Bundle bundle) throws Exception {
+        bundle.stop();
+    }
+
+}
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/java/org/apache/geronimo/gshell/osgi/UninstallBundle.java Fri Oct 12 11:27:49 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.geronimo.gshell.osgi;
+
+import org.osgi.framework.Bundle;
+import org.apache.geronimo.gshell.command.annotation.CommandComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Oct 3, 2007
+ * Time: 12:37:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@CommandComponent(id="uninstall", description="Uninstall bundle")
+public class UninstallBundle extends BundleCommand {
+
+    protected void doExecute(Bundle bundle) throws Exception {
+        bundle.uninstall();
+    }
+
+}

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-commands.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-commands.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-commands.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-commands.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd">
+
+    <bean id="list-bundles" class="org.apache.geronimo.gshell.osgi.ListBundles" />
+
+    <bean id="refresh-bundle" class="org.apache.geronimo.gshell.osgi.RefreshBundle" />
+
+    <bean id="resolve-bundle" class="org.apache.geronimo.gshell.osgi.ResolveBundle" />
+
+    <bean id="shutdown" class="org.apache.geronimo.gshell.osgi.Shutdown" />
+
+    <bean id="start-bundle" class="org.apache.geronimo.gshell.osgi.StartBundle" />
+
+    <bean id="start-level" class="org.apache.geronimo.gshell.osgi.StartLevel" />
+
+    <bean id="stop-bundle" class="org.apache.geronimo.gshell.osgi.StopBundle" />
+
+    <bean id="uninstall-bundle" class="org.apache.geronimo.gshell.osgi.UninstallBundle" />
+
+</beans>
\ No newline at end of file

Added: incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=584225&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml Fri Oct 12 11:27:49 2007
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:osgi="http://www.springframework.org/schema/osgi"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+  http://www.springframework.org/schema/beans
+  http://www.springframework.org/schema/beans/spring-beans.xsd
+  http://www.springframework.org/schema/util
+  http://www.springframework.org/schema/util/spring-util.xsd
+  http://www.springframework.org/schema/osgi
+  http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+    <osgi:service ref="list-bundles" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="refresh-bundle" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="resolve-bundle" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="shutdown" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="start-bundle" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="start-level" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="stop-bundle" interface="org.apache.geronimo.gshell.command.Command" />
+
+    <osgi:service ref="uninstall-bundle" interface="org.apache.geronimo.gshell.command.Command" />
+
+</beans>
\ No newline at end of file



Mime
View raw message