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