evenisse 2003/07/02 07:39:14 Modified: src/java/org/apache/maven DefaultProjectMarshaller.java DefaultProjectUnmarshaller.java src/java/org/apache/maven/project Project.java Added: src/java/org/apache/maven/project Branch.java Log: Branch tag is present in maven schema and used by several project but it didn't appear in project object. This patch correct this. Revision Changes Path 1.3 +29 -0 maven/src/java/org/apache/maven/DefaultProjectMarshaller.java Index: DefaultProjectMarshaller.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/DefaultProjectMarshaller.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultProjectMarshaller.java 23 Jun 2003 04:44:18 -0000 1.2 +++ DefaultProjectMarshaller.java 2 Jul 2003 14:39:14 -0000 1.3 @@ -1,6 +1,7 @@ package org.apache.maven; import org.apache.maven.project.Build; +import org.apache.maven.project.Branch; import org.apache.maven.project.Contributor; import org.apache.maven.project.Dependency; import org.apache.maven.project.Developer; @@ -101,6 +102,7 @@ marshallRepository( project ); marshallVersions( project ); + marshallBranches( project ); marshallMailingLists( project ); marshallDevelopers( project ); @@ -179,6 +181,33 @@ } } serializer.endTag( NAMESPACE, "versions" ); + } + } + + /** + * Description of the Method + */ + private void marshallBranches( Project project ) + throws Exception + { + List branches = project.getBranches(); + if ( branches != null ) + { + serializer.startTag( NAMESPACE, "branches" ); + Branch branch; + for ( int i = 0; i < branches.size(); i++ ) + { + branch = (Branch) branches.get( i ); + if ( branch != null ) + { + serializer.startTag( NAMESPACE, "branch" ); + + marshallString( branch.getTag(), "tag" ); + + serializer.endTag( NAMESPACE, "branch" ); + } + } + serializer.endTag( NAMESPACE, "branches" ); } } 1.3 +29 -1 maven/src/java/org/apache/maven/DefaultProjectUnmarshaller.java Index: DefaultProjectUnmarshaller.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/DefaultProjectUnmarshaller.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultProjectUnmarshaller.java 23 Jun 2003 04:44:30 -0000 1.2 +++ DefaultProjectUnmarshaller.java 2 Jul 2003 14:39:14 -0000 1.3 @@ -1,6 +1,7 @@ package org.apache.maven; import org.apache.maven.project.Build; +import org.apache.maven.project.Branch; import org.apache.maven.project.Contributor; import org.apache.maven.project.Dependency; import org.apache.maven.project.Developer; @@ -185,6 +186,33 @@ else if ( parser.getName().equals( "tag" ) ) { v.setTag( parser.nextText() ); + } + else + { + parser.nextText(); + } + } + } + else + { + parser.nextText(); + } + } + } + else if ( parser.getName().equals( "branches" ) ) + { + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "branch" ) ) + { + Branch b = new Branch(); + project.addBranch( b ); + + while ( parser.nextTag() == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "tag" ) ) + { + b.setTag( parser.nextText() ); } else { 1.83 +35 -1 maven/src/java/org/apache/maven/project/Project.java Index: Project.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/project/Project.java,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- Project.java 18 Jun 2003 02:48:08 -0000 1.82 +++ Project.java 2 Jul 2003 14:39:14 -0000 1.83 @@ -175,6 +175,9 @@ /** Versions associated with this project. */ private List versions; + /** Branches associated with this project. */ + private List branches; + /** * Distributions map that associates the distribution ids * with the distribution objects. @@ -241,6 +244,7 @@ contributors = new ArrayList(); licenses = new ArrayList(); versions = new ArrayList(); + branches = new ArrayList(); dependencyPaths = new HashMap(); dependencyMap = new HashMap(); goalNames = new ArrayList(); @@ -1115,6 +1119,36 @@ public List getVersions() { return versions; + } + + /** + * Add a branch to this project. + * + * @param branch Branch for this project. + */ + public void addBranch( Branch branch ) + { + branches.add( branch ); + } + + /** + * Set the branches for this project. + * + * @param branches List of branches for this project. + */ + public void setBranches( List branches ) + { + this.branches = branches; + } + + /** + * Return the branches for this project. + * + * @return List of branches. + */ + public List getBranches() + { + return branches; } /** 1.1 maven/src/java/org/apache/maven/project/Branch.java Index: Branch.java =================================================================== package org.apache.maven.project; /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "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 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 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * ==================================================================== */ /** * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Venisse</a> * @version $Id: Branch.java,v 1.1 2003/07/02 14:39:14 evenisse Exp $ */ public class Branch extends BaseObject { /** * Repository tag from which this branch * is made. */ private String tag; /** * Constructor for the Branch object */ public Branch() { } /** * Sets the tag attribute of the Branch object * * @param tag the repository tag from which this branch is made */ public void setTag( String tag ) { this.tag = tag; } /** * Gets the tag attribute of the Branch object * * @return the repository tag from which this branch is made */ public String getTag() { return tag; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]