james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yazad Khambata" <yaz...@gmail.com>
Subject Re: Adding/Editing user info programmatically
Date Sun, 06 Apr 2008 10:45:50 GMT
Thank you,

I wrote a code using commons-net to send data to the server to create users,
It is a shabby way to do things, with will suffice my current needs, thank
you all for your support

_______________________________________________________________
The below code use apache commons net...

        TelnetClient telnetClient = null;
        try {
            telnetClient = new TelnetClient();

            final InetAddress inetAddress =
InetAddress.getByName("localhost");
            telnetClient.connect(inetAddress, 4555);

            System.out.println("Connection established...");

            //Writer
            final OutputStream outputStream =
telnetClient.getOutputStream();
            final OutputStreamWriter outputStreamWriter = new
OutputStreamWriter(outputStream);
            final BufferedWriter bufferedWriter = new
BufferedWriter(outputStreamWriter);
            PrintWriter printWriter = new PrintWriter(bufferedWriter);


            //Reader
            final InputStream inputStream = telnetClient.getInputStream();
            final InputStreamReader inputStreamReader = new
InputStreamReader(inputStream);
            final BufferedReader bufferedReader = new
BufferedReader(inputStreamReader);

            //printMessagesFromServer(bufferedReader);

            //login as root
            printWriter.println("root");
            printWriter.println("root");

            //add user
            printWriter.println("adduser success success");
            printWriter.flush();

            printWriter.println("verify success4");
            //close streams...
            outputStream.close();
            bufferedReader.close();
        } finally {
            if(telnetClient != null) {
                telnetClient.disconnect();
                System.out.println("Disconnected...");
            }
        }

_______________________________________________________________

On Sun, Apr 6, 2008 at 12:30 PM, Robert Burrell Donkin <
robertburrelldonkin@gmail.com> wrote:

> On Sat, Apr 5, 2008 at 11:13 PM, Yazad Khambata <yazad3@gmail.com> wrote:
> > Hi Robert,
> >     Thanks for the link... I think  it's best if I download the source
> zip
> >  now... Is there any javadoc available? I couldn't find any on the site,
> nor
> >  in the downloaded binary... Thanks.
>
> the best plan is to download the source (if you're targeting stable)
> or checkout the project from subversion (if you're targeting trunk)
> and take a look at it in an IDE
>
> - robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message