Return-Path: Delivered-To: apmail-maven-dev-archive@www.apache.org Received: (qmail 97435 invoked from network); 5 Jan 2004 22:27:26 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Jan 2004 22:27:26 -0000 Received: (qmail 16610 invoked by uid 500); 5 Jan 2004 22:27:12 -0000 Delivered-To: apmail-maven-dev-archive@maven.apache.org Received: (qmail 16594 invoked by uid 500); 5 Jan 2004 22:27:12 -0000 Mailing-List: contact dev-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Maven Developers List" Reply-To: "Maven Developers List" Delivered-To: mailing list dev@maven.apache.org Received: (qmail 16579 invoked from network); 5 Jan 2004 22:27:11 -0000 Received: from unknown (HELO conan.f2.com.au) (203.26.51.167) by daedalus.apache.org with SMTP; 5 Jan 2004 22:27:11 -0000 Received: from sydmsg1.int.f2.com.au (h-172.31.139.16 [172.31.139.16] (may be forged)) by conan.f2.com.au (8.12.10/8.12.10) with ESMTP id i05MRGb1029131 for ; Tue, 6 Jan 2004 09:27:16 +1100 Received: by sydmsg1.int.f2.com.au with Internet Mail Service (5.5.2657.72) id ; Tue, 6 Jan 2004 09:27:11 +1100 Message-ID: <9BAE99905FCF684D91F63E1439475FBA0F6A6A29@sydmsg1.int.f2.com.au> From: Brett Porter To: "'Maven Developers List'" Subject: RE: cvs commit: maven-components/maven-model/src/java/org/apache/ maven/model Repository.java Date: Tue, 6 Jan 2004 09:27:05 +1100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C3D3DB.0C9B0390" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C3D3DB.0C9B0390 Content-Type: text/plain 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. - Brett > -----Original Message----- > From: Emmanuel Venisse [mailto:emmanuel@venisse.net] > 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: > To: > 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 apache@apache.org. > > * > > * 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: dev-unsubscribe@maven.apache.org > > For additional commands, e-mail: dev-help@maven.apache.org > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org > For additional commands, e-mail: dev-help@maven.apache.org > ------_=_NextPart_001_01C3D3DB.0C9B0390--