You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2008/09/18 17:50:52 UTC

[jira] Commented: (SMX4KNL-36) Investigate having a different bootstrap mechanism for a remote client to not start all the bundles installed (maybe by not using osgi)

    [ https://issues.apache.org/activemq/browse/SMX4KNL-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45803#action_45803 ] 

Guillaume Nodet commented on SMX4KNL-36:
----------------------------------------

The remote client can be used this way.  We really should provide an enhanced version of this class to be run from a simple batch script to avoid booting the whole OSGi framework.

{code}
package org.apache.geronimo.gshell.spring;
 
import java.net.URI;
import java.util.List;
import java.util.LinkedList;
 
import org.apache.geronimo.gshell.whisper.transport.TransportException;
import org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocator;
import org.apache.geronimo.gshell.whisper.transport.TransportFactory;
import org.apache.geronimo.gshell.whisper.transport.tcp.SpringTcpTransportFactory;
import org.apache.geronimo.gshell.whisper.stream.StreamFeeder;
import org.apache.geronimo.gshell.remote.crypto.CryptoContext;
import org.apache.geronimo.gshell.remote.client.RshClient;
import org.apache.geronimo.gshell.remote.client.handler.EchoHandler;
import org.apache.geronimo.gshell.remote.client.handler.ClientMessageHandler;
 
public class RemoteConsoleTest {
 
    public static void main(String[] args) throws Exception {
        CryptoContext context = new CryptoContext("RSA", null);
 
        List<ClientMessageHandler> handlers = new LinkedList<ClientMessageHandler>();
        handlers.add(new EchoHandler());
 
        RshClient client = new RshClient(context, new Locator(), handlers);
 
        client.initialize();
        client.connect(new URI("tcp://127.0.0.1:8101/"), new URI("tcp://0.0.0.0:0"));
        System.out.println("Connected");
        client.login("smx", "smx");
        System.out.println("Logged in");
 
        StreamFeeder outputFeeder = new StreamFeeder(client.getInputStream(), System.out);
        outputFeeder.createThread().start();
 
        client.openShell();
        System.out.println("Shell openened");
        client.execute("osgi list");
 
        client.closeShell();
        client.close();
 
        System.exit(0);
    }
 
    private static class Locator implements TransportFactoryLocator {
        SpringTcpTransportFactory factory = new SpringTcpTransportFactory();
 
        public TransportFactory locate(URI arg0) throws TransportException {
            return factory;
        }
 
    }
 
}
{code}

> Investigate having a different bootstrap mechanism for a remote client to not start all the bundles installed (maybe by not using osgi)
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SMX4KNL-36
>                 URL: https://issues.apache.org/activemq/browse/SMX4KNL-36
>             Project: ServiceMix Kernel
>          Issue Type: Improvement
>            Reporter: Guillaume Nodet
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.