|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.lib.cvsclient.CVSRoot
public class CVSRoot
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.
Field Summary
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.
Constructor Summary
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.
Method Summary
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.
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Field Detail
METHOD_LOCAL
public static final java.lang.String METHOD_LOCAL
- A constant representing the "local" connection method.
- See Also:
- Constant Field Values
METHOD_FORK
public static final java.lang.String METHOD_FORK
- A constant representing the "fork" connection method.
- See Also:
- Constant Field Values
METHOD_SERVER
public static final java.lang.String METHOD_SERVER
- A constant representing the "server" connection method.
- See Also:
- Constant Field Values
METHOD_PSERVER
public static final java.lang.String METHOD_PSERVER
- A constant representing the "pserver" connection method.
- See Also:
- Constant Field Values
METHOD_EXT
public static final java.lang.String METHOD_EXT
- A constant representing the "ext" connection method.
- See Also:
- Constant Field Values
Constructor Detail
CVSRoot
protected CVSRoot(java.util.Properties props)
throws java.lang.IllegalArgumentException
- This constructor allows to construct CVSRoot from Properties object.
The names are exactly the same as the attribute names in this class.
- Throws:
java.lang.IllegalArgumentException
CVSRoot
protected CVSRoot(java.lang.String cvsroot)
throws java.lang.IllegalArgumentException
- 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. :pserver;username=anonymous;hostname=localhost:/path/to/repository
For CVSNT compatability it also supports following local repository path format
driveletter:path\\path\\path
- Throws:
java.lang.IllegalArgumentException
Method Detail
parse
public static CVSRoot parse(java.lang.String cvsroot)
throws java.lang.IllegalArgumentException
- Parse the CVSROOT string into CVSRoot object.
The CVSROOT string must be of the form
[:method:][[user][:password]@][hostname:[port]]/path/to/repository
- Throws:
java.lang.IllegalArgumentException
parse
public static CVSRoot parse(java.util.Properties props)
throws java.lang.IllegalArgumentException
- Construct CVSRoot from Properties object.
The names are exactly the same as the attribute names in this class.
- Throws:
java.lang.IllegalArgumentException
isLocal
public boolean isLocal()
- Test whether this cvsroot describes a local connection or remote connection.
The connection is local if and only if the host name is
null
.
E.g. for local or fork methods.
toString
public 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. Use getPassword to get it.
- Overrides:
toString
in class java.lang.Object
getCompatibilityLevel
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:
- -1 = not compatible - if none of the below match
- 0 = when equals(..) returns true
- 1 = refers to same repository on the same machine using same method on same port and same user
- 2 = refers to same repository on the same machine using same method
- 3 = refers to same repository on the same machine
equals
public boolean equals(java.lang.Object o)
- CVSRoots are equal if their toString representations are equal.
This puts some extra pressure on the toString method that should be defined very precisely.
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
getMethod
public java.lang.String getMethod()
- Get the connection method.
- Returns:
- The connection method or
null
when no method is defined.
setMethod
protected void setMethod(java.lang.String method)
- setting the method has effects on other components.
The method might change
- urlFormat
- username and password
- hostname/port
If urlFormat becomes LOCAL_FORMAT then username, password and hostname are set to null and port to 0.
If urlFormat becomes SERVER_FORMAT then hostname must not be null.
getUserName
public java.lang.String getUserName()
- Get the user name.
- Returns:
- The user name or code>null
when the user name is not defined.
setUserName
protected void setUserName(java.lang.String username)
- Set the user name.
- Parameters:
username
- The user name.
getPassword
public java.lang.String getPassword()
- Get the password.
- Returns:
- The password or
null
when the password is not defined.
setPassword
protected void setPassword(java.lang.String password)
- Set the password.
- Parameters:
password
- The password
getHostName
public java.lang.String getHostName()
- Get the host name.
- Returns:
- The host name or
null
when the host name is
not defined
setHostName
protected void setHostName(java.lang.String hostname)
- Set the host name.
- Parameters:
hostname
- The host name or null
when the host name is
not defined.
getPort
public int getPort()
- Get the port number.
- Returns:
- The port number or zero when the port is not defined.
setPort
public void setPort(int port)
- Set the port number.
- Parameters:
port
- The port number or zero when the port is not defined.
getRepository
public java.lang.String getRepository()
- Get the repository.
- Returns:
- The repository. This is never
null
.
setRepository
protected void setRepository(java.lang.String repository)
- Set the repository.
- Parameters:
repository
- The repository. Must not be null
.
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
Built on October 26 2010. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.