The way I did it was by using a telnet client to programmatically telnet to
port 4555 and sending user add commands through output stream.. For this you
need a telnet client (eg. inetFactory.jar from jscape).
import com.jscape.inet.telnet.*;
import java.io.*;
public class TelnetClient extends TelnetAdapter {
private Telnet telnet = null;
private OutputStream output = null;
private static BufferedReader reader = null;
private boolean connected = false;
public TelnetClient(String hostname, String LoginName, String LoginPasswd)
throws IOException {
String input = null;
// create new Telnet instance
telnet = new Telnet(hostname);
telnet.setPort(4555);
// register this class as TelnetListener
telnet.addTelnetListener(this);
try{
// establish Telnet connection
telnet.connect();
}catch(Exception ex){
System.out.println("exception caught while connecting" +ex);
}
connected = true;
// get output stream
output = telnet.getOutputStream();
// sends all data entered at console to Telnet server
System.out.println("going to add user through telnet session");
String serverLogin = "root";
String serverPasswd = "root";
input = "adduser " + LoginName + " " + LoginPasswd;
if (connected) {
((TelnetOutputStream) output).println(serverLogin);
int command = telnet.TSC_CR;
((TelnetOutputStream) output).println(serverPasswd);
command = telnet.TSC_CR;
((TelnetOutputStream) output).println(input);
} else {
//break;
}
telnet.disconnect();
}
Rgds,
Gaurav Handa
-----Original Message-----
From: Radha K [mailto:[EMAIL PROTECTED]
Sent: Monday, November 28, 2005 5:09 PM
To: James Users List
Subject: Re: add user to james through java class or web UI
are there any other solutions for this??
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]