maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r1059189 - in /maven/maven-3/trunk/maven-model/src/main: java/org/apache/maven/model/merge/ModelMerger.java mdo/maven.mdo
Date Fri, 14 Jan 2011 22:33:29 GMT
Author: bentmann
Date: Fri Jan 14 22:33:29 2011
New Revision: 1059189

URL: http://svn.apache.org/viewvc?rev=1059189&view=rev
Log:
o Unified inheritance hierarchy of POM model classes

Modified:
    maven/maven-3/trunk/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
    maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo

Modified: maven/maven-3/trunk/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java?rev=1059189&r1=1059188&r2=1059189&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
(original)
+++ maven/maven-3/trunk/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java
Fri Jan 14 22:33:29 2011
@@ -1320,8 +1320,7 @@ public class ModelMerger
     protected void mergeReportPlugin( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
                                       Map<Object, Object> context )
     {
-        mergeReportPlugin_Inherited( target, source, sourceDominant, context );
-        mergeReportPlugin_Configuration( target, source, sourceDominant, context );
+        mergeConfigurationContainer( target, source, sourceDominant, context );
         mergeReportPlugin_GroupId( target, source, sourceDominant, context );
         mergeReportPlugin_ArtifactId( target, source, sourceDominant, context );
         mergeReportPlugin_Version( target, source, sourceDominant, context );
@@ -1370,39 +1369,6 @@ public class ModelMerger
         }
     }
 
-    protected void mergeReportPlugin_Inherited( ReportPlugin target, ReportPlugin source,
boolean sourceDominant,
-                                                Map<Object, Object> context )
-    {
-        String src = source.getInherited();
-        if ( src != null )
-        {
-            if ( sourceDominant || target.getInherited() == null )
-            {
-                target.setInherited( src );
-                target.setLocation( "inherited", source.getLocation( "inherited" ) );
-            }
-        }
-    }
-
-    protected void mergeReportPlugin_Configuration( ReportPlugin target, ReportPlugin source,
boolean sourceDominant,
-                                                    Map<Object, Object> context )
-    {
-        Xpp3Dom src = (Xpp3Dom) source.getConfiguration();
-        if ( src != null )
-        {
-            Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration();
-            if ( sourceDominant || tgt == null )
-            {
-                tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt );
-            }
-            else
-            {
-                tgt = Xpp3Dom.mergeXpp3Dom( tgt, src );
-            }
-            target.setConfiguration( tgt );
-        }
-    }
-
     protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source,
boolean sourceDominant,
                                                  Map<Object, Object> context )
     {
@@ -1431,6 +1397,42 @@ public class ModelMerger
         }
     }
 
+    protected void mergeReportSet( ReportSet target, ReportSet source, boolean sourceDominant,
+                                   Map<Object, Object> context )
+    {
+        mergeConfigurationContainer( target, source, sourceDominant, context );
+        mergeReportSet_Id( target, source, sourceDominant, context );
+        mergeReportSet_Reports( target, source, sourceDominant, context );
+    }
+
+    protected void mergeReportSet_Id( ReportSet target, ReportSet source, boolean sourceDominant,
+                                      Map<Object, Object> context )
+    {
+        String src = source.getId();
+        if ( src != null )
+        {
+            if ( sourceDominant || target.getId() == null )
+            {
+                target.setId( src );
+                target.setLocation( "id", source.getLocation( "id" ) );
+            }
+        }
+    }
+
+    protected void mergeReportSet_Reports( ReportSet target, ReportSet source, boolean sourceDominant,
+                                           Map<Object, Object> context )
+    {
+        List<String> src = source.getReports();
+        if ( !src.isEmpty() )
+        {
+            List<String> tgt = target.getReports();
+            List<String> merged = new ArrayList<String>( tgt.size() + src.size()
);
+            merged.addAll( tgt );
+            merged.addAll( src );
+            target.setReports( merged );
+        }
+    }
+
     protected void mergeDependencyManagement( DependencyManagement target, DependencyManagement
source,
                                               boolean sourceDominant, Map<Object, Object>
context )
     {

Modified: maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo?rev=1059189&r1=1059188&r2=1059189&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo (original)
+++ maven/maven-3/trunk/maven-model/src/main/mdo/maven.mdo Fri Jan 14 22:33:29 2011
@@ -3261,6 +3261,7 @@
     <class xml.tagName="plugin" java.clone="deep">
       <name>ReportPlugin</name>
       <version>4.0.0</version>
+      <superClass>ConfigurationContainer</superClass>
       <description>
         <![CDATA[
         The <code>&lt;plugin&gt;</code> element contains informations
required for a report plugin.
@@ -3289,25 +3290,6 @@
           <type>String</type>
         </field>
         <field>
-          <name>inherited</name>
-          <version>4.0.0</version>
-          <type>String</type>
-          <description>
-            <![CDATA[
-            Whether the configuration in this plugin should be made available to projects
-            that inherit from this one. Note: While the type of this field is <code>String</code>
-            for technical reasons, the semantic type is actually <code>Boolean</code>.
-            Default value is <code>true</code>.
-            ]]>
-          </description>
-        </field>
-        <field>
-          <name>configuration</name>
-          <version>4.0.0</version>
-          <type>DOM</type>
-          <description>The configuration of the reporting plugin.</description>
-        </field>
-        <field>
           <name>reportSets</name>
           <version>4.0.0</version>
           <description>
@@ -3376,28 +3358,6 @@
     {
         return groupId + ":" + artifactId;
     }
-
-    public boolean isInherited()
-    {
-        return ( inherited != null ) ? Boolean.parseBoolean( inherited ) : true;
-    }
-
-    public void setInherited( boolean inherited )
-    {
-        this.inherited = String.valueOf( inherited );
-    }
-
-    private boolean inheritanceApplied = true;
-
-    public void unsetInheritanceApplied()
-    {
-        this.inheritanceApplied = false;
-    }
-
-    public boolean isInheritanceApplied()
-    {
-        return inheritanceApplied;
-    }
             ]]>
           </code>
         </codeSegment>
@@ -3406,6 +3366,7 @@
     <class java.clone="deep">
       <name>ReportSet</name>
       <version>4.0.0</version>
+      <superClass>ConfigurationContainer</superClass>
       <description>Represents a set of reports and configuration to be used to generate
them.</description>
       <fields>
         <field>
@@ -3418,18 +3379,6 @@
           <defaultValue>default</defaultValue>
         </field>
         <field>
-          <name>configuration</name>
-          <version>4.0.0</version>
-          <description>Configuration of the report to be used when generating this
set.</description>
-          <type>DOM</type>
-        </field>
-        <field>
-          <name>inherited</name>
-          <version>4.0.0</version>
-          <type>String</type>
-          <description>Whether any configuration should be propagated to child POMs.</description>
-        </field>
-        <field>
           <name>reports</name>
           <version>4.0.0</version>
           <required>true</required>
@@ -3445,18 +3394,6 @@
           <version>4.0.0</version>
           <code>
             <![CDATA[
-    private boolean inheritanceApplied = true;
-
-    public void unsetInheritanceApplied()
-    {
-        this.inheritanceApplied = false;
-    }
-
-    public boolean isInheritanceApplied()
-    {
-        return inheritanceApplied;
-    }
-
     @Override
     public String toString()
     {



Mime
View raw message