...
You can either deploy another set of keystores that use the above names or change the named used and deploy new keystores. The key aliases must be set to a valid key in the store that will be used to secure the communication.
Using the client jar
From Apache ServiceMix Kernel 1.1.0 and posterior versions, it is possible to use a more lightweight way to connect to a ServiceMix Kernel instance using the following command line:
Code Block |
---|
java -jar lib/servicemix-client.jar
|
There are a few parameters that can be set on the command line to change the URL used to connect to the Kernel, the user or the password.
All these parameters are detailed in the help screen:
Panel | |||||
---|---|---|---|---|---|
| |||||
|
For example, to shut down the Kernel from the command line, you can run the following command:
Panel | |||||
---|---|---|---|---|---|
| |||||
|
Programmatically connect to the Kernel
A connection to the kernel can also be done programmatically.
You can find a code example from the client library mentionned in the previous section.
Code Block | ||
---|---|---|
| ||
import org.apache.geronimo.gshell.remote.crypto.CryptoContext;
import org.apache.geronimo.gshell.remote.client.RshClient;
import org.apache.geronimo.gshell.remote.client.RemoteExecuteException;
import org.apache.geronimo.gshell.remote.client.handler.EchoHandler;
import org.apache.geronimo.gshell.remote.client.handler.ClientMessageHandler;
import org.apache.geronimo.gshell.whisper.transport.TransportException;
import org.apache.geronimo.gshell.whisper.transport.TransportFactory;
import org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocator;
import org.apache.geronimo.gshell.whisper.transport.tcp.SpringTcpTransportFactory;
import org.apache.geronimo.gshell.whisper.stream.StreamFeeder;
import org.apache.geronimo.gshell.layout.NotFoundException;
import org.apache.geronimo.gshell.ExitNotification;
public class Main {
public static void main(String[] args) throws Exception {
RshClient client = null;
try {
CryptoContext context = new CryptoContext("RSA", null);
List<ClientMessageHandler> handlers = new LinkedList<ClientMessageHandler>();
handlers.add(new EchoHandler());
client = new RshClient(context, new Locator(), handlers);
client.initialize();
client.connect(address, new URI("tcp://0.0.0.0:0"));
client.login(user, password);
StreamFeeder outputFeeder = new StreamFeeder(client.getInputStream(), System.out);
outputFeeder.createThread().start();
client.openShell();
System.out.println("Connected");
client.execute(args[0]);
} catch (ExitNotification e) {
System.exit(0);
} catch (Throwable t) {
t.printStackTrace();
System.exit(1);
} finally {
try {
client.closeShell();
client.close();
} catch (Throwable t) { }
}
System.exit(0);
}
private static class Locator implements TransportFactoryLocator {
SpringTcpTransportFactory factory = new SpringTcpTransportFactory();
public TransportFactory locate(URI arg0) throws TransportException {
return factory;
}
}
}
|
You can find a more complete example at the following location.
Wiki Markup |
---|
{scrollbar} |