maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r778494 - in /maven/components/branches/MNG-2766: maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java maven-model/src/main/mdo/maven.mdo
Date Mon, 25 May 2009 20:43:01 GMT
Author: bentmann
Date: Mon May 25 20:43:01 2009
New Revision: 778494

URL: http://svn.apache.org/viewvc?rev=778494&view=rev
Log:
o Extended model with fields to track source file and project directory

Modified:
    maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
    maven/components/branches/MNG-2766/maven-model/src/main/mdo/maven.mdo

Modified: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java?rev=778494&r1=778493&r2=778494&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
(original)
+++ maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
Mon May 25 20:43:01 2009
@@ -50,7 +50,11 @@
             throw new IllegalArgumentException( "input file missing" );
         }
 
-        return read( ReaderFactory.newXmlReader( input ), options );
+        Model model = read( ReaderFactory.newXmlReader( input ), options );
+
+        model.setPomFile( input );
+
+        return model;
     }
 
     public Model read( Reader input, Map<String, Object> options )

Modified: maven/components/branches/MNG-2766/maven-model/src/main/mdo/maven.mdo
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-model/src/main/mdo/maven.mdo?rev=778494&r1=778493&r2=778494&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-model/src/main/mdo/maven.mdo (original)
+++ maven/components/branches/MNG-2766/maven-model/src/main/mdo/maven.mdo Mon May 25 20:43:01
2009
@@ -567,22 +567,66 @@
           <code>
             <![CDATA[
     /**
+     * The POM from which this model originated. This is transient runtime state and therefore
not managed by Modello.
+     */
+    private java.io.File pomFile;
+
+    /**
+     * Gets the POM file from which this model originated. This can either be a {@code pom.xml}
of some project being
+     * built or the {@code *.pom} of some artifact being resolved from the repository.
+     * 
+     * @return The POM file from which this model originated or {@code null} if unknown.
+     */
+    public java.io.File getPomFile()
+    {
+        return pomFile;
+    }
+
+    public void setPomFile( java.io.File pomFile )
+    {
+        this.pomFile = pomFile;
+    }
+
+    /**
+     * The base directory for the corresponding project (if any). This is transient runtime
state and therefore not
+     * managed by Modello.
+     */
+    private java.io.File projectDirectory;
+
+    /**
+     * Gets the base directory for the corresponding project (if any). Note that this is
really a separate piece of
+     * information and not necessarily equivalent to the parent directory of {@link #getPomFile()}.
+     * 
+     * @return The base directory for the corresponding project or {@code null} if this model
does not belong to a local
+     *         project but describes the metadata of some artifact from the repository.
+     */
+    public java.io.File getProjectDirectory()
+    {
+        return projectDirectory;
+    }
+
+    public void setProjectDirectory( java.io.File projectDirectory )
+    {
+        this.projectDirectory = projectDirectory;
+    }
+
+    /**
      * @return the model id as <code>groupId:artifactId:packaging:version</code>
      */
-      public String getId()
-      {
-          StringBuffer id = new StringBuffer();
-
-          id.append( getGroupId() == null ? "[inherited]" : getGroupId() );
-          id.append( ":" );
-          id.append( getArtifactId() );
-          id.append( ":" );
-          id.append( getPackaging() );
-          id.append( ":" );
-          id.append( getVersion() == null ? "[inherited]" : getVersion() );
+    public String getId()
+    {
+        StringBuilder id = new StringBuilder( 64 );
 
-          return id.toString();
-      }
+        id.append( ( getGroupId() == null ) ? "[inherited]" : getGroupId() );
+        id.append( ":" );
+        id.append( getArtifactId() );
+        id.append( ":" );
+        id.append( getPackaging() );
+        id.append( ":" );
+        id.append( ( getVersion() == null ) ? "[inherited]" : getVersion() );
+
+        return id.toString();
+    }
 
     @Override
     public String toString()
@@ -1878,7 +1922,7 @@
      */
     public String toString()
     {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder( 128 );
 
         sb.append("PatternSet [includes: {");
         for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
@@ -1963,14 +2007,13 @@
      */
     public String getId()
     {
-        StringBuffer id = new StringBuffer();
+        StringBuilder id = new StringBuilder( 64 );
 
         id.append( getGroupId() );
         id.append( ":" );
         id.append( getArtifactId() );
         id.append( ":" );
         id.append( "pom" );
-      //  id.append( getPackaging() );
         id.append( ":" );
         id.append( getVersion() );
 



Mime
View raw message