org.kohsuke.jnt
Class JavaNet

java.lang.Object
  extended by org.kohsuke.jnt.JavaNet

public class JavaNet
extends Object

Root of java.net.

Start with one of the connect method, which gives you an instance of JavaNet. The rest of the java.net object model can be traversed from this object.

Author:
Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)

Method Summary
static JavaNet connect()
          obtains the connection info from ~/.java.net and returns the connected JavaNet object.
static JavaNet connect(File accountFile)
          obtains the connection info from the given file and returns the connected JavaNet object.
static JavaNet connect(String userName, String password)
          Connects to java.net directly by using the given account info.
static JavaNet connect(String userName, String password, String proxyServer, int proxyPort)
          Connects to java.net through HTTP proxy by using the given account info.
static JavaNet connect(com.meterware.httpunit.WebConversation conversation)
          Connects to java.net by using a WebConversation instance that has already logged in.
static JavaNet connectAnonymously()
          Connects anonymously.
 com.meterware.httpunit.WebConversation getConversation()
          Obtains the session being used.
 JNMyself getMyself()
          Obtains a special JNUser object that represents the currently logged-in user.
 JNProject getProject(String projectName)
          Obtains a JNProject object from its name.
 JNRole getRole(String roleName)
          Obtains a JNRole object from a role name.
 JNUser getUser(String userName)
          Obtains a JNUser object from an user name.
 void login(String userName, String password)
          Logs in to the java.net.
 String[][] runAdHocQuery(String sql)
          Runs ad-hoc query against java.net database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConversation

public final com.meterware.httpunit.WebConversation getConversation()
Obtains the session being used. If you need to use the underlying HTTPUnit directly, use this method.


login

public void login(String userName,
                  String password)
           throws ProcessingException
Logs in to the java.net. This method has to be called first.

Throws:
ProcessingException

connect

public static JavaNet connect()
                       throws ProcessingException
obtains the connection info from ~/.java.net and returns the connected JavaNet object.

Throws:
ProcessingException

connect

public static JavaNet connect(File accountFile)
                       throws ProcessingException
obtains the connection info from the given file and returns the connected JavaNet object.

Parameters:
accountFile - The property file that stores the connection information.
Throws:
ProcessingException

connectAnonymously

public static JavaNet connectAnonymously()
Connects anonymously.


connect

public static JavaNet connect(String userName,
                              String password)
                       throws ProcessingException
Connects to java.net directly by using the given account info.

Throws:
ProcessingException

connect

public static JavaNet connect(String userName,
                              String password,
                              String proxyServer,
                              int proxyPort)
                       throws ProcessingException
Connects to java.net through HTTP proxy by using the given account info.

Throws:
ProcessingException

connect

public static JavaNet connect(com.meterware.httpunit.WebConversation conversation)
Connects to java.net by using a WebConversation instance that has already logged in.

Don't use this method unless you know what you are doing.


getProject

public JNProject getProject(String projectName)
                     throws ProcessingException
Obtains a JNProject object from its name.

A successful completion of this method does not guarantee that the project actually exists.

Returns:
always non-null, even if no such project exists.
Throws:
ProcessingException

getMyself

public JNMyself getMyself()
                   throws ProcessingException
Obtains a special JNUser object that represents the currently logged-in user.

Returns:
always return non-null object.
Throws:
ProcessingException

getUser

public JNUser getUser(String userName)
Obtains a JNUser object from an user name.

A successful completion of this method does not guarantee that the user exists.

Returns:
always return a non-null object.

getRole

public JNRole getRole(String roleName)
               throws ProcessingException
Obtains a JNRole object from a role name.

A successful completion of this method does not guarantee that the role actually exists.

Throws:
ProcessingException

runAdHocQuery

public String[][] runAdHocQuery(String sql)
                         throws ProcessingException
Runs ad-hoc query against java.net database. Requires domain admin privilege.

Throws:
ProcessingException


Copyright © 2003-2009 Kohsuke Kawaguchi. All Rights Reserved.