public class PServerConnection extends AbstractConnection
Modifier and Type | Field and Description |
---|---|
protected static String |
AUTHENTICATION_FAILED_RESPONSE
A response indicating that the authorisation has failed.
|
protected static String |
AUTHENTICATION_SUCCEEDED_RESPONSE
A response indicating that authorisation has succeeded.
|
static int |
DEFAULT_PORT
The default port number to use.
|
protected String |
encodedPassword
The password, encoded appropriately.
|
protected String |
hostName
The host to use.
|
protected static String |
OPEN_POSTAMBLE
The string that is sent at the end of the request to open a connection.
|
protected static 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 Socket |
socket
The socket used for the connection.
|
protected SocketFactory |
socketFactory
The socket factory that will be used to create sockets.
|
protected String |
userName
The user name to use.
|
protected static String |
VERIFY_POSTAMBLE
The string that is sent at the end of a verify request.
|
protected static String |
VERIFY_PREAMBLE
The string that is sent at the beginning of the request to verify a
connection.
|
Constructor and Description |
---|
PServerConnection()
Create an uninitialized PServerConnection.
|
PServerConnection(CVSRoot cvsRoot)
Create PServerConnection and setup it's properties from the supplied
CVSRoot object.
|
PServerConnection(CVSRoot cvsRoot,
SocketFactory factory)
Create PServerConnection and setup it's properties from the supplied
CVSRoot object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection with the server.
|
String |
getEncodedPassword()
Get the encoded password.
|
String |
getHostName()
Get the host name to use.
|
int |
getPort()
Get the port number to use.
|
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(String encodedPassword)
Set the encoded password.
|
void |
setHostName(String hostName)
Get the host name to use.
|
void |
setPort(int port)
Set the port number to use.
|
void |
setUserName(String userName)
Set the userName.
|
void |
verify()
Authenticate with the server.
|
getInputStream, getOutputStream, getRepository, setInputStream, setOutputStream, setRepository, verifyProtocol
protected static final String OPEN_PREAMBLE
protected static final String OPEN_POSTAMBLE
protected static final String VERIFY_PREAMBLE
protected static final String VERIFY_POSTAMBLE
protected static final String AUTHENTICATION_SUCCEEDED_RESPONSE
protected static final String AUTHENTICATION_FAILED_RESPONSE
protected String userName
protected String encodedPassword
public static final int DEFAULT_PORT
protected int port
protected String hostName
protected Socket socket
protected SocketFactory socketFactory
public PServerConnection()
public PServerConnection(CVSRoot cvsRoot)
IllegalArgumentException
- if the cvsRoot does not represent pserver connection type.public PServerConnection(CVSRoot cvsRoot, SocketFactory factory)
IllegalArgumentException
- if the cvsRoot does not represent pserver connection type.public void verify() throws AuthenticationException
AuthenticationException
- if the connection with the server cannot be establishedpublic void open() throws AuthenticationException, CommandAbortedException
AutenticationException
- if the connection with the server cannot be establishedAuthenticationException
CommandAbortedException
public String getUserName()
public void setUserName(String userName)
name
- the userNamepublic String getEncodedPassword()
public void setEncodedPassword(String encodedPassword)
password
- the encoded password to use for authenticationpublic int getPort()
public void setPort(int port)
thePort
- the port number to use. If you do not set this, 2401 is used
by default for pserver.public String getHostName()
public void setHostName(String hostName)
theHostName
- the host name of the server to connect to. If you do not set
this, localhost is used by default for pserver.public void close() throws IOException
IOException
public void modifyInputStream(ConnectionModifier modifier) throws IOException
modifier
- the connection modifier that performs the modificationsIOException
- if an error occurs modifying the streamspublic void modifyOutputStream(ConnectionModifier modifier) throws IOException
modifier
- the connection modifier that performs the modificationsIOException
- if an error occurs modifying the streamspublic boolean isOpen()
Copyright © 2016. All rights reserved.