org.apache.maven.xdoc.util
Class ScmUtil

java.lang.Object
  extended byorg.apache.maven.xdoc.util.ScmUtil

public final class ScmUtil
extends Object

Utility class to manage SCM informations. NOTE: This is very CVS specific, but I would like to try additional SCM package like subversion ASAP.

Version:
$Id$
Author:
Jason van Zyl, Arnaud Heritier

Constructor Summary
ScmUtil()
           
 
Method Summary
 String anonymousAccessCVS(String connection)
          Create the documentation to provide an anonymous access with a CVS SCM.
 String anonymousAccessSVN(String connection, String checkoutDirectoryName)
          Create the documentation to provide an anonymous access with a SVN SCM.
 String developerAccessClearCase(String devConnection)
          Create the documentation to provide an developer access with a Clearcase SCM.
 String developerAccessCVS(String devConnection)
          Create the documentation to provide an developer access with a CVS SCM.
 String developerAccessPerforce(String devConnection)
          Create the documentation to provide an developer access with a Perforce SCM.
 String developerAccessStarteam(String devConnection)
          Create the documentation to provide an developer access with a Starteam SCM.
 String developerAccessSVN(String devConnection, String checkoutDirectoryName)
          Create the documentation to provide an developer access with a SVN SCM.
 String getCvsConnection(String conn, String username)
          Get cvs connection string.
 String getCvsModule(String conn)
          Get cvs module.
 String getSCMConnectionSeparator(String connection)
          Get the separator used in an SCM string
 String getScmType(String scmConnection)
          Get the SCM type.
 String getSvnConnection(String conn)
          Get svn connection string.
protected  boolean isValid(String value)
          Simple check for a value in the POM.
 String[] splitSCMConnection(String connection)
          Splits an SCM string into parts.
 String[] tokenizerToArray(org.apache.maven.util.EnhancedStringTokenizer tok)
          Converts a tokenizer to an array of strings FIXME: This should be in a string util class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScmUtil

public ScmUtil()
Method Detail

getScmType

public String getScmType(String scmConnection)
Get the SCM type.

Parameters:
scmConnection - the scm connection to analyse.
Returns:
the scm type : cvs, svn , ...

getCvsConnection

public String getCvsConnection(String conn,
                               String username)
Get cvs connection string. Used in xdocs/src/plugin-resources/templates/scm/cvs.xml. If username == "", assumes anonymous (pserver) connection. In this case, inserts a separator (':' or '|') between the username and '@' to indicate that there is a password and that it is empty. If username != "" it replaces username in conn.

Parameters:
conn - six token connection string
username - username override if non-empty.
Returns:
CVS root.

getCvsModule

public String getCvsModule(String conn)
Get cvs module. Used in xdocs/src/plugin-resources/templates/scm/cvs.xml.

Parameters:
conn - six token connection string
Returns:
CVS module.

getSvnConnection

public String getSvnConnection(String conn)
Get svn connection string. Used in xdocs/src/plugin-resources/templates/scm/svn.xml. It removes the first two elements (scm:svn:)

Parameters:
conn - the repository connection
Returns:
CVS root.

anonymousAccessCVS

public String anonymousAccessCVS(String connection)
Create the documentation to provide an anonymous access with a CVS SCM. For example, generate the following command line:

cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login

cvs -z3 -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co maven-plugins/dist

Parameters:
connection - The connection string.
See Also:
http://ximbiot.com/cvs/manual/cvs-1.12.12/cvs_16.html#SEC115

developerAccessCVS

public String developerAccessCVS(String devConnection)
Create the documentation to provide an developer access with a CVS SCM. For example, generate the following command line:

export CVS_RSH=ssh

cvs -z3 -d :ext:username@cvs.apache.org:/home/cvs co maven-plugins/dist

Parameters:
devConnection - The developer connection string.
See Also:
http://ximbiot.com/cvs/manual/cvs-1.12.12/cvs_16.html#SEC115

anonymousAccessSVN

public String anonymousAccessSVN(String connection,
                                 String checkoutDirectoryName)
Create the documentation to provide an anonymous access with a SVN SCM. For example, generate the following command line:

svn checkout http://svn.apache.org/repos/asf/maven/components/trunk/ maven

Parameters:
connection - The connection string.
checkoutDirectoryName - The checkout directory.
See Also:
http://svnbook.red-bean.com/

developerAccessSVN

public String developerAccessSVN(String devConnection,
                                 String checkoutDirectoryName)
Create the documentation to provide an developer access with a SVN SCM. For example, generate the following command line:

svn checkout https://svn.apache.org/repos/asf/maven/components/trunk maven

svn commit --username your-username -m "A message"

Parameters:
devConnection - The developer connection string.
checkoutDirectoryName - The checkout directory.
See Also:
http://svnbook.red-bean.com/

developerAccessPerforce

public String developerAccessPerforce(String devConnection)
Create the documentation to provide an developer access with a Perforce SCM. For example, generate the following command line:

p4 -H hostname -p port -u username -P password path

p4 -H hostname -p port -u username -P password path submit -c changement

Parameters:
devConnection -
See Also:
http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html

developerAccessStarteam

public String developerAccessStarteam(String devConnection)
Create the documentation to provide an developer access with a Starteam SCM. For example, generate the following command line:

stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -is

stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -f NCI -is

Parameters:
devConnection -

developerAccessClearCase

public String developerAccessClearCase(String devConnection)
Create the documentation to provide an developer access with a Clearcase SCM. For example, generate the following command line:

cleartool checkout module

Parameters:
devConnection -

splitSCMConnection

public String[] splitSCMConnection(String connection)
Splits an SCM string into parts.

Parameters:
connection -
Returns:
A string array of SCM parts

getSCMConnectionSeparator

public String getSCMConnectionSeparator(String connection)
Get the separator used in an SCM string

Parameters:
connection -
Returns:
String that can be either ":" or "|"

tokenizerToArray

public String[] tokenizerToArray(org.apache.maven.util.EnhancedStringTokenizer tok)
Converts a tokenizer to an array of strings FIXME: This should be in a string util class.

Parameters:
tok -
Returns:
String[]

isValid

protected boolean isValid(String value)
Simple check for a value in the POM. Due to the Jelly swizzling fields that aren't set come out as empty strings. This will not be required when the new lazy evaluation mechanism is put in place.

Parameters:
value - POM value to test.
Returns:
Is the value valid.


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.