On Mon, 2004-01-05 at 17:27, Brett Porter wrote: > I don't think we want to introduce a dependency on maven-scm for > maven-model. I'd prefer that the users of these functions just started using > maven-scm directly and these can get tossed. Its just there for current code > compatibility.
The model should indeed be dependency free. Any maven entity should be transformed or adapted in maven-project. Wagon will be used for artifact handling and it is within maven-project that the transformation of a Maven dependency gets turned into an artifact. The same goes with the repository, a simple adapter can be made in order to use maven-scm notions within maven-project. The whole idea will ultimately be to allow people to easily swap out component in maven-project for advanced uses. > - Brett > > > -----Original Message----- > > From: Emmanuel Venisse [mailto:[EMAIL PROTECTED] > > Sent: Monday, 5 January 2004 8:26 PM > > To: Maven Developers List > > Subject: Re: cvs commit: > > maven-components/maven-model/src/java/org/apache/maven/model > > Repository.java > > > > > > Why you don't use directly maven-scm in this deprecated methods? > > > > Emmanuel > > > > ----- Original Message ----- > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, January 05, 2004 9:54 AM > > Subject: cvs commit: > > maven-components/maven-model/src/java/org/apache/maven/model > > Repository.java > > > > > > > brett 2004/01/05 00:54:42 > > > > > > Modified: maven-model/src/java/org/apache/maven/model > > Repository.java > > > Log: > > > add legacy (now deprecated) functions for compatibility > > > > > > Revision Changes Path > > > 1.6 +172 -3 > > maven-components/maven-model/src/java/org/apache/maven/model/R > > epository.java > > > > > > Index: Repository.java > > > > > =================================================================== > > > RCS file: > > /home/cvs/maven-components/maven-model/src/java/org/apache/mav > > en/model/Repos > > itory.java,v > > > retrieving revision 1.5 > > > retrieving revision 1.6 > > > diff -u -r1.5 -r1.6 > > > --- Repository.java 2 Dec 2003 04:08:25 -0000 1.5 > > > +++ Repository.java 5 Jan 2004 08:54:42 -0000 1.6 > > > @@ -26,12 +26,12 @@ > > > * if and wherever such third-party acknowledgments > > normally appear. > > > * > > > * 4. The names "Apache" and "Apache Software Foundation" and > > > - * "Apache MavenSession" must not be used to endorse > > or promote > > products > > > + * "Apache Maven" must not be used to endorse or > > promote products > > > * derived from this software without prior written > > permission. For > > > * written permission, please contact [EMAIL PROTECTED] > > > * > > > * 5. Products derived from this software may not be > > called "Apache", > > > - * "Apache MavenSession", nor may "Apache" appear in > > their name, > > without > > > + * "Apache Maven", nor may "Apache" appear in their > > name, without > > > * prior written permission of the Apache Software Foundation. > > > * > > > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED > > OR IMPLIED > > > @@ -57,6 +57,9 @@ > > > */ > > > > > > import java.io.Serializable; > > > +import java.util.ArrayList; > > > +import java.util.List; > > > +import java.util.StringTokenizer; > > > > > > /** > > > * NOTE: This is very CVS specific, but I would like to try > > > additional > > SCM > > > @@ -130,4 +133,170 @@ > > > { > > > return url; > > > } > > > + > > > + /** > > > + * Get the SCM type. > > > + * @todo remove usages > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @return SCM type > > > + */ > > > + public String getScmType() { > > > + return getConnection().substring( 4, > > connection.indexOf( ":", > > 4 ) ); > > > + } > > > + > > > + /** > > > + * Get the CVS Root. > > > + * @todo remove usages > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @return cvs root > > > + */ > > > + public String getCvsRoot() { > > > + return getConnection().substring( 0, > > connection.lastIndexOf( > > ":" ) ).substring( 7 ); > > > + } > > > + > > > + /** > > > + * Get the CVS module. > > > + * @todo remove usages > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @return cvs module > > > + */ > > > + public String getCvsModule() { > > > + return getConnection().substring( > > connection.lastIndexOf( ":" ) > > + 1 ); > > > + } > > > + > > > + /** > > > + * Get the CVS server. > > > + * @todo remove usages > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @return cvs server > > > + */ > > > + public String getCvsServer() { > > > + return getConnection().substring( > > connection.lastIndexOf( ":" ) > > + 1 ); > > > + } > > > + > > > + /** > > > + * Get cvs server. > > > + * > > > + * Used in xdocs/src/plugin-resources/templates/cvs-usage.xml > > > + * @todo remove usages > > > + * > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @param conn six token connection string > > > + * @return CVS module. > > > + */ > > > + public String getCvsServer(String conn) > > > + { > > > + String[] tokens = splitSCMConnection(conn); > > > + if(tokens[3].indexOf('@') >= 0) > > > + { > > > + return tokens[3].substring(tokens[3].indexOf('@')+1); > > > + } > > > + else > > > + { > > > + return tokens[3]; > > > + } > > > + } > > > + > > > + /** > > > + * Get cvs root. > > > + * > > > + * Used in xdocs/src/plugin-resources/templates/cvs-usage.xml > > > + * @todo remove usages > > > + * > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @param conn six token connection string > > > + * @param username username override if non-empty. > > > + * @return CVS root. > > > + */ > > > + public String getCvsRoot(String conn, String username) > > > + { > > > + String[] tokens = splitSCMConnection(conn); > > > + if(tokens[3].indexOf('@') >= 0) > > > + { > > > + if (username.length() == 0) > > > + { > > > + username = tokens[3].substring(0, > > tokens[3].indexOf('@')); > > > + } > > > + tokens[3] = username + "@" + > > tokens[3].substring(tokens[3].indexOf('@') + 1); > > > + } > > > + String result = ":" + tokens[2] + ":" + tokens[3] + ":" + > > tokens[4]; > > > + return result; > > > + } > > > + > > > + /** > > > + * Get cvs module. > > > + * > > > + * Used in xdocs/src/plugin-resources/templates/cvs-usage.xml > > > + * @todo remove usages > > > + * > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @param conn six token connection string > > > + * @return CVS module. > > > + */ > > > + public String getCvsModule(String conn) > > > + { > > > + String[] tokens = splitSCMConnection(conn); > > > + return tokens[5]; > > > + } > > > + > > > + > > > + /** > > > + * Splits an SCM string into parts > > > + * @deprecated use maven-scm RepositoryInfo > > > + * @todo remove usages > > > + * @param connection > > > + * @return > > > + */ > > > + public static String[] splitSCMConnection(String connection) > > > + { > > > + if (connection == null) > > > + { > > > + throw new NullPointerException("repository > > connection is > > null"); > > > + } > > > + > > > + if (connection.length() < 4) > > > + { > > > + throw new > > IllegalArgumentException("repository connection > > is too short"); > > > + } > > > + > > > + if (!connection.startsWith("scm")) > > > + { > > > + throw new > > IllegalArgumentException("repository connection > > must start with scm[delim]"); > > > + } > > > + > > > + String delimiter = "" + connection.charAt(3); > > > + > > > + StringTokenizer tok = new StringTokenizer(connection, > > delimiter); > > > + > > > + String[] tokens = tokenizerToArray(tok); > > > + > > > + if (tokens.length < 6) > > > + { > > > + throw new > > IllegalArgumentException("repository connection > > string contains less than six tokens"); > > > + } > > > + > > > + if (tokens.length > 6) > > > + { > > > + throw new > > IllegalArgumentException("repository connection > > string contains more than six tokens"); > > > + } > > > + return tokens; > > > + } > > > + > > > + /** > > > + * Converts a tokenizer to an array of strings > > > + * @todo add method to maven-scm EnhancedStringTokenizer > > > + * @deprecated use maven-scm EnhancedStringTokenizer > > > + * @param tok > > > + * @return String[] > > > + */ > > > + public static String[] tokenizerToArray(StringTokenizer tok) > > > + { > > > + List l = new ArrayList(); > > > + while (tok.hasMoreTokens()) > > > + { > > > + l.add(tok.nextToken()); > > > + } > > > + return (String[]) l.toArray(new String[l.size()]); > > > + } > > > } > > > + > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > -- jvz. Jason van Zyl [EMAIL PROTECTED] http://tambora.zenplex.org In short, man creates for himself a new religion of a rational and technical order to justify his work and to be justified in it. -- Jacques Ellul, The Technological Society --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
