001 /* 002 =================== DO NOT EDIT THIS FILE ==================== 003 Generated by Modello 1.4.1 on 2012-01-20 18:09:18, 004 any modifications will be overwritten. 005 ============================================================== 006 */ 007 008 package org.apache.maven.model.io.xpp3; 009 010 //---------------------------------/ 011 //- Imported classes and packages -/ 012 //---------------------------------/ 013 014 import java.io.OutputStream; 015 import java.io.Writer; 016 import java.text.DateFormat; 017 import java.util.Iterator; 018 import java.util.Locale; 019 import org.apache.maven.model.Activation; 020 import org.apache.maven.model.ActivationFile; 021 import org.apache.maven.model.ActivationOS; 022 import org.apache.maven.model.ActivationProperty; 023 import org.apache.maven.model.Build; 024 import org.apache.maven.model.BuildBase; 025 import org.apache.maven.model.CiManagement; 026 import org.apache.maven.model.ConfigurationContainer; 027 import org.apache.maven.model.Contributor; 028 import org.apache.maven.model.Dependency; 029 import org.apache.maven.model.DependencyManagement; 030 import org.apache.maven.model.DeploymentRepository; 031 import org.apache.maven.model.Developer; 032 import org.apache.maven.model.DistributionManagement; 033 import org.apache.maven.model.Exclusion; 034 import org.apache.maven.model.Extension; 035 import org.apache.maven.model.FileSet; 036 import org.apache.maven.model.IssueManagement; 037 import org.apache.maven.model.License; 038 import org.apache.maven.model.MailingList; 039 import org.apache.maven.model.Model; 040 import org.apache.maven.model.ModelBase; 041 import org.apache.maven.model.Notifier; 042 import org.apache.maven.model.Organization; 043 import org.apache.maven.model.Parent; 044 import org.apache.maven.model.PatternSet; 045 import org.apache.maven.model.Plugin; 046 import org.apache.maven.model.PluginConfiguration; 047 import org.apache.maven.model.PluginContainer; 048 import org.apache.maven.model.PluginExecution; 049 import org.apache.maven.model.PluginManagement; 050 import org.apache.maven.model.Prerequisites; 051 import org.apache.maven.model.Profile; 052 import org.apache.maven.model.Relocation; 053 import org.apache.maven.model.ReportPlugin; 054 import org.apache.maven.model.ReportSet; 055 import org.apache.maven.model.Reporting; 056 import org.apache.maven.model.Repository; 057 import org.apache.maven.model.RepositoryBase; 058 import org.apache.maven.model.RepositoryPolicy; 059 import org.apache.maven.model.Resource; 060 import org.apache.maven.model.Scm; 061 import org.apache.maven.model.Site; 062 import org.codehaus.plexus.util.xml.Xpp3Dom; 063 import org.codehaus.plexus.util.xml.pull.MXSerializer; 064 import org.codehaus.plexus.util.xml.pull.XmlSerializer; 065 066 /** 067 * Class MavenXpp3Writer. 068 * 069 * @version $Revision$ $Date$ 070 */ 071 @SuppressWarnings( "all" ) 072 public class MavenXpp3Writer 073 { 074 075 //--------------------------/ 076 //- Class/Member Variables -/ 077 //--------------------------/ 078 079 /** 080 * Field NAMESPACE. 081 */ 082 private static final String NAMESPACE = null; 083 084 085 //-----------/ 086 //- Methods -/ 087 //-----------/ 088 089 /** 090 * Method write. 091 * 092 * @param writer 093 * @param model 094 * @throws java.io.IOException 095 */ 096 public void write( Writer writer, Model model ) 097 throws java.io.IOException 098 { 099 XmlSerializer serializer = new MXSerializer(); 100 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); 101 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); 102 serializer.setOutput( writer ); 103 serializer.startDocument( model.getModelEncoding(), null ); 104 writeModel( model, "project", serializer ); 105 serializer.endDocument(); 106 } //-- void write( Writer, Model ) 107 108 /** 109 * Method write. 110 * 111 * @param stream 112 * @param model 113 * @throws java.io.IOException 114 */ 115 public void write( OutputStream stream, Model model ) 116 throws java.io.IOException 117 { 118 XmlSerializer serializer = new MXSerializer(); 119 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); 120 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); 121 serializer.setOutput( stream, model.getModelEncoding() ); 122 serializer.startDocument( model.getModelEncoding(), null ); 123 writeModel( model, "project", serializer ); 124 serializer.endDocument(); 125 } //-- void write( OutputStream, Model ) 126 127 /** 128 * Method writeActivation. 129 * 130 * @param activation 131 * @param serializer 132 * @param tagName 133 * @throws java.io.IOException 134 */ 135 private void writeActivation( Activation activation, String tagName, XmlSerializer serializer ) 136 throws java.io.IOException 137 { 138 serializer.startTag( NAMESPACE, tagName ); 139 if ( activation.isActiveByDefault() != false ) 140 { 141 serializer.startTag( NAMESPACE, "activeByDefault" ).text( String.valueOf( activation.isActiveByDefault() ) ).endTag( NAMESPACE, "activeByDefault" ); 142 } 143 if ( activation.getJdk() != null ) 144 { 145 serializer.startTag( NAMESPACE, "jdk" ).text( activation.getJdk() ).endTag( NAMESPACE, "jdk" ); 146 } 147 if ( activation.getOs() != null ) 148 { 149 writeActivationOS( (ActivationOS) activation.getOs(), "os", serializer ); 150 } 151 if ( activation.getProperty() != null ) 152 { 153 writeActivationProperty( (ActivationProperty) activation.getProperty(), "property", serializer ); 154 } 155 if ( activation.getFile() != null ) 156 { 157 writeActivationFile( (ActivationFile) activation.getFile(), "file", serializer ); 158 } 159 serializer.endTag( NAMESPACE, tagName ); 160 } //-- void writeActivation( Activation, String, XmlSerializer ) 161 162 /** 163 * Method writeActivationFile. 164 * 165 * @param activationFile 166 * @param serializer 167 * @param tagName 168 * @throws java.io.IOException 169 */ 170 private void writeActivationFile( ActivationFile activationFile, String tagName, XmlSerializer serializer ) 171 throws java.io.IOException 172 { 173 serializer.startTag( NAMESPACE, tagName ); 174 if ( activationFile.getMissing() != null ) 175 { 176 serializer.startTag( NAMESPACE, "missing" ).text( activationFile.getMissing() ).endTag( NAMESPACE, "missing" ); 177 } 178 if ( activationFile.getExists() != null ) 179 { 180 serializer.startTag( NAMESPACE, "exists" ).text( activationFile.getExists() ).endTag( NAMESPACE, "exists" ); 181 } 182 serializer.endTag( NAMESPACE, tagName ); 183 } //-- void writeActivationFile( ActivationFile, String, XmlSerializer ) 184 185 /** 186 * Method writeActivationOS. 187 * 188 * @param activationOS 189 * @param serializer 190 * @param tagName 191 * @throws java.io.IOException 192 */ 193 private void writeActivationOS( ActivationOS activationOS, String tagName, XmlSerializer serializer ) 194 throws java.io.IOException 195 { 196 serializer.startTag( NAMESPACE, tagName ); 197 if ( activationOS.getName() != null ) 198 { 199 serializer.startTag( NAMESPACE, "name" ).text( activationOS.getName() ).endTag( NAMESPACE, "name" ); 200 } 201 if ( activationOS.getFamily() != null ) 202 { 203 serializer.startTag( NAMESPACE, "family" ).text( activationOS.getFamily() ).endTag( NAMESPACE, "family" ); 204 } 205 if ( activationOS.getArch() != null ) 206 { 207 serializer.startTag( NAMESPACE, "arch" ).text( activationOS.getArch() ).endTag( NAMESPACE, "arch" ); 208 } 209 if ( activationOS.getVersion() != null ) 210 { 211 serializer.startTag( NAMESPACE, "version" ).text( activationOS.getVersion() ).endTag( NAMESPACE, "version" ); 212 } 213 serializer.endTag( NAMESPACE, tagName ); 214 } //-- void writeActivationOS( ActivationOS, String, XmlSerializer ) 215 216 /** 217 * Method writeActivationProperty. 218 * 219 * @param activationProperty 220 * @param serializer 221 * @param tagName 222 * @throws java.io.IOException 223 */ 224 private void writeActivationProperty( ActivationProperty activationProperty, String tagName, XmlSerializer serializer ) 225 throws java.io.IOException 226 { 227 serializer.startTag( NAMESPACE, tagName ); 228 if ( activationProperty.getName() != null ) 229 { 230 serializer.startTag( NAMESPACE, "name" ).text( activationProperty.getName() ).endTag( NAMESPACE, "name" ); 231 } 232 if ( activationProperty.getValue() != null ) 233 { 234 serializer.startTag( NAMESPACE, "value" ).text( activationProperty.getValue() ).endTag( NAMESPACE, "value" ); 235 } 236 serializer.endTag( NAMESPACE, tagName ); 237 } //-- void writeActivationProperty( ActivationProperty, String, XmlSerializer ) 238 239 /** 240 * Method writeBuild. 241 * 242 * @param build 243 * @param serializer 244 * @param tagName 245 * @throws java.io.IOException 246 */ 247 private void writeBuild( Build build, String tagName, XmlSerializer serializer ) 248 throws java.io.IOException 249 { 250 serializer.startTag( NAMESPACE, tagName ); 251 if ( build.getSourceDirectory() != null ) 252 { 253 serializer.startTag( NAMESPACE, "sourceDirectory" ).text( build.getSourceDirectory() ).endTag( NAMESPACE, "sourceDirectory" ); 254 } 255 if ( build.getScriptSourceDirectory() != null ) 256 { 257 serializer.startTag( NAMESPACE, "scriptSourceDirectory" ).text( build.getScriptSourceDirectory() ).endTag( NAMESPACE, "scriptSourceDirectory" ); 258 } 259 if ( build.getTestSourceDirectory() != null ) 260 { 261 serializer.startTag( NAMESPACE, "testSourceDirectory" ).text( build.getTestSourceDirectory() ).endTag( NAMESPACE, "testSourceDirectory" ); 262 } 263 if ( build.getOutputDirectory() != null ) 264 { 265 serializer.startTag( NAMESPACE, "outputDirectory" ).text( build.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" ); 266 } 267 if ( build.getTestOutputDirectory() != null ) 268 { 269 serializer.startTag( NAMESPACE, "testOutputDirectory" ).text( build.getTestOutputDirectory() ).endTag( NAMESPACE, "testOutputDirectory" ); 270 } 271 if ( ( build.getExtensions() != null ) && ( build.getExtensions().size() > 0 ) ) 272 { 273 serializer.startTag( NAMESPACE, "extensions" ); 274 for ( Iterator iter = build.getExtensions().iterator(); iter.hasNext(); ) 275 { 276 Extension o = (Extension) iter.next(); 277 writeExtension( o, "extension", serializer ); 278 } 279 serializer.endTag( NAMESPACE, "extensions" ); 280 } 281 if ( build.getDefaultGoal() != null ) 282 { 283 serializer.startTag( NAMESPACE, "defaultGoal" ).text( build.getDefaultGoal() ).endTag( NAMESPACE, "defaultGoal" ); 284 } 285 if ( ( build.getResources() != null ) && ( build.getResources().size() > 0 ) ) 286 { 287 serializer.startTag( NAMESPACE, "resources" ); 288 for ( Iterator iter = build.getResources().iterator(); iter.hasNext(); ) 289 { 290 Resource o = (Resource) iter.next(); 291 writeResource( o, "resource", serializer ); 292 } 293 serializer.endTag( NAMESPACE, "resources" ); 294 } 295 if ( ( build.getTestResources() != null ) && ( build.getTestResources().size() > 0 ) ) 296 { 297 serializer.startTag( NAMESPACE, "testResources" ); 298 for ( Iterator iter = build.getTestResources().iterator(); iter.hasNext(); ) 299 { 300 Resource o = (Resource) iter.next(); 301 writeResource( o, "testResource", serializer ); 302 } 303 serializer.endTag( NAMESPACE, "testResources" ); 304 } 305 if ( build.getDirectory() != null ) 306 { 307 serializer.startTag( NAMESPACE, "directory" ).text( build.getDirectory() ).endTag( NAMESPACE, "directory" ); 308 } 309 if ( build.getFinalName() != null ) 310 { 311 serializer.startTag( NAMESPACE, "finalName" ).text( build.getFinalName() ).endTag( NAMESPACE, "finalName" ); 312 } 313 if ( ( build.getFilters() != null ) && ( build.getFilters().size() > 0 ) ) 314 { 315 serializer.startTag( NAMESPACE, "filters" ); 316 for ( Iterator iter = build.getFilters().iterator(); iter.hasNext(); ) 317 { 318 String filter = (String) iter.next(); 319 serializer.startTag( NAMESPACE, "filter" ).text( filter ).endTag( NAMESPACE, "filter" ); 320 } 321 serializer.endTag( NAMESPACE, "filters" ); 322 } 323 if ( build.getPluginManagement() != null ) 324 { 325 writePluginManagement( (PluginManagement) build.getPluginManagement(), "pluginManagement", serializer ); 326 } 327 if ( ( build.getPlugins() != null ) && ( build.getPlugins().size() > 0 ) ) 328 { 329 serializer.startTag( NAMESPACE, "plugins" ); 330 for ( Iterator iter = build.getPlugins().iterator(); iter.hasNext(); ) 331 { 332 Plugin o = (Plugin) iter.next(); 333 writePlugin( o, "plugin", serializer ); 334 } 335 serializer.endTag( NAMESPACE, "plugins" ); 336 } 337 serializer.endTag( NAMESPACE, tagName ); 338 } //-- void writeBuild( Build, String, XmlSerializer ) 339 340 /** 341 * Method writeBuildBase. 342 * 343 * @param buildBase 344 * @param serializer 345 * @param tagName 346 * @throws java.io.IOException 347 */ 348 private void writeBuildBase( BuildBase buildBase, String tagName, XmlSerializer serializer ) 349 throws java.io.IOException 350 { 351 serializer.startTag( NAMESPACE, tagName ); 352 if ( buildBase.getDefaultGoal() != null ) 353 { 354 serializer.startTag( NAMESPACE, "defaultGoal" ).text( buildBase.getDefaultGoal() ).endTag( NAMESPACE, "defaultGoal" ); 355 } 356 if ( ( buildBase.getResources() != null ) && ( buildBase.getResources().size() > 0 ) ) 357 { 358 serializer.startTag( NAMESPACE, "resources" ); 359 for ( Iterator iter = buildBase.getResources().iterator(); iter.hasNext(); ) 360 { 361 Resource o = (Resource) iter.next(); 362 writeResource( o, "resource", serializer ); 363 } 364 serializer.endTag( NAMESPACE, "resources" ); 365 } 366 if ( ( buildBase.getTestResources() != null ) && ( buildBase.getTestResources().size() > 0 ) ) 367 { 368 serializer.startTag( NAMESPACE, "testResources" ); 369 for ( Iterator iter = buildBase.getTestResources().iterator(); iter.hasNext(); ) 370 { 371 Resource o = (Resource) iter.next(); 372 writeResource( o, "testResource", serializer ); 373 } 374 serializer.endTag( NAMESPACE, "testResources" ); 375 } 376 if ( buildBase.getDirectory() != null ) 377 { 378 serializer.startTag( NAMESPACE, "directory" ).text( buildBase.getDirectory() ).endTag( NAMESPACE, "directory" ); 379 } 380 if ( buildBase.getFinalName() != null ) 381 { 382 serializer.startTag( NAMESPACE, "finalName" ).text( buildBase.getFinalName() ).endTag( NAMESPACE, "finalName" ); 383 } 384 if ( ( buildBase.getFilters() != null ) && ( buildBase.getFilters().size() > 0 ) ) 385 { 386 serializer.startTag( NAMESPACE, "filters" ); 387 for ( Iterator iter = buildBase.getFilters().iterator(); iter.hasNext(); ) 388 { 389 String filter = (String) iter.next(); 390 serializer.startTag( NAMESPACE, "filter" ).text( filter ).endTag( NAMESPACE, "filter" ); 391 } 392 serializer.endTag( NAMESPACE, "filters" ); 393 } 394 if ( buildBase.getPluginManagement() != null ) 395 { 396 writePluginManagement( (PluginManagement) buildBase.getPluginManagement(), "pluginManagement", serializer ); 397 } 398 if ( ( buildBase.getPlugins() != null ) && ( buildBase.getPlugins().size() > 0 ) ) 399 { 400 serializer.startTag( NAMESPACE, "plugins" ); 401 for ( Iterator iter = buildBase.getPlugins().iterator(); iter.hasNext(); ) 402 { 403 Plugin o = (Plugin) iter.next(); 404 writePlugin( o, "plugin", serializer ); 405 } 406 serializer.endTag( NAMESPACE, "plugins" ); 407 } 408 serializer.endTag( NAMESPACE, tagName ); 409 } //-- void writeBuildBase( BuildBase, String, XmlSerializer ) 410 411 /** 412 * Method writeCiManagement. 413 * 414 * @param ciManagement 415 * @param serializer 416 * @param tagName 417 * @throws java.io.IOException 418 */ 419 private void writeCiManagement( CiManagement ciManagement, String tagName, XmlSerializer serializer ) 420 throws java.io.IOException 421 { 422 serializer.startTag( NAMESPACE, tagName ); 423 if ( ciManagement.getSystem() != null ) 424 { 425 serializer.startTag( NAMESPACE, "system" ).text( ciManagement.getSystem() ).endTag( NAMESPACE, "system" ); 426 } 427 if ( ciManagement.getUrl() != null ) 428 { 429 serializer.startTag( NAMESPACE, "url" ).text( ciManagement.getUrl() ).endTag( NAMESPACE, "url" ); 430 } 431 if ( ( ciManagement.getNotifiers() != null ) && ( ciManagement.getNotifiers().size() > 0 ) ) 432 { 433 serializer.startTag( NAMESPACE, "notifiers" ); 434 for ( Iterator iter = ciManagement.getNotifiers().iterator(); iter.hasNext(); ) 435 { 436 Notifier o = (Notifier) iter.next(); 437 writeNotifier( o, "notifier", serializer ); 438 } 439 serializer.endTag( NAMESPACE, "notifiers" ); 440 } 441 serializer.endTag( NAMESPACE, tagName ); 442 } //-- void writeCiManagement( CiManagement, String, XmlSerializer ) 443 444 /** 445 * Method writeConfigurationContainer. 446 * 447 * @param configurationContainer 448 * @param serializer 449 * @param tagName 450 * @throws java.io.IOException 451 */ 452 private void writeConfigurationContainer( ConfigurationContainer configurationContainer, String tagName, XmlSerializer serializer ) 453 throws java.io.IOException 454 { 455 serializer.startTag( NAMESPACE, tagName ); 456 if ( configurationContainer.getInherited() != null ) 457 { 458 serializer.startTag( NAMESPACE, "inherited" ).text( configurationContainer.getInherited() ).endTag( NAMESPACE, "inherited" ); 459 } 460 if ( configurationContainer.getConfiguration() != null ) 461 { 462 ((Xpp3Dom) configurationContainer.getConfiguration()).writeToSerializer( NAMESPACE, serializer ); 463 } 464 serializer.endTag( NAMESPACE, tagName ); 465 } //-- void writeConfigurationContainer( ConfigurationContainer, String, XmlSerializer ) 466 467 /** 468 * Method writeContributor. 469 * 470 * @param contributor 471 * @param serializer 472 * @param tagName 473 * @throws java.io.IOException 474 */ 475 private void writeContributor( Contributor contributor, String tagName, XmlSerializer serializer ) 476 throws java.io.IOException 477 { 478 serializer.startTag( NAMESPACE, tagName ); 479 if ( contributor.getName() != null ) 480 { 481 serializer.startTag( NAMESPACE, "name" ).text( contributor.getName() ).endTag( NAMESPACE, "name" ); 482 } 483 if ( contributor.getEmail() != null ) 484 { 485 serializer.startTag( NAMESPACE, "email" ).text( contributor.getEmail() ).endTag( NAMESPACE, "email" ); 486 } 487 if ( contributor.getUrl() != null ) 488 { 489 serializer.startTag( NAMESPACE, "url" ).text( contributor.getUrl() ).endTag( NAMESPACE, "url" ); 490 } 491 if ( contributor.getOrganization() != null ) 492 { 493 serializer.startTag( NAMESPACE, "organization" ).text( contributor.getOrganization() ).endTag( NAMESPACE, "organization" ); 494 } 495 if ( contributor.getOrganizationUrl() != null ) 496 { 497 serializer.startTag( NAMESPACE, "organizationUrl" ).text( contributor.getOrganizationUrl() ).endTag( NAMESPACE, "organizationUrl" ); 498 } 499 if ( ( contributor.getRoles() != null ) && ( contributor.getRoles().size() > 0 ) ) 500 { 501 serializer.startTag( NAMESPACE, "roles" ); 502 for ( Iterator iter = contributor.getRoles().iterator(); iter.hasNext(); ) 503 { 504 String role = (String) iter.next(); 505 serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" ); 506 } 507 serializer.endTag( NAMESPACE, "roles" ); 508 } 509 if ( contributor.getTimezone() != null ) 510 { 511 serializer.startTag( NAMESPACE, "timezone" ).text( contributor.getTimezone() ).endTag( NAMESPACE, "timezone" ); 512 } 513 if ( ( contributor.getProperties() != null ) && ( contributor.getProperties().size() > 0 ) ) 514 { 515 serializer.startTag( NAMESPACE, "properties" ); 516 for ( Iterator iter = contributor.getProperties().keySet().iterator(); iter.hasNext(); ) 517 { 518 String key = (String) iter.next(); 519 String value = (String) contributor.getProperties().get( key ); 520 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 521 } 522 serializer.endTag( NAMESPACE, "properties" ); 523 } 524 serializer.endTag( NAMESPACE, tagName ); 525 } //-- void writeContributor( Contributor, String, XmlSerializer ) 526 527 /** 528 * Method writeDependency. 529 * 530 * @param dependency 531 * @param serializer 532 * @param tagName 533 * @throws java.io.IOException 534 */ 535 private void writeDependency( Dependency dependency, String tagName, XmlSerializer serializer ) 536 throws java.io.IOException 537 { 538 serializer.startTag( NAMESPACE, tagName ); 539 if ( dependency.getGroupId() != null ) 540 { 541 serializer.startTag( NAMESPACE, "groupId" ).text( dependency.getGroupId() ).endTag( NAMESPACE, "groupId" ); 542 } 543 if ( dependency.getArtifactId() != null ) 544 { 545 serializer.startTag( NAMESPACE, "artifactId" ).text( dependency.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 546 } 547 if ( dependency.getVersion() != null ) 548 { 549 serializer.startTag( NAMESPACE, "version" ).text( dependency.getVersion() ).endTag( NAMESPACE, "version" ); 550 } 551 if ( ( dependency.getType() != null ) && !dependency.getType().equals( "jar" ) ) 552 { 553 serializer.startTag( NAMESPACE, "type" ).text( dependency.getType() ).endTag( NAMESPACE, "type" ); 554 } 555 if ( dependency.getClassifier() != null ) 556 { 557 serializer.startTag( NAMESPACE, "classifier" ).text( dependency.getClassifier() ).endTag( NAMESPACE, "classifier" ); 558 } 559 if ( dependency.getScope() != null ) 560 { 561 serializer.startTag( NAMESPACE, "scope" ).text( dependency.getScope() ).endTag( NAMESPACE, "scope" ); 562 } 563 if ( dependency.getSystemPath() != null ) 564 { 565 serializer.startTag( NAMESPACE, "systemPath" ).text( dependency.getSystemPath() ).endTag( NAMESPACE, "systemPath" ); 566 } 567 if ( ( dependency.getExclusions() != null ) && ( dependency.getExclusions().size() > 0 ) ) 568 { 569 serializer.startTag( NAMESPACE, "exclusions" ); 570 for ( Iterator iter = dependency.getExclusions().iterator(); iter.hasNext(); ) 571 { 572 Exclusion o = (Exclusion) iter.next(); 573 writeExclusion( o, "exclusion", serializer ); 574 } 575 serializer.endTag( NAMESPACE, "exclusions" ); 576 } 577 if ( dependency.getOptional() != null ) 578 { 579 serializer.startTag( NAMESPACE, "optional" ).text( dependency.getOptional() ).endTag( NAMESPACE, "optional" ); 580 } 581 serializer.endTag( NAMESPACE, tagName ); 582 } //-- void writeDependency( Dependency, String, XmlSerializer ) 583 584 /** 585 * Method writeDependencyManagement. 586 * 587 * @param dependencyManagement 588 * @param serializer 589 * @param tagName 590 * @throws java.io.IOException 591 */ 592 private void writeDependencyManagement( DependencyManagement dependencyManagement, String tagName, XmlSerializer serializer ) 593 throws java.io.IOException 594 { 595 serializer.startTag( NAMESPACE, tagName ); 596 if ( ( dependencyManagement.getDependencies() != null ) && ( dependencyManagement.getDependencies().size() > 0 ) ) 597 { 598 serializer.startTag( NAMESPACE, "dependencies" ); 599 for ( Iterator iter = dependencyManagement.getDependencies().iterator(); iter.hasNext(); ) 600 { 601 Dependency o = (Dependency) iter.next(); 602 writeDependency( o, "dependency", serializer ); 603 } 604 serializer.endTag( NAMESPACE, "dependencies" ); 605 } 606 serializer.endTag( NAMESPACE, tagName ); 607 } //-- void writeDependencyManagement( DependencyManagement, String, XmlSerializer ) 608 609 /** 610 * Method writeDeploymentRepository. 611 * 612 * @param deploymentRepository 613 * @param serializer 614 * @param tagName 615 * @throws java.io.IOException 616 */ 617 private void writeDeploymentRepository( DeploymentRepository deploymentRepository, String tagName, XmlSerializer serializer ) 618 throws java.io.IOException 619 { 620 serializer.startTag( NAMESPACE, tagName ); 621 if ( deploymentRepository.isUniqueVersion() != true ) 622 { 623 serializer.startTag( NAMESPACE, "uniqueVersion" ).text( String.valueOf( deploymentRepository.isUniqueVersion() ) ).endTag( NAMESPACE, "uniqueVersion" ); 624 } 625 if ( deploymentRepository.getReleases() != null ) 626 { 627 writeRepositoryPolicy( (RepositoryPolicy) deploymentRepository.getReleases(), "releases", serializer ); 628 } 629 if ( deploymentRepository.getSnapshots() != null ) 630 { 631 writeRepositoryPolicy( (RepositoryPolicy) deploymentRepository.getSnapshots(), "snapshots", serializer ); 632 } 633 if ( deploymentRepository.getId() != null ) 634 { 635 serializer.startTag( NAMESPACE, "id" ).text( deploymentRepository.getId() ).endTag( NAMESPACE, "id" ); 636 } 637 if ( deploymentRepository.getName() != null ) 638 { 639 serializer.startTag( NAMESPACE, "name" ).text( deploymentRepository.getName() ).endTag( NAMESPACE, "name" ); 640 } 641 if ( deploymentRepository.getUrl() != null ) 642 { 643 serializer.startTag( NAMESPACE, "url" ).text( deploymentRepository.getUrl() ).endTag( NAMESPACE, "url" ); 644 } 645 if ( ( deploymentRepository.getLayout() != null ) && !deploymentRepository.getLayout().equals( "default" ) ) 646 { 647 serializer.startTag( NAMESPACE, "layout" ).text( deploymentRepository.getLayout() ).endTag( NAMESPACE, "layout" ); 648 } 649 serializer.endTag( NAMESPACE, tagName ); 650 } //-- void writeDeploymentRepository( DeploymentRepository, String, XmlSerializer ) 651 652 /** 653 * Method writeDeveloper. 654 * 655 * @param developer 656 * @param serializer 657 * @param tagName 658 * @throws java.io.IOException 659 */ 660 private void writeDeveloper( Developer developer, String tagName, XmlSerializer serializer ) 661 throws java.io.IOException 662 { 663 serializer.startTag( NAMESPACE, tagName ); 664 if ( developer.getId() != null ) 665 { 666 serializer.startTag( NAMESPACE, "id" ).text( developer.getId() ).endTag( NAMESPACE, "id" ); 667 } 668 if ( developer.getName() != null ) 669 { 670 serializer.startTag( NAMESPACE, "name" ).text( developer.getName() ).endTag( NAMESPACE, "name" ); 671 } 672 if ( developer.getEmail() != null ) 673 { 674 serializer.startTag( NAMESPACE, "email" ).text( developer.getEmail() ).endTag( NAMESPACE, "email" ); 675 } 676 if ( developer.getUrl() != null ) 677 { 678 serializer.startTag( NAMESPACE, "url" ).text( developer.getUrl() ).endTag( NAMESPACE, "url" ); 679 } 680 if ( developer.getOrganization() != null ) 681 { 682 serializer.startTag( NAMESPACE, "organization" ).text( developer.getOrganization() ).endTag( NAMESPACE, "organization" ); 683 } 684 if ( developer.getOrganizationUrl() != null ) 685 { 686 serializer.startTag( NAMESPACE, "organizationUrl" ).text( developer.getOrganizationUrl() ).endTag( NAMESPACE, "organizationUrl" ); 687 } 688 if ( ( developer.getRoles() != null ) && ( developer.getRoles().size() > 0 ) ) 689 { 690 serializer.startTag( NAMESPACE, "roles" ); 691 for ( Iterator iter = developer.getRoles().iterator(); iter.hasNext(); ) 692 { 693 String role = (String) iter.next(); 694 serializer.startTag( NAMESPACE, "role" ).text( role ).endTag( NAMESPACE, "role" ); 695 } 696 serializer.endTag( NAMESPACE, "roles" ); 697 } 698 if ( developer.getTimezone() != null ) 699 { 700 serializer.startTag( NAMESPACE, "timezone" ).text( developer.getTimezone() ).endTag( NAMESPACE, "timezone" ); 701 } 702 if ( ( developer.getProperties() != null ) && ( developer.getProperties().size() > 0 ) ) 703 { 704 serializer.startTag( NAMESPACE, "properties" ); 705 for ( Iterator iter = developer.getProperties().keySet().iterator(); iter.hasNext(); ) 706 { 707 String key = (String) iter.next(); 708 String value = (String) developer.getProperties().get( key ); 709 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 710 } 711 serializer.endTag( NAMESPACE, "properties" ); 712 } 713 serializer.endTag( NAMESPACE, tagName ); 714 } //-- void writeDeveloper( Developer, String, XmlSerializer ) 715 716 /** 717 * Method writeDistributionManagement. 718 * 719 * @param distributionManagement 720 * @param serializer 721 * @param tagName 722 * @throws java.io.IOException 723 */ 724 private void writeDistributionManagement( DistributionManagement distributionManagement, String tagName, XmlSerializer serializer ) 725 throws java.io.IOException 726 { 727 serializer.startTag( NAMESPACE, tagName ); 728 if ( distributionManagement.getRepository() != null ) 729 { 730 writeDeploymentRepository( (DeploymentRepository) distributionManagement.getRepository(), "repository", serializer ); 731 } 732 if ( distributionManagement.getSnapshotRepository() != null ) 733 { 734 writeDeploymentRepository( (DeploymentRepository) distributionManagement.getSnapshotRepository(), "snapshotRepository", serializer ); 735 } 736 if ( distributionManagement.getSite() != null ) 737 { 738 writeSite( (Site) distributionManagement.getSite(), "site", serializer ); 739 } 740 if ( distributionManagement.getDownloadUrl() != null ) 741 { 742 serializer.startTag( NAMESPACE, "downloadUrl" ).text( distributionManagement.getDownloadUrl() ).endTag( NAMESPACE, "downloadUrl" ); 743 } 744 if ( distributionManagement.getRelocation() != null ) 745 { 746 writeRelocation( (Relocation) distributionManagement.getRelocation(), "relocation", serializer ); 747 } 748 if ( distributionManagement.getStatus() != null ) 749 { 750 serializer.startTag( NAMESPACE, "status" ).text( distributionManagement.getStatus() ).endTag( NAMESPACE, "status" ); 751 } 752 serializer.endTag( NAMESPACE, tagName ); 753 } //-- void writeDistributionManagement( DistributionManagement, String, XmlSerializer ) 754 755 /** 756 * Method writeExclusion. 757 * 758 * @param exclusion 759 * @param serializer 760 * @param tagName 761 * @throws java.io.IOException 762 */ 763 private void writeExclusion( Exclusion exclusion, String tagName, XmlSerializer serializer ) 764 throws java.io.IOException 765 { 766 serializer.startTag( NAMESPACE, tagName ); 767 if ( exclusion.getArtifactId() != null ) 768 { 769 serializer.startTag( NAMESPACE, "artifactId" ).text( exclusion.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 770 } 771 if ( exclusion.getGroupId() != null ) 772 { 773 serializer.startTag( NAMESPACE, "groupId" ).text( exclusion.getGroupId() ).endTag( NAMESPACE, "groupId" ); 774 } 775 serializer.endTag( NAMESPACE, tagName ); 776 } //-- void writeExclusion( Exclusion, String, XmlSerializer ) 777 778 /** 779 * Method writeExtension. 780 * 781 * @param extension 782 * @param serializer 783 * @param tagName 784 * @throws java.io.IOException 785 */ 786 private void writeExtension( Extension extension, String tagName, XmlSerializer serializer ) 787 throws java.io.IOException 788 { 789 serializer.startTag( NAMESPACE, tagName ); 790 if ( extension.getGroupId() != null ) 791 { 792 serializer.startTag( NAMESPACE, "groupId" ).text( extension.getGroupId() ).endTag( NAMESPACE, "groupId" ); 793 } 794 if ( extension.getArtifactId() != null ) 795 { 796 serializer.startTag( NAMESPACE, "artifactId" ).text( extension.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 797 } 798 if ( extension.getVersion() != null ) 799 { 800 serializer.startTag( NAMESPACE, "version" ).text( extension.getVersion() ).endTag( NAMESPACE, "version" ); 801 } 802 serializer.endTag( NAMESPACE, tagName ); 803 } //-- void writeExtension( Extension, String, XmlSerializer ) 804 805 /** 806 * Method writeFileSet. 807 * 808 * @param fileSet 809 * @param serializer 810 * @param tagName 811 * @throws java.io.IOException 812 */ 813 private void writeFileSet( FileSet fileSet, String tagName, XmlSerializer serializer ) 814 throws java.io.IOException 815 { 816 serializer.startTag( NAMESPACE, tagName ); 817 if ( fileSet.getDirectory() != null ) 818 { 819 serializer.startTag( NAMESPACE, "directory" ).text( fileSet.getDirectory() ).endTag( NAMESPACE, "directory" ); 820 } 821 if ( ( fileSet.getIncludes() != null ) && ( fileSet.getIncludes().size() > 0 ) ) 822 { 823 serializer.startTag( NAMESPACE, "includes" ); 824 for ( Iterator iter = fileSet.getIncludes().iterator(); iter.hasNext(); ) 825 { 826 String include = (String) iter.next(); 827 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); 828 } 829 serializer.endTag( NAMESPACE, "includes" ); 830 } 831 if ( ( fileSet.getExcludes() != null ) && ( fileSet.getExcludes().size() > 0 ) ) 832 { 833 serializer.startTag( NAMESPACE, "excludes" ); 834 for ( Iterator iter = fileSet.getExcludes().iterator(); iter.hasNext(); ) 835 { 836 String exclude = (String) iter.next(); 837 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); 838 } 839 serializer.endTag( NAMESPACE, "excludes" ); 840 } 841 serializer.endTag( NAMESPACE, tagName ); 842 } //-- void writeFileSet( FileSet, String, XmlSerializer ) 843 844 /** 845 * Method writeIssueManagement. 846 * 847 * @param issueManagement 848 * @param serializer 849 * @param tagName 850 * @throws java.io.IOException 851 */ 852 private void writeIssueManagement( IssueManagement issueManagement, String tagName, XmlSerializer serializer ) 853 throws java.io.IOException 854 { 855 serializer.startTag( NAMESPACE, tagName ); 856 if ( issueManagement.getSystem() != null ) 857 { 858 serializer.startTag( NAMESPACE, "system" ).text( issueManagement.getSystem() ).endTag( NAMESPACE, "system" ); 859 } 860 if ( issueManagement.getUrl() != null ) 861 { 862 serializer.startTag( NAMESPACE, "url" ).text( issueManagement.getUrl() ).endTag( NAMESPACE, "url" ); 863 } 864 serializer.endTag( NAMESPACE, tagName ); 865 } //-- void writeIssueManagement( IssueManagement, String, XmlSerializer ) 866 867 /** 868 * Method writeLicense. 869 * 870 * @param license 871 * @param serializer 872 * @param tagName 873 * @throws java.io.IOException 874 */ 875 private void writeLicense( License license, String tagName, XmlSerializer serializer ) 876 throws java.io.IOException 877 { 878 serializer.startTag( NAMESPACE, tagName ); 879 if ( license.getName() != null ) 880 { 881 serializer.startTag( NAMESPACE, "name" ).text( license.getName() ).endTag( NAMESPACE, "name" ); 882 } 883 if ( license.getUrl() != null ) 884 { 885 serializer.startTag( NAMESPACE, "url" ).text( license.getUrl() ).endTag( NAMESPACE, "url" ); 886 } 887 if ( license.getDistribution() != null ) 888 { 889 serializer.startTag( NAMESPACE, "distribution" ).text( license.getDistribution() ).endTag( NAMESPACE, "distribution" ); 890 } 891 if ( license.getComments() != null ) 892 { 893 serializer.startTag( NAMESPACE, "comments" ).text( license.getComments() ).endTag( NAMESPACE, "comments" ); 894 } 895 serializer.endTag( NAMESPACE, tagName ); 896 } //-- void writeLicense( License, String, XmlSerializer ) 897 898 /** 899 * Method writeMailingList. 900 * 901 * @param mailingList 902 * @param serializer 903 * @param tagName 904 * @throws java.io.IOException 905 */ 906 private void writeMailingList( MailingList mailingList, String tagName, XmlSerializer serializer ) 907 throws java.io.IOException 908 { 909 serializer.startTag( NAMESPACE, tagName ); 910 if ( mailingList.getName() != null ) 911 { 912 serializer.startTag( NAMESPACE, "name" ).text( mailingList.getName() ).endTag( NAMESPACE, "name" ); 913 } 914 if ( mailingList.getSubscribe() != null ) 915 { 916 serializer.startTag( NAMESPACE, "subscribe" ).text( mailingList.getSubscribe() ).endTag( NAMESPACE, "subscribe" ); 917 } 918 if ( mailingList.getUnsubscribe() != null ) 919 { 920 serializer.startTag( NAMESPACE, "unsubscribe" ).text( mailingList.getUnsubscribe() ).endTag( NAMESPACE, "unsubscribe" ); 921 } 922 if ( mailingList.getPost() != null ) 923 { 924 serializer.startTag( NAMESPACE, "post" ).text( mailingList.getPost() ).endTag( NAMESPACE, "post" ); 925 } 926 if ( mailingList.getArchive() != null ) 927 { 928 serializer.startTag( NAMESPACE, "archive" ).text( mailingList.getArchive() ).endTag( NAMESPACE, "archive" ); 929 } 930 if ( ( mailingList.getOtherArchives() != null ) && ( mailingList.getOtherArchives().size() > 0 ) ) 931 { 932 serializer.startTag( NAMESPACE, "otherArchives" ); 933 for ( Iterator iter = mailingList.getOtherArchives().iterator(); iter.hasNext(); ) 934 { 935 String otherArchive = (String) iter.next(); 936 serializer.startTag( NAMESPACE, "otherArchive" ).text( otherArchive ).endTag( NAMESPACE, "otherArchive" ); 937 } 938 serializer.endTag( NAMESPACE, "otherArchives" ); 939 } 940 serializer.endTag( NAMESPACE, tagName ); 941 } //-- void writeMailingList( MailingList, String, XmlSerializer ) 942 943 /** 944 * Method writeModel. 945 * 946 * @param model 947 * @param serializer 948 * @param tagName 949 * @throws java.io.IOException 950 */ 951 private void writeModel( Model model, String tagName, XmlSerializer serializer ) 952 throws java.io.IOException 953 { 954 serializer.setPrefix( "", "http://maven.apache.org/POM/4.0.0" ); 955 serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" ); 956 serializer.startTag( NAMESPACE, tagName ); 957 serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" ); 958 if ( model.getModelVersion() != null ) 959 { 960 serializer.startTag( NAMESPACE, "modelVersion" ).text( model.getModelVersion() ).endTag( NAMESPACE, "modelVersion" ); 961 } 962 if ( model.getParent() != null ) 963 { 964 writeParent( (Parent) model.getParent(), "parent", serializer ); 965 } 966 if ( model.getGroupId() != null ) 967 { 968 serializer.startTag( NAMESPACE, "groupId" ).text( model.getGroupId() ).endTag( NAMESPACE, "groupId" ); 969 } 970 if ( model.getArtifactId() != null ) 971 { 972 serializer.startTag( NAMESPACE, "artifactId" ).text( model.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 973 } 974 if ( model.getVersion() != null ) 975 { 976 serializer.startTag( NAMESPACE, "version" ).text( model.getVersion() ).endTag( NAMESPACE, "version" ); 977 } 978 if ( ( model.getPackaging() != null ) && !model.getPackaging().equals( "jar" ) ) 979 { 980 serializer.startTag( NAMESPACE, "packaging" ).text( model.getPackaging() ).endTag( NAMESPACE, "packaging" ); 981 } 982 if ( model.getName() != null ) 983 { 984 serializer.startTag( NAMESPACE, "name" ).text( model.getName() ).endTag( NAMESPACE, "name" ); 985 } 986 if ( model.getDescription() != null ) 987 { 988 serializer.startTag( NAMESPACE, "description" ).text( model.getDescription() ).endTag( NAMESPACE, "description" ); 989 } 990 if ( model.getUrl() != null ) 991 { 992 serializer.startTag( NAMESPACE, "url" ).text( model.getUrl() ).endTag( NAMESPACE, "url" ); 993 } 994 if ( model.getInceptionYear() != null ) 995 { 996 serializer.startTag( NAMESPACE, "inceptionYear" ).text( model.getInceptionYear() ).endTag( NAMESPACE, "inceptionYear" ); 997 } 998 if ( model.getOrganization() != null ) 999 { 1000 writeOrganization( (Organization) model.getOrganization(), "organization", serializer ); 1001 } 1002 if ( ( model.getLicenses() != null ) && ( model.getLicenses().size() > 0 ) ) 1003 { 1004 serializer.startTag( NAMESPACE, "licenses" ); 1005 for ( Iterator iter = model.getLicenses().iterator(); iter.hasNext(); ) 1006 { 1007 License o = (License) iter.next(); 1008 writeLicense( o, "license", serializer ); 1009 } 1010 serializer.endTag( NAMESPACE, "licenses" ); 1011 } 1012 if ( ( model.getDevelopers() != null ) && ( model.getDevelopers().size() > 0 ) ) 1013 { 1014 serializer.startTag( NAMESPACE, "developers" ); 1015 for ( Iterator iter = model.getDevelopers().iterator(); iter.hasNext(); ) 1016 { 1017 Developer o = (Developer) iter.next(); 1018 writeDeveloper( o, "developer", serializer ); 1019 } 1020 serializer.endTag( NAMESPACE, "developers" ); 1021 } 1022 if ( ( model.getContributors() != null ) && ( model.getContributors().size() > 0 ) ) 1023 { 1024 serializer.startTag( NAMESPACE, "contributors" ); 1025 for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); ) 1026 { 1027 Contributor o = (Contributor) iter.next(); 1028 writeContributor( o, "contributor", serializer ); 1029 } 1030 serializer.endTag( NAMESPACE, "contributors" ); 1031 } 1032 if ( ( model.getMailingLists() != null ) && ( model.getMailingLists().size() > 0 ) ) 1033 { 1034 serializer.startTag( NAMESPACE, "mailingLists" ); 1035 for ( Iterator iter = model.getMailingLists().iterator(); iter.hasNext(); ) 1036 { 1037 MailingList o = (MailingList) iter.next(); 1038 writeMailingList( o, "mailingList", serializer ); 1039 } 1040 serializer.endTag( NAMESPACE, "mailingLists" ); 1041 } 1042 if ( model.getPrerequisites() != null ) 1043 { 1044 writePrerequisites( (Prerequisites) model.getPrerequisites(), "prerequisites", serializer ); 1045 } 1046 if ( ( model.getModules() != null ) && ( model.getModules().size() > 0 ) ) 1047 { 1048 serializer.startTag( NAMESPACE, "modules" ); 1049 for ( Iterator iter = model.getModules().iterator(); iter.hasNext(); ) 1050 { 1051 String module = (String) iter.next(); 1052 serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" ); 1053 } 1054 serializer.endTag( NAMESPACE, "modules" ); 1055 } 1056 if ( model.getScm() != null ) 1057 { 1058 writeScm( (Scm) model.getScm(), "scm", serializer ); 1059 } 1060 if ( model.getIssueManagement() != null ) 1061 { 1062 writeIssueManagement( (IssueManagement) model.getIssueManagement(), "issueManagement", serializer ); 1063 } 1064 if ( model.getCiManagement() != null ) 1065 { 1066 writeCiManagement( (CiManagement) model.getCiManagement(), "ciManagement", serializer ); 1067 } 1068 if ( model.getDistributionManagement() != null ) 1069 { 1070 writeDistributionManagement( (DistributionManagement) model.getDistributionManagement(), "distributionManagement", serializer ); 1071 } 1072 if ( ( model.getProperties() != null ) && ( model.getProperties().size() > 0 ) ) 1073 { 1074 serializer.startTag( NAMESPACE, "properties" ); 1075 for ( Iterator iter = model.getProperties().keySet().iterator(); iter.hasNext(); ) 1076 { 1077 String key = (String) iter.next(); 1078 String value = (String) model.getProperties().get( key ); 1079 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 1080 } 1081 serializer.endTag( NAMESPACE, "properties" ); 1082 } 1083 if ( model.getDependencyManagement() != null ) 1084 { 1085 writeDependencyManagement( (DependencyManagement) model.getDependencyManagement(), "dependencyManagement", serializer ); 1086 } 1087 if ( ( model.getDependencies() != null ) && ( model.getDependencies().size() > 0 ) ) 1088 { 1089 serializer.startTag( NAMESPACE, "dependencies" ); 1090 for ( Iterator iter = model.getDependencies().iterator(); iter.hasNext(); ) 1091 { 1092 Dependency o = (Dependency) iter.next(); 1093 writeDependency( o, "dependency", serializer ); 1094 } 1095 serializer.endTag( NAMESPACE, "dependencies" ); 1096 } 1097 if ( ( model.getRepositories() != null ) && ( model.getRepositories().size() > 0 ) ) 1098 { 1099 serializer.startTag( NAMESPACE, "repositories" ); 1100 for ( Iterator iter = model.getRepositories().iterator(); iter.hasNext(); ) 1101 { 1102 Repository o = (Repository) iter.next(); 1103 writeRepository( o, "repository", serializer ); 1104 } 1105 serializer.endTag( NAMESPACE, "repositories" ); 1106 } 1107 if ( ( model.getPluginRepositories() != null ) && ( model.getPluginRepositories().size() > 0 ) ) 1108 { 1109 serializer.startTag( NAMESPACE, "pluginRepositories" ); 1110 for ( Iterator iter = model.getPluginRepositories().iterator(); iter.hasNext(); ) 1111 { 1112 Repository o = (Repository) iter.next(); 1113 writeRepository( o, "pluginRepository", serializer ); 1114 } 1115 serializer.endTag( NAMESPACE, "pluginRepositories" ); 1116 } 1117 if ( model.getBuild() != null ) 1118 { 1119 writeBuild( (Build) model.getBuild(), "build", serializer ); 1120 } 1121 if ( model.getReports() != null ) 1122 { 1123 ((Xpp3Dom) model.getReports()).writeToSerializer( NAMESPACE, serializer ); 1124 } 1125 if ( model.getReporting() != null ) 1126 { 1127 writeReporting( (Reporting) model.getReporting(), "reporting", serializer ); 1128 } 1129 if ( ( model.getProfiles() != null ) && ( model.getProfiles().size() > 0 ) ) 1130 { 1131 serializer.startTag( NAMESPACE, "profiles" ); 1132 for ( Iterator iter = model.getProfiles().iterator(); iter.hasNext(); ) 1133 { 1134 Profile o = (Profile) iter.next(); 1135 writeProfile( o, "profile", serializer ); 1136 } 1137 serializer.endTag( NAMESPACE, "profiles" ); 1138 } 1139 serializer.endTag( NAMESPACE, tagName ); 1140 } //-- void writeModel( Model, String, XmlSerializer ) 1141 1142 /** 1143 * Method writeModelBase. 1144 * 1145 * @param modelBase 1146 * @param serializer 1147 * @param tagName 1148 * @throws java.io.IOException 1149 */ 1150 private void writeModelBase( ModelBase modelBase, String tagName, XmlSerializer serializer ) 1151 throws java.io.IOException 1152 { 1153 serializer.startTag( NAMESPACE, tagName ); 1154 if ( ( modelBase.getModules() != null ) && ( modelBase.getModules().size() > 0 ) ) 1155 { 1156 serializer.startTag( NAMESPACE, "modules" ); 1157 for ( Iterator iter = modelBase.getModules().iterator(); iter.hasNext(); ) 1158 { 1159 String module = (String) iter.next(); 1160 serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" ); 1161 } 1162 serializer.endTag( NAMESPACE, "modules" ); 1163 } 1164 if ( modelBase.getDistributionManagement() != null ) 1165 { 1166 writeDistributionManagement( (DistributionManagement) modelBase.getDistributionManagement(), "distributionManagement", serializer ); 1167 } 1168 if ( ( modelBase.getProperties() != null ) && ( modelBase.getProperties().size() > 0 ) ) 1169 { 1170 serializer.startTag( NAMESPACE, "properties" ); 1171 for ( Iterator iter = modelBase.getProperties().keySet().iterator(); iter.hasNext(); ) 1172 { 1173 String key = (String) iter.next(); 1174 String value = (String) modelBase.getProperties().get( key ); 1175 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 1176 } 1177 serializer.endTag( NAMESPACE, "properties" ); 1178 } 1179 if ( modelBase.getDependencyManagement() != null ) 1180 { 1181 writeDependencyManagement( (DependencyManagement) modelBase.getDependencyManagement(), "dependencyManagement", serializer ); 1182 } 1183 if ( ( modelBase.getDependencies() != null ) && ( modelBase.getDependencies().size() > 0 ) ) 1184 { 1185 serializer.startTag( NAMESPACE, "dependencies" ); 1186 for ( Iterator iter = modelBase.getDependencies().iterator(); iter.hasNext(); ) 1187 { 1188 Dependency o = (Dependency) iter.next(); 1189 writeDependency( o, "dependency", serializer ); 1190 } 1191 serializer.endTag( NAMESPACE, "dependencies" ); 1192 } 1193 if ( ( modelBase.getRepositories() != null ) && ( modelBase.getRepositories().size() > 0 ) ) 1194 { 1195 serializer.startTag( NAMESPACE, "repositories" ); 1196 for ( Iterator iter = modelBase.getRepositories().iterator(); iter.hasNext(); ) 1197 { 1198 Repository o = (Repository) iter.next(); 1199 writeRepository( o, "repository", serializer ); 1200 } 1201 serializer.endTag( NAMESPACE, "repositories" ); 1202 } 1203 if ( ( modelBase.getPluginRepositories() != null ) && ( modelBase.getPluginRepositories().size() > 0 ) ) 1204 { 1205 serializer.startTag( NAMESPACE, "pluginRepositories" ); 1206 for ( Iterator iter = modelBase.getPluginRepositories().iterator(); iter.hasNext(); ) 1207 { 1208 Repository o = (Repository) iter.next(); 1209 writeRepository( o, "pluginRepository", serializer ); 1210 } 1211 serializer.endTag( NAMESPACE, "pluginRepositories" ); 1212 } 1213 if ( modelBase.getReports() != null ) 1214 { 1215 ((Xpp3Dom) modelBase.getReports()).writeToSerializer( NAMESPACE, serializer ); 1216 } 1217 if ( modelBase.getReporting() != null ) 1218 { 1219 writeReporting( (Reporting) modelBase.getReporting(), "reporting", serializer ); 1220 } 1221 serializer.endTag( NAMESPACE, tagName ); 1222 } //-- void writeModelBase( ModelBase, String, XmlSerializer ) 1223 1224 /** 1225 * Method writeNotifier. 1226 * 1227 * @param notifier 1228 * @param serializer 1229 * @param tagName 1230 * @throws java.io.IOException 1231 */ 1232 private void writeNotifier( Notifier notifier, String tagName, XmlSerializer serializer ) 1233 throws java.io.IOException 1234 { 1235 serializer.startTag( NAMESPACE, tagName ); 1236 if ( ( notifier.getType() != null ) && !notifier.getType().equals( "mail" ) ) 1237 { 1238 serializer.startTag( NAMESPACE, "type" ).text( notifier.getType() ).endTag( NAMESPACE, "type" ); 1239 } 1240 if ( notifier.isSendOnError() != true ) 1241 { 1242 serializer.startTag( NAMESPACE, "sendOnError" ).text( String.valueOf( notifier.isSendOnError() ) ).endTag( NAMESPACE, "sendOnError" ); 1243 } 1244 if ( notifier.isSendOnFailure() != true ) 1245 { 1246 serializer.startTag( NAMESPACE, "sendOnFailure" ).text( String.valueOf( notifier.isSendOnFailure() ) ).endTag( NAMESPACE, "sendOnFailure" ); 1247 } 1248 if ( notifier.isSendOnSuccess() != true ) 1249 { 1250 serializer.startTag( NAMESPACE, "sendOnSuccess" ).text( String.valueOf( notifier.isSendOnSuccess() ) ).endTag( NAMESPACE, "sendOnSuccess" ); 1251 } 1252 if ( notifier.isSendOnWarning() != true ) 1253 { 1254 serializer.startTag( NAMESPACE, "sendOnWarning" ).text( String.valueOf( notifier.isSendOnWarning() ) ).endTag( NAMESPACE, "sendOnWarning" ); 1255 } 1256 if ( notifier.getAddress() != null ) 1257 { 1258 serializer.startTag( NAMESPACE, "address" ).text( notifier.getAddress() ).endTag( NAMESPACE, "address" ); 1259 } 1260 if ( ( notifier.getConfiguration() != null ) && ( notifier.getConfiguration().size() > 0 ) ) 1261 { 1262 serializer.startTag( NAMESPACE, "configuration" ); 1263 for ( Iterator iter = notifier.getConfiguration().keySet().iterator(); iter.hasNext(); ) 1264 { 1265 String key = (String) iter.next(); 1266 String value = (String) notifier.getConfiguration().get( key ); 1267 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 1268 } 1269 serializer.endTag( NAMESPACE, "configuration" ); 1270 } 1271 serializer.endTag( NAMESPACE, tagName ); 1272 } //-- void writeNotifier( Notifier, String, XmlSerializer ) 1273 1274 /** 1275 * Method writeOrganization. 1276 * 1277 * @param organization 1278 * @param serializer 1279 * @param tagName 1280 * @throws java.io.IOException 1281 */ 1282 private void writeOrganization( Organization organization, String tagName, XmlSerializer serializer ) 1283 throws java.io.IOException 1284 { 1285 serializer.startTag( NAMESPACE, tagName ); 1286 if ( organization.getName() != null ) 1287 { 1288 serializer.startTag( NAMESPACE, "name" ).text( organization.getName() ).endTag( NAMESPACE, "name" ); 1289 } 1290 if ( organization.getUrl() != null ) 1291 { 1292 serializer.startTag( NAMESPACE, "url" ).text( organization.getUrl() ).endTag( NAMESPACE, "url" ); 1293 } 1294 serializer.endTag( NAMESPACE, tagName ); 1295 } //-- void writeOrganization( Organization, String, XmlSerializer ) 1296 1297 /** 1298 * Method writeParent. 1299 * 1300 * @param parent 1301 * @param serializer 1302 * @param tagName 1303 * @throws java.io.IOException 1304 */ 1305 private void writeParent( Parent parent, String tagName, XmlSerializer serializer ) 1306 throws java.io.IOException 1307 { 1308 serializer.startTag( NAMESPACE, tagName ); 1309 if ( parent.getGroupId() != null ) 1310 { 1311 serializer.startTag( NAMESPACE, "groupId" ).text( parent.getGroupId() ).endTag( NAMESPACE, "groupId" ); 1312 } 1313 if ( parent.getArtifactId() != null ) 1314 { 1315 serializer.startTag( NAMESPACE, "artifactId" ).text( parent.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 1316 } 1317 if ( parent.getVersion() != null ) 1318 { 1319 serializer.startTag( NAMESPACE, "version" ).text( parent.getVersion() ).endTag( NAMESPACE, "version" ); 1320 } 1321 if ( ( parent.getRelativePath() != null ) && !parent.getRelativePath().equals( "../pom.xml" ) ) 1322 { 1323 serializer.startTag( NAMESPACE, "relativePath" ).text( parent.getRelativePath() ).endTag( NAMESPACE, "relativePath" ); 1324 } 1325 serializer.endTag( NAMESPACE, tagName ); 1326 } //-- void writeParent( Parent, String, XmlSerializer ) 1327 1328 /** 1329 * Method writePatternSet. 1330 * 1331 * @param patternSet 1332 * @param serializer 1333 * @param tagName 1334 * @throws java.io.IOException 1335 */ 1336 private void writePatternSet( PatternSet patternSet, String tagName, XmlSerializer serializer ) 1337 throws java.io.IOException 1338 { 1339 serializer.startTag( NAMESPACE, tagName ); 1340 if ( ( patternSet.getIncludes() != null ) && ( patternSet.getIncludes().size() > 0 ) ) 1341 { 1342 serializer.startTag( NAMESPACE, "includes" ); 1343 for ( Iterator iter = patternSet.getIncludes().iterator(); iter.hasNext(); ) 1344 { 1345 String include = (String) iter.next(); 1346 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); 1347 } 1348 serializer.endTag( NAMESPACE, "includes" ); 1349 } 1350 if ( ( patternSet.getExcludes() != null ) && ( patternSet.getExcludes().size() > 0 ) ) 1351 { 1352 serializer.startTag( NAMESPACE, "excludes" ); 1353 for ( Iterator iter = patternSet.getExcludes().iterator(); iter.hasNext(); ) 1354 { 1355 String exclude = (String) iter.next(); 1356 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); 1357 } 1358 serializer.endTag( NAMESPACE, "excludes" ); 1359 } 1360 serializer.endTag( NAMESPACE, tagName ); 1361 } //-- void writePatternSet( PatternSet, String, XmlSerializer ) 1362 1363 /** 1364 * Method writePlugin. 1365 * 1366 * @param plugin 1367 * @param serializer 1368 * @param tagName 1369 * @throws java.io.IOException 1370 */ 1371 private void writePlugin( Plugin plugin, String tagName, XmlSerializer serializer ) 1372 throws java.io.IOException 1373 { 1374 serializer.startTag( NAMESPACE, tagName ); 1375 if ( ( plugin.getGroupId() != null ) && !plugin.getGroupId().equals( "org.apache.maven.plugins" ) ) 1376 { 1377 serializer.startTag( NAMESPACE, "groupId" ).text( plugin.getGroupId() ).endTag( NAMESPACE, "groupId" ); 1378 } 1379 if ( plugin.getArtifactId() != null ) 1380 { 1381 serializer.startTag( NAMESPACE, "artifactId" ).text( plugin.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 1382 } 1383 if ( plugin.getVersion() != null ) 1384 { 1385 serializer.startTag( NAMESPACE, "version" ).text( plugin.getVersion() ).endTag( NAMESPACE, "version" ); 1386 } 1387 if ( plugin.getExtensions() != null ) 1388 { 1389 serializer.startTag( NAMESPACE, "extensions" ).text( plugin.getExtensions() ).endTag( NAMESPACE, "extensions" ); 1390 } 1391 if ( ( plugin.getExecutions() != null ) && ( plugin.getExecutions().size() > 0 ) ) 1392 { 1393 serializer.startTag( NAMESPACE, "executions" ); 1394 for ( Iterator iter = plugin.getExecutions().iterator(); iter.hasNext(); ) 1395 { 1396 PluginExecution o = (PluginExecution) iter.next(); 1397 writePluginExecution( o, "execution", serializer ); 1398 } 1399 serializer.endTag( NAMESPACE, "executions" ); 1400 } 1401 if ( ( plugin.getDependencies() != null ) && ( plugin.getDependencies().size() > 0 ) ) 1402 { 1403 serializer.startTag( NAMESPACE, "dependencies" ); 1404 for ( Iterator iter = plugin.getDependencies().iterator(); iter.hasNext(); ) 1405 { 1406 Dependency o = (Dependency) iter.next(); 1407 writeDependency( o, "dependency", serializer ); 1408 } 1409 serializer.endTag( NAMESPACE, "dependencies" ); 1410 } 1411 if ( plugin.getGoals() != null ) 1412 { 1413 ((Xpp3Dom) plugin.getGoals()).writeToSerializer( NAMESPACE, serializer ); 1414 } 1415 if ( plugin.getInherited() != null ) 1416 { 1417 serializer.startTag( NAMESPACE, "inherited" ).text( plugin.getInherited() ).endTag( NAMESPACE, "inherited" ); 1418 } 1419 if ( plugin.getConfiguration() != null ) 1420 { 1421 ((Xpp3Dom) plugin.getConfiguration()).writeToSerializer( NAMESPACE, serializer ); 1422 } 1423 serializer.endTag( NAMESPACE, tagName ); 1424 } //-- void writePlugin( Plugin, String, XmlSerializer ) 1425 1426 /** 1427 * Method writePluginConfiguration. 1428 * 1429 * @param pluginConfiguration 1430 * @param serializer 1431 * @param tagName 1432 * @throws java.io.IOException 1433 */ 1434 private void writePluginConfiguration( PluginConfiguration pluginConfiguration, String tagName, XmlSerializer serializer ) 1435 throws java.io.IOException 1436 { 1437 serializer.startTag( NAMESPACE, tagName ); 1438 if ( pluginConfiguration.getPluginManagement() != null ) 1439 { 1440 writePluginManagement( (PluginManagement) pluginConfiguration.getPluginManagement(), "pluginManagement", serializer ); 1441 } 1442 if ( ( pluginConfiguration.getPlugins() != null ) && ( pluginConfiguration.getPlugins().size() > 0 ) ) 1443 { 1444 serializer.startTag( NAMESPACE, "plugins" ); 1445 for ( Iterator iter = pluginConfiguration.getPlugins().iterator(); iter.hasNext(); ) 1446 { 1447 Plugin o = (Plugin) iter.next(); 1448 writePlugin( o, "plugin", serializer ); 1449 } 1450 serializer.endTag( NAMESPACE, "plugins" ); 1451 } 1452 serializer.endTag( NAMESPACE, tagName ); 1453 } //-- void writePluginConfiguration( PluginConfiguration, String, XmlSerializer ) 1454 1455 /** 1456 * Method writePluginContainer. 1457 * 1458 * @param pluginContainer 1459 * @param serializer 1460 * @param tagName 1461 * @throws java.io.IOException 1462 */ 1463 private void writePluginContainer( PluginContainer pluginContainer, String tagName, XmlSerializer serializer ) 1464 throws java.io.IOException 1465 { 1466 serializer.startTag( NAMESPACE, tagName ); 1467 if ( ( pluginContainer.getPlugins() != null ) && ( pluginContainer.getPlugins().size() > 0 ) ) 1468 { 1469 serializer.startTag( NAMESPACE, "plugins" ); 1470 for ( Iterator iter = pluginContainer.getPlugins().iterator(); iter.hasNext(); ) 1471 { 1472 Plugin o = (Plugin) iter.next(); 1473 writePlugin( o, "plugin", serializer ); 1474 } 1475 serializer.endTag( NAMESPACE, "plugins" ); 1476 } 1477 serializer.endTag( NAMESPACE, tagName ); 1478 } //-- void writePluginContainer( PluginContainer, String, XmlSerializer ) 1479 1480 /** 1481 * Method writePluginExecution. 1482 * 1483 * @param pluginExecution 1484 * @param serializer 1485 * @param tagName 1486 * @throws java.io.IOException 1487 */ 1488 private void writePluginExecution( PluginExecution pluginExecution, String tagName, XmlSerializer serializer ) 1489 throws java.io.IOException 1490 { 1491 serializer.startTag( NAMESPACE, tagName ); 1492 if ( ( pluginExecution.getId() != null ) && !pluginExecution.getId().equals( "default" ) ) 1493 { 1494 serializer.startTag( NAMESPACE, "id" ).text( pluginExecution.getId() ).endTag( NAMESPACE, "id" ); 1495 } 1496 if ( pluginExecution.getPhase() != null ) 1497 { 1498 serializer.startTag( NAMESPACE, "phase" ).text( pluginExecution.getPhase() ).endTag( NAMESPACE, "phase" ); 1499 } 1500 if ( ( pluginExecution.getGoals() != null ) && ( pluginExecution.getGoals().size() > 0 ) ) 1501 { 1502 serializer.startTag( NAMESPACE, "goals" ); 1503 for ( Iterator iter = pluginExecution.getGoals().iterator(); iter.hasNext(); ) 1504 { 1505 String goal = (String) iter.next(); 1506 serializer.startTag( NAMESPACE, "goal" ).text( goal ).endTag( NAMESPACE, "goal" ); 1507 } 1508 serializer.endTag( NAMESPACE, "goals" ); 1509 } 1510 if ( pluginExecution.getInherited() != null ) 1511 { 1512 serializer.startTag( NAMESPACE, "inherited" ).text( pluginExecution.getInherited() ).endTag( NAMESPACE, "inherited" ); 1513 } 1514 if ( pluginExecution.getConfiguration() != null ) 1515 { 1516 ((Xpp3Dom) pluginExecution.getConfiguration()).writeToSerializer( NAMESPACE, serializer ); 1517 } 1518 serializer.endTag( NAMESPACE, tagName ); 1519 } //-- void writePluginExecution( PluginExecution, String, XmlSerializer ) 1520 1521 /** 1522 * Method writePluginManagement. 1523 * 1524 * @param pluginManagement 1525 * @param serializer 1526 * @param tagName 1527 * @throws java.io.IOException 1528 */ 1529 private void writePluginManagement( PluginManagement pluginManagement, String tagName, XmlSerializer serializer ) 1530 throws java.io.IOException 1531 { 1532 serializer.startTag( NAMESPACE, tagName ); 1533 if ( ( pluginManagement.getPlugins() != null ) && ( pluginManagement.getPlugins().size() > 0 ) ) 1534 { 1535 serializer.startTag( NAMESPACE, "plugins" ); 1536 for ( Iterator iter = pluginManagement.getPlugins().iterator(); iter.hasNext(); ) 1537 { 1538 Plugin o = (Plugin) iter.next(); 1539 writePlugin( o, "plugin", serializer ); 1540 } 1541 serializer.endTag( NAMESPACE, "plugins" ); 1542 } 1543 serializer.endTag( NAMESPACE, tagName ); 1544 } //-- void writePluginManagement( PluginManagement, String, XmlSerializer ) 1545 1546 /** 1547 * Method writePrerequisites. 1548 * 1549 * @param prerequisites 1550 * @param serializer 1551 * @param tagName 1552 * @throws java.io.IOException 1553 */ 1554 private void writePrerequisites( Prerequisites prerequisites, String tagName, XmlSerializer serializer ) 1555 throws java.io.IOException 1556 { 1557 serializer.startTag( NAMESPACE, tagName ); 1558 if ( ( prerequisites.getMaven() != null ) && !prerequisites.getMaven().equals( "2.0" ) ) 1559 { 1560 serializer.startTag( NAMESPACE, "maven" ).text( prerequisites.getMaven() ).endTag( NAMESPACE, "maven" ); 1561 } 1562 serializer.endTag( NAMESPACE, tagName ); 1563 } //-- void writePrerequisites( Prerequisites, String, XmlSerializer ) 1564 1565 /** 1566 * Method writeProfile. 1567 * 1568 * @param profile 1569 * @param serializer 1570 * @param tagName 1571 * @throws java.io.IOException 1572 */ 1573 private void writeProfile( Profile profile, String tagName, XmlSerializer serializer ) 1574 throws java.io.IOException 1575 { 1576 serializer.startTag( NAMESPACE, tagName ); 1577 if ( ( profile.getId() != null ) && !profile.getId().equals( "default" ) ) 1578 { 1579 serializer.startTag( NAMESPACE, "id" ).text( profile.getId() ).endTag( NAMESPACE, "id" ); 1580 } 1581 if ( profile.getActivation() != null ) 1582 { 1583 writeActivation( (Activation) profile.getActivation(), "activation", serializer ); 1584 } 1585 if ( profile.getBuild() != null ) 1586 { 1587 writeBuildBase( (BuildBase) profile.getBuild(), "build", serializer ); 1588 } 1589 if ( ( profile.getModules() != null ) && ( profile.getModules().size() > 0 ) ) 1590 { 1591 serializer.startTag( NAMESPACE, "modules" ); 1592 for ( Iterator iter = profile.getModules().iterator(); iter.hasNext(); ) 1593 { 1594 String module = (String) iter.next(); 1595 serializer.startTag( NAMESPACE, "module" ).text( module ).endTag( NAMESPACE, "module" ); 1596 } 1597 serializer.endTag( NAMESPACE, "modules" ); 1598 } 1599 if ( profile.getDistributionManagement() != null ) 1600 { 1601 writeDistributionManagement( (DistributionManagement) profile.getDistributionManagement(), "distributionManagement", serializer ); 1602 } 1603 if ( ( profile.getProperties() != null ) && ( profile.getProperties().size() > 0 ) ) 1604 { 1605 serializer.startTag( NAMESPACE, "properties" ); 1606 for ( Iterator iter = profile.getProperties().keySet().iterator(); iter.hasNext(); ) 1607 { 1608 String key = (String) iter.next(); 1609 String value = (String) profile.getProperties().get( key ); 1610 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 1611 } 1612 serializer.endTag( NAMESPACE, "properties" ); 1613 } 1614 if ( profile.getDependencyManagement() != null ) 1615 { 1616 writeDependencyManagement( (DependencyManagement) profile.getDependencyManagement(), "dependencyManagement", serializer ); 1617 } 1618 if ( ( profile.getDependencies() != null ) && ( profile.getDependencies().size() > 0 ) ) 1619 { 1620 serializer.startTag( NAMESPACE, "dependencies" ); 1621 for ( Iterator iter = profile.getDependencies().iterator(); iter.hasNext(); ) 1622 { 1623 Dependency o = (Dependency) iter.next(); 1624 writeDependency( o, "dependency", serializer ); 1625 } 1626 serializer.endTag( NAMESPACE, "dependencies" ); 1627 } 1628 if ( ( profile.getRepositories() != null ) && ( profile.getRepositories().size() > 0 ) ) 1629 { 1630 serializer.startTag( NAMESPACE, "repositories" ); 1631 for ( Iterator iter = profile.getRepositories().iterator(); iter.hasNext(); ) 1632 { 1633 Repository o = (Repository) iter.next(); 1634 writeRepository( o, "repository", serializer ); 1635 } 1636 serializer.endTag( NAMESPACE, "repositories" ); 1637 } 1638 if ( ( profile.getPluginRepositories() != null ) && ( profile.getPluginRepositories().size() > 0 ) ) 1639 { 1640 serializer.startTag( NAMESPACE, "pluginRepositories" ); 1641 for ( Iterator iter = profile.getPluginRepositories().iterator(); iter.hasNext(); ) 1642 { 1643 Repository o = (Repository) iter.next(); 1644 writeRepository( o, "pluginRepository", serializer ); 1645 } 1646 serializer.endTag( NAMESPACE, "pluginRepositories" ); 1647 } 1648 if ( profile.getReports() != null ) 1649 { 1650 ((Xpp3Dom) profile.getReports()).writeToSerializer( NAMESPACE, serializer ); 1651 } 1652 if ( profile.getReporting() != null ) 1653 { 1654 writeReporting( (Reporting) profile.getReporting(), "reporting", serializer ); 1655 } 1656 serializer.endTag( NAMESPACE, tagName ); 1657 } //-- void writeProfile( Profile, String, XmlSerializer ) 1658 1659 /** 1660 * Method writeRelocation. 1661 * 1662 * @param relocation 1663 * @param serializer 1664 * @param tagName 1665 * @throws java.io.IOException 1666 */ 1667 private void writeRelocation( Relocation relocation, String tagName, XmlSerializer serializer ) 1668 throws java.io.IOException 1669 { 1670 serializer.startTag( NAMESPACE, tagName ); 1671 if ( relocation.getGroupId() != null ) 1672 { 1673 serializer.startTag( NAMESPACE, "groupId" ).text( relocation.getGroupId() ).endTag( NAMESPACE, "groupId" ); 1674 } 1675 if ( relocation.getArtifactId() != null ) 1676 { 1677 serializer.startTag( NAMESPACE, "artifactId" ).text( relocation.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 1678 } 1679 if ( relocation.getVersion() != null ) 1680 { 1681 serializer.startTag( NAMESPACE, "version" ).text( relocation.getVersion() ).endTag( NAMESPACE, "version" ); 1682 } 1683 if ( relocation.getMessage() != null ) 1684 { 1685 serializer.startTag( NAMESPACE, "message" ).text( relocation.getMessage() ).endTag( NAMESPACE, "message" ); 1686 } 1687 serializer.endTag( NAMESPACE, tagName ); 1688 } //-- void writeRelocation( Relocation, String, XmlSerializer ) 1689 1690 /** 1691 * Method writeReportPlugin. 1692 * 1693 * @param reportPlugin 1694 * @param serializer 1695 * @param tagName 1696 * @throws java.io.IOException 1697 */ 1698 private void writeReportPlugin( ReportPlugin reportPlugin, String tagName, XmlSerializer serializer ) 1699 throws java.io.IOException 1700 { 1701 serializer.startTag( NAMESPACE, tagName ); 1702 if ( ( reportPlugin.getGroupId() != null ) && !reportPlugin.getGroupId().equals( "org.apache.maven.plugins" ) ) 1703 { 1704 serializer.startTag( NAMESPACE, "groupId" ).text( reportPlugin.getGroupId() ).endTag( NAMESPACE, "groupId" ); 1705 } 1706 if ( reportPlugin.getArtifactId() != null ) 1707 { 1708 serializer.startTag( NAMESPACE, "artifactId" ).text( reportPlugin.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); 1709 } 1710 if ( reportPlugin.getVersion() != null ) 1711 { 1712 serializer.startTag( NAMESPACE, "version" ).text( reportPlugin.getVersion() ).endTag( NAMESPACE, "version" ); 1713 } 1714 if ( ( reportPlugin.getReportSets() != null ) && ( reportPlugin.getReportSets().size() > 0 ) ) 1715 { 1716 serializer.startTag( NAMESPACE, "reportSets" ); 1717 for ( Iterator iter = reportPlugin.getReportSets().iterator(); iter.hasNext(); ) 1718 { 1719 ReportSet o = (ReportSet) iter.next(); 1720 writeReportSet( o, "reportSet", serializer ); 1721 } 1722 serializer.endTag( NAMESPACE, "reportSets" ); 1723 } 1724 if ( reportPlugin.getInherited() != null ) 1725 { 1726 serializer.startTag( NAMESPACE, "inherited" ).text( reportPlugin.getInherited() ).endTag( NAMESPACE, "inherited" ); 1727 } 1728 if ( reportPlugin.getConfiguration() != null ) 1729 { 1730 ((Xpp3Dom) reportPlugin.getConfiguration()).writeToSerializer( NAMESPACE, serializer ); 1731 } 1732 serializer.endTag( NAMESPACE, tagName ); 1733 } //-- void writeReportPlugin( ReportPlugin, String, XmlSerializer ) 1734 1735 /** 1736 * Method writeReportSet. 1737 * 1738 * @param reportSet 1739 * @param serializer 1740 * @param tagName 1741 * @throws java.io.IOException 1742 */ 1743 private void writeReportSet( ReportSet reportSet, String tagName, XmlSerializer serializer ) 1744 throws java.io.IOException 1745 { 1746 serializer.startTag( NAMESPACE, tagName ); 1747 if ( ( reportSet.getId() != null ) && !reportSet.getId().equals( "default" ) ) 1748 { 1749 serializer.startTag( NAMESPACE, "id" ).text( reportSet.getId() ).endTag( NAMESPACE, "id" ); 1750 } 1751 if ( ( reportSet.getReports() != null ) && ( reportSet.getReports().size() > 0 ) ) 1752 { 1753 serializer.startTag( NAMESPACE, "reports" ); 1754 for ( Iterator iter = reportSet.getReports().iterator(); iter.hasNext(); ) 1755 { 1756 String report = (String) iter.next(); 1757 serializer.startTag( NAMESPACE, "report" ).text( report ).endTag( NAMESPACE, "report" ); 1758 } 1759 serializer.endTag( NAMESPACE, "reports" ); 1760 } 1761 if ( reportSet.getInherited() != null ) 1762 { 1763 serializer.startTag( NAMESPACE, "inherited" ).text( reportSet.getInherited() ).endTag( NAMESPACE, "inherited" ); 1764 } 1765 if ( reportSet.getConfiguration() != null ) 1766 { 1767 ((Xpp3Dom) reportSet.getConfiguration()).writeToSerializer( NAMESPACE, serializer ); 1768 } 1769 serializer.endTag( NAMESPACE, tagName ); 1770 } //-- void writeReportSet( ReportSet, String, XmlSerializer ) 1771 1772 /** 1773 * Method writeReporting. 1774 * 1775 * @param reporting 1776 * @param serializer 1777 * @param tagName 1778 * @throws java.io.IOException 1779 */ 1780 private void writeReporting( Reporting reporting, String tagName, XmlSerializer serializer ) 1781 throws java.io.IOException 1782 { 1783 serializer.startTag( NAMESPACE, tagName ); 1784 if ( reporting.getExcludeDefaults() != null ) 1785 { 1786 serializer.startTag( NAMESPACE, "excludeDefaults" ).text( reporting.getExcludeDefaults() ).endTag( NAMESPACE, "excludeDefaults" ); 1787 } 1788 if ( reporting.getOutputDirectory() != null ) 1789 { 1790 serializer.startTag( NAMESPACE, "outputDirectory" ).text( reporting.getOutputDirectory() ).endTag( NAMESPACE, "outputDirectory" ); 1791 } 1792 if ( ( reporting.getPlugins() != null ) && ( reporting.getPlugins().size() > 0 ) ) 1793 { 1794 serializer.startTag( NAMESPACE, "plugins" ); 1795 for ( Iterator iter = reporting.getPlugins().iterator(); iter.hasNext(); ) 1796 { 1797 ReportPlugin o = (ReportPlugin) iter.next(); 1798 writeReportPlugin( o, "plugin", serializer ); 1799 } 1800 serializer.endTag( NAMESPACE, "plugins" ); 1801 } 1802 serializer.endTag( NAMESPACE, tagName ); 1803 } //-- void writeReporting( Reporting, String, XmlSerializer ) 1804 1805 /** 1806 * Method writeRepository. 1807 * 1808 * @param repository 1809 * @param serializer 1810 * @param tagName 1811 * @throws java.io.IOException 1812 */ 1813 private void writeRepository( Repository repository, String tagName, XmlSerializer serializer ) 1814 throws java.io.IOException 1815 { 1816 serializer.startTag( NAMESPACE, tagName ); 1817 if ( repository.getReleases() != null ) 1818 { 1819 writeRepositoryPolicy( (RepositoryPolicy) repository.getReleases(), "releases", serializer ); 1820 } 1821 if ( repository.getSnapshots() != null ) 1822 { 1823 writeRepositoryPolicy( (RepositoryPolicy) repository.getSnapshots(), "snapshots", serializer ); 1824 } 1825 if ( repository.getId() != null ) 1826 { 1827 serializer.startTag( NAMESPACE, "id" ).text( repository.getId() ).endTag( NAMESPACE, "id" ); 1828 } 1829 if ( repository.getName() != null ) 1830 { 1831 serializer.startTag( NAMESPACE, "name" ).text( repository.getName() ).endTag( NAMESPACE, "name" ); 1832 } 1833 if ( repository.getUrl() != null ) 1834 { 1835 serializer.startTag( NAMESPACE, "url" ).text( repository.getUrl() ).endTag( NAMESPACE, "url" ); 1836 } 1837 if ( ( repository.getLayout() != null ) && !repository.getLayout().equals( "default" ) ) 1838 { 1839 serializer.startTag( NAMESPACE, "layout" ).text( repository.getLayout() ).endTag( NAMESPACE, "layout" ); 1840 } 1841 serializer.endTag( NAMESPACE, tagName ); 1842 } //-- void writeRepository( Repository, String, XmlSerializer ) 1843 1844 /** 1845 * Method writeRepositoryBase. 1846 * 1847 * @param repositoryBase 1848 * @param serializer 1849 * @param tagName 1850 * @throws java.io.IOException 1851 */ 1852 private void writeRepositoryBase( RepositoryBase repositoryBase, String tagName, XmlSerializer serializer ) 1853 throws java.io.IOException 1854 { 1855 serializer.startTag( NAMESPACE, tagName ); 1856 if ( repositoryBase.getId() != null ) 1857 { 1858 serializer.startTag( NAMESPACE, "id" ).text( repositoryBase.getId() ).endTag( NAMESPACE, "id" ); 1859 } 1860 if ( repositoryBase.getName() != null ) 1861 { 1862 serializer.startTag( NAMESPACE, "name" ).text( repositoryBase.getName() ).endTag( NAMESPACE, "name" ); 1863 } 1864 if ( repositoryBase.getUrl() != null ) 1865 { 1866 serializer.startTag( NAMESPACE, "url" ).text( repositoryBase.getUrl() ).endTag( NAMESPACE, "url" ); 1867 } 1868 if ( ( repositoryBase.getLayout() != null ) && !repositoryBase.getLayout().equals( "default" ) ) 1869 { 1870 serializer.startTag( NAMESPACE, "layout" ).text( repositoryBase.getLayout() ).endTag( NAMESPACE, "layout" ); 1871 } 1872 serializer.endTag( NAMESPACE, tagName ); 1873 } //-- void writeRepositoryBase( RepositoryBase, String, XmlSerializer ) 1874 1875 /** 1876 * Method writeRepositoryPolicy. 1877 * 1878 * @param repositoryPolicy 1879 * @param serializer 1880 * @param tagName 1881 * @throws java.io.IOException 1882 */ 1883 private void writeRepositoryPolicy( RepositoryPolicy repositoryPolicy, String tagName, XmlSerializer serializer ) 1884 throws java.io.IOException 1885 { 1886 serializer.startTag( NAMESPACE, tagName ); 1887 if ( repositoryPolicy.getEnabled() != null ) 1888 { 1889 serializer.startTag( NAMESPACE, "enabled" ).text( repositoryPolicy.getEnabled() ).endTag( NAMESPACE, "enabled" ); 1890 } 1891 if ( repositoryPolicy.getUpdatePolicy() != null ) 1892 { 1893 serializer.startTag( NAMESPACE, "updatePolicy" ).text( repositoryPolicy.getUpdatePolicy() ).endTag( NAMESPACE, "updatePolicy" ); 1894 } 1895 if ( repositoryPolicy.getChecksumPolicy() != null ) 1896 { 1897 serializer.startTag( NAMESPACE, "checksumPolicy" ).text( repositoryPolicy.getChecksumPolicy() ).endTag( NAMESPACE, "checksumPolicy" ); 1898 } 1899 serializer.endTag( NAMESPACE, tagName ); 1900 } //-- void writeRepositoryPolicy( RepositoryPolicy, String, XmlSerializer ) 1901 1902 /** 1903 * Method writeResource. 1904 * 1905 * @param resource 1906 * @param serializer 1907 * @param tagName 1908 * @throws java.io.IOException 1909 */ 1910 private void writeResource( Resource resource, String tagName, XmlSerializer serializer ) 1911 throws java.io.IOException 1912 { 1913 serializer.startTag( NAMESPACE, tagName ); 1914 if ( resource.getTargetPath() != null ) 1915 { 1916 serializer.startTag( NAMESPACE, "targetPath" ).text( resource.getTargetPath() ).endTag( NAMESPACE, "targetPath" ); 1917 } 1918 if ( resource.getFiltering() != null ) 1919 { 1920 serializer.startTag( NAMESPACE, "filtering" ).text( resource.getFiltering() ).endTag( NAMESPACE, "filtering" ); 1921 } 1922 if ( resource.getDirectory() != null ) 1923 { 1924 serializer.startTag( NAMESPACE, "directory" ).text( resource.getDirectory() ).endTag( NAMESPACE, "directory" ); 1925 } 1926 if ( ( resource.getIncludes() != null ) && ( resource.getIncludes().size() > 0 ) ) 1927 { 1928 serializer.startTag( NAMESPACE, "includes" ); 1929 for ( Iterator iter = resource.getIncludes().iterator(); iter.hasNext(); ) 1930 { 1931 String include = (String) iter.next(); 1932 serializer.startTag( NAMESPACE, "include" ).text( include ).endTag( NAMESPACE, "include" ); 1933 } 1934 serializer.endTag( NAMESPACE, "includes" ); 1935 } 1936 if ( ( resource.getExcludes() != null ) && ( resource.getExcludes().size() > 0 ) ) 1937 { 1938 serializer.startTag( NAMESPACE, "excludes" ); 1939 for ( Iterator iter = resource.getExcludes().iterator(); iter.hasNext(); ) 1940 { 1941 String exclude = (String) iter.next(); 1942 serializer.startTag( NAMESPACE, "exclude" ).text( exclude ).endTag( NAMESPACE, "exclude" ); 1943 } 1944 serializer.endTag( NAMESPACE, "excludes" ); 1945 } 1946 serializer.endTag( NAMESPACE, tagName ); 1947 } //-- void writeResource( Resource, String, XmlSerializer ) 1948 1949 /** 1950 * Method writeScm. 1951 * 1952 * @param scm 1953 * @param serializer 1954 * @param tagName 1955 * @throws java.io.IOException 1956 */ 1957 private void writeScm( Scm scm, String tagName, XmlSerializer serializer ) 1958 throws java.io.IOException 1959 { 1960 serializer.startTag( NAMESPACE, tagName ); 1961 if ( scm.getConnection() != null ) 1962 { 1963 serializer.startTag( NAMESPACE, "connection" ).text( scm.getConnection() ).endTag( NAMESPACE, "connection" ); 1964 } 1965 if ( scm.getDeveloperConnection() != null ) 1966 { 1967 serializer.startTag( NAMESPACE, "developerConnection" ).text( scm.getDeveloperConnection() ).endTag( NAMESPACE, "developerConnection" ); 1968 } 1969 if ( ( scm.getTag() != null ) && !scm.getTag().equals( "HEAD" ) ) 1970 { 1971 serializer.startTag( NAMESPACE, "tag" ).text( scm.getTag() ).endTag( NAMESPACE, "tag" ); 1972 } 1973 if ( scm.getUrl() != null ) 1974 { 1975 serializer.startTag( NAMESPACE, "url" ).text( scm.getUrl() ).endTag( NAMESPACE, "url" ); 1976 } 1977 serializer.endTag( NAMESPACE, tagName ); 1978 } //-- void writeScm( Scm, String, XmlSerializer ) 1979 1980 /** 1981 * Method writeSite. 1982 * 1983 * @param site 1984 * @param serializer 1985 * @param tagName 1986 * @throws java.io.IOException 1987 */ 1988 private void writeSite( Site site, String tagName, XmlSerializer serializer ) 1989 throws java.io.IOException 1990 { 1991 serializer.startTag( NAMESPACE, tagName ); 1992 if ( site.getId() != null ) 1993 { 1994 serializer.startTag( NAMESPACE, "id" ).text( site.getId() ).endTag( NAMESPACE, "id" ); 1995 } 1996 if ( site.getName() != null ) 1997 { 1998 serializer.startTag( NAMESPACE, "name" ).text( site.getName() ).endTag( NAMESPACE, "name" ); 1999 } 2000 if ( site.getUrl() != null ) 2001 { 2002 serializer.startTag( NAMESPACE, "url" ).text( site.getUrl() ).endTag( NAMESPACE, "url" ); 2003 } 2004 serializer.endTag( NAMESPACE, tagName ); 2005 } //-- void writeSite( Site, String, XmlSerializer ) 2006 2007 }