org.netbeans.lib.cvsclient.connection
Class PServerConnection

java.lang.Object
  extended by org.netbeans.lib.cvsclient.connection.AbstractConnection
      extended by org.netbeans.lib.cvsclient.connection.PServerConnection
All Implemented Interfaces:
Connection

public class PServerConnection
extends AbstractConnection

Implements a connection to a pserver. See the cvs documents for more information about different connection methods. PServer is popular where security is not an issue. For secure connections, consider using a kserver (Kerberos) or the GSSAPI.


Field Summary
protected static java.lang.String AUTHENTICATION_FAILED_RESPONSE
          A response indicating that the authorisation has failed.
protected static java.lang.String AUTHENTICATION_SUCCEEDED_RESPONSE
          A response indicating that authorisation has succeeded.
static int DEFAULT_PORT
          The default port number to use.
protected  java.lang.String encodedPassword
          The password, encoded appropriately.
protected  java.lang.String hostName
          The host to use.
protected static java.lang.String OPEN_POSTAMBLE
          The string that is sent at the end of the request to open a connection.
protected static java.lang.String OPEN_PREAMBLE
          The string that is sent at the beginning of the request to open a connection.
protected  int port
          The port number to use.
protected  java.net.Socket socket
          The socket used for the connection.
protected  javax.net.SocketFactory socketFactory
          The socket factory that will be used to create sockets.
protected  java.lang.String userName
          The user name to use.
protected static java.lang.String VERIFY_POSTAMBLE
          The string that is sent at the end of a verify request.
protected static java.lang.String VERIFY_PREAMBLE
          The string that is sent at the beginning of the request to verify a connection.
 
Constructor Summary
PServerConnection()
          Create an uninitialized PServerConnection.
PServerConnection(CVSRoot cvsRoot)
          Create PServerConnection and setup it's properties from the supplied CVSRoot object.
PServerConnection(CVSRoot cvsRoot, javax.net.SocketFactory factory)
          Create PServerConnection and setup it's properties from the supplied CVSRoot object.
 
Method Summary
 void close()
          Close the connection with the server.
 java.lang.String getEncodedPassword()
          Get the encoded password.
 java.lang.String getHostName()
          Get the host name to use.
 int getPort()
          Get the port number to use.
 java.lang.String getUserName()
          Get the username.
 boolean isOpen()
          Returns true to indicate that the connection was successfully established.
 void modifyInputStream(ConnectionModifier modifier)
          Modify the underlying inputstream.
 void modifyOutputStream(ConnectionModifier modifier)
          Modify the underlying outputstream.
 void open()
          Authenticate with the server and open a channel of communication with the server.
 void setEncodedPassword(java.lang.String encodedPassword)
          Set the encoded password.
 void setHostName(java.lang.String hostName)
          Get the host name to use.
 void setPort(int port)
          Set the port number to use.
 void setUserName(java.lang.String userName)
          Set the userName.
 void verify()
          Authenticate with the server.
 
Methods inherited from class org.netbeans.lib.cvsclient.connection.AbstractConnection
getInputStream, getOutputStream, getRepository, setInputStream, setOutputStream, setRepository, verifyProtocol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_PREAMBLE

protected static final java.lang.String OPEN_PREAMBLE
The string that is sent at the beginning of the request to open a connection.

See Also:
Constant Field Values

OPEN_POSTAMBLE

protected static final java.lang.String OPEN_POSTAMBLE
The string that is sent at the end of the request to open a connection.

See Also:
Constant Field Values

VERIFY_PREAMBLE

protected static final java.lang.String VERIFY_PREAMBLE
The string that is sent at the beginning of the request to verify a connection. Note the difference between opening a connection and simply verifying.

See Also:
Constant Field Values

VERIFY_POSTAMBLE

protected static final java.lang.String VERIFY_POSTAMBLE
The string that is sent at the end of a verify request.

See Also:
Constant Field Values

AUTHENTICATION_SUCCEEDED_RESPONSE

protected static final java.lang.String AUTHENTICATION_SUCCEEDED_RESPONSE
A response indicating that authorisation has succeeded.

See Also:
Constant Field Values

AUTHENTICATION_FAILED_RESPONSE

protected static final java.lang.String AUTHENTICATION_FAILED_RESPONSE
A response indicating that the authorisation has failed.

See Also:
Constant Field Values

userName

protected java.lang.String userName
The user name to use.


encodedPassword

protected java.lang.String encodedPassword
The password, encoded appropriately.


DEFAULT_PORT

public static final int DEFAULT_PORT
The default port number to use.

See Also:
Constant Field Values

port

protected int port
The port number to use.


hostName

protected java.lang.String hostName
The host to use.


socket

protected java.net.Socket socket
The socket used for the connection.


socketFactory

protected javax.net.SocketFactory socketFactory
The socket factory that will be used to create sockets.

Constructor Detail

PServerConnection

public PServerConnection()
Create an uninitialized PServerConnection. All properties needs to be set explicitly by appropriate setters before this connection can be opened.


PServerConnection

public PServerConnection(CVSRoot cvsRoot)
Create PServerConnection and setup it's properties from the supplied CVSRoot object.

Throws:
java.lang.IllegalArgumentException - if the cvsRoot does not represent pserver connection type.

PServerConnection

public PServerConnection(CVSRoot cvsRoot,
                         javax.net.SocketFactory factory)
Create PServerConnection and setup it's properties from the supplied CVSRoot object.

Throws:
java.lang.IllegalArgumentException - if the cvsRoot does not represent pserver connection type.
Method Detail

verify

public void verify()
            throws AuthenticationException
Authenticate with the server. Closes the connection immediately. Clients can use this method to ensure that they are capable of authenticating with the server. If no exception is thrown, you can assume that authentication was successful.

Throws:
AuthenticationException - if the connection with the server cannot be established

open

public void open()
          throws AuthenticationException,
                 CommandAbortedException
Authenticate with the server and open a channel of communication with the server. This Client will call this method before interacting with the server. It is up to implementing classes to ensure that they are configured to talk to the server (e.g. port number etc.).

Throws:
AutenticationException - if the connection with the server cannot be established
AuthenticationException
CommandAbortedException

getUserName

public java.lang.String getUserName()
Get the username.


setUserName

public void setUserName(java.lang.String userName)
Set the userName.

Parameters:
name - the userName

getEncodedPassword

public java.lang.String getEncodedPassword()
Get the encoded password.

Returns:
the encoded password

setEncodedPassword

public void setEncodedPassword(java.lang.String encodedPassword)
Set the encoded password.

Parameters:
password - the encoded password to use for authentication

getPort

public int getPort()
Get the port number to use.

Returns:
the port number

setPort

public void setPort(int port)
Set the port number to use.

Parameters:
thePort - the port number to use. If you do not set this, 2401 is used by default for pserver.

getHostName

public java.lang.String getHostName()
Get the host name to use.

Returns:
the host name of the server to connect to. If you do not set this, localhost is used by default for pserver.

setHostName

public void setHostName(java.lang.String hostName)
Get the host name to use.

Parameters:
theHostName - the host name of the server to connect to. If you do not set this, localhost is used by default for pserver.

close

public void close()
           throws java.io.IOException
Close the connection with the server.

Throws:
java.io.IOException

modifyInputStream

public void modifyInputStream(ConnectionModifier modifier)
                       throws java.io.IOException
Modify the underlying inputstream.

Parameters:
modifier - the connection modifier that performs the modifications
Throws:
java.io.IOException - if an error occurs modifying the streams

modifyOutputStream

public void modifyOutputStream(ConnectionModifier modifier)
                        throws java.io.IOException
Modify the underlying outputstream.

Parameters:
modifier - the connection modifier that performs the modifications
Throws:
java.io.IOException - if an error occurs modifying the streams

isOpen

public boolean isOpen()
Returns true to indicate that the connection was successfully established.


 

Built on August 7 2008.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.