Coverage Report - org.apache.maven.plugins.shade.pom.MavenJDOMWriter
 
Classes in this File Line Coverage Branch Coverage Complexity
MavenJDOMWriter
0%
0/912
0%
0/534
4.097
MavenJDOMWriter$Counter
0%
0/8
N/A
4.097
 
 1  
 package org.apache.maven.plugins.shade.pom;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 //package org.apache.maven.model.io.jdom;
 23  
 
 24  
 //---------------------------------/
 25  
 //- Imported classes and packages -/
 26  
 //---------------------------------/
 27  
 
 28  
 import java.io.OutputStream;
 29  
 import java.io.OutputStreamWriter;
 30  
 import java.io.Writer;
 31  
 import java.util.ArrayList;
 32  
 import java.util.Collection;
 33  
 import java.util.Iterator;
 34  
 import java.util.ListIterator;
 35  
 import java.util.Map;
 36  
 
 37  
 import org.apache.maven.model.ActivationFile;
 38  
 import org.apache.maven.model.ActivationOS;
 39  
 import org.apache.maven.model.ActivationProperty;
 40  
 import org.apache.maven.model.Build;
 41  
 import org.apache.maven.model.BuildBase;
 42  
 import org.apache.maven.model.CiManagement;
 43  
 import org.apache.maven.model.ConfigurationContainer;
 44  
 import org.apache.maven.model.Contributor;
 45  
 import org.apache.maven.model.Dependency;
 46  
 import org.apache.maven.model.DependencyManagement;
 47  
 import org.apache.maven.model.DeploymentRepository;
 48  
 import org.apache.maven.model.Developer;
 49  
 import org.apache.maven.model.DistributionManagement;
 50  
 import org.apache.maven.model.Exclusion;
 51  
 import org.apache.maven.model.Extension;
 52  
 import org.apache.maven.model.FileSet;
 53  
 import org.apache.maven.model.IssueManagement;
 54  
 import org.apache.maven.model.License;
 55  
 import org.apache.maven.model.MailingList;
 56  
 import org.apache.maven.model.Model;
 57  
 import org.apache.maven.model.ModelBase;
 58  
 import org.apache.maven.model.Notifier;
 59  
 import org.apache.maven.model.Organization;
 60  
 import org.apache.maven.model.Parent;
 61  
 import org.apache.maven.model.PatternSet;
 62  
 import org.apache.maven.model.Plugin;
 63  
 import org.apache.maven.model.PluginConfiguration;
 64  
 import org.apache.maven.model.PluginContainer;
 65  
 import org.apache.maven.model.PluginExecution;
 66  
 import org.apache.maven.model.PluginManagement;
 67  
 import org.apache.maven.model.Prerequisites;
 68  
 import org.apache.maven.model.Profile;
 69  
 import org.apache.maven.model.Relocation;
 70  
 import org.apache.maven.model.ReportPlugin;
 71  
 import org.apache.maven.model.ReportSet;
 72  
 import org.apache.maven.model.Reporting;
 73  
 import org.apache.maven.model.Repository;
 74  
 import org.apache.maven.model.RepositoryBase;
 75  
 import org.apache.maven.model.RepositoryPolicy;
 76  
 import org.apache.maven.model.Resource;
 77  
 import org.apache.maven.model.Scm;
 78  
 import org.apache.maven.model.Site;
 79  
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 80  
 import org.jdom.Content;
 81  
 import org.jdom.DefaultJDOMFactory;
 82  
 import org.jdom.Document;
 83  
 import org.jdom.Element;
 84  
 import org.jdom.Text;
 85  
 import org.jdom.output.Format;
 86  
 import org.jdom.output.XMLOutputter;
 87  
 
 88  
 /**
 89  
  * Class MavenJDOMWriter.
 90  
  * 
 91  
  * @version $Revision$ $Date$
 92  
  */
 93  
 public class MavenJDOMWriter
 94  
 {
 95  
 
 96  
     // --------------------------/
 97  
     // - Class/Member Variables -/
 98  
     // --------------------------/
 99  
 
 100  
     /**
 101  
      * Field factory
 102  
      */
 103  
     private DefaultJDOMFactory factory;
 104  
 
 105  
     /**
 106  
      * Field lineSeparator
 107  
      */
 108  
     private String lineSeparator;
 109  
 
 110  
     // ----------------/
 111  
     // - Constructors -/
 112  
     // ----------------/
 113  
 
 114  
     public MavenJDOMWriter()
 115  0
     {
 116  0
         factory = new DefaultJDOMFactory();
 117  0
         lineSeparator = "\n";
 118  0
     } // -- org.apache.maven.model.io.jdom.MavenJDOMWriter()
 119  
 
 120  
     // -----------/
 121  
     // - Methods -/
 122  
     // -----------/
 123  
 
 124  
     /**
 125  
      * Method findAndReplaceProperties
 126  
      * 
 127  
      * @param counter
 128  
      * @param props
 129  
      * @param name
 130  
      * @param parent
 131  
      */
 132  
     protected Element findAndReplaceProperties( Counter counter, Element parent, String name, Map props )
 133  
     {
 134  0
         boolean shouldExist = props != null && !props.isEmpty();
 135  0
         Element element = updateElement( counter, parent, name, shouldExist );
 136  0
         if ( shouldExist )
 137  
         {
 138  0
             Iterator it = props.keySet().iterator();
 139  0
             Counter innerCounter = new Counter( counter.getDepth() + 1 );
 140  0
             while ( it.hasNext() )
 141  
             {
 142  0
                 String key = (String) it.next();
 143  0
                 findAndReplaceSimpleElement( innerCounter, element, key, (String) props.get( key ), null );
 144  0
             }
 145  0
             ArrayList lst = new ArrayList( props.keySet() );
 146  0
             it = element.getChildren().iterator();
 147  0
             while ( it.hasNext() )
 148  
             {
 149  0
                 Element elem = (Element) it.next();
 150  0
                 String key = elem.getName();
 151  0
                 if ( !lst.contains( key ) )
 152  
                 {
 153  0
                     it.remove();
 154  
                 }
 155  0
             }
 156  
         }
 157  0
         return element;
 158  
     } // -- Element findAndReplaceProperties(Counter, Element, String, Map)
 159  
 
 160  
     /**
 161  
      * Method findAndReplaceSimpleElement
 162  
      * 
 163  
      * @param counter
 164  
      * @param defaultValue
 165  
      * @param text
 166  
      * @param name
 167  
      * @param parent
 168  
      */
 169  
     protected Element findAndReplaceSimpleElement( Counter counter, Element parent, String name, String text,
 170  
                                                    String defaultValue )
 171  
     {
 172  0
         if ( defaultValue != null && text != null && defaultValue.equals( text ) )
 173  
         {
 174  0
             Element element = parent.getChild( name, parent.getNamespace() );
 175  
             // if exist and is default value or if doesn't exist.. just keep the way it is..
 176  0
             if ( ( element != null && defaultValue.equals( element.getText() ) ) || element == null )
 177  
             {
 178  0
                 return element;
 179  
             }
 180  
         }
 181  0
         boolean shouldExist = text != null && text.trim().length() > 0;
 182  0
         Element element = updateElement( counter, parent, name, shouldExist );
 183  0
         if ( shouldExist )
 184  
         {
 185  0
             element.setText( text );
 186  
         }
 187  0
         return element;
 188  
     } // -- Element findAndReplaceSimpleElement(Counter, Element, String, String, String)
 189  
 
 190  
     /**
 191  
      * Method findAndReplaceSimpleLists
 192  
      * 
 193  
      * @param counter
 194  
      * @param childName
 195  
      * @param parentName
 196  
      * @param list
 197  
      * @param parent
 198  
      */
 199  
     protected Element findAndReplaceSimpleLists( Counter counter, Element parent, java.util.Collection list,
 200  
                                                  String parentName, String childName )
 201  
     {
 202  0
         boolean shouldExist = list != null && list.size() > 0;
 203  0
         Element element = updateElement( counter, parent, parentName, shouldExist );
 204  0
         if ( shouldExist )
 205  
         {
 206  0
             Iterator it = list.iterator();
 207  0
             Iterator elIt = element.getChildren( childName, element.getNamespace() ).iterator();
 208  0
             if ( !elIt.hasNext() )
 209  0
                 elIt = null;
 210  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 211  0
             while ( it.hasNext() )
 212  
             {
 213  0
                 String value = (String) it.next();
 214  
                 Element el;
 215  0
                 if ( elIt != null && elIt.hasNext() )
 216  
                 {
 217  0
                     el = (Element) elIt.next();
 218  0
                     if ( !elIt.hasNext() )
 219  0
                         elIt = null;
 220  
                 }
 221  
                 else
 222  
                 {
 223  0
                     el = factory.element( childName, element.getNamespace() );
 224  0
                     insertAtPreferredLocation( element, el, innerCount );
 225  
                 }
 226  0
                 el.setText( value );
 227  0
                 innerCount.increaseCount();
 228  0
             }
 229  0
             if ( elIt != null )
 230  
             {
 231  0
                 while ( elIt.hasNext() )
 232  
                 {
 233  0
                     elIt.next();
 234  0
                     elIt.remove();
 235  
                 }
 236  
             }
 237  
         }
 238  0
         return element;
 239  
     } // -- Element findAndReplaceSimpleLists(Counter, Element, java.util.Collection, String, String)
 240  
 
 241  
     /**
 242  
      * Method findAndReplaceXpp3DOM
 243  
      * 
 244  
      * @param counter
 245  
      * @param dom
 246  
      * @param name
 247  
      * @param parent
 248  
      */
 249  
     protected Element findAndReplaceXpp3DOM( Counter counter, Element parent, String name, Xpp3Dom dom )
 250  
     {
 251  0
         boolean shouldExist = dom != null && ( dom.getChildCount() > 0 || dom.getValue() != null );
 252  0
         Element element = updateElement( counter, parent, name, shouldExist );
 253  0
         if ( shouldExist )
 254  
         {
 255  0
             replaceXpp3DOM( element, dom, new Counter( counter.getDepth() + 1 ) );
 256  
         }
 257  0
         return element;
 258  
     } // -- Element findAndReplaceXpp3DOM(Counter, Element, String, Xpp3Dom)
 259  
 
 260  
     /**
 261  
      * Method insertAtPreferredLocation
 262  
      * 
 263  
      * @param parent
 264  
      * @param counter
 265  
      * @param child
 266  
      */
 267  
     protected void insertAtPreferredLocation( Element parent, Element child, Counter counter )
 268  
     {
 269  0
         int contentIndex = 0;
 270  0
         int elementCounter = 0;
 271  0
         Iterator it = parent.getContent().iterator();
 272  0
         Text lastText = null;
 273  0
         int offset = 0;
 274  0
         while ( it.hasNext() && elementCounter <= counter.getCurrentIndex() )
 275  
         {
 276  0
             Object next = it.next();
 277  0
             offset = offset + 1;
 278  0
             if ( next instanceof Element )
 279  
             {
 280  0
                 elementCounter = elementCounter + 1;
 281  0
                 contentIndex = contentIndex + offset;
 282  0
                 offset = 0;
 283  
             }
 284  0
             if ( next instanceof Text && it.hasNext() )
 285  
             {
 286  0
                 lastText = (Text) next;
 287  
             }
 288  0
         }
 289  0
         if ( lastText != null && lastText.getTextTrim().length() == 0 )
 290  
         {
 291  0
             lastText = (Text) lastText.clone();
 292  
         }
 293  
         else
 294  
         {
 295  0
             String starter = lineSeparator;
 296  0
             for ( int i = 0; i < counter.getDepth(); i++ )
 297  
             {
 298  0
                 starter = starter + "    "; // TODO make settable?
 299  
             }
 300  0
             lastText = factory.text( starter );
 301  
         }
 302  0
         if ( parent.getContentSize() == 0 )
 303  
         {
 304  0
             Text finalText = (Text) lastText.clone();
 305  0
             finalText.setText( finalText.getText().substring( 0, finalText.getText().length() - "    ".length() ) );
 306  0
             parent.addContent( contentIndex, finalText );
 307  
         }
 308  0
         parent.addContent( contentIndex, child );
 309  0
         parent.addContent( contentIndex, lastText );
 310  0
     } // -- void insertAtPreferredLocation(Element, Element, Counter)
 311  
 
 312  
     /**
 313  
      * Method iterateContributor
 314  
      * 
 315  
      * @param counter
 316  
      * @param childTag
 317  
      * @param parentTag
 318  
      * @param list
 319  
      * @param parent
 320  
      */
 321  
     protected void iterateContributor( Counter counter, Element parent, java.util.Collection list,
 322  
                                        java.lang.String parentTag, java.lang.String childTag )
 323  
     {
 324  0
         boolean shouldExist = list != null && list.size() > 0;
 325  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 326  0
         if ( shouldExist )
 327  
         {
 328  0
             Iterator it = list.iterator();
 329  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 330  0
             if ( !elIt.hasNext() )
 331  0
                 elIt = null;
 332  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 333  0
             while ( it.hasNext() )
 334  
             {
 335  0
                 Contributor value = (Contributor) it.next();
 336  
                 Element el;
 337  0
                 if ( elIt != null && elIt.hasNext() )
 338  
                 {
 339  0
                     el = (Element) elIt.next();
 340  0
                     if ( !elIt.hasNext() )
 341  0
                         elIt = null;
 342  
                 }
 343  
                 else
 344  
                 {
 345  0
                     el = factory.element( childTag, element.getNamespace() );
 346  0
                     insertAtPreferredLocation( element, el, innerCount );
 347  
                 }
 348  0
                 updateContributor( value, childTag, innerCount, el );
 349  0
                 innerCount.increaseCount();
 350  0
             }
 351  0
             if ( elIt != null )
 352  
             {
 353  0
                 while ( elIt.hasNext() )
 354  
                 {
 355  0
                     elIt.next();
 356  0
                     elIt.remove();
 357  
                 }
 358  
             }
 359  
         }
 360  0
     } // -- void iterateContributor(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 361  
 
 362  
     /**
 363  
      * Method iterateDependency
 364  
      * 
 365  
      * @param counter
 366  
      * @param childTag
 367  
      * @param parentTag
 368  
      * @param list
 369  
      * @param parent
 370  
      */
 371  
     protected void iterateDependency( Counter counter, Element parent, java.util.Collection list,
 372  
                                       java.lang.String parentTag, java.lang.String childTag )
 373  
     {
 374  0
         boolean shouldExist = list != null && list.size() > 0;
 375  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 376  0
         if ( shouldExist )
 377  
         {
 378  0
             Iterator it = list.iterator();
 379  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 380  0
             if ( !elIt.hasNext() )
 381  0
                 elIt = null;
 382  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 383  0
             while ( it.hasNext() )
 384  
             {
 385  0
                 Dependency value = (Dependency) it.next();
 386  
                 Element el;
 387  0
                 if ( elIt != null && elIt.hasNext() )
 388  
                 {
 389  0
                     el = (Element) elIt.next();
 390  0
                     if ( !elIt.hasNext() )
 391  0
                         elIt = null;
 392  
                 }
 393  
                 else
 394  
                 {
 395  0
                     el = factory.element( childTag, element.getNamespace() );
 396  0
                     insertAtPreferredLocation( element, el, innerCount );
 397  
                 }
 398  0
                 updateDependency( value, childTag, innerCount, el );
 399  0
                 innerCount.increaseCount();
 400  0
             }
 401  0
             if ( elIt != null )
 402  
             {
 403  0
                 while ( elIt.hasNext() )
 404  
                 {
 405  0
                     elIt.next();
 406  0
                     elIt.remove();
 407  
                 }
 408  
             }
 409  
         }
 410  0
     } // -- void iterateDependency(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 411  
 
 412  
     /**
 413  
      * Method iterateDeveloper
 414  
      * 
 415  
      * @param counter
 416  
      * @param childTag
 417  
      * @param parentTag
 418  
      * @param list
 419  
      * @param parent
 420  
      */
 421  
     protected void iterateDeveloper( Counter counter, Element parent, java.util.Collection list,
 422  
                                      java.lang.String parentTag, java.lang.String childTag )
 423  
     {
 424  0
         boolean shouldExist = list != null && list.size() > 0;
 425  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 426  0
         if ( shouldExist )
 427  
         {
 428  0
             Iterator it = list.iterator();
 429  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 430  0
             if ( !elIt.hasNext() )
 431  0
                 elIt = null;
 432  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 433  0
             while ( it.hasNext() )
 434  
             {
 435  0
                 Developer value = (Developer) it.next();
 436  
                 Element el;
 437  0
                 if ( elIt != null && elIt.hasNext() )
 438  
                 {
 439  0
                     el = (Element) elIt.next();
 440  0
                     if ( !elIt.hasNext() )
 441  0
                         elIt = null;
 442  
                 }
 443  
                 else
 444  
                 {
 445  0
                     el = factory.element( childTag, element.getNamespace() );
 446  0
                     insertAtPreferredLocation( element, el, innerCount );
 447  
                 }
 448  0
                 updateDeveloper( value, childTag, innerCount, el );
 449  0
                 innerCount.increaseCount();
 450  0
             }
 451  0
             if ( elIt != null )
 452  
             {
 453  0
                 while ( elIt.hasNext() )
 454  
                 {
 455  0
                     elIt.next();
 456  0
                     elIt.remove();
 457  
                 }
 458  
             }
 459  
         }
 460  0
     } // -- void iterateDeveloper(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 461  
 
 462  
     /**
 463  
      * Method iterateExclusion
 464  
      * 
 465  
      * @param counter
 466  
      * @param childTag
 467  
      * @param parentTag
 468  
      * @param list
 469  
      * @param parent
 470  
      */
 471  
     protected void iterateExclusion( Counter counter, Element parent, java.util.Collection list,
 472  
                                      java.lang.String parentTag, java.lang.String childTag )
 473  
     {
 474  0
         boolean shouldExist = list != null && list.size() > 0;
 475  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 476  0
         if ( shouldExist )
 477  
         {
 478  0
             Iterator it = list.iterator();
 479  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 480  0
             if ( !elIt.hasNext() )
 481  0
                 elIt = null;
 482  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 483  0
             while ( it.hasNext() )
 484  
             {
 485  0
                 Exclusion value = (Exclusion) it.next();
 486  
                 Element el;
 487  0
                 if ( elIt != null && elIt.hasNext() )
 488  
                 {
 489  0
                     el = (Element) elIt.next();
 490  0
                     if ( !elIt.hasNext() )
 491  0
                         elIt = null;
 492  
                 }
 493  
                 else
 494  
                 {
 495  0
                     el = factory.element( childTag, element.getNamespace() );
 496  0
                     insertAtPreferredLocation( element, el, innerCount );
 497  
                 }
 498  0
                 updateExclusion( value, childTag, innerCount, el );
 499  0
                 innerCount.increaseCount();
 500  0
             }
 501  0
             if ( elIt != null )
 502  
             {
 503  0
                 while ( elIt.hasNext() )
 504  
                 {
 505  0
                     elIt.next();
 506  0
                     elIt.remove();
 507  
                 }
 508  
             }
 509  
         }
 510  0
     } // -- void iterateExclusion(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 511  
 
 512  
     /**
 513  
      * Method iterateExtension
 514  
      * 
 515  
      * @param counter
 516  
      * @param childTag
 517  
      * @param parentTag
 518  
      * @param list
 519  
      * @param parent
 520  
      */
 521  
     protected void iterateExtension( Counter counter, Element parent, java.util.Collection list,
 522  
                                      java.lang.String parentTag, java.lang.String childTag )
 523  
     {
 524  0
         boolean shouldExist = list != null && list.size() > 0;
 525  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 526  0
         if ( shouldExist )
 527  
         {
 528  0
             Iterator it = list.iterator();
 529  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 530  0
             if ( !elIt.hasNext() )
 531  0
                 elIt = null;
 532  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 533  0
             while ( it.hasNext() )
 534  
             {
 535  0
                 Extension value = (Extension) it.next();
 536  
                 Element el;
 537  0
                 if ( elIt != null && elIt.hasNext() )
 538  
                 {
 539  0
                     el = (Element) elIt.next();
 540  0
                     if ( !elIt.hasNext() )
 541  0
                         elIt = null;
 542  
                 }
 543  
                 else
 544  
                 {
 545  0
                     el = factory.element( childTag, element.getNamespace() );
 546  0
                     insertAtPreferredLocation( element, el, innerCount );
 547  
                 }
 548  0
                 updateExtension( value, childTag, innerCount, el );
 549  0
                 innerCount.increaseCount();
 550  0
             }
 551  0
             if ( elIt != null )
 552  
             {
 553  0
                 while ( elIt.hasNext() )
 554  
                 {
 555  0
                     elIt.next();
 556  0
                     elIt.remove();
 557  
                 }
 558  
             }
 559  
         }
 560  0
     } // -- void iterateExtension(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 561  
 
 562  
     /**
 563  
      * Method iterateLicense
 564  
      * 
 565  
      * @param counter
 566  
      * @param childTag
 567  
      * @param parentTag
 568  
      * @param list
 569  
      * @param parent
 570  
      */
 571  
     protected void iterateLicense( Counter counter, Element parent, java.util.Collection list,
 572  
                                    java.lang.String parentTag, java.lang.String childTag )
 573  
     {
 574  0
         boolean shouldExist = list != null && list.size() > 0;
 575  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 576  0
         if ( shouldExist )
 577  
         {
 578  0
             Iterator it = list.iterator();
 579  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 580  0
             if ( !elIt.hasNext() )
 581  0
                 elIt = null;
 582  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 583  0
             while ( it.hasNext() )
 584  
             {
 585  0
                 License value = (License) it.next();
 586  
                 Element el;
 587  0
                 if ( elIt != null && elIt.hasNext() )
 588  
                 {
 589  0
                     el = (Element) elIt.next();
 590  0
                     if ( !elIt.hasNext() )
 591  0
                         elIt = null;
 592  
                 }
 593  
                 else
 594  
                 {
 595  0
                     el = factory.element( childTag, element.getNamespace() );
 596  0
                     insertAtPreferredLocation( element, el, innerCount );
 597  
                 }
 598  0
                 updateLicense( value, childTag, innerCount, el );
 599  0
                 innerCount.increaseCount();
 600  0
             }
 601  0
             if ( elIt != null )
 602  
             {
 603  0
                 while ( elIt.hasNext() )
 604  
                 {
 605  0
                     elIt.next();
 606  0
                     elIt.remove();
 607  
                 }
 608  
             }
 609  
         }
 610  0
     } // -- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 611  
 
 612  
     /**
 613  
      * Method iterateMailingList
 614  
      * 
 615  
      * @param counter
 616  
      * @param childTag
 617  
      * @param parentTag
 618  
      * @param list
 619  
      * @param parent
 620  
      */
 621  
     protected void iterateMailingList( Counter counter, Element parent, java.util.Collection list,
 622  
                                        java.lang.String parentTag, java.lang.String childTag )
 623  
     {
 624  0
         boolean shouldExist = list != null && list.size() > 0;
 625  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 626  0
         if ( shouldExist )
 627  
         {
 628  0
             Iterator it = list.iterator();
 629  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 630  0
             if ( !elIt.hasNext() )
 631  0
                 elIt = null;
 632  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 633  0
             while ( it.hasNext() )
 634  
             {
 635  0
                 MailingList value = (MailingList) it.next();
 636  
                 Element el;
 637  0
                 if ( elIt != null && elIt.hasNext() )
 638  
                 {
 639  0
                     el = (Element) elIt.next();
 640  0
                     if ( !elIt.hasNext() )
 641  0
                         elIt = null;
 642  
                 }
 643  
                 else
 644  
                 {
 645  0
                     el = factory.element( childTag, element.getNamespace() );
 646  0
                     insertAtPreferredLocation( element, el, innerCount );
 647  
                 }
 648  0
                 updateMailingList( value, childTag, innerCount, el );
 649  0
                 innerCount.increaseCount();
 650  0
             }
 651  0
             if ( elIt != null )
 652  
             {
 653  0
                 while ( elIt.hasNext() )
 654  
                 {
 655  0
                     elIt.next();
 656  0
                     elIt.remove();
 657  
                 }
 658  
             }
 659  
         }
 660  0
     } // -- void iterateMailingList(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 661  
 
 662  
     /**
 663  
      * Method iterateNotifier
 664  
      * 
 665  
      * @param counter
 666  
      * @param childTag
 667  
      * @param parentTag
 668  
      * @param list
 669  
      * @param parent
 670  
      */
 671  
     protected void iterateNotifier( Counter counter, Element parent, java.util.Collection list,
 672  
                                     java.lang.String parentTag, java.lang.String childTag )
 673  
     {
 674  0
         boolean shouldExist = list != null && list.size() > 0;
 675  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 676  0
         if ( shouldExist )
 677  
         {
 678  0
             Iterator it = list.iterator();
 679  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 680  0
             if ( !elIt.hasNext() )
 681  0
                 elIt = null;
 682  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 683  0
             while ( it.hasNext() )
 684  
             {
 685  0
                 Notifier value = (Notifier) it.next();
 686  
                 Element el;
 687  0
                 if ( elIt != null && elIt.hasNext() )
 688  
                 {
 689  0
                     el = (Element) elIt.next();
 690  0
                     if ( !elIt.hasNext() )
 691  0
                         elIt = null;
 692  
                 }
 693  
                 else
 694  
                 {
 695  0
                     el = factory.element( childTag, element.getNamespace() );
 696  0
                     insertAtPreferredLocation( element, el, innerCount );
 697  
                 }
 698  0
                 updateNotifier( value, childTag, innerCount, el );
 699  0
                 innerCount.increaseCount();
 700  0
             }
 701  0
             if ( elIt != null )
 702  
             {
 703  0
                 while ( elIt.hasNext() )
 704  
                 {
 705  0
                     elIt.next();
 706  0
                     elIt.remove();
 707  
                 }
 708  
             }
 709  
         }
 710  0
     } // -- void iterateNotifier(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 711  
 
 712  
     /**
 713  
      * Method iteratePlugin
 714  
      * 
 715  
      * @param counter
 716  
      * @param childTag
 717  
      * @param parentTag
 718  
      * @param list
 719  
      * @param parent
 720  
      */
 721  
     protected void iteratePlugin( Counter counter, Element parent, java.util.Collection list,
 722  
                                   java.lang.String parentTag, java.lang.String childTag )
 723  
     {
 724  0
         boolean shouldExist = list != null && list.size() > 0;
 725  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 726  0
         if ( shouldExist )
 727  
         {
 728  0
             Iterator it = list.iterator();
 729  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 730  0
             if ( !elIt.hasNext() )
 731  0
                 elIt = null;
 732  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 733  0
             while ( it.hasNext() )
 734  
             {
 735  0
                 Plugin value = (Plugin) it.next();
 736  
                 Element el;
 737  0
                 if ( elIt != null && elIt.hasNext() )
 738  
                 {
 739  0
                     el = (Element) elIt.next();
 740  0
                     if ( !elIt.hasNext() )
 741  0
                         elIt = null;
 742  
                 }
 743  
                 else
 744  
                 {
 745  0
                     el = factory.element( childTag, element.getNamespace() );
 746  0
                     insertAtPreferredLocation( element, el, innerCount );
 747  
                 }
 748  0
                 updatePlugin( value, childTag, innerCount, el );
 749  0
                 innerCount.increaseCount();
 750  0
             }
 751  0
             if ( elIt != null )
 752  
             {
 753  0
                 while ( elIt.hasNext() )
 754  
                 {
 755  0
                     elIt.next();
 756  0
                     elIt.remove();
 757  
                 }
 758  
             }
 759  
         }
 760  0
     } // -- void iteratePlugin(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 761  
 
 762  
     /**
 763  
      * Method iteratePluginExecution
 764  
      * 
 765  
      * @param counter
 766  
      * @param childTag
 767  
      * @param parentTag
 768  
      * @param list
 769  
      * @param parent
 770  
      */
 771  
     protected void iteratePluginExecution( Counter counter, Element parent, java.util.Collection list,
 772  
                                            java.lang.String parentTag, java.lang.String childTag )
 773  
     {
 774  0
         boolean shouldExist = list != null && list.size() > 0;
 775  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 776  0
         if ( shouldExist )
 777  
         {
 778  0
             Iterator it = list.iterator();
 779  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 780  0
             if ( !elIt.hasNext() )
 781  0
                 elIt = null;
 782  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 783  0
             while ( it.hasNext() )
 784  
             {
 785  0
                 PluginExecution value = (PluginExecution) it.next();
 786  
                 Element el;
 787  0
                 if ( elIt != null && elIt.hasNext() )
 788  
                 {
 789  0
                     el = (Element) elIt.next();
 790  0
                     if ( !elIt.hasNext() )
 791  0
                         elIt = null;
 792  
                 }
 793  
                 else
 794  
                 {
 795  0
                     el = factory.element( childTag, element.getNamespace() );
 796  0
                     insertAtPreferredLocation( element, el, innerCount );
 797  
                 }
 798  0
                 updatePluginExecution( value, childTag, innerCount, el );
 799  0
                 innerCount.increaseCount();
 800  0
             }
 801  0
             if ( elIt != null )
 802  
             {
 803  0
                 while ( elIt.hasNext() )
 804  
                 {
 805  0
                     elIt.next();
 806  0
                     elIt.remove();
 807  
                 }
 808  
             }
 809  
         }
 810  0
     } // -- void iteratePluginExecution(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 811  
 
 812  
     /**
 813  
      * Method iterateProfile
 814  
      * 
 815  
      * @param counter
 816  
      * @param childTag
 817  
      * @param parentTag
 818  
      * @param list
 819  
      * @param parent
 820  
      */
 821  
     protected void iterateProfile( Counter counter, Element parent, java.util.Collection list,
 822  
                                    java.lang.String parentTag, java.lang.String childTag )
 823  
     {
 824  0
         boolean shouldExist = list != null && list.size() > 0;
 825  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 826  0
         if ( shouldExist )
 827  
         {
 828  0
             Iterator it = list.iterator();
 829  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 830  0
             if ( !elIt.hasNext() )
 831  0
                 elIt = null;
 832  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 833  0
             while ( it.hasNext() )
 834  
             {
 835  0
                 Profile value = (Profile) it.next();
 836  
                 Element el;
 837  0
                 if ( elIt != null && elIt.hasNext() )
 838  
                 {
 839  0
                     el = (Element) elIt.next();
 840  0
                     if ( !elIt.hasNext() )
 841  0
                         elIt = null;
 842  
                 }
 843  
                 else
 844  
                 {
 845  0
                     el = factory.element( childTag, element.getNamespace() );
 846  0
                     insertAtPreferredLocation( element, el, innerCount );
 847  
                 }
 848  0
                 updateProfile( value, childTag, innerCount, el );
 849  0
                 innerCount.increaseCount();
 850  0
             }
 851  0
             if ( elIt != null )
 852  
             {
 853  0
                 while ( elIt.hasNext() )
 854  
                 {
 855  0
                     elIt.next();
 856  0
                     elIt.remove();
 857  
                 }
 858  
             }
 859  
         }
 860  0
     } // -- void iterateProfile(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 861  
 
 862  
     /**
 863  
      * Method iterateReportPlugin
 864  
      * 
 865  
      * @param counter
 866  
      * @param childTag
 867  
      * @param parentTag
 868  
      * @param list
 869  
      * @param parent
 870  
      */
 871  
     protected void iterateReportPlugin( Counter counter, Element parent, java.util.Collection list,
 872  
                                         java.lang.String parentTag, java.lang.String childTag )
 873  
     {
 874  0
         boolean shouldExist = list != null && list.size() > 0;
 875  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 876  0
         if ( shouldExist )
 877  
         {
 878  0
             Iterator it = list.iterator();
 879  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 880  0
             if ( !elIt.hasNext() )
 881  0
                 elIt = null;
 882  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 883  0
             while ( it.hasNext() )
 884  
             {
 885  0
                 ReportPlugin value = (ReportPlugin) it.next();
 886  
                 Element el;
 887  0
                 if ( elIt != null && elIt.hasNext() )
 888  
                 {
 889  0
                     el = (Element) elIt.next();
 890  0
                     if ( !elIt.hasNext() )
 891  0
                         elIt = null;
 892  
                 }
 893  
                 else
 894  
                 {
 895  0
                     el = factory.element( childTag, element.getNamespace() );
 896  0
                     insertAtPreferredLocation( element, el, innerCount );
 897  
                 }
 898  0
                 updateReportPlugin( value, childTag, innerCount, el );
 899  0
                 innerCount.increaseCount();
 900  0
             }
 901  0
             if ( elIt != null )
 902  
             {
 903  0
                 while ( elIt.hasNext() )
 904  
                 {
 905  0
                     elIt.next();
 906  0
                     elIt.remove();
 907  
                 }
 908  
             }
 909  
         }
 910  0
     } // -- void iterateReportPlugin(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 911  
 
 912  
     /**
 913  
      * Method iterateReportSet
 914  
      * 
 915  
      * @param counter
 916  
      * @param childTag
 917  
      * @param parentTag
 918  
      * @param list
 919  
      * @param parent
 920  
      */
 921  
     protected void iterateReportSet( Counter counter, Element parent, java.util.Collection list,
 922  
                                      java.lang.String parentTag, java.lang.String childTag )
 923  
     {
 924  0
         boolean shouldExist = list != null && list.size() > 0;
 925  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 926  0
         if ( shouldExist )
 927  
         {
 928  0
             Iterator it = list.iterator();
 929  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 930  0
             if ( !elIt.hasNext() )
 931  0
                 elIt = null;
 932  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 933  0
             while ( it.hasNext() )
 934  
             {
 935  0
                 ReportSet value = (ReportSet) it.next();
 936  
                 Element el;
 937  0
                 if ( elIt != null && elIt.hasNext() )
 938  
                 {
 939  0
                     el = (Element) elIt.next();
 940  0
                     if ( !elIt.hasNext() )
 941  0
                         elIt = null;
 942  
                 }
 943  
                 else
 944  
                 {
 945  0
                     el = factory.element( childTag, element.getNamespace() );
 946  0
                     insertAtPreferredLocation( element, el, innerCount );
 947  
                 }
 948  0
                 updateReportSet( value, childTag, innerCount, el );
 949  0
                 innerCount.increaseCount();
 950  0
             }
 951  0
             if ( elIt != null )
 952  
             {
 953  0
                 while ( elIt.hasNext() )
 954  
                 {
 955  0
                     elIt.next();
 956  0
                     elIt.remove();
 957  
                 }
 958  
             }
 959  
         }
 960  0
     } // -- void iterateReportSet(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 961  
 
 962  
     /**
 963  
      * Method iterateRepository
 964  
      * 
 965  
      * @param counter
 966  
      * @param childTag
 967  
      * @param parentTag
 968  
      * @param list
 969  
      * @param parent
 970  
      */
 971  
     protected void iterateRepository( Counter counter, Element parent, java.util.Collection list,
 972  
                                       java.lang.String parentTag, java.lang.String childTag )
 973  
     {
 974  0
         boolean shouldExist = list != null && list.size() > 0;
 975  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 976  0
         if ( shouldExist )
 977  
         {
 978  0
             Iterator it = list.iterator();
 979  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 980  0
             if ( !elIt.hasNext() )
 981  0
                 elIt = null;
 982  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 983  0
             while ( it.hasNext() )
 984  
             {
 985  0
                 Repository value = (Repository) it.next();
 986  
                 Element el;
 987  0
                 if ( elIt != null && elIt.hasNext() )
 988  
                 {
 989  0
                     el = (Element) elIt.next();
 990  0
                     if ( !elIt.hasNext() )
 991  0
                         elIt = null;
 992  
                 }
 993  
                 else
 994  
                 {
 995  0
                     el = factory.element( childTag, element.getNamespace() );
 996  0
                     insertAtPreferredLocation( element, el, innerCount );
 997  
                 }
 998  0
                 updateRepository( value, childTag, innerCount, el );
 999  0
                 innerCount.increaseCount();
 1000  0
             }
 1001  0
             if ( elIt != null )
 1002  
             {
 1003  0
                 while ( elIt.hasNext() )
 1004  
                 {
 1005  0
                     elIt.next();
 1006  0
                     elIt.remove();
 1007  
                 }
 1008  
             }
 1009  
         }
 1010  0
     } // -- void iterateRepository(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 1011  
 
 1012  
     /**
 1013  
      * Method iterateResource
 1014  
      * 
 1015  
      * @param counter
 1016  
      * @param childTag
 1017  
      * @param parentTag
 1018  
      * @param list
 1019  
      * @param parent
 1020  
      */
 1021  
     protected void iterateResource( Counter counter, Element parent, java.util.Collection list,
 1022  
                                     java.lang.String parentTag, java.lang.String childTag )
 1023  
     {
 1024  0
         boolean shouldExist = list != null && list.size() > 0;
 1025  0
         Element element = updateElement( counter, parent, parentTag, shouldExist );
 1026  0
         if ( shouldExist )
 1027  
         {
 1028  0
             Iterator it = list.iterator();
 1029  0
             Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
 1030  0
             if ( !elIt.hasNext() )
 1031  0
                 elIt = null;
 1032  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1033  0
             while ( it.hasNext() )
 1034  
             {
 1035  0
                 Resource value = (Resource) it.next();
 1036  
                 Element el;
 1037  0
                 if ( elIt != null && elIt.hasNext() )
 1038  
                 {
 1039  0
                     el = (Element) elIt.next();
 1040  0
                     if ( !elIt.hasNext() )
 1041  0
                         elIt = null;
 1042  
                 }
 1043  
                 else
 1044  
                 {
 1045  0
                     el = factory.element( childTag, element.getNamespace() );
 1046  0
                     insertAtPreferredLocation( element, el, innerCount );
 1047  
                 }
 1048  0
                 updateResource( value, childTag, innerCount, el );
 1049  0
                 innerCount.increaseCount();
 1050  0
             }
 1051  0
             if ( elIt != null )
 1052  
             {
 1053  0
                 while ( elIt.hasNext() )
 1054  
                 {
 1055  0
                     elIt.next();
 1056  0
                     elIt.remove();
 1057  
                 }
 1058  
             }
 1059  
         }
 1060  0
     } // -- void iterateResource(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
 1061  
 
 1062  
     /**
 1063  
      * Method replaceXpp3DOM
 1064  
      * 
 1065  
      * @param parent
 1066  
      * @param counter
 1067  
      * @param parentDom
 1068  
      */
 1069  
     protected void replaceXpp3DOM( Element parent, Xpp3Dom parentDom, Counter counter )
 1070  
     {
 1071  0
         if ( parentDom.getChildCount() > 0 )
 1072  
         {
 1073  0
             Xpp3Dom[] childs = parentDom.getChildren();
 1074  0
             Collection domChilds = new ArrayList();
 1075  0
             for ( int i = 0; i < childs.length; i++ )
 1076  
             {
 1077  0
                 domChilds.add( childs[i] );
 1078  
             }
 1079  
             // int domIndex = 0;
 1080  0
             ListIterator it = parent.getChildren().listIterator();
 1081  0
             while ( it.hasNext() )
 1082  
             {
 1083  0
                 Element elem = (Element) it.next();
 1084  0
                 Iterator it2 = domChilds.iterator();
 1085  0
                 Xpp3Dom corrDom = null;
 1086  0
                 while ( it2.hasNext() )
 1087  
                 {
 1088  0
                     Xpp3Dom dm = (Xpp3Dom) it2.next();
 1089  0
                     if ( dm.getName().equals( elem.getName() ) )
 1090  
                     {
 1091  0
                         corrDom = dm;
 1092  0
                         break;
 1093  
                     }
 1094  0
                 }
 1095  0
                 if ( corrDom != null )
 1096  
                 {
 1097  0
                     domChilds.remove( corrDom );
 1098  0
                     replaceXpp3DOM( elem, corrDom, new Counter( counter.getDepth() + 1 ) );
 1099  0
                     counter.increaseCount();
 1100  
                 }
 1101  
                 else
 1102  
                 {
 1103  0
                     parent.removeContent( elem );
 1104  
                 }
 1105  0
             }
 1106  0
             Iterator it2 = domChilds.iterator();
 1107  0
             while ( it2.hasNext() )
 1108  
             {
 1109  0
                 Xpp3Dom dm = (Xpp3Dom) it2.next();
 1110  0
                 Element elem = factory.element( dm.getName(), parent.getNamespace() );
 1111  0
                 insertAtPreferredLocation( parent, elem, counter );
 1112  0
                 counter.increaseCount();
 1113  0
                 replaceXpp3DOM( elem, dm, new Counter( counter.getDepth() + 1 ) );
 1114  0
             }
 1115  0
         }
 1116  0
         else if ( parentDom.getValue() != null )
 1117  
         {
 1118  0
             parent.setText( parentDom.getValue() );
 1119  
         }
 1120  0
     } // -- void replaceXpp3DOM(Element, Xpp3Dom, Counter)
 1121  
 
 1122  
     /**
 1123  
      * Method updateActivation
 1124  
      * 
 1125  
      * @param value
 1126  
      * @param element
 1127  
      * @param counter
 1128  
      * @param xmlTag
 1129  
      */
 1130  
     /*
 1131  
      * protected void updateActivation(Activation value, String xmlTag, Counter counter, Element element) { boolean
 1132  
      * shouldExist = value != null; Element root = updateElement(counter, element, xmlTag, shouldExist); if
 1133  
      * (shouldExist) { Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceSimpleElement(innerCount,
 1134  
      * root, "activeByDefault", !value.isActiveByDefault() ? null : String.valueOf( value.isActiveByDefault() ),
 1135  
      * "false"); findAndReplaceSimpleElement(innerCount, root, "jdk", value.getJdk(), null); updateActivationOS(
 1136  
      * value.getOs(), "os", innerCount, root); updateActivationProperty( value.getProperty(), "property", innerCount,
 1137  
      * root); updateActivationFile( value.getFile(), "file", innerCount, root); updateActivationCustom(
 1138  
      * value.getCustom(), "custom", innerCount, root); } } //-- void updateActivation(Activation, String, Counter,
 1139  
      * Element)
 1140  
      */
 1141  
 
 1142  
     /**
 1143  
      * Method updateActivationCustom
 1144  
      * 
 1145  
      * @param value
 1146  
      * @param element
 1147  
      * @param counter
 1148  
      * @param xmlTag
 1149  
      */
 1150  
     /*
 1151  
      * protected void updateActivationCustom(ActivationCustom value, String xmlTag, Counter counter, Element element) {
 1152  
      * boolean shouldExist = value != null; Element root = updateElement(counter, element, xmlTag, shouldExist); if
 1153  
      * (shouldExist) { Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceXpp3DOM(innerCount, root,
 1154  
      * "configuration", (Xpp3Dom)value.getConfiguration()); findAndReplaceSimpleElement(innerCount, root, "type",
 1155  
      * value.getType(), null); } } //-- void updateActivationCustom(ActivationCustom, String, Counter, Element)
 1156  
      */
 1157  
 
 1158  
     /**
 1159  
      * Method updateActivationFile
 1160  
      * 
 1161  
      * @param value
 1162  
      * @param element
 1163  
      * @param counter
 1164  
      * @param xmlTag
 1165  
      */
 1166  
     protected void updateActivationFile( ActivationFile value, String xmlTag, Counter counter, Element element )
 1167  
     {
 1168  0
         boolean shouldExist = value != null;
 1169  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1170  0
         if ( shouldExist )
 1171  
         {
 1172  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1173  0
             findAndReplaceSimpleElement( innerCount, root, "missing", value.getMissing(), null );
 1174  0
             findAndReplaceSimpleElement( innerCount, root, "exists", value.getExists(), null );
 1175  
         }
 1176  0
     } // -- void updateActivationFile(ActivationFile, String, Counter, Element)
 1177  
 
 1178  
     /**
 1179  
      * Method updateActivationOS
 1180  
      * 
 1181  
      * @param value
 1182  
      * @param element
 1183  
      * @param counter
 1184  
      * @param xmlTag
 1185  
      */
 1186  
     protected void updateActivationOS( ActivationOS value, String xmlTag, Counter counter, Element element )
 1187  
     {
 1188  0
         boolean shouldExist = value != null;
 1189  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1190  0
         if ( shouldExist )
 1191  
         {
 1192  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1193  0
             findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1194  0
             findAndReplaceSimpleElement( innerCount, root, "family", value.getFamily(), null );
 1195  0
             findAndReplaceSimpleElement( innerCount, root, "arch", value.getArch(), null );
 1196  0
             findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1197  
         }
 1198  0
     } // -- void updateActivationOS(ActivationOS, String, Counter, Element)
 1199  
 
 1200  
     /**
 1201  
      * Method updateActivationProperty
 1202  
      * 
 1203  
      * @param value
 1204  
      * @param element
 1205  
      * @param counter
 1206  
      * @param xmlTag
 1207  
      */
 1208  
     protected void updateActivationProperty( ActivationProperty value, String xmlTag, Counter counter, Element element )
 1209  
     {
 1210  0
         boolean shouldExist = value != null;
 1211  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1212  0
         if ( shouldExist )
 1213  
         {
 1214  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1215  0
             findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1216  0
             findAndReplaceSimpleElement( innerCount, root, "value", value.getValue(), null );
 1217  
         }
 1218  0
     } // -- void updateActivationProperty(ActivationProperty, String, Counter, Element)
 1219  
 
 1220  
     /**
 1221  
      * Method updateBuild
 1222  
      * 
 1223  
      * @param value
 1224  
      * @param element
 1225  
      * @param counter
 1226  
      * @param xmlTag
 1227  
      */
 1228  
     protected void updateBuild( Build value, String xmlTag, Counter counter, Element element )
 1229  
     {
 1230  0
         boolean shouldExist = value != null;
 1231  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1232  0
         if ( shouldExist )
 1233  
         {
 1234  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1235  0
             findAndReplaceSimpleElement( innerCount, root, "sourceDirectory", value.getSourceDirectory(), null );
 1236  0
             findAndReplaceSimpleElement( innerCount, root, "scriptSourceDirectory", value.getScriptSourceDirectory(),
 1237  
                                          null );
 1238  0
             findAndReplaceSimpleElement( innerCount, root, "testSourceDirectory", value.getTestSourceDirectory(), null );
 1239  0
             findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null );
 1240  0
             findAndReplaceSimpleElement( innerCount, root, "testOutputDirectory", value.getTestOutputDirectory(), null );
 1241  0
             iterateExtension( innerCount, root, value.getExtensions(), "extensions", "extension" );
 1242  0
             findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null );
 1243  0
             iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
 1244  0
             iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" );
 1245  0
             findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
 1246  0
             findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null );
 1247  0
             findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" );
 1248  0
             updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
 1249  0
             iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
 1250  
         }
 1251  0
     } // -- void updateBuild(Build, String, Counter, Element)
 1252  
 
 1253  
     /**
 1254  
      * Method updateBuildBase
 1255  
      * 
 1256  
      * @param value
 1257  
      * @param element
 1258  
      * @param counter
 1259  
      * @param xmlTag
 1260  
      */
 1261  
     protected void updateBuildBase( BuildBase value, String xmlTag, Counter counter, Element element )
 1262  
     {
 1263  0
         boolean shouldExist = value != null;
 1264  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1265  0
         if ( shouldExist )
 1266  
         {
 1267  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1268  0
             findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null );
 1269  0
             iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
 1270  0
             iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" );
 1271  0
             findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
 1272  0
             findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null );
 1273  0
             findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" );
 1274  0
             updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
 1275  0
             iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
 1276  
         }
 1277  0
     } // -- void updateBuildBase(BuildBase, String, Counter, Element)
 1278  
 
 1279  
     /**
 1280  
      * Method updateCiManagement
 1281  
      * 
 1282  
      * @param value
 1283  
      * @param element
 1284  
      * @param counter
 1285  
      * @param xmlTag
 1286  
      */
 1287  
     protected void updateCiManagement( CiManagement value, String xmlTag, Counter counter, Element element )
 1288  
     {
 1289  0
         boolean shouldExist = value != null;
 1290  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1291  0
         if ( shouldExist )
 1292  
         {
 1293  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1294  0
             findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null );
 1295  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1296  0
             iterateNotifier( innerCount, root, value.getNotifiers(), "notifiers", "notifier" );
 1297  
         }
 1298  0
     } // -- void updateCiManagement(CiManagement, String, Counter, Element)
 1299  
 
 1300  
     /**
 1301  
      * Method updateConfigurationContainer
 1302  
      * 
 1303  
      * @param value
 1304  
      * @param element
 1305  
      * @param counter
 1306  
      * @param xmlTag
 1307  
      */
 1308  
     protected void updateConfigurationContainer( ConfigurationContainer value, String xmlTag, Counter counter,
 1309  
                                                  Element element )
 1310  
     {
 1311  0
         boolean shouldExist = value != null;
 1312  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1313  0
         if ( shouldExist )
 1314  
         {
 1315  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1316  0
             findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
 1317  0
             findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
 1318  
         }
 1319  0
     } // -- void updateConfigurationContainer(ConfigurationContainer, String, Counter, Element)
 1320  
 
 1321  
     /**
 1322  
      * Method updateContributor
 1323  
      * 
 1324  
      * @param value
 1325  
      * @param element
 1326  
      * @param counter
 1327  
      * @param xmlTag
 1328  
      */
 1329  
     protected void updateContributor( Contributor value, String xmlTag, Counter counter, Element element )
 1330  
     {
 1331  0
         Element root = element;
 1332  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1333  0
         findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1334  0
         findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
 1335  0
         findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1336  0
         findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null );
 1337  0
         findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null );
 1338  0
         findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
 1339  0
         findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
 1340  0
         findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
 1341  0
     } // -- void updateContributor(Contributor, String, Counter, Element)
 1342  
 
 1343  
     /**
 1344  
      * Method updateDependency
 1345  
      * 
 1346  
      * @param value
 1347  
      * @param element
 1348  
      * @param counter
 1349  
      * @param xmlTag
 1350  
      */
 1351  
     protected void updateDependency( Dependency value, String xmlTag, Counter counter, Element element )
 1352  
     {
 1353  0
         Element root = element;
 1354  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1355  0
         findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
 1356  0
         findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1357  0
         findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1358  0
         findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "jar" );
 1359  0
         findAndReplaceSimpleElement( innerCount, root, "classifier", value.getClassifier(), null );
 1360  0
         findAndReplaceSimpleElement( innerCount, root, "scope", value.getScope(), null );
 1361  0
         findAndReplaceSimpleElement( innerCount, root, "systemPath", value.getSystemPath(), null );
 1362  0
         iterateExclusion( innerCount, root, value.getExclusions(), "exclusions", "exclusion" );
 1363  0
         findAndReplaceSimpleElement( innerCount, root, "optional", !value.isOptional() ? null
 1364  
                         : String.valueOf( value.isOptional() ), "false" );
 1365  0
     } // -- void updateDependency(Dependency, String, Counter, Element)
 1366  
 
 1367  
     /**
 1368  
      * Method updateDependencyManagement
 1369  
      * 
 1370  
      * @param value
 1371  
      * @param element
 1372  
      * @param counter
 1373  
      * @param xmlTag
 1374  
      */
 1375  
     protected void updateDependencyManagement( DependencyManagement value, String xmlTag, Counter counter,
 1376  
                                                Element element )
 1377  
     {
 1378  0
         boolean shouldExist = value != null;
 1379  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1380  0
         if ( shouldExist )
 1381  
         {
 1382  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1383  0
             iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
 1384  
         }
 1385  0
     } // -- void updateDependencyManagement(DependencyManagement, String, Counter, Element)
 1386  
 
 1387  
     /**
 1388  
      * Method updateDeploymentRepository
 1389  
      * 
 1390  
      * @param value
 1391  
      * @param element
 1392  
      * @param counter
 1393  
      * @param xmlTag
 1394  
      */
 1395  
     protected void updateDeploymentRepository( DeploymentRepository value, String xmlTag, Counter counter,
 1396  
                                                Element element )
 1397  
     {
 1398  0
         boolean shouldExist = value != null;
 1399  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1400  0
         if ( shouldExist )
 1401  
         {
 1402  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1403  0
             findAndReplaceSimpleElement( innerCount, root, "uniqueVersion", value.isUniqueVersion() ? null
 1404  
                             : String.valueOf( value.isUniqueVersion() ), "true" );
 1405  0
             findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
 1406  0
             findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1407  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1408  0
             findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" );
 1409  
         }
 1410  0
     } // -- void updateDeploymentRepository(DeploymentRepository, String, Counter, Element)
 1411  
 
 1412  
     /**
 1413  
      * Method updateDeveloper
 1414  
      * 
 1415  
      * @param value
 1416  
      * @param element
 1417  
      * @param counter
 1418  
      * @param xmlTag
 1419  
      */
 1420  
     protected void updateDeveloper( Developer value, String xmlTag, Counter counter, Element element )
 1421  
     {
 1422  0
         Element root = element;
 1423  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1424  0
         findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
 1425  0
         findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1426  0
         findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
 1427  0
         findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1428  0
         findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null );
 1429  0
         findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null );
 1430  0
         findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
 1431  0
         findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
 1432  0
         findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
 1433  0
     } // -- void updateDeveloper(Developer, String, Counter, Element)
 1434  
 
 1435  
     /**
 1436  
      * Method updateDistributionManagement
 1437  
      * 
 1438  
      * @param value
 1439  
      * @param element
 1440  
      * @param counter
 1441  
      * @param xmlTag
 1442  
      */
 1443  
     protected void updateDistributionManagement( DistributionManagement value, String xmlTag, Counter counter,
 1444  
                                                  Element element )
 1445  
     {
 1446  0
         boolean shouldExist = value != null;
 1447  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1448  0
         if ( shouldExist )
 1449  
         {
 1450  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1451  0
             updateDeploymentRepository( value.getRepository(), "repository", innerCount, root );
 1452  0
             updateDeploymentRepository( value.getSnapshotRepository(), "snapshotRepository", innerCount, root );
 1453  0
             updateSite( value.getSite(), "site", innerCount, root );
 1454  0
             findAndReplaceSimpleElement( innerCount, root, "downloadUrl", value.getDownloadUrl(), null );
 1455  0
             updateRelocation( value.getRelocation(), "relocation", innerCount, root );
 1456  0
             findAndReplaceSimpleElement( innerCount, root, "status", value.getStatus(), null );
 1457  
         }
 1458  0
     } // -- void updateDistributionManagement(DistributionManagement, String, Counter, Element)
 1459  
 
 1460  
     /**
 1461  
      * Method updateElement
 1462  
      * 
 1463  
      * @param counter
 1464  
      * @param shouldExist
 1465  
      * @param name
 1466  
      * @param parent
 1467  
      */
 1468  
     protected Element updateElement( Counter counter, Element parent, String name, boolean shouldExist )
 1469  
     {
 1470  0
         Element element = parent.getChild( name, parent.getNamespace() );
 1471  0
         if ( element != null && shouldExist )
 1472  
         {
 1473  0
             counter.increaseCount();
 1474  
         }
 1475  0
         if ( element == null && shouldExist )
 1476  
         {
 1477  0
             element = factory.element( name, parent.getNamespace() );
 1478  0
             insertAtPreferredLocation( parent, element, counter );
 1479  0
             counter.increaseCount();
 1480  
         }
 1481  0
         if ( !shouldExist && element != null )
 1482  
         {
 1483  0
             int index = parent.indexOf( element );
 1484  0
             if ( index > 0 )
 1485  
             {
 1486  0
                 Content previous = parent.getContent( index - 1 );
 1487  0
                 if ( previous instanceof Text )
 1488  
                 {
 1489  0
                     Text txt = (Text) previous;
 1490  0
                     if ( txt.getTextTrim().length() == 0 )
 1491  
                     {
 1492  0
                         parent.removeContent( txt );
 1493  
                     }
 1494  
                 }
 1495  
             }
 1496  0
             parent.removeContent( element );
 1497  
         }
 1498  0
         return element;
 1499  
     } // -- Element updateElement(Counter, Element, String, boolean)
 1500  
 
 1501  
     /**
 1502  
      * Method updateExclusion
 1503  
      * 
 1504  
      * @param value
 1505  
      * @param element
 1506  
      * @param counter
 1507  
      * @param xmlTag
 1508  
      */
 1509  
     protected void updateExclusion( Exclusion value, String xmlTag, Counter counter, Element element )
 1510  
     {
 1511  0
         Element root = element;
 1512  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1513  0
         findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1514  0
         findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
 1515  0
     } // -- void updateExclusion(Exclusion, String, Counter, Element)
 1516  
 
 1517  
     /**
 1518  
      * Method updateExtension
 1519  
      * 
 1520  
      * @param value
 1521  
      * @param element
 1522  
      * @param counter
 1523  
      * @param xmlTag
 1524  
      */
 1525  
     protected void updateExtension( Extension value, String xmlTag, Counter counter, Element element )
 1526  
     {
 1527  0
         Element root = element;
 1528  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1529  0
         findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
 1530  0
         findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1531  0
         findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1532  0
     } // -- void updateExtension(Extension, String, Counter, Element)
 1533  
 
 1534  
     /**
 1535  
      * Method updateFileSet
 1536  
      * 
 1537  
      * @param value
 1538  
      * @param element
 1539  
      * @param counter
 1540  
      * @param xmlTag
 1541  
      */
 1542  
     protected void updateFileSet( FileSet value, String xmlTag, Counter counter, Element element )
 1543  
     {
 1544  0
         boolean shouldExist = value != null;
 1545  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1546  0
         if ( shouldExist )
 1547  
         {
 1548  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1549  0
             findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
 1550  0
             findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" );
 1551  0
             findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" );
 1552  
         }
 1553  0
     } // -- void updateFileSet(FileSet, String, Counter, Element)
 1554  
 
 1555  
     /**
 1556  
      * Method updateIssueManagement
 1557  
      * 
 1558  
      * @param value
 1559  
      * @param element
 1560  
      * @param counter
 1561  
      * @param xmlTag
 1562  
      */
 1563  
     protected void updateIssueManagement( IssueManagement value, String xmlTag, Counter counter, Element element )
 1564  
     {
 1565  0
         boolean shouldExist = value != null;
 1566  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1567  0
         if ( shouldExist )
 1568  
         {
 1569  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1570  0
             findAndReplaceSimpleElement( innerCount, root, "system", value.getSystem(), null );
 1571  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1572  
         }
 1573  0
     } // -- void updateIssueManagement(IssueManagement, String, Counter, Element)
 1574  
 
 1575  
     /**
 1576  
      * Method updateLicense
 1577  
      * 
 1578  
      * @param value
 1579  
      * @param element
 1580  
      * @param counter
 1581  
      * @param xmlTag
 1582  
      */
 1583  
     protected void updateLicense( License value, String xmlTag, Counter counter, Element element )
 1584  
     {
 1585  0
         Element root = element;
 1586  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1587  0
         findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1588  0
         findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1589  0
         findAndReplaceSimpleElement( innerCount, root, "distribution", value.getDistribution(), null );
 1590  0
         findAndReplaceSimpleElement( innerCount, root, "comments", value.getComments(), null );
 1591  0
     } // -- void updateLicense(License, String, Counter, Element)
 1592  
 
 1593  
     /**
 1594  
      * Method updateMailingList
 1595  
      * 
 1596  
      * @param value
 1597  
      * @param element
 1598  
      * @param counter
 1599  
      * @param xmlTag
 1600  
      */
 1601  
     protected void updateMailingList( MailingList value, String xmlTag, Counter counter, Element element )
 1602  
     {
 1603  0
         Element root = element;
 1604  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1605  0
         findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1606  0
         findAndReplaceSimpleElement( innerCount, root, "subscribe", value.getSubscribe(), null );
 1607  0
         findAndReplaceSimpleElement( innerCount, root, "unsubscribe", value.getUnsubscribe(), null );
 1608  0
         findAndReplaceSimpleElement( innerCount, root, "post", value.getPost(), null );
 1609  0
         findAndReplaceSimpleElement( innerCount, root, "archive", value.getArchive(), null );
 1610  0
         findAndReplaceSimpleLists( innerCount, root, value.getOtherArchives(), "otherArchives", "otherArchive" );
 1611  0
     } // -- void updateMailingList(MailingList, String, Counter, Element)
 1612  
 
 1613  
     /**
 1614  
      * Method updateModel
 1615  
      * 
 1616  
      * @param value
 1617  
      * @param element
 1618  
      * @param counter
 1619  
      * @param xmlTag
 1620  
      */
 1621  
     protected void updateModel( Model value, String xmlTag, Counter counter, Element element )
 1622  
     {
 1623  0
         Element root = element;
 1624  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1625  0
         updateParent( value.getParent(), "parent", innerCount, root );
 1626  0
         findAndReplaceSimpleElement( innerCount, root, "modelVersion", value.getModelVersion(), null );
 1627  0
         findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
 1628  0
         findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1629  0
         findAndReplaceSimpleElement( innerCount, root, "packaging", value.getPackaging(), "jar" );
 1630  0
         findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1631  0
         findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1632  0
         findAndReplaceSimpleElement( innerCount, root, "description", value.getDescription(), null );
 1633  0
         findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1634  0
         updatePrerequisites( value.getPrerequisites(), "prerequisites", innerCount, root );
 1635  0
         updateIssueManagement( value.getIssueManagement(), "issueManagement", innerCount, root );
 1636  0
         updateCiManagement( value.getCiManagement(), "ciManagement", innerCount, root );
 1637  0
         findAndReplaceSimpleElement( innerCount, root, "inceptionYear", value.getInceptionYear(), null );
 1638  0
         iterateMailingList( innerCount, root, value.getMailingLists(), "mailingLists", "mailingList" );
 1639  0
         iterateDeveloper( innerCount, root, value.getDevelopers(), "developers", "developer" );
 1640  0
         iterateContributor( innerCount, root, value.getContributors(), "contributors", "contributor" );
 1641  0
         iterateLicense( innerCount, root, value.getLicenses(), "licenses", "license" );
 1642  0
         updateScm( value.getScm(), "scm", innerCount, root );
 1643  0
         updateOrganization( value.getOrganization(), "organization", innerCount, root );
 1644  0
         updateBuild( value.getBuild(), "build", innerCount, root );
 1645  0
         iterateProfile( innerCount, root, value.getProfiles(), "profiles", "profile" );
 1646  0
         findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
 1647  0
         iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
 1648  0
         iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
 1649  0
         iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
 1650  0
         findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
 1651  0
         updateReporting( value.getReporting(), "reporting", innerCount, root );
 1652  0
         updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
 1653  0
         updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
 1654  0
         findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
 1655  0
     } // -- void updateModel(Model, String, Counter, Element)
 1656  
 
 1657  
     /**
 1658  
      * Method updateModelBase
 1659  
      * 
 1660  
      * @param value
 1661  
      * @param element
 1662  
      * @param counter
 1663  
      * @param xmlTag
 1664  
      */
 1665  
     protected void updateModelBase( ModelBase value, String xmlTag, Counter counter, Element element )
 1666  
     {
 1667  0
         boolean shouldExist = value != null;
 1668  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1669  0
         if ( shouldExist )
 1670  
         {
 1671  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1672  0
             findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
 1673  0
             iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
 1674  0
             iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories",
 1675  
                                "pluginRepository" );
 1676  0
             iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
 1677  0
             findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
 1678  0
             updateReporting( value.getReporting(), "reporting", innerCount, root );
 1679  0
             updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
 1680  0
             updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
 1681  0
             findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
 1682  
         }
 1683  0
     } // -- void updateModelBase(ModelBase, String, Counter, Element)
 1684  
 
 1685  
     /**
 1686  
      * Method updateNotifier
 1687  
      * 
 1688  
      * @param value
 1689  
      * @param element
 1690  
      * @param counter
 1691  
      * @param xmlTag
 1692  
      */
 1693  
     protected void updateNotifier( Notifier value, String xmlTag, Counter counter, Element element )
 1694  
     {
 1695  0
         Element root = element;
 1696  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1697  0
         findAndReplaceSimpleElement( innerCount, root, "type", value.getType(), "mail" );
 1698  0
         findAndReplaceSimpleElement( innerCount, root, "sendOnError", value.isSendOnError() ? null
 1699  
                         : String.valueOf( value.isSendOnError() ), "true" );
 1700  0
         findAndReplaceSimpleElement( innerCount, root, "sendOnFailure", value.isSendOnFailure() ? null
 1701  
                         : String.valueOf( value.isSendOnFailure() ), "true" );
 1702  0
         findAndReplaceSimpleElement( innerCount, root, "sendOnSuccess", value.isSendOnSuccess() ? null
 1703  
                         : String.valueOf( value.isSendOnSuccess() ), "true" );
 1704  0
         findAndReplaceSimpleElement( innerCount, root, "sendOnWarning", value.isSendOnWarning() ? null
 1705  
                         : String.valueOf( value.isSendOnWarning() ), "true" );
 1706  0
         findAndReplaceSimpleElement( innerCount, root, "address", value.getAddress(), null );
 1707  0
         findAndReplaceProperties( innerCount, root, "configuration", value.getConfiguration() );
 1708  0
     } // -- void updateNotifier(Notifier, String, Counter, Element)
 1709  
 
 1710  
     /**
 1711  
      * Method updateOrganization
 1712  
      * 
 1713  
      * @param value
 1714  
      * @param element
 1715  
      * @param counter
 1716  
      * @param xmlTag
 1717  
      */
 1718  
     protected void updateOrganization( Organization value, String xmlTag, Counter counter, Element element )
 1719  
     {
 1720  0
         boolean shouldExist = value != null;
 1721  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1722  0
         if ( shouldExist )
 1723  
         {
 1724  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1725  0
             findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 1726  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 1727  
         }
 1728  0
     } // -- void updateOrganization(Organization, String, Counter, Element)
 1729  
 
 1730  
     /**
 1731  
      * Method updateParent
 1732  
      * 
 1733  
      * @param value
 1734  
      * @param element
 1735  
      * @param counter
 1736  
      * @param xmlTag
 1737  
      */
 1738  
     protected void updateParent( Parent value, String xmlTag, Counter counter, Element element )
 1739  
     {
 1740  0
         boolean shouldExist = value != null;
 1741  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1742  0
         if ( shouldExist )
 1743  
         {
 1744  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1745  0
             findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1746  0
             findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
 1747  0
             findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1748  0
             findAndReplaceSimpleElement( innerCount, root, "relativePath", value.getRelativePath(), "../pom.xml" );
 1749  
         }
 1750  0
     } // -- void updateParent(Parent, String, Counter, Element)
 1751  
 
 1752  
     /**
 1753  
      * Method updatePatternSet
 1754  
      * 
 1755  
      * @param value
 1756  
      * @param element
 1757  
      * @param counter
 1758  
      * @param xmlTag
 1759  
      */
 1760  
     protected void updatePatternSet( PatternSet value, String xmlTag, Counter counter, Element element )
 1761  
     {
 1762  0
         boolean shouldExist = value != null;
 1763  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1764  0
         if ( shouldExist )
 1765  
         {
 1766  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1767  0
             findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" );
 1768  0
             findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" );
 1769  
         }
 1770  0
     } // -- void updatePatternSet(PatternSet, String, Counter, Element)
 1771  
 
 1772  
     /**
 1773  
      * Method updatePlugin
 1774  
      * 
 1775  
      * @param value
 1776  
      * @param element
 1777  
      * @param counter
 1778  
      * @param xmlTag
 1779  
      */
 1780  
     protected void updatePlugin( Plugin value, String xmlTag, Counter counter, Element element )
 1781  
     {
 1782  0
         Element root = element;
 1783  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1784  0
         findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" );
 1785  0
         findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1786  0
         findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1787  0
         findAndReplaceSimpleElement( innerCount, root, "extensions", !value.isExtensions() ? null
 1788  
                         : String.valueOf( value.isExtensions() ), "false" );
 1789  0
         iteratePluginExecution( innerCount, root, value.getExecutions(), "executions", "execution" );
 1790  0
         iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
 1791  0
         findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() );
 1792  0
         findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
 1793  0
         findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
 1794  0
     } // -- void updatePlugin(Plugin, String, Counter, Element)
 1795  
 
 1796  
     /**
 1797  
      * Method updatePluginConfiguration
 1798  
      * 
 1799  
      * @param value
 1800  
      * @param element
 1801  
      * @param counter
 1802  
      * @param xmlTag
 1803  
      */
 1804  
     protected void updatePluginConfiguration( PluginConfiguration value, String xmlTag, Counter counter, Element element )
 1805  
     {
 1806  0
         boolean shouldExist = value != null;
 1807  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1808  0
         if ( shouldExist )
 1809  
         {
 1810  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1811  0
             updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
 1812  0
             iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
 1813  
         }
 1814  0
     } // -- void updatePluginConfiguration(PluginConfiguration, String, Counter, Element)
 1815  
 
 1816  
     /**
 1817  
      * Method updatePluginContainer
 1818  
      * 
 1819  
      * @param value
 1820  
      * @param element
 1821  
      * @param counter
 1822  
      * @param xmlTag
 1823  
      */
 1824  
     protected void updatePluginContainer( PluginContainer value, String xmlTag, Counter counter, Element element )
 1825  
     {
 1826  0
         boolean shouldExist = value != null;
 1827  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1828  0
         if ( shouldExist )
 1829  
         {
 1830  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1831  0
             iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
 1832  
         }
 1833  0
     } // -- void updatePluginContainer(PluginContainer, String, Counter, Element)
 1834  
 
 1835  
     /**
 1836  
      * Method updatePluginExecution
 1837  
      * 
 1838  
      * @param value
 1839  
      * @param element
 1840  
      * @param counter
 1841  
      * @param xmlTag
 1842  
      */
 1843  
     protected void updatePluginExecution( PluginExecution value, String xmlTag, Counter counter, Element element )
 1844  
     {
 1845  0
         Element root = element;
 1846  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1847  0
         findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
 1848  0
         findAndReplaceSimpleElement( innerCount, root, "phase", value.getPhase(), null );
 1849  0
         findAndReplaceSimpleLists( innerCount, root, value.getGoals(), "goals", "goal" );
 1850  0
         findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
 1851  0
         findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
 1852  0
     } // -- void updatePluginExecution(PluginExecution, String, Counter, Element)
 1853  
 
 1854  
     /**
 1855  
      * Method updatePluginManagement
 1856  
      * 
 1857  
      * @param value
 1858  
      * @param element
 1859  
      * @param counter
 1860  
      * @param xmlTag
 1861  
      */
 1862  
     protected void updatePluginManagement( PluginManagement value, String xmlTag, Counter counter, Element element )
 1863  
     {
 1864  0
         boolean shouldExist = value != null;
 1865  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1866  0
         if ( shouldExist )
 1867  
         {
 1868  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1869  0
             iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
 1870  
         }
 1871  0
     } // -- void updatePluginManagement(PluginManagement, String, Counter, Element)
 1872  
 
 1873  
     /**
 1874  
      * Method updatePrerequisites
 1875  
      * 
 1876  
      * @param value
 1877  
      * @param element
 1878  
      * @param counter
 1879  
      * @param xmlTag
 1880  
      */
 1881  
     protected void updatePrerequisites( Prerequisites value, String xmlTag, Counter counter, Element element )
 1882  
     {
 1883  0
         boolean shouldExist = value != null;
 1884  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1885  0
         if ( shouldExist )
 1886  
         {
 1887  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1888  0
             findAndReplaceSimpleElement( innerCount, root, "maven", value.getMaven(), "2.0" );
 1889  
         }
 1890  0
     } // -- void updatePrerequisites(Prerequisites, String, Counter, Element)
 1891  
 
 1892  
     /**
 1893  
      * Method updateProfile
 1894  
      * 
 1895  
      * @param value
 1896  
      * @param element
 1897  
      * @param counter
 1898  
      * @param xmlTag
 1899  
      */
 1900  
     protected void updateProfile( Profile value, String xmlTag, Counter counter, Element element )
 1901  
     {
 1902  0
         Element root = element;
 1903  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1904  0
         findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
 1905  
         // updateActivation( value.getActivation(), "activation", innerCount, root);
 1906  0
         updateBuildBase( value.getBuild(), "build", innerCount, root );
 1907  0
         findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
 1908  0
         iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
 1909  0
         iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories", "pluginRepository" );
 1910  0
         iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
 1911  0
         findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
 1912  0
         updateReporting( value.getReporting(), "reporting", innerCount, root );
 1913  0
         updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
 1914  0
         updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
 1915  0
         findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
 1916  0
     } // -- void updateProfile(Profile, String, Counter, Element)
 1917  
 
 1918  
     /**
 1919  
      * Method updateRelocation
 1920  
      * 
 1921  
      * @param value
 1922  
      * @param element
 1923  
      * @param counter
 1924  
      * @param xmlTag
 1925  
      */
 1926  
     protected void updateRelocation( Relocation value, String xmlTag, Counter counter, Element element )
 1927  
     {
 1928  0
         boolean shouldExist = value != null;
 1929  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1930  0
         if ( shouldExist )
 1931  
         {
 1932  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1933  0
             findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), null );
 1934  0
             findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1935  0
             findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1936  0
             findAndReplaceSimpleElement( innerCount, root, "message", value.getMessage(), null );
 1937  
         }
 1938  0
     } // -- void updateRelocation(Relocation, String, Counter, Element)
 1939  
 
 1940  
     /**
 1941  
      * Method updateReportPlugin
 1942  
      * 
 1943  
      * @param value
 1944  
      * @param element
 1945  
      * @param counter
 1946  
      * @param xmlTag
 1947  
      */
 1948  
     protected void updateReportPlugin( ReportPlugin value, String xmlTag, Counter counter, Element element )
 1949  
     {
 1950  0
         Element root = element;
 1951  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1952  0
         findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" );
 1953  0
         findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
 1954  0
         findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
 1955  0
         findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
 1956  0
         findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
 1957  0
         iterateReportSet( innerCount, root, value.getReportSets(), "reportSets", "reportSet" );
 1958  0
     } // -- void updateReportPlugin(ReportPlugin, String, Counter, Element)
 1959  
 
 1960  
     /**
 1961  
      * Method updateReportSet
 1962  
      * 
 1963  
      * @param value
 1964  
      * @param element
 1965  
      * @param counter
 1966  
      * @param xmlTag
 1967  
      */
 1968  
     protected void updateReportSet( ReportSet value, String xmlTag, Counter counter, Element element )
 1969  
     {
 1970  0
         Element root = element;
 1971  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 1972  0
         findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), "default" );
 1973  0
         findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
 1974  0
         findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
 1975  0
         findAndReplaceSimpleLists( innerCount, root, value.getReports(), "reports", "report" );
 1976  0
     } // -- void updateReportSet(ReportSet, String, Counter, Element)
 1977  
 
 1978  
     /**
 1979  
      * Method updateReporting
 1980  
      * 
 1981  
      * @param value
 1982  
      * @param element
 1983  
      * @param counter
 1984  
      * @param xmlTag
 1985  
      */
 1986  
     protected void updateReporting( Reporting value, String xmlTag, Counter counter, Element element )
 1987  
     {
 1988  0
         boolean shouldExist = value != null;
 1989  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 1990  0
         if ( shouldExist )
 1991  
         {
 1992  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 1993  0
             findAndReplaceSimpleElement( innerCount, root, "excludeDefaults", !value.isExcludeDefaults() ? null
 1994  
                             : String.valueOf( value.isExcludeDefaults() ), "false" );
 1995  0
             findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null );
 1996  0
             iterateReportPlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
 1997  
         }
 1998  0
     } // -- void updateReporting(Reporting, String, Counter, Element)
 1999  
 
 2000  
     /**
 2001  
      * Method updateRepository
 2002  
      * 
 2003  
      * @param value
 2004  
      * @param element
 2005  
      * @param counter
 2006  
      * @param xmlTag
 2007  
      */
 2008  
     protected void updateRepository( Repository value, String xmlTag, Counter counter, Element element )
 2009  
     {
 2010  0
         Element root = element;
 2011  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 2012  0
         updateRepositoryPolicy( value.getReleases(), "releases", innerCount, root );
 2013  0
         updateRepositoryPolicy( value.getSnapshots(), "snapshots", innerCount, root );
 2014  0
         findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
 2015  0
         findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 2016  0
         findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 2017  0
         findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" );
 2018  0
     } // -- void updateRepository(Repository, String, Counter, Element)
 2019  
 
 2020  
     /**
 2021  
      * Method updateRepositoryBase
 2022  
      * 
 2023  
      * @param value
 2024  
      * @param element
 2025  
      * @param counter
 2026  
      * @param xmlTag
 2027  
      */
 2028  
     protected void updateRepositoryBase( RepositoryBase value, String xmlTag, Counter counter, Element element )
 2029  
     {
 2030  0
         boolean shouldExist = value != null;
 2031  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 2032  0
         if ( shouldExist )
 2033  
         {
 2034  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 2035  0
             findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
 2036  0
             findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 2037  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 2038  0
             findAndReplaceSimpleElement( innerCount, root, "layout", value.getLayout(), "default" );
 2039  
         }
 2040  0
     } // -- void updateRepositoryBase(RepositoryBase, String, Counter, Element)
 2041  
 
 2042  
     /**
 2043  
      * Method updateRepositoryPolicy
 2044  
      * 
 2045  
      * @param value
 2046  
      * @param element
 2047  
      * @param counter
 2048  
      * @param xmlTag
 2049  
      */
 2050  
     protected void updateRepositoryPolicy( RepositoryPolicy value, String xmlTag, Counter counter, Element element )
 2051  
     {
 2052  0
         boolean shouldExist = value != null;
 2053  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 2054  0
         if ( shouldExist )
 2055  
         {
 2056  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 2057  0
             findAndReplaceSimpleElement( innerCount, root, "enabled", value.isEnabled() ? null
 2058  
                             : String.valueOf( value.isEnabled() ), "true" );
 2059  0
             findAndReplaceSimpleElement( innerCount, root, "updatePolicy", value.getUpdatePolicy(), null );
 2060  0
             findAndReplaceSimpleElement( innerCount, root, "checksumPolicy", value.getChecksumPolicy(), null );
 2061  
         }
 2062  0
     } // -- void updateRepositoryPolicy(RepositoryPolicy, String, Counter, Element)
 2063  
 
 2064  
     /**
 2065  
      * Method updateResource
 2066  
      * 
 2067  
      * @param value
 2068  
      * @param element
 2069  
      * @param counter
 2070  
      * @param xmlTag
 2071  
      */
 2072  
     protected void updateResource( Resource value, String xmlTag, Counter counter, Element element )
 2073  
     {
 2074  0
         Element root = element;
 2075  0
         Counter innerCount = new Counter( counter.getDepth() + 1 );
 2076  0
         findAndReplaceSimpleElement( innerCount, root, "targetPath", value.getTargetPath(), null );
 2077  0
         findAndReplaceSimpleElement( innerCount, root, "filtering", !value.isFiltering() ? null
 2078  
                         : String.valueOf( value.isFiltering() ), "false" );
 2079  0
         findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
 2080  0
         findAndReplaceSimpleLists( innerCount, root, value.getIncludes(), "includes", "include" );
 2081  0
         findAndReplaceSimpleLists( innerCount, root, value.getExcludes(), "excludes", "exclude" );
 2082  0
     } // -- void updateResource(Resource, String, Counter, Element)
 2083  
 
 2084  
     /**
 2085  
      * Method updateScm
 2086  
      * 
 2087  
      * @param value
 2088  
      * @param element
 2089  
      * @param counter
 2090  
      * @param xmlTag
 2091  
      */
 2092  
     protected void updateScm( Scm value, String xmlTag, Counter counter, Element element )
 2093  
     {
 2094  0
         boolean shouldExist = value != null;
 2095  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 2096  0
         if ( shouldExist )
 2097  
         {
 2098  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 2099  0
             findAndReplaceSimpleElement( innerCount, root, "connection", value.getConnection(), null );
 2100  0
             findAndReplaceSimpleElement( innerCount, root, "developerConnection", value.getDeveloperConnection(), null );
 2101  0
             findAndReplaceSimpleElement( innerCount, root, "tag", value.getTag(), "HEAD" );
 2102  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 2103  
         }
 2104  0
     } // -- void updateScm(Scm, String, Counter, Element)
 2105  
 
 2106  
     /**
 2107  
      * Method updateSite
 2108  
      * 
 2109  
      * @param value
 2110  
      * @param element
 2111  
      * @param counter
 2112  
      * @param xmlTag
 2113  
      */
 2114  
     protected void updateSite( Site value, String xmlTag, Counter counter, Element element )
 2115  
     {
 2116  0
         boolean shouldExist = value != null;
 2117  0
         Element root = updateElement( counter, element, xmlTag, shouldExist );
 2118  0
         if ( shouldExist )
 2119  
         {
 2120  0
             Counter innerCount = new Counter( counter.getDepth() + 1 );
 2121  0
             findAndReplaceSimpleElement( innerCount, root, "id", value.getId(), null );
 2122  0
             findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
 2123  0
             findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
 2124  
         }
 2125  0
     } // -- void updateSite(Site, String, Counter, Element)
 2126  
 
 2127  
     /**
 2128  
      * Method write
 2129  
      * 
 2130  
      * @deprecated
 2131  
      * @param project
 2132  
      * @param stream
 2133  
      * @param document
 2134  
      */
 2135  
     public void write( Model project, Document document, OutputStream stream )
 2136  
         throws java.io.IOException
 2137  
     {
 2138  0
         updateModel( project, "project", new Counter( 0 ), document.getRootElement() );
 2139  0
         XMLOutputter outputter = new XMLOutputter();
 2140  0
         Format format = Format.getPrettyFormat();
 2141  0
         format.setIndent( "    " ).setLineSeparator( System.getProperty( "line.separator" ) );
 2142  0
         outputter.setFormat( format );
 2143  0
         outputter.output( document, stream );
 2144  0
     } // -- void write(Model, Document, OutputStream)
 2145  
 
 2146  
     /**
 2147  
      * Method write
 2148  
      * 
 2149  
      * @param project
 2150  
      * @param writer
 2151  
      * @param document
 2152  
      */
 2153  
     public void write( Model project, Document document, OutputStreamWriter writer )
 2154  
         throws java.io.IOException
 2155  
     {
 2156  0
         Format format = Format.getRawFormat();
 2157  0
         format.setEncoding( writer.getEncoding() ).setLineSeparator( System.getProperty( "line.separator" ) );
 2158  0
         write( project, document, writer, format );
 2159  0
     } // -- void write(Model, Document, OutputStreamWriter)
 2160  
 
 2161  
     /**
 2162  
      * Method write
 2163  
      * 
 2164  
      * @param project
 2165  
      * @param jdomFormat
 2166  
      * @param writer
 2167  
      * @param document
 2168  
      */
 2169  
     public void write( Model project, Document document, Writer writer, Format jdomFormat )
 2170  
         throws java.io.IOException
 2171  
     {
 2172  0
         updateModel( project, "project", new Counter( 0 ), document.getRootElement() );
 2173  0
         XMLOutputter outputter = new XMLOutputter();
 2174  0
         outputter.setFormat( jdomFormat );
 2175  0
         outputter.output( document, writer );
 2176  0
     } // -- void write(Model, Document, Writer, Format)
 2177  
 
 2178  
     // -----------------/
 2179  
     // - Inner Classes -/
 2180  
     // -----------------/
 2181  
 
 2182  
     /**
 2183  
      * Class Counter.
 2184  
      * 
 2185  
      * @version $Revision$ $Date$
 2186  
      */
 2187  
     public class Counter
 2188  
     {
 2189  
 
 2190  
         // --------------------------/
 2191  
         // - Class/Member Variables -/
 2192  
         // --------------------------/
 2193  
 
 2194  
         /**
 2195  
          * Field currentIndex
 2196  
          */
 2197  0
         private int currentIndex = 0;
 2198  
 
 2199  
         /**
 2200  
          * Field level
 2201  
          */
 2202  
         private int level;
 2203  
 
 2204  
         // ----------------/
 2205  
         // - Constructors -/
 2206  
         // ----------------/
 2207  
 
 2208  
         public Counter( int depthLevel )
 2209  0
         {
 2210  0
             level = depthLevel;
 2211  0
         } // -- org.apache.maven.model.io.jdom.Counter(int)
 2212  
 
 2213  
         // -----------/
 2214  
         // - Methods -/
 2215  
         // -----------/
 2216  
 
 2217  
         /**
 2218  
          * Method getCurrentIndex
 2219  
          */
 2220  
         public int getCurrentIndex()
 2221  
         {
 2222  0
             return currentIndex;
 2223  
         } // -- int getCurrentIndex()
 2224  
 
 2225  
         /**
 2226  
          * Method getDepth
 2227  
          */
 2228  
         public int getDepth()
 2229  
         {
 2230  0
             return level;
 2231  
         } // -- int getDepth()
 2232  
 
 2233  
         /**
 2234  
          * Method increaseCount
 2235  
          */
 2236  
         public void increaseCount()
 2237  
         {
 2238  0
             currentIndex = currentIndex + 1;
 2239  0
         } // -- void increaseCount()
 2240  
 
 2241  
     }
 2242  
 
 2243  
 }