public class CVSRoot extends 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 String |
METHOD_EXT
A constant representing the "ext" connection method.
|
static String |
METHOD_FORK
A constant representing the "fork" connection method.
|
static String |
METHOD_LOCAL
A constant representing the "local" connection method.
|
static String |
METHOD_PSERVER
A constant representing the "pserver" connection method.
|
static String |
METHOD_SERVER
A constant representing the "server" connection method.
|
Modifier | Constructor and Description |
---|---|
protected |
CVSRoot(Properties props)
This constructor allows to construct CVSRoot from Properties object.
|
protected |
CVSRoot(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(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.
|
String |
getHostName()
Get the host name.
|
String |
getMethod()
Get the connection method.
|
String |
getPassword()
Get the password.
|
int |
getPort()
Get the port number.
|
String |
getRepository()
Get the repository.
|
String |
getUserName()
Get the user name.
|
int |
hashCode() |
boolean |
isLocal()
Test whether this cvsroot describes a local connection or remote
connection.
|
static CVSRoot |
parse(Properties props)
Construct CVSRoot from Properties object.
|
static CVSRoot |
parse(String cvsroot)
Parse the CVSROOT string into CVSRoot object.
|
protected void |
setHostName(String hostname)
Set the host name.
|
protected void |
setMethod(String method)
setting the method has effects on other components.
|
void |
setPassword(String password)
Set the password.
|
void |
setPort(int port)
Set the port number.
|
protected void |
setRepository(String repository)
Set the repository.
|
protected void |
setUserName(String username)
Set the user name.
|
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 String METHOD_LOCAL
public static final String METHOD_FORK
public static final String METHOD_SERVER
public static final String METHOD_PSERVER
public static final String METHOD_EXT
protected CVSRoot(Properties props) throws IllegalArgumentException
IllegalArgumentException
protected CVSRoot(String cvsroot) throws IllegalArgumentException
IllegalArgumentException
public static CVSRoot parse(String cvsroot) throws IllegalArgumentException
IllegalArgumentException
public static CVSRoot parse(Properties props) throws IllegalArgumentException
IllegalArgumentException
public boolean isLocal()
null
. E.g. for local or fork methods.public String toString()
LOCAL_FORMAT --> :method:/reposi/tory
SERVER_FORMAT --> :method:user@hostname:[port]/reposi/tory
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(Object o)
public String getMethod()
null
when no method is
defined.protected void setMethod(String method)
public String getUserName()
protected void setUserName(String username)
username
- The user name.public String getPassword()
null
when the password is not
defined.public void setPassword(String password)
password
- The passwordpublic String getHostName()
null
when the host name is not
definedprotected void setHostName(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 String getRepository()
null
.protected void setRepository(String repository)
repository
- The repository. Must not be null
.Copyright © 2016. All rights reserved.