You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/12/06 00:16:42 UTC

svn commit: r601569 - in /servicemix/branches/servicemix-4.0: ./ bundles/ bundles/mina/ runtime/features/camel-feature/ runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/ runtime/gshell/gshell-core/src/main/java/org/apache/gero...

Author: gnodet
Date: Wed Dec  5 15:16:39 2007
New Revision: 601569

URL: http://svn.apache.org/viewvc?rev=601569&view=rev
Log:
Add gshell remote support

Added:
    servicemix/branches/servicemix-4.0/bundles/mina/   (with props)
    servicemix/branches/servicemix-4.0/bundles/mina/pom.xml
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringExecuteHandler.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringOpenShellHandler.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringRshServer.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/SpringTransportFactoryLocator.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/SpringBaseTransportFactory.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SpringSslTransportFactory.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/SpringTcpTransportFactory.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/SpringVmTransportFactory.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml
      - copied, changed from r600644, servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/gshell-remote.xml
Removed:
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/gshell-remote.xml
Modified:
    servicemix/branches/servicemix-4.0/bundles/pom.xml
    servicemix/branches/servicemix-4.0/pom.xml
    servicemix/branches/servicemix-4.0/runtime/features/camel-feature/   (props changed)
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
    servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
    servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml
    servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/unix-bin.xml
    servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/windows-bin.xml
    servicemix/branches/servicemix-4.0/runtime/minimum/src/main/release/etc/org.apache.servicemix.shell.cfg

Propchange: servicemix/branches/servicemix-4.0/bundles/mina/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Dec  5 15:16:39 2007
@@ -0,0 +1 @@
+target

Added: servicemix/branches/servicemix-4.0/bundles/mina/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/bundles/mina/pom.xml?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/bundles/mina/pom.xml (added)
+++ servicemix/branches/servicemix-4.0/bundles/mina/pom.xml Wed Dec  5 15:16:39 2007
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+    <!--
+
+        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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix</groupId>
+        <artifactId>bundles</artifactId>
+        <version>4.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.servicemix.bundles</groupId>
+    <artifactId>${pom.groupId}.${pkgArtifactId}</artifactId>
+    <version>${pkgVersion}-${pomVersion}</version>
+    <packaging>bundle</packaging>
+    <name>ServiceMix OSGI Common Bundles: ${pkgArtifactId}</name>
+    <description>
+        This bundle simply wraps ${pkgArtifactId}-${pkgVersion}.jar.
+    </description>
+
+    <properties>
+        <pkgArtifactId>mina</pkgArtifactId>
+        <pkgVersion>1.1.5</pkgVersion>
+        <pomVersion>4.0-SNAPSHOT</pomVersion>
+        <servicemix.osgi.import.pkg>
+             com.jcraft.jzlib*;resolution:=optional,
+             net.gleamynode.netty2*;resolution:=optional,
+            *
+        </servicemix.osgi.import.pkg>
+		<servicemix.osgi.export.pkg>org.apache.mina</servicemix.osgi.export.pkg>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-core</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-filter-codec-netty</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-filter-compression</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-filter-ssl</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-integration-jmx</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.mina</groupId>
+            <artifactId>mina-integration-spring</artifactId>
+            <version>${pkgVersion}</version>
+            <optional>true</optional>
+        </dependency>
+    </dependencies>
+
+</project>

Modified: servicemix/branches/servicemix-4.0/bundles/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/bundles/pom.xml?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/bundles/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/bundles/pom.xml Wed Dec  5 15:16:39 2007
@@ -45,6 +45,7 @@
         <module>jaxb-impl</module>
         <module>jaxws-api</module>
         <module>httpcore</module>
+        <module>mina</module>
         <module>openejb</module>
         <module>openjpa</module>
         <module>wsdl4j</module>

Modified: servicemix/branches/servicemix-4.0/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/pom.xml?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/pom.xml Wed Dec  5 15:16:39 2007
@@ -245,6 +245,11 @@
                 <artifactId>org.apache.servicemix.bundles.jaxws-api</artifactId>
                 <version>${jaxws.api.version}-4.0-SNAPSHOT</version>
             </dependency>
+           <dependency>
+               <groupId>org.apache.servicemix.bundles</groupId>
+               <artifactId>org.apache.servicemix.bundles.mina</artifactId>
+               <version>1.1.5-4.0-SNAPSHOT</version>
+            </dependency>
             <dependency>
                 <groupId>org.apache.servicemix.bundles</groupId>
                 <artifactId>org.apache.servicemix.bundles.openejb</artifactId>

Propchange: servicemix/branches/servicemix-4.0/runtime/features/camel-feature/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Dec  5 15:16:39 2007
@@ -0,0 +1 @@
+target

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringExecuteHandler.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringExecuteHandler.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringExecuteHandler.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringExecuteHandler.java Wed Dec  5 15:16:39 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.remote.server.handler;
+
+import org.apache.geronimo.gshell.remote.message.ExecuteMessage;
+import org.apache.geronimo.gshell.whisper.transport.Session;
+import org.apache.geronimo.gshell.lookup.IOLookup;
+import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
+import org.apache.geronimo.gshell.common.Notification;
+import org.apache.geronimo.gshell.spring.IOTargetSource;
+import org.apache.geronimo.gshell.spring.EnvironmentTargetSource;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 5:14:29 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringExecuteHandler extends ServerMessageHandlerSupport<ExecuteMessage>
+{
+    public SpringExecuteHandler() {
+        super(ExecuteMessage.class);
+    }
+
+    public void handle(final Session session, final ServerSessionContext context, final ExecuteMessage message) throws Exception {
+        // Need to make sure that the execuing thread has the right I/O and environment in context
+        IOTargetSource.setIO(context.io);
+        EnvironmentTargetSource.setEnvironment(context.env);
+
+        ExecuteMessage.Result reply;
+
+        try {
+            Object result = message.execute(context.shell);
+
+            log.debug("Result: {}", result);
+
+            reply = new ExecuteMessage.Result(result);
+        }
+        catch (Notification n) {
+            log.debug("Notification: " + n);
+
+            reply = new ExecuteMessage.Notification(n);
+        }
+        catch (Throwable t) {
+            log.debug("Fault: " + t);
+
+            reply = new ExecuteMessage.Fault(t);
+        }
+
+        reply.setCorrelationId(message.getId());
+        session.send(reply);
+    }
+}

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringOpenShellHandler.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringOpenShellHandler.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringOpenShellHandler.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/remote/server/handler/SpringOpenShellHandler.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.remote.server.handler;
+
+import org.apache.geronimo.gshell.DefaultEnvironment;
+import org.apache.geronimo.gshell.command.CommandExecutor;
+import org.apache.geronimo.gshell.shell.ShellInfo;
+import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.remote.message.EchoMessage;
+import org.apache.geronimo.gshell.remote.message.OpenShellMessage;
+import org.apache.geronimo.gshell.remote.server.DefaultRemoteShell;
+import org.apache.geronimo.gshell.remote.server.RemoteIO;
+import org.apache.geronimo.gshell.whisper.transport.Session;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 4:36:43 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringOpenShellHandler extends ServerMessageHandlerSupport<OpenShellMessage> {
+
+    private ShellInfo shellInfo;
+    private CommandExecutor executor;
+
+    public SpringOpenShellHandler() {
+        super(OpenShellMessage.class);
+    }
+
+    public SpringOpenShellHandler(ShellInfo shellInfo, CommandExecutor executor) {
+        this();
+        this.shellInfo = shellInfo;
+        this.executor = executor;
+    }
+
+    public void handle(Session session, ServerSessionContext context, OpenShellMessage message) throws Exception {
+        // Setup the I/O context (w/o auto-flushing)
+        context.io = new RemoteIO(session);
+        // Setup shell environemnt
+        context.env = new DefaultEnvironment(context.io);
+
+        // Create a new shell instance
+        context.shell = new DefaultRemoteShell(shellInfo, executor, context.env);
+
+        //
+        // TODO: Send a meaningful response
+        //
+
+        EchoMessage reply = new EchoMessage("OPEN SHELL SUCCESS");
+        reply.setCorrelationId(message.getId());
+        session.send(reply);
+    }
+}

Modified: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java (original)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/GShell.java Wed Dec  5 15:16:39 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.geronimo.gshell.spring;
 
+import java.util.Arrays;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -88,10 +89,10 @@
 	    	}
 	        
 	        // If a command was specified on the command line, then just execute that command.
-			if( args!=null && args.length > 0 ) {
-	        	System.out.println("Executing 1 command:");
+			if (args != null && args.length > 0 && (args.length > 1 || args[0].length() > 0)) {
+                System.out.println("Executing 1 command: " + Arrays.toString(args));
 				Object value = shell.execute((Object[])args);
-	        	if( mainService!=null ) {
+	        	if (mainService != null) {
 	        		if( value instanceof Number ) {
 	        			mainService.setExitCode(((Number)value).intValue());
 	        		} else {

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringRshServer.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringRshServer.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringRshServer.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/spring/SpringRshServer.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,60 @@
+package org.apache.geronimo.gshell.spring;
+
+import java.net.URI;
+
+import org.apache.geronimo.gshell.remote.server.RshServer;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 8:34:40 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringRshServer {
+
+    private RshServer server;
+    private String location;
+    private boolean start;
+
+    public RshServer getServer() {
+        return server;
+    }
+
+    public void setServer(RshServer server) {
+        this.server = server;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public boolean isStart() {
+        return start;
+    }
+
+    public void setStart(boolean start) {
+        this.start = start;
+    }
+
+    public void start() throws Exception {
+        if (start) {
+            try {
+                server.bind(URI.create(location));
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw e;
+            }
+        }
+    }
+
+    public void stop() throws Exception {
+        if (start) {
+            server.close();
+        }
+    }
+}

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/SpringTransportFactoryLocator.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/SpringTransportFactoryLocator.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/SpringTransportFactoryLocator.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/SpringTransportFactoryLocator.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,60 @@
+/*
+ * 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.whisper.transport;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Spring based implementation of the TransportFactory locator
+ */
+public class SpringTransportFactoryLocator<T extends TransportFactory> implements TransportFactoryLocator<T> {
+
+    private List<T> factories;
+    private Map<String, T> factoryMap;
+
+    public List<T> getFactories() {
+        return factories;
+    }
+
+    public void setFactories(List<T> factories) {
+        this.factories = factories;
+        this.factoryMap = new HashMap<String, T>();
+        for (T factory : factories) {
+            factoryMap.put(factory.getScheme(), factory);
+        }
+    }
+
+    public T locate(URI location) throws TransportException {
+        assert location != null;
+
+        String scheme = location.getScheme();
+
+        if (scheme == null) {
+            throw new InvalidLocationException(location);
+        }
+
+        T factory = factoryMap.get(scheme);
+        if (factory == null) {
+            throw new LookupException(scheme);
+        }
+        return factory;
+    }
+    
+}

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/SpringBaseTransportFactory.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/SpringBaseTransportFactory.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/SpringBaseTransportFactory.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/SpringBaseTransportFactory.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,114 @@
+/*
+ * 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.whisper.transport.base;
+
+import java.net.URI;
+
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransport;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransportServer;
+import org.apache.geronimo.gshell.whisper.transport.Transport;
+import org.apache.geronimo.gshell.whisper.transport.TransportServer;
+import org.apache.geronimo.gshell.whisper.transport.TransportFactory;
+import org.apache.mina.common.IoHandler;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 8:09:12 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public abstract class SpringBaseTransportFactory<T extends BaseTransport, TC extends Transport.Configuration, S extends BaseTransportServer, SC extends TransportServer.Configuration>
+    implements TransportFactory {
+
+    private String scheme;
+
+    protected SpringBaseTransportFactory(String scheme) {
+        this.scheme = scheme;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    //
+    // Transport (Client) Connection
+    //
+
+    public T connect(final URI remote, final URI local, final TC config) throws Exception {
+        assert remote != null;
+        assert config != null;
+        // local can be null
+
+        T transport = createTransport();
+
+        transport.setConfiguration(config);
+
+        transport.connect(remote, local);
+
+        return transport;
+    }
+
+    public T connect(final URI remote, final URI local, final IoHandler handler) throws Exception {
+        assert remote != null;
+        assert handler != null;
+        // local can be null
+
+        T transport = createTransport();
+
+        transport.getConfiguration().setHandler(handler);
+
+        transport.connect(remote, local);
+
+        return transport;
+    }
+
+    //
+    // TransportServer Binding
+    //
+
+    public S bind(final URI location, final SC config) throws Exception {
+        assert location != null;
+        assert config != null;
+
+        S server = createTransportServer();
+
+        server.setConfiguration(config);
+
+        server.bind(location);
+
+        return server;
+    }
+
+    public S bind(final URI location, final IoHandler handler) throws Exception {
+        assert location != null;
+        assert handler != null;
+
+        S server = createTransportServer();
+
+        server.getConfiguration().setHandler(handler);
+
+        server.bind(location);
+
+        return server;
+    }
+
+    protected abstract T createTransport();
+
+    protected abstract S createTransportServer();
+
+}

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SpringSslTransportFactory.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SpringSslTransportFactory.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SpringSslTransportFactory.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/ssl/SpringSslTransportFactory.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,41 @@
+package org.apache.geronimo.gshell.whisper.transport.ssl;
+
+import org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransport;
+import org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransportServer;
+import org.apache.geronimo.gshell.whisper.transport.base.SpringBaseTransportFactory;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransport;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransportServer;
+import org.apache.geronimo.gshell.whisper.ssl.SSLContextFactory;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 8:21:35 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringSslTransportFactory<T extends SslTransport, S extends SslTransportServer>
+    extends SpringBaseTransportFactory {
+
+    private SSLContextFactory contextFactory;
+
+    public SpringSslTransportFactory() {
+        super("ssl");
+    }
+
+    public SSLContextFactory getContextFactory() {
+        return contextFactory;
+    }
+
+    public void setContextFactory(SSLContextFactory contextFactory) {
+        this.contextFactory = contextFactory;
+    }
+
+    protected BaseTransport createTransport() {
+        return new SslTransport(contextFactory);
+    }
+
+    protected BaseTransportServer createTransportServer() {
+        return new SslTransportServer(contextFactory);
+    }
+}

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/SpringTcpTransportFactory.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/SpringTcpTransportFactory.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/SpringTcpTransportFactory.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/tcp/SpringTcpTransportFactory.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,28 @@
+package org.apache.geronimo.gshell.whisper.transport.tcp;
+
+import org.apache.geronimo.gshell.whisper.transport.base.SpringBaseTransportFactory;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransport;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransportServer;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 8:19:22 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringTcpTransportFactory<T extends TcpTransport, S extends TcpTransportServer>
+    extends SpringBaseTransportFactory {
+
+    public SpringTcpTransportFactory() {
+        super("tcp");
+    }
+
+    protected BaseTransport createTransport() {
+        return new TcpTransport();
+    }
+
+    protected BaseTransportServer createTransportServer() {
+        return new TcpTransportServer();
+    }
+}

Added: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/SpringVmTransportFactory.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/SpringVmTransportFactory.java?rev=601569&view=auto
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/SpringVmTransportFactory.java (added)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/whisper/transport/vm/SpringVmTransportFactory.java Wed Dec  5 15:16:39 2007
@@ -0,0 +1,30 @@
+package org.apache.geronimo.gshell.whisper.transport.vm;
+
+import org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransport;
+import org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransportServer;
+import org.apache.geronimo.gshell.whisper.transport.base.SpringBaseTransportFactory;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransport;
+import org.apache.geronimo.gshell.whisper.transport.base.BaseTransportServer;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Dec 5, 2007
+ * Time: 8:23:51 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class SpringVmTransportFactory<T extends VmTransport, S extends VmTransportServer>
+    extends SpringBaseTransportFactory {
+
+    public SpringVmTransportFactory() {
+        super("vm");
+    }
+
+    protected BaseTransport createTransport() {
+        return new VmTransport();
+    }
+
+    protected BaseTransportServer createTransportServer() {
+        return new VmTransportServer();
+    }
+}

Modified: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml (original)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml Wed Dec  5 15:16:39 2007
@@ -53,6 +53,8 @@
     <osgix:property-placeholder persistent-id="org.apache.servicemix.shell">
         <osgix:default-properties>
             <prop key="startLocalConsole">true</prop>
+            <prop key="startRemoteShell">true</prop>
+            <prop key="remoteShellLocation">tcp://0.0.0.0:8100/</prop>
         </osgix:default-properties>
     </osgix:property-placeholder>
 

Copied: servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml (from r600644, servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/gshell-remote.xml)
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml?p2=servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml&p1=servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/gshell-remote.xml&r1=600644&r2=601569&rev=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/gshell-remote.xml (original)
+++ servicemix/branches/servicemix-4.0/runtime/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml Wed Dec  5 15:16:39 2007
@@ -26,12 +26,6 @@
   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" />
@@ -43,12 +37,13 @@
                     <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.SpringExecuteHandler" />
                 <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 class="org.apache.geronimo.gshell.remote.server.handler.SpringOpenShellHandler">
+                    <constructor-arg ref="shellInfo" />
+                    <constructor-arg ref="commandExecutor" />
                 </bean>
             </list>
         </constructor-arg>
@@ -56,14 +51,35 @@
 
     <bean id="timeoutManager" class="org.apache.geronimo.gshell.remote.server.timeout.DefaultTimeoutManager" />
 
+    <bean id="transportFactoryLocator" class="org.apache.geronimo.gshell.whisper.transport.SpringTransportFactoryLocator">
+        <property name="factories">
+            <list>
+                <ref local="tcpTransportFactory" />
+                <ref local="sslTransportFactory" />
+                <ref local="vmTransportFactory" />
+            </list>
+        </property>
+    </bean>
+
     <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="sslTransportFactory" class="org.apache.geronimo.gshell.whisper.transport.ssl.SpringSslTransportFactory">
+        <property name="contextFactory" ref="sslContextFactory" />
+    </bean>
+
+    <bean id="tcpTransportFactory" class="org.apache.geronimo.gshell.whisper.transport.tcp.SpringTcpTransportFactory" />
 
-    <bean id="sslTransport" class="org.apache.geronimo.gshell.whisper.transport.ssl.SslTransport">
-        
+    <bean id="vmTransportFactory" class="org.apache.geronimo.gshell.whisper.transport.vm.SpringVmTransportFactory" />
+
+    <bean id="cryptoContext" class="org.apache.geronimo.gshell.remote.crypto.CryptoContext">
+        <constructor-arg value="RSA" />
+        <constructor-arg><null /></constructor-arg>
     </bean>
 
-    
+    <bean id="remoteShell" class="org.apache.geronimo.gshell.spring.SpringRshServer" init-method="start" destroy-method="stop">
+        <property name="server" ref="rshServer" />
+        <property name="start" value="${startRemoteShell}" />
+        <property name="location" value="${remoteShellLocation}" />
+    </bean>
 
 </beans>

Modified: servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml (original)
+++ servicemix/branches/servicemix-4.0/runtime/minimum/pom.xml Wed Dec  5 15:16:39 2007
@@ -125,6 +125,10 @@
       </dependency>
       <dependency>
           <groupId>org.apache.servicemix.bundles</groupId>
+          <artifactId>org.apache.servicemix.bundles.mina</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.servicemix.bundles</groupId>
           <artifactId>org.apache.servicemix.bundles.xstream</artifactId>
       </dependency>
 

Modified: servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/unix-bin.xml?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/unix-bin.xml Wed Dec  5 15:16:39 2007
@@ -133,6 +133,7 @@
 
 		        <!-- GShell -->
                 <include>org.apache.geronimo.specs:geronimo-stax-api_1.0_spec</include>
+                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.mina</include>
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.xstream</include>
                 <include>org.apache.servicemix.gshell:org.apache.servicemix.gshell.core</include>
                 <include>org.apache.servicemix.gshell:org.apache.servicemix.gshell.osgi</include>

Modified: servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/windows-bin.xml?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/branches/servicemix-4.0/runtime/minimum/src/main/descriptors/windows-bin.xml Wed Dec  5 15:16:39 2007
@@ -133,6 +133,7 @@
 
 		        <!-- GShell -->
                 <include>org.apache.geronimo.specs:geronimo-stax-api_1.0_spec</include>
+                <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.mina</include>
                 <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.xstream</include>
                 <include>org.apache.servicemix.gshell:org.apache.servicemix.gshell.core</include>
                 <include>org.apache.servicemix.gshell:org.apache.servicemix.gshell.osgi</include>

Modified: servicemix/branches/servicemix-4.0/runtime/minimum/src/main/release/etc/org.apache.servicemix.shell.cfg
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/minimum/src/main/release/etc/org.apache.servicemix.shell.cfg?rev=601569&r1=601568&r2=601569&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/minimum/src/main/release/etc/org.apache.servicemix.shell.cfg (original)
+++ servicemix/branches/servicemix-4.0/runtime/minimum/src/main/release/etc/org.apache.servicemix.shell.cfg Wed Dec  5 15:16:39 2007
@@ -18,3 +18,5 @@
 #
 #
 startLocalConsole=true
+startRemoteShell=true
+remoteShellLocation=tcp://0.0.0.0:8101/