org.tigris.subversion.svnclientadapter
Class SVNUrl

java.lang.Object
  extended by org.tigris.subversion.svnclientadapter.SVNUrl

public class SVNUrl
extends java.lang.Object

We could have used URL, using custom protocols (svn, svn+ssl) (@see http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/) but this is not really necessary as we don't want to open a connection directly with this class. We just want a string which represent a SVN url which can be used with our JNI methods. An SVNUrl is immutable.

Author:
C???dric Chabanois cchabanois@ifrance.com

Field Summary
protected static char SEGMENT_SEPARATOR
           
 
Constructor Summary
SVNUrl(java.lang.String svnUrl)
          Constructor
 
Method Summary
 SVNUrl appendPath(java.lang.String path)
          Asnwer a new SVNUrl with added segments
 boolean equals(java.lang.Object target)
           
static int getDefaultPort(java.lang.String protocol)
          get the default port for given protocol
 java.lang.String getHost()
           
 java.lang.String getLastPathSegment()
           
 SVNUrl getParent()
          Return new SVNUrl which represents parent of the receiver
 java.lang.String[] getPathSegments()
          get the path of the url.
 int getPort()
           
 java.lang.String getProtocol()
          get the protocol
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEGMENT_SEPARATOR

protected static final char SEGMENT_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

SVNUrl

public SVNUrl(java.lang.String svnUrl)
       throws java.net.MalformedURLException
Constructor

Parameters:
svnUrl - a string to parse url from
Throws:
java.net.MalformedURLException - when parsing failed
Method Detail

appendPath

public SVNUrl appendPath(java.lang.String path)
Asnwer a new SVNUrl with added segments

Parameters:
path - a String of path segment(s) to ba appended to receiver
Returns:
new SVNUrl

getDefaultPort

public static int getDefaultPort(java.lang.String protocol)
get the default port for given protocol

Parameters:
protocol -
Returns:
port number or -1 if protocol is unknown

getProtocol

public java.lang.String getProtocol()
get the protocol

Returns:
either http, https, file, svn or svn+ssh

getHost

public java.lang.String getHost()
Returns:
Returns the host.

getPort

public int getPort()
Returns:
Returns the port.

getPathSegments

public java.lang.String[] getPathSegments()
get the path of the url.

Returns:
an arrray of url path segments

getLastPathSegment

public java.lang.String getLastPathSegment()
Returns:
the "file" name, i.e. the element after last /

getParent

public SVNUrl getParent()
Return new SVNUrl which represents parent of the receiver

Returns:
the parent url or null if no parent

equals

public boolean equals(java.lang.Object target)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object