public class CVSRoot
extends java.lang.Object
CVSRoot represents the cvsroot that identifies the cvs repository's location and the means to get to it. We use following definition of cvsroot:
[:method:][[user][:password]@][hostname[:[port]]]/path/to/repository
When the method is not defined, we treat it as local or ext method depending on whether the hostname is present or not. This gives us two different formats:
[:method:]/path/to/repository
or
(:local:|:fork:)anything
2. Server format
[:method:][[user][:password]@]hostname[:[port]]/path/to/repository
There are currently 6 different methods that are implemented by 3 different connection classes.
- :local:, :fork: & no-method --> LocalConnection (LOCAL_FORMAT)
- :server: & :ext: --> SSH2Connection (SERVER_FORMAT)
- :pserver: --> PServerConnection (SERVER_FORMAT)
gserver and kserver are not included. Environment variables are not used (like CVS_RSH).
local and no-method work like fork. They start the cvs server program on
the local machine thus using the remote protocol on the local machine.
According to Cederqvist fork's relation to local is:
"In other words it does pretty much the same thing as :local:,
but various quirks, bugs and the like are those of the remote CVS rather
than the local CVS."
server is using ssh. According to Cederqvist it would use an internal RSH
client but since it is not known what this exactly means it just uses ssh.
Note ssh is able only to use ssh protocol version 2 which is recommended anyways.
Note that cvsroot is case sensitive so remember to write the method in lowercase.
You can succesfully construct a cvsroot that has a different method but
ConnectionFactory will be unable to create a connection for such CVSRoot.
CVSRoot object keeps the cvsroot in components that are
- method
- user
- password
- host
- port
- repository
You can change these components through setters.
When you ask fo the cvsroot string representation it is constructed based
on the current values of the components. The returned cvsroot never contains
the password for security reasons.
Also "no-method" is always represented as local method.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
METHOD_EXT
A constant representing the "ext" connection method.
|
static java.lang.String |
METHOD_FORK
A constant representing the "fork" connection method.
|
static java.lang.String |
METHOD_LOCAL
A constant representing the "local" connection method.
|
static java.lang.String |
METHOD_PSERVER
A constant representing the "pserver" connection method.
|
static java.lang.String |
METHOD_SERVER
A constant representing the "server" connection method.
|
Modifier | Constructor and Description |
---|---|
protected |
CVSRoot(java.util.Properties props)
This constructor allows to construct CVSRoot from Properties object.
|
protected |
CVSRoot(java.lang.String cvsroot)
Breaks the string representation of cvsroot into it's components:
The valid format (from the cederqvist) is:
:method:[[user][:password]@]hostname[:[port]]/path/to/repository
Also parse alternative format from WinCVS, which stores connection
parameters such as username and hostname in method options:
:method[;option=arg...]:other_connection_data
e.g.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
CVSRoots are equal if their toString representations are equal.
|
int |
getCompatibilityLevel(CVSRoot compared)
With this method it is possible to compare how close two CVSRoots are to each other.
|
java.lang.String |
getHostName()
Get the host name.
|
java.lang.String |
getMethod()
Get the connection method.
|
java.lang.String |
getPassword()
Get the password.
|
int |
getPort()
Get the port number.
|
java.lang.String |
getRepository()
Get the repository.
|
java.lang.String |
getUserName()
Get the user name.
|
int |
hashCode() |
boolean |
isLocal()
Test whether this cvsroot describes a local connection or remote connection.
|
static CVSRoot |
parse(java.util.Properties props)
Construct CVSRoot from Properties object.
|
static CVSRoot |
parse(java.lang.String cvsroot)
Parse the CVSROOT string into CVSRoot object.
|
protected void |
setHostName(java.lang.String hostname)
Set the host name.
|
protected void |
setMethod(java.lang.String method)
setting the method has effects on other components.
|
protected void |
setPassword(java.lang.String password)
Set the password.
|
void |
setPort(int port)
Set the port number.
|
protected void |
setRepository(java.lang.String repository)
Set the repository.
|
protected void |
setUserName(java.lang.String username)
Set the user name.
|
java.lang.String |
toString()
LOCAL_FORMAT --> :method:/reposi/tory
"no method" is always represented internally as null SERVER_FORMAT --> :method:user@hostname:[port]/reposi/tory
Password is never included in cvsroot string representation. |
public static final java.lang.String METHOD_LOCAL
public static final java.lang.String METHOD_FORK
public static final java.lang.String METHOD_SERVER
public static final java.lang.String METHOD_PSERVER
public static final java.lang.String METHOD_EXT
protected CVSRoot(java.util.Properties props) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
protected CVSRoot(java.lang.String cvsroot) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static CVSRoot parse(java.lang.String cvsroot) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static CVSRoot parse(java.util.Properties props) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public boolean isLocal()
null
.
E.g. for local or fork methods.public java.lang.String toString()
LOCAL_FORMAT --> :method:/reposi/tory
SERVER_FORMAT --> :method:user@hostname:[port]/reposi/tory
toString
in class java.lang.Object
public int getCompatibilityLevel(CVSRoot compared)
With this method it is possible to compare how close two CVSRoots are to each other. The possible values are:
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getMethod()
null
when no method is defined.protected void setMethod(java.lang.String method)
public java.lang.String getUserName()
protected void setUserName(java.lang.String username)
username
- The user name.public java.lang.String getPassword()
null
when the password is not defined.protected void setPassword(java.lang.String password)
password
- The passwordpublic java.lang.String getHostName()
null
when the host name is
not definedprotected void setHostName(java.lang.String hostname)
hostname
- The host name or null
when the host name is
not defined.public int getPort()
public void setPort(int port)
port
- The port number or zero when the port is not defined.public java.lang.String getRepository()
null
.protected void setRepository(java.lang.String repository)
repository
- The repository. Must not be null
.Built on January 12 2013. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.