You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2008/07/19 22:06:41 UTC

svn commit: r678212 [1/3] - in /maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder: ./ impl/

Author: sisbell
Date: Sat Jul 19 13:06:40 2008
New Revision: 678212

URL: http://svn.apache.org/viewvc?rev=678212&view=rev
Log:
Maven code style.

Modified:
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomArtifactResolver.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ProjectUri.java
    maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java

Modified: maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java?rev=678212&r1=678211&r2=678212&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java Sat Jul 19 13:06:40 2008
@@ -26,33 +26,37 @@
 
 import java.util.*;
 
-public final class ArtifactModelContainerFactory implements ModelContainerFactory {
+public final class ArtifactModelContainerFactory
+    implements ModelContainerFactory
+{
 
-    private static final Collection<String> uris = Collections.unmodifiableList(Arrays.asList(
+    private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
 
-            ProjectUri.DependencyManagement.Dependencies.Dependency.xUri,
-            ProjectUri.Dependencies.Dependency.xUri,
+        ProjectUri.DependencyManagement.Dependencies.Dependency.xUri, ProjectUri.Dependencies.Dependency.xUri,
 
-            ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri,
-            ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri,
+        ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri,
+        ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri,
 
-            ProjectUri.Build.Plugins.Plugin.xUri,
-            ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri,
-            ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri
-    ));
+        ProjectUri.Build.Plugins.Plugin.xUri, ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri,
+        ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri ) );
 
-    public Collection<String> getUris() {
+    public Collection<String> getUris()
+    {
         return uris;
     }
 
-    public ModelContainer create(List<ModelProperty> modelProperties) {
-        if (modelProperties == null || modelProperties.size() == 0) {
-            throw new IllegalArgumentException("modelProperties: null or empty");
+    public ModelContainer create( List<ModelProperty> modelProperties )
+    {
+        if ( modelProperties == null || modelProperties.size() == 0 )
+        {
+            throw new IllegalArgumentException( "modelProperties: null or empty" );
         }
-        return new ArtifactModelContainer(modelProperties);
+        return new ArtifactModelContainer( modelProperties );
     }
 
-    private static class ArtifactModelContainer implements ModelContainer {
+    private static class ArtifactModelContainer
+        implements ModelContainer
+    {
 
         private String groupId;
 
@@ -64,86 +68,117 @@
 
         private List<ModelProperty> properties;
 
-        private ArtifactModelContainer(List<ModelProperty> properties) {
-            this.properties = new ArrayList<ModelProperty>(properties);
-            this.properties = Collections.unmodifiableList(this.properties);
-
-            for (ModelProperty mp : properties) {
-                if (mp.getUri().endsWith("version")) {
+        private ArtifactModelContainer( List<ModelProperty> properties )
+        {
+            this.properties = new ArrayList<ModelProperty>( properties );
+            this.properties = Collections.unmodifiableList( this.properties );
+
+            for ( ModelProperty mp : properties )
+            {
+                if ( mp.getUri().endsWith( "version" ) )
+                {
                     this.version = mp.getValue();
-                } else if (mp.getUri().endsWith("artifactId")) {
+                }
+                else if ( mp.getUri().endsWith( "artifactId" ) )
+                {
                     this.artifactId = mp.getValue();
-                } else if (mp.getUri().endsWith("groupId")) {
+                }
+                else if ( mp.getUri().endsWith( "groupId" ) )
+                {
                     this.groupId = mp.getValue();
-                } else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.type)) {
+                }
+                else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) )
+                {
                     this.type = mp.getValue();
                 }
             }
-            if (groupId == null) {
+            if ( groupId == null )
+            {
                 groupId = "org.apache.maven.plugins";
                 //  throw new IllegalArgumentException("properties does not contain group id. Artifact ID = "
                 //          + artifactId + ", Version = " + version);
             }
 
-            if (artifactId == null) {
-                throw new IllegalArgumentException("Properties does not contain artifact id. Group ID = " + groupId +
-                        ", Version = " + version);
+            if ( artifactId == null )
+            {
+                throw new IllegalArgumentException(
+                    "Properties does not contain artifact id. Group ID = " + groupId + ", Version = " + version );
             }
 
-            if(type == null) {
+            if ( type == null )
+            {
                 type = "";
             }
         }
 
-        public ModelContainerAction containerAction(ModelContainer modelContainer) {
-            if (modelContainer == null) {
-                throw new IllegalArgumentException("modelContainer: null");
+        public ModelContainerAction containerAction( ModelContainer modelContainer )
+        {
+            if ( modelContainer == null )
+            {
+                throw new IllegalArgumentException( "modelContainer: null" );
             }
 
-            if (!(modelContainer instanceof ArtifactModelContainer)) {
-                throw new IllegalArgumentException("modelContainer: wrong type");
+            if ( !( modelContainer instanceof ArtifactModelContainer ) )
+            {
+                throw new IllegalArgumentException( "modelContainer: wrong type" );
             }
 
             ArtifactModelContainer c = (ArtifactModelContainer) modelContainer;
-            if (c.groupId.equals(groupId) && c.artifactId.equals(artifactId)) {
-                if (c.version == null) {
-                    if(version == null) {
+            if ( c.groupId.equals( groupId ) && c.artifactId.equals( artifactId ) )
+            {
+                if ( c.version == null )
+                {
+                    if ( version == null )
+                    {
                         return ModelContainerAction.JOIN;
                     }
                     return ModelContainerAction.DELETE;//TODO Verify - PluginManagement Section may make versions equal
                 }
 
-                if(c.version.equals(version)) {
-                    if(c.type.equals(type)) {
+                if ( c.version.equals( version ) )
+                {
+                    if ( c.type.equals( type ) )
+                    {
                         return ModelContainerAction.JOIN;
-                    } else {
-                        return ModelContainerAction.NOP; 
                     }
-                } else {
-                   return ModelContainerAction.DELETE;
+                    else
+                    {
+                        return ModelContainerAction.NOP;
+                    }
+                }
+                else
+                {
+                    return ModelContainerAction.DELETE;
                 }
-            } else {
+            }
+            else
+            {
                 return ModelContainerAction.NOP;
             }
         }
 
-        public ModelContainer createNewInstance(List<ModelProperty> modelProperties) {
-            return new ArtifactModelContainer(modelProperties);
+        public ModelContainer createNewInstance( List<ModelProperty> modelProperties )
+        {
+            return new ArtifactModelContainer( modelProperties );
         }
 
-        public List<ModelProperty> getProperties() {
+        public List<ModelProperty> getProperties()
+        {
             return properties;
         }
 
-        public void sort(List<ModelProperty> modelProperties) {
+        public void sort( List<ModelProperty> modelProperties )
+        {
         }
 
-        public String toString() {
+        public String toString()
+        {
             StringBuffer sb = new StringBuffer();
-            sb.append("Group ID = ").append(groupId).append(", Artifact ID = ").append(artifactId)
-                    .append(", Version").append(version).append("\r\n");
-            for (ModelProperty mp : properties) {
-                sb.append(mp).append("\r\n");
+            sb.append( "Group ID = " ).append( groupId ).append( ", Artifact ID = " ).append( artifactId )
+                .append( ", Version" ).append( version ).append( "\r\n" );
+            for ( ModelProperty mp : properties )
+            {
+                sb.append( mp ).append( "\r\n" );
             }
             return sb.toString();
         }

Modified: maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java?rev=678212&r1=678211&r2=678212&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java Sat Jul 19 13:06:40 2008
@@ -26,73 +26,88 @@
 
 import java.util.*;
 
-public class IdModelContainerFactory implements ModelContainerFactory {
+public class IdModelContainerFactory
+    implements ModelContainerFactory
+{
+
+    private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
+        ProjectUri.PluginRepositories.PluginRepository.xUri, ProjectUri.Repositories.Repository.xUri,
+        ProjectUri.Reporting.Plugins.Plugin.ReportSets.ReportSet.xUri, ProjectUri.Profiles.Profile.xUri,
+        ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri ) );
 
-    private static final Collection<String> uris = Collections.unmodifiableList(Arrays.asList(
-            ProjectUri.PluginRepositories.PluginRepository.xUri,
-            ProjectUri.Repositories.Repository.xUri,
-            ProjectUri.Reporting.Plugins.Plugin.ReportSets.ReportSet.xUri,
-            ProjectUri.Profiles.Profile.xUri,
-            ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri
-    ));
-
-    public Collection<String> getUris() {
+    public Collection<String> getUris()
+    {
         return uris;
     }
 
-    public ModelContainer create(List<ModelProperty> modelProperties) {
-        if (modelProperties == null || modelProperties.size() == 0) {
-            throw new IllegalArgumentException("modelProperties: null or empty");
+    public ModelContainer create( List<ModelProperty> modelProperties )
+    {
+        if ( modelProperties == null || modelProperties.size() == 0 )
+        {
+            throw new IllegalArgumentException( "modelProperties: null or empty" );
         }
-        return new IdModelContainer(modelProperties);
+        return new IdModelContainer( modelProperties );
     }
 
-    private static class IdModelContainer implements ModelContainer {
+    private static class IdModelContainer
+        implements ModelContainer
+    {
 
         private String id;
 
         private List<ModelProperty> properties;
 
-        private IdModelContainer(List<ModelProperty> properties) {
-            this.properties = new ArrayList<ModelProperty>(properties);
-            this.properties = Collections.unmodifiableList(this.properties);
-
-            for (ModelProperty mp : properties) {
-                if (mp.getUri().endsWith("/id")) {
+        private IdModelContainer( List<ModelProperty> properties )
+        {
+            this.properties = new ArrayList<ModelProperty>( properties );
+            this.properties = Collections.unmodifiableList( this.properties );
+
+            for ( ModelProperty mp : properties )
+            {
+                if ( mp.getUri().endsWith( "/id" ) )
+                {
                     this.id = mp.getValue();
                 }
             }
         }
 
-        public ModelContainerAction containerAction(ModelContainer modelContainer) {
-            if (modelContainer == null) {
-                throw new IllegalArgumentException("modelContainer: null");
+        public ModelContainerAction containerAction( ModelContainer modelContainer )
+        {
+            if ( modelContainer == null )
+            {
+                throw new IllegalArgumentException( "modelContainer: null" );
             }
 
-            if (!(modelContainer instanceof IdModelContainer)) {
-                throw new IllegalArgumentException("modelContainer: wrong type");
+            if ( !( modelContainer instanceof IdModelContainer ) )
+            {
+                throw new IllegalArgumentException( "modelContainer: wrong type" );
             }
 
             IdModelContainer c = (IdModelContainer) modelContainer;
-            if (c.id == null || id == null) {
+            if ( c.id == null || id == null )
+            {
                 return ModelContainerAction.NOP;
             }
-            return (c.id.equals(id)) ? ModelContainerAction.JOIN : ModelContainerAction.NOP;
+            return ( c.id.equals( id ) ) ? ModelContainerAction.JOIN : ModelContainerAction.NOP;
         }
 
-        public ModelContainer createNewInstance(List<ModelProperty> modelProperties) {
-            return new IdModelContainer(modelProperties);
+        public ModelContainer createNewInstance( List<ModelProperty> modelProperties )
+        {
+            return new IdModelContainer( modelProperties );
         }
 
-        public void sort(List<ModelProperty> modelProperties) {
+        public void sort( List<ModelProperty> modelProperties )
+        {
 
         }
 
-        public List<ModelProperty> getProperties() {
+        public List<ModelProperty> getProperties()
+        {
             return properties;
         }
 
-        public String toString() {
+        public String toString()
+        {
             return "ID = " + id;
         }
     }

Modified: maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomArtifactResolver.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomArtifactResolver.java?rev=678212&r1=678211&r2=678212&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomArtifactResolver.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomArtifactResolver.java Sat Jul 19 13:06:40 2008
@@ -29,7 +29,8 @@
 import java.io.IOException;
 import java.util.List;
 
-public class PomArtifactResolver {
+public class PomArtifactResolver
+{
 
     /**
      * Local repository used in resolving artifacts
@@ -49,12 +50,13 @@
     /**
      * Constructor
      *
-     * @param localRepository local repository used in resolving artifacts
+     * @param localRepository    local repository used in resolving artifacts
      * @param remoteRepositories remote repositories used in resolving artifacts
-     * @param resolver artifact resolver used to resolve artifacts
+     * @param resolver           artifact resolver used to resolve artifacts
      */
-    public PomArtifactResolver(ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
-                               ArtifactResolver resolver) {
+    public PomArtifactResolver( ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
+                                ArtifactResolver resolver )
+    {
         this.localRepository = localRepository;
         this.remoteRepositories = remoteRepositories;
         this.resolver = resolver;
@@ -66,16 +68,23 @@
      * @param artifact the artifact to resolve
      * @throws IOException if there is a problem resolving the artifact
      */
-    public void resolve(Artifact artifact) throws IOException {
-        File artifactFile = new File(localRepository.getBasedir(), localRepository.pathOf(artifact));
-        artifact.setFile(artifactFile);
+    public void resolve( Artifact artifact )
+        throws IOException
+    {
+        File artifactFile = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) );
+        artifact.setFile( artifactFile );
 
-        try {
+        try
+        {
             resolver.resolve( artifact, remoteRepositories, localRepository );
-        } catch (ArtifactResolutionException e) {
-            throw new IOException(e.getMessage());
-        } catch (ArtifactNotFoundException e) {
-            throw new IOException(e.getMessage());
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new IOException( e.getMessage() );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new IOException( e.getMessage() );
         }
     }
 }

Modified: maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java?rev=678212&r1=678211&r2=678212&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java Sat Jul 19 13:06:40 2008
@@ -34,7 +34,9 @@
 /**
  * Provides a wrapper for the maven model.
  */
-public final class PomClassicDomainModel implements InputStreamDomainModel {
+public final class PomClassicDomainModel
+    implements InputStreamDomainModel
+{
 
     private byte[] inputBytes;
 
@@ -51,9 +53,12 @@
      * @param model maven model
      * @throws IOException if there is a problem constructing the model
      */
-    public PomClassicDomainModel(Model model) throws IOException {
-        if (model == null) {
-            throw new IllegalArgumentException("model: null");
+    public PomClassicDomainModel( Model model )
+        throws IOException
+    {
+        if ( model == null )
+        {
+            throw new IllegalArgumentException( "model: null" );
         }
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         Writer out = WriterFactory.newXmlWriter( baos );
@@ -69,11 +74,14 @@
      * @param inputStream input stream of the maven model
      * @throws IOException if there is a problem constructing the model
      */
-    public PomClassicDomainModel(InputStream inputStream) throws IOException {
-        if (inputStream == null) {
-            throw new IllegalArgumentException("inputStream: null");
+    public PomClassicDomainModel( InputStream inputStream )
+        throws IOException
+    {
+        if ( inputStream == null )
+        {
+            throw new IllegalArgumentException( "inputStream: null" );
         }
-        this.inputBytes = IOUtil.toByteArray(inputStream);
+        this.inputBytes = IOUtil.toByteArray( inputStream );
     }
 
 
@@ -83,50 +91,64 @@
      *
      * @param a model to compare
      * @return true if groupId.equals(a.groupId) && artifactId.equals(a.artifactId) && version.equals(a.version),
-     * otherwise returns false.
+     *         otherwise returns false.
      */
-    public boolean matchesModel(Model a) {
-        if(a == null) {
-            throw new IllegalArgumentException("a: null");
+    public boolean matchesModel( Model a )
+    {
+        if ( a == null )
+        {
+            throw new IllegalArgumentException( "a: null" );
         }
-        if(model == null) {
-            try {
+        if ( model == null )
+        {
+            try
+            {
                 model = getModel();
-            } catch (IOException e) {
+            }
+            catch ( IOException e )
+            {
                 return false;
             }
         }
 
-        String groupId = (model.getGroupId() == null) ? model.getParent().getGroupId() : model.getGroupId();
-        String artifactId = (model.getArtifactId() == null) ? model.getParent().getArtifactId() : model.getArtifactId();
-        String version = (model.getVersion() == null) ? model.getParent().getVersion() : model.getVersion();
+        String groupId = ( model.getGroupId() == null ) ? model.getParent().getGroupId() : model.getGroupId();
+        String artifactId =
+            ( model.getArtifactId() == null ) ? model.getParent().getArtifactId() : model.getArtifactId();
+        String version = ( model.getVersion() == null ) ? model.getParent().getVersion() : model.getVersion();
 
-        String aGroupId = (a.getGroupId() == null) ? a.getParent().getGroupId() : a.getGroupId();
-        String aArtifactId = (a.getArtifactId() == null) ? a.getParent().getArtifactId() : a.getArtifactId();
-        String aVersion = (a.getVersion() == null) ? a.getParent().getVersion() : a.getVersion();
+        String aGroupId = ( a.getGroupId() == null ) ? a.getParent().getGroupId() : a.getGroupId();
+        String aArtifactId = ( a.getArtifactId() == null ) ? a.getParent().getArtifactId() : a.getArtifactId();
+        String aVersion = ( a.getVersion() == null ) ? a.getParent().getVersion() : a.getVersion();
 
-        return groupId.equals(aGroupId) && artifactId.equals(aArtifactId) && version.equals(aVersion);
+        return groupId.equals( aGroupId ) && artifactId.equals( aArtifactId ) && version.equals( aVersion );
     }
 
 
-    public boolean matchesParent(Parent parent) {
-        if(parent == null) {
-            throw new IllegalArgumentException("parent: null");
+    public boolean matchesParent( Parent parent )
+    {
+        if ( parent == null )
+        {
+            throw new IllegalArgumentException( "parent: null" );
         }
-        if(model == null) {
-            try {
+        if ( model == null )
+        {
+            try
+            {
                 model = getModel();
-            } catch (IOException e) {
+            }
+            catch ( IOException e )
+            {
                 return false;
             }
         }
 
-        String groupId = (model.getGroupId() == null) ? model.getParent().getGroupId() : model.getGroupId();
-        String artifactId = (model.getArtifactId() == null) ? model.getParent().getArtifactId() : model.getArtifactId();
-        String version = (model.getVersion() == null) ? model.getParent().getVersion() : model.getVersion();
+        String groupId = ( model.getGroupId() == null ) ? model.getParent().getGroupId() : model.getGroupId();
+        String artifactId =
+            ( model.getArtifactId() == null ) ? model.getParent().getArtifactId() : model.getArtifactId();
+        String version = ( model.getVersion() == null ) ? model.getParent().getVersion() : model.getVersion();
 
-        return (parent.getGroupId().equals(groupId) && parent.getArtifactId().equals(artifactId)
-                && parent.getVersion().equals(version));
+        return ( parent.getGroupId().equals( groupId ) && parent.getArtifactId().equals( artifactId ) &&
+            parent.getVersion().equals( version ) );
     }
 
     /**
@@ -134,7 +156,8 @@
      *
      * @return XML model as string
      */
-    public String asString() {
+    public String asString()
+    {
         try
         {
             return IOUtil.toString( ReaderFactory.newXmlReader( new ByteArrayInputStream( inputBytes ) ) );
@@ -151,41 +174,50 @@
      *
      * @return maven model
      */
-    public Model getModel() throws IOException {
-        if(model != null) {
+    public Model getModel()
+        throws IOException
+    {
+        if ( model != null )
+        {
             return model;
         }
-        try {
-            return new MavenXpp3Reader().read(ReaderFactory.newXmlReader(new ByteArrayInputStream( inputBytes )) );
+        try
+        {
+            return new MavenXpp3Reader().read( ReaderFactory.newXmlReader( new ByteArrayInputStream( inputBytes ) ) );
         }
-        catch (XmlPullParserException e) {
+        catch ( XmlPullParserException e )
+        {
             e.printStackTrace();
-            throw new IOException(e.getMessage());
+            throw new IOException( e.getMessage() );
         }
     }
 
     /**
      * @see org.apache.maven.shared.model.InputStreamDomainModel#getInputStream()
      */
-    public InputStream getInputStream() {
+    public InputStream getInputStream()
+    {
         byte[] copy = new byte[inputBytes.length];
-        System.arraycopy(inputBytes, 0, copy, 0, inputBytes.length);
-        return new ByteArrayInputStream(copy);
+        System.arraycopy( inputBytes, 0, copy, 0, inputBytes.length );
+        return new ByteArrayInputStream( copy );
     }
 
     /**
      * @see org.apache.maven.shared.model.DomainModel#getEventHistory()
      */
-    public String getEventHistory() {
+    public String getEventHistory()
+    {
         return eventHistory;
     }
 
     /**
      * @see org.apache.maven.shared.model.DomainModel#setEventHistory(String)
      */
-    public void setEventHistory(String eventHistory) {
-        if(eventHistory == null) {
-            throw new IllegalArgumentException("eventHistory: null");
+    public void setEventHistory( String eventHistory )
+    {
+        if ( eventHistory == null )
+        {
+            throw new IllegalArgumentException( "eventHistory: null" );
         }
         this.eventHistory = eventHistory;
     }
@@ -196,8 +228,9 @@
      * @param o domain model
      * @return true if this.asString.equals(o.asString()), otherwise false.
      */
-    public boolean equals(Object o) {
-        return o instanceof PomClassicDomainModel && this.asString().equals(((PomClassicDomainModel) o).asString());
+    public boolean equals( Object o )
+    {
+        return o instanceof PomClassicDomainModel && this.asString().equals( ( (PomClassicDomainModel) o ).asString() );
     }
 
 }

Modified: maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java?rev=678212&r1=678211&r2=678212&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java Sat Jul 19 13:06:40 2008
@@ -31,7 +31,9 @@
 /**
  * Provides methods for transforming model properties into a domain model for the pom classic format and vice versa.
  */
-public final class PomClassicTransformer implements ModelTransformer {
+public final class PomClassicTransformer
+    implements ModelTransformer
+{
 
     /**
      * The URIs this tranformer supports
@@ -41,99 +43,109 @@
     /**
      * Default constructor
      */
-    public PomClassicTransformer() {
-        this.uris = new HashSet<String>(Arrays.asList(
-                ProjectUri.Build.Extensions.xUri,
-                ProjectUri.Build.PluginManagement.Plugins.xUri,
-                ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
-                ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
-                ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.xUri,
-                ProjectUri.Build.Plugins.xUri,
-                ProjectUri.Build.Plugins.Plugin.configuration,
-                ProjectUri.Build.Plugins.Plugin.Dependencies.xUri,
-                ProjectUri.Build.Plugins.Plugin.Executions.xUri,
-                ProjectUri.Build.Resources.xUri,
-                ProjectUri.Build.Resources.Resource.includes,
-                ProjectUri.Build.Resources.Resource.excludes,
-                ProjectUri.Build.TestResources.xUri,
-   
-                ProjectUri.CiManagement.Notifiers.xUri,
-
-                ProjectUri.Contributors.xUri,
-
-                ProjectUri.Dependencies.xUri,
-                ProjectUri.Dependencies.Dependency.Exclusions.xUri,
-
-                ProjectUri.DependencyManagement.Dependencies.xUri,
-                ProjectUri.DependencyManagement.Dependencies.Dependency.Exclusions.xUri,
-
-                ProjectUri.Developers.xUri,
-                ProjectUri.Developers.Developer.roles,
-                ProjectUri.Licenses.xUri,
-                ProjectUri.MailingLists.xUri,
-                ProjectUri.Modules.xUri,
-                ProjectUri.PluginRepositories.xUri,
-
-                ProjectUri.Profiles.xUri,
-                ProjectUri.Profiles.Profile.Build.Plugins.xUri,
-                ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Dependencies.xUri,
-                ProjectUri.Profiles.Profile.Build.Resources.xUri,
-                ProjectUri.Profiles.Profile.Build.TestResources.xUri,
-                ProjectUri.Profiles.Profile.Dependencies.xUri,
-                ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri,
-                ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri,
-                ProjectUri.Profiles.Profile.PluginRepositories.xUri,
-                ProjectUri.Profiles.Profile.Reporting.Plugins.xUri,
-                ProjectUri.Profiles.Profile.Repositories.xUri,
-
-                ProjectUri.Reporting.Plugins.xUri,
-                ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri,
-
-                ProjectUri.Repositories.xUri,
-
-                "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies#collection",
-                "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection",
-                "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/executions#collection",
-                "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins#collection",
-                "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies/dependency/exclusions#collection",
-                "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies/dependency/exclusions#collection",
-                "http://apache.org/maven/project/profiles/profile/reporting/plugins/plugin/reportSets#collection",
-                "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/executions#collection"
-        ));
+    public PomClassicTransformer()
+    {
+        this.uris = new HashSet<String>( Arrays.asList( ProjectUri.Build.Extensions.xUri,
+                                                        ProjectUri.Build.PluginManagement.Plugins.xUri,
+                                                        ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
+                                                        ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
+                                                        ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.xUri,
+                                                        ProjectUri.Build.Plugins.xUri,
+                                                        ProjectUri.Build.Plugins.Plugin.configuration,
+                                                        ProjectUri.Build.Plugins.Plugin.Dependencies.xUri,
+                                                        ProjectUri.Build.Plugins.Plugin.Executions.xUri,
+                                                        ProjectUri.Build.Resources.xUri,
+                                                        ProjectUri.Build.Resources.Resource.includes,
+                                                        ProjectUri.Build.Resources.Resource.excludes,
+                                                        ProjectUri.Build.TestResources.xUri,
+
+                                                        ProjectUri.CiManagement.Notifiers.xUri,
+
+                                                        ProjectUri.Contributors.xUri,
+
+                                                        ProjectUri.Dependencies.xUri,
+                                                        ProjectUri.Dependencies.Dependency.Exclusions.xUri,
+
+                                                        ProjectUri.DependencyManagement.Dependencies.xUri,
+                                                        ProjectUri.DependencyManagement.Dependencies.Dependency.Exclusions.xUri,
+
+                                                        ProjectUri.Developers.xUri,
+                                                        ProjectUri.Developers.Developer.roles, ProjectUri.Licenses.xUri,
+                                                        ProjectUri.MailingLists.xUri, ProjectUri.Modules.xUri,
+                                                        ProjectUri.PluginRepositories.xUri,
+
+                                                        ProjectUri.Profiles.xUri,
+                                                        ProjectUri.Profiles.Profile.Build.Plugins.xUri,
+                                                        ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Dependencies.xUri,
+                                                        ProjectUri.Profiles.Profile.Build.Resources.xUri,
+                                                        ProjectUri.Profiles.Profile.Build.TestResources.xUri,
+                                                        ProjectUri.Profiles.Profile.Dependencies.xUri,
+                                                        ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri,
+                                                        ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri,
+                                                        ProjectUri.Profiles.Profile.PluginRepositories.xUri,
+                                                        ProjectUri.Profiles.Profile.Reporting.Plugins.xUri,
+                                                        ProjectUri.Profiles.Profile.Repositories.xUri,
+
+                                                        ProjectUri.Reporting.Plugins.xUri,
+                                                        ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri,
+
+                                                        ProjectUri.Repositories.xUri,
+
+                                                        "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/executions#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies/dependency/exclusions#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies/dependency/exclusions#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/reporting/plugins/plugin/reportSets#collection",
+                                                        "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/executions#collection" ) );
     }
 
     /**
      * @see ModelTransformer#transformToDomainModel(java.util.List)
      */
-    public DomainModel transformToDomainModel(List<ModelProperty> properties) throws IOException {
-        if (properties == null) {
-            throw new IllegalArgumentException("properties: null");
+    public DomainModel transformToDomainModel( List<ModelProperty> properties )
+        throws IOException
+    {
+        if ( properties == null )
+        {
+            throw new IllegalArgumentException( "properties: null" );
         }
 
         List<ModelProperty> props = new ArrayList<ModelProperty>();
-        for (ModelProperty mp : properties) { //TODO: Resolved values
-            if (mp.getValue() != null && (mp.getValue().contains("=") || mp.getValue().contains("<"))) {
-                props.add(new ModelProperty(mp.getUri(), "<![CDATA[" + mp.getValue() + "]]>"));
-            } else {
-                props.add(mp);
+        for ( ModelProperty mp : properties )
+        { //TODO: Resolved values
+            if ( mp.getValue() != null && ( mp.getValue().contains( "=" ) || mp.getValue().contains( "<" ) ) )
+            {
+                props.add( new ModelProperty( mp.getUri(), "<![CDATA[" + mp.getValue() + "]]>" ) );
+            }
+            else
+            {
+                props.add( mp );
             }
         }
 
         String xml = null;
-        try {
-            xml = ModelMarshaller.unmarshalModelPropertiesToXml(props, ProjectUri.baseUri);
-            return new PomClassicDomainModel(new MavenXpp3Reader().read(new StringReader(xml)));
-        } catch (XmlPullParserException e) {
-            throw new IOException(e + ":\r\n" + xml);
+        try
+        {
+            xml = ModelMarshaller.unmarshalModelPropertiesToXml( props, ProjectUri.baseUri );
+            return new PomClassicDomainModel( new MavenXpp3Reader().read( new StringReader( xml ) ) );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new IOException( e + ":\r\n" + xml );
         }
     }
 
     /**
      * @see ModelTransformer#transformToModelProperties(java.util.List)
      */
-    public List<ModelProperty> transformToModelProperties(List<DomainModel> domainModels) throws IOException {
-        if (domainModels == null || domainModels.isEmpty()) {
-            throw new IllegalArgumentException("domainModels: null or empty");
+    public List<ModelProperty> transformToModelProperties( List<DomainModel> domainModels )
+        throws IOException
+    {
+        if ( domainModels == null || domainModels.isEmpty() )
+        {
+            throw new IllegalArgumentException( "domainModels: null or empty" );
         }
 
         List<ModelProperty> modelProperties = new ArrayList<ModelProperty>();
@@ -141,55 +153,70 @@
         StringBuffer scmUrl = new StringBuffer();
         StringBuffer scmConnectionUrl = new StringBuffer();
         StringBuffer scmDeveloperUrl = new StringBuffer();
-        for (DomainModel domainModel : domainModels) {
-            if (!(domainModel instanceof PomClassicDomainModel)) {
-                throw new IllegalArgumentException("domainModels: Invalid domain model");
+        for ( DomainModel domainModel : domainModels )
+        {
+            if ( !( domainModel instanceof PomClassicDomainModel ) )
+            {
+                throw new IllegalArgumentException( "domainModels: Invalid domain model" );
             }
 
             List<ModelProperty> tmp = ModelMarshaller.marshallXmlToModelProperties(
-                    ((PomClassicDomainModel) domainModel).getInputStream(), ProjectUri.baseUri, uris);
+                ( (PomClassicDomainModel) domainModel ).getInputStream(), ProjectUri.baseUri, uris );
             List clearedProperties = new ArrayList<ModelProperty>();
 
             //Missing Version Rule
-            if (getPropertyFor(ProjectUri.version, tmp) == null) {
-                ModelProperty parentVersion = getPropertyFor(ProjectUri.Parent.version, tmp);
-                if(parentVersion != null) {
-                    tmp.add(new ModelProperty(ProjectUri.version, parentVersion.getValue()));
+            if ( getPropertyFor( ProjectUri.version, tmp ) == null )
+            {
+                ModelProperty parentVersion = getPropertyFor( ProjectUri.Parent.version, tmp );
+                if ( parentVersion != null )
+                {
+                    tmp.add( new ModelProperty( ProjectUri.version, parentVersion.getValue() ) );
                 }
             }
 
             //Modules Not Inherited Rule
-            if (domainModels.indexOf(domainModel) != 0) {
-                ModelProperty modulesProperty = getPropertyFor(ProjectUri.Modules.xUri, tmp);
-                if (modulesProperty != null) {
-                    tmp.remove(modulesProperty);
-                    tmp.removeAll(getPropertiesFor(ProjectUri.Modules.module, tmp));
+            if ( domainModels.indexOf( domainModel ) != 0 )
+            {
+                ModelProperty modulesProperty = getPropertyFor( ProjectUri.Modules.xUri, tmp );
+                if ( modulesProperty != null )
+                {
+                    tmp.remove( modulesProperty );
+                    tmp.removeAll( getPropertiesFor( ProjectUri.Modules.module, tmp ) );
                 }
             }
 
             //Missing groupId, use parent one Rule
-            if (getPropertyFor(ProjectUri.groupId, tmp) == null) {
-                ModelProperty parentGroupId = getPropertyFor(ProjectUri.Parent.groupId, tmp);
-                if(parentGroupId != null) {
-                    tmp.add(new ModelProperty(ProjectUri.groupId, parentGroupId.getValue()));   
+            if ( getPropertyFor( ProjectUri.groupId, tmp ) == null )
+            {
+                ModelProperty parentGroupId = getPropertyFor( ProjectUri.Parent.groupId, tmp );
+                if ( parentGroupId != null )
+                {
+                    tmp.add( new ModelProperty( ProjectUri.groupId, parentGroupId.getValue() ) );
                 }
 
             }
 
             //Not inherited plugin execution rule            
-            if (domainModels.indexOf(domainModel) > 0) {
+            if ( domainModels.indexOf( domainModel ) > 0 )
+            {
                 List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
                 ModelDataSource source = new DefaultModelDataSource();
-                source.init(tmp, Arrays.asList(new ArtifactModelContainerFactory(), new IdModelContainerFactory()));
-                List<ModelContainer> containers = source.queryFor(ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri);
-                for (ModelContainer container : containers) {
-                    for (ModelProperty mp : container.getProperties()) {
-                        if (mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.Execution.inherited)
-                                && mp.getValue() != null && mp.getValue().equals("false")) {
-                            removeProperties.addAll(container.getProperties());
-                            for (int j = tmp.indexOf(mp); j >= 0; j--) {
-                                if (tmp.get(j).getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.xUri)) {
-                                    removeProperties.add(tmp.get(j));
+                source.init( tmp, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
+                List<ModelContainer> containers =
+                    source.queryFor( ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri );
+                for ( ModelContainer container : containers )
+                {
+                    for ( ModelProperty mp : container.getProperties() )
+                    {
+                        if ( mp.getUri().equals( ProjectUri.Build.Plugins.Plugin.Executions.Execution.inherited ) &&
+                            mp.getValue() != null && mp.getValue().equals( "false" ) )
+                        {
+                            removeProperties.addAll( container.getProperties() );
+                            for ( int j = tmp.indexOf( mp ); j >= 0; j-- )
+                            {
+                                if ( tmp.get( j ).getUri().equals( ProjectUri.Build.Plugins.Plugin.Executions.xUri ) )
+                                {
+                                    removeProperties.add( tmp.get( j ) );
                                     break;
                                 }
                             }
@@ -197,23 +224,29 @@
                         }
                     }
                 }
-                tmp.removeAll(removeProperties);
+                tmp.removeAll( removeProperties );
             }
 
             //Not inherited plugin rule
-            if (domainModels.indexOf(domainModel) > 0) {
+            if ( domainModels.indexOf( domainModel ) > 0 )
+            {
                 List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
                 ModelDataSource source = new DefaultModelDataSource();
-                source.init(tmp, Arrays.asList(new ArtifactModelContainerFactory(), new IdModelContainerFactory()));
-                List<ModelContainer> containers = source.queryFor(ProjectUri.Build.Plugins.Plugin.xUri);
-                for (ModelContainer container : containers) {
-                    for (ModelProperty mp : container.getProperties()) {
-                        if (mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.inherited)
-                                && mp.getValue() != null && mp.getValue().equals("false")) {
-                            removeProperties.addAll(container.getProperties());
-                            for (int j = tmp.indexOf(mp); j >= 0; j--) {
-                                if (tmp.get(j).getUri().equals(ProjectUri.Build.Plugins.Plugin.xUri)) {
-                                    removeProperties.add(tmp.get(j));
+                source.init( tmp, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
+                List<ModelContainer> containers = source.queryFor( ProjectUri.Build.Plugins.Plugin.xUri );
+                for ( ModelContainer container : containers )
+                {
+                    for ( ModelProperty mp : container.getProperties() )
+                    {
+                        if ( mp.getUri().equals( ProjectUri.Build.Plugins.Plugin.inherited ) && mp.getValue() != null &&
+                            mp.getValue().equals( "false" ) )
+                        {
+                            removeProperties.addAll( container.getProperties() );
+                            for ( int j = tmp.indexOf( mp ); j >= 0; j-- )
+                            {
+                                if ( tmp.get( j ).getUri().equals( ProjectUri.Build.Plugins.Plugin.xUri ) )
+                                {
+                                    removeProperties.add( tmp.get( j ) );
                                     break;
                                 }
                             }
@@ -221,100 +254,118 @@
                         }
                     }
                 }
-                tmp.removeAll(removeProperties);
+                tmp.removeAll( removeProperties );
             }
 
-
             //SCM Rule
-            ModelProperty scmUrlProperty = getPropertyFor(ProjectUri.Scm.url, tmp);
-            if (scmUrl.length() == 0 && scmUrlProperty != null) {
-                scmUrl.append(scmUrlProperty.getValue());
-                for (String projectName : projectNames) {
-                    scmUrl.append("/").append(projectName);
-                }
-                int index = tmp.indexOf(scmUrlProperty);
-                tmp.remove(index);
-                tmp.add(index, new ModelProperty(ProjectUri.Scm.url, scmUrl.toString()));
+            ModelProperty scmUrlProperty = getPropertyFor( ProjectUri.Scm.url, tmp );
+            if ( scmUrl.length() == 0 && scmUrlProperty != null )
+            {
+                scmUrl.append( scmUrlProperty.getValue() );
+                for ( String projectName : projectNames )
+                {
+                    scmUrl.append( "/" ).append( projectName );
+                }
+                int index = tmp.indexOf( scmUrlProperty );
+                tmp.remove( index );
+                tmp.add( index, new ModelProperty( ProjectUri.Scm.url, scmUrl.toString() ) );
             }
 
             //SCM Connection Rule
-            scmUrlProperty = getPropertyFor(ProjectUri.Scm.connection, tmp);
-            if (scmConnectionUrl.length() == 0 && scmUrlProperty != null) {
-                scmConnectionUrl.append(scmUrlProperty.getValue());
-                for (String projectName : projectNames) {
-                    scmConnectionUrl.append("/").append(projectName);
-                }
-                int index = tmp.indexOf(scmUrlProperty);
-                tmp.remove(index);
-                tmp.add(index, new ModelProperty(ProjectUri.Scm.connection, scmConnectionUrl.toString()));
+            scmUrlProperty = getPropertyFor( ProjectUri.Scm.connection, tmp );
+            if ( scmConnectionUrl.length() == 0 && scmUrlProperty != null )
+            {
+                scmConnectionUrl.append( scmUrlProperty.getValue() );
+                for ( String projectName : projectNames )
+                {
+                    scmConnectionUrl.append( "/" ).append( projectName );
+                }
+                int index = tmp.indexOf( scmUrlProperty );
+                tmp.remove( index );
+                tmp.add( index, new ModelProperty( ProjectUri.Scm.connection, scmConnectionUrl.toString() ) );
             }
 
             //SCM Developer Rule
-            scmUrlProperty = getPropertyFor(ProjectUri.Scm.developerConnection, tmp);
-            if (scmDeveloperUrl.length() == 0 && scmUrlProperty != null) {
-                scmDeveloperUrl.append(scmUrlProperty.getValue());
-                for (String projectName : projectNames) {
-                    scmDeveloperUrl.append("/").append(projectName);
-                }
-                int index = tmp.indexOf(scmUrlProperty);
-                tmp.remove(index);
-                tmp.add(index, new ModelProperty(ProjectUri.Scm.developerConnection, scmDeveloperUrl.toString()));
+            scmUrlProperty = getPropertyFor( ProjectUri.Scm.developerConnection, tmp );
+            if ( scmDeveloperUrl.length() == 0 && scmUrlProperty != null )
+            {
+                scmDeveloperUrl.append( scmUrlProperty.getValue() );
+                for ( String projectName : projectNames )
+                {
+                    scmDeveloperUrl.append( "/" ).append( projectName );
+                }
+                int index = tmp.indexOf( scmUrlProperty );
+                tmp.remove( index );
+                tmp.add( index, new ModelProperty( ProjectUri.Scm.developerConnection, scmDeveloperUrl.toString() ) );
             }
 
             //Remove Plugin Repository Inheritance Rule
-            for(ModelProperty mp : tmp) {
-                if(domainModels.indexOf(domainModel) > 0 && mp.getUri().startsWith(ProjectUri.PluginRepositories.xUri)){
-                    clearedProperties.add(mp);
+            for ( ModelProperty mp : tmp )
+            {
+                if ( domainModels.indexOf( domainModel ) > 0 &&
+                    mp.getUri().startsWith( ProjectUri.PluginRepositories.xUri ) )
+                {
+                    clearedProperties.add( mp );
                 }
             }
 
             //Project Name Inheritance Rule
-             for(ModelProperty mp : tmp) {
-                if(domainModels.indexOf(domainModel) > 0 && mp.getUri().equals(ProjectUri.name)){
-                    clearedProperties.add(mp);
+            for ( ModelProperty mp : tmp )
+            {
+                if ( domainModels.indexOf( domainModel ) > 0 && mp.getUri().equals( ProjectUri.name ) )
+                {
+                    clearedProperties.add( mp );
                     break;
                 }
             }
 
             //Packaging Inheritance Rule
-             for(ModelProperty mp : tmp) {
-                if(domainModels.indexOf(domainModel) > 0 && mp.getUri().equals(ProjectUri.packaging)){
-                    clearedProperties.add(mp);
+            for ( ModelProperty mp : tmp )
+            {
+                if ( domainModels.indexOf( domainModel ) > 0 && mp.getUri().equals( ProjectUri.packaging ) )
+                {
+                    clearedProperties.add( mp );
                     break;
                 }
             }
 
             //Build Resources Inheritence Rule
-             for(ModelProperty mp : tmp) {
-                if(domainModels.indexOf(domainModel) > 0 && mp.getUri().startsWith(ProjectUri.Build.Resources.xUri)){
-                    clearedProperties.add(mp);
+            for ( ModelProperty mp : tmp )
+            {
+                if ( domainModels.indexOf( domainModel ) > 0 &&
+                    mp.getUri().startsWith( ProjectUri.Build.Resources.xUri ) )
+                {
+                    clearedProperties.add( mp );
                 }
             }
 
             //Build Test Resources Inheritance Rule
-            for(ModelProperty mp : tmp) {
-               if(domainModels.indexOf(domainModel) > 0 && mp.getUri().startsWith(ProjectUri.Build.TestResources.xUri)){
-                   clearedProperties.add(mp);
-               }
+            for ( ModelProperty mp : tmp )
+            {
+                if ( domainModels.indexOf( domainModel ) > 0 &&
+                    mp.getUri().startsWith( ProjectUri.Build.TestResources.xUri ) )
+                {
+                    clearedProperties.add( mp );
+                }
             }
 
             //Profiles not inherited rule
-            for(ModelProperty mp : tmp) {
-               if(domainModels.indexOf(domainModel) > 0 && mp.getUri().startsWith(ProjectUri.Profiles.xUri)){
-                   clearedProperties.add(mp);
-               }
+            for ( ModelProperty mp : tmp )
+            {
+                if ( domainModels.indexOf( domainModel ) > 0 && mp.getUri().startsWith( ProjectUri.Profiles.xUri ) )
+                {
+                    clearedProperties.add( mp );
+                }
             }
 
-                      
-            ModelProperty artifactId = getPropertyFor(ProjectUri.artifactId, tmp);
-            if(artifactId != null) {
-                projectNames.add(0, artifactId.getValue());
+            ModelProperty artifactId = getPropertyFor( ProjectUri.artifactId, tmp );
+            if ( artifactId != null )
+            {
+                projectNames.add( 0, artifactId.getValue() );
             }
 
-            tmp.removeAll(clearedProperties);
-            modelProperties.addAll(tmp);
-
-
+            tmp.removeAll( clearedProperties );
+            modelProperties.addAll( tmp );
 
             //Remove Parent Info
             /*
@@ -333,22 +384,26 @@
      *
      * @return Returns the base uri of all model properties: http://apache.org/maven/project/
      */
-    public String getBaseUri() {
+    public String getBaseUri()
+    {
         return ProjectUri.baseUri;
     }
 
     /**
      * Returns all model properties containing the specified uri from the specified properties list.
      *
-     * @param uri the uri to use in finding the returned model properties
+     * @param uri        the uri to use in finding the returned model properties
      * @param properties the model properties list to search
      * @return all model properties containing the specified uri from the specified properties list
      */
-    private static List<ModelProperty> getPropertiesFor(String uri, List<ModelProperty> properties) {
+    private static List<ModelProperty> getPropertiesFor( String uri, List<ModelProperty> properties )
+    {
         List<ModelProperty> modelProperties = new ArrayList<ModelProperty>();
-        for (ModelProperty mp : properties) {
-            if (uri.equals(mp.getUri())) {
-                modelProperties.add(mp);
+        for ( ModelProperty mp : properties )
+        {
+            if ( uri.equals( mp.getUri() ) )
+            {
+                modelProperties.add( mp );
             }
         }
         return modelProperties;
@@ -358,13 +413,16 @@
     /**
      * Returns the first model property containing the specified uri from the specified properties list.
      *
-     * @param uri the uri to use in finding the returned model property
+     * @param uri        the uri to use in finding the returned model property
      * @param properties the model properties list to search
      * @return the first model property containing the specified uri from the specified properties list.
      */
-    private static ModelProperty getPropertyFor(String uri, List<ModelProperty> properties) {
-        for (ModelProperty mp : properties) {
-            if (uri.equals(mp.getUri())) {
+    private static ModelProperty getPropertyFor( String uri, List<ModelProperty> properties )
+    {
+        for ( ModelProperty mp : properties )
+        {
+            if ( uri.equals( mp.getUri() ) )
+            {
                 return mp;
             }
         }

Modified: maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java?rev=678212&r1=678211&r2=678212&view=diff
==============================================================================
--- maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java (original)
+++ maven/sandbox/branches/SI_MAVEN_2_1_A/maven-project/src/main/java/org/apache/maven/project/builder/ProjectBuilder.java Sat Jul 19 13:06:40 2008
@@ -29,13 +29,14 @@
 import java.util.Collection;
 import java.util.List;
 
-public interface ProjectBuilder {
+public interface ProjectBuilder
+{
 
     String ROLE = ProjectBuilder.class.getName();
 
-    MavenProject buildFromLocalPath(InputStream pom, List<Model> inheritedModels,
-                                    Collection<InterpolatorProperty> interpolatorProperties,
-                                    PomArtifactResolver resolver, File baseDirectory)
-            throws IOException;
+    MavenProject buildFromLocalPath( InputStream pom, List<Model> inheritedModels,
+                                     Collection<InterpolatorProperty> interpolatorProperties,
+                                     PomArtifactResolver resolver, File baseDirectory )
+        throws IOException;
 
 }