001 /* 002 =================== DO NOT EDIT THIS FILE ==================== 003 Generated by Modello 1.4.1 on 2013-02-24 03:37:13, 004 any modifications will be overwritten. 005 ============================================================== 006 */ 007 008 package org.apache.maven.settings.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.settings.Activation; 020 import org.apache.maven.settings.ActivationFile; 021 import org.apache.maven.settings.ActivationOS; 022 import org.apache.maven.settings.ActivationProperty; 023 import org.apache.maven.settings.IdentifiableBase; 024 import org.apache.maven.settings.Mirror; 025 import org.apache.maven.settings.Profile; 026 import org.apache.maven.settings.Proxy; 027 import org.apache.maven.settings.Repository; 028 import org.apache.maven.settings.RepositoryBase; 029 import org.apache.maven.settings.RepositoryPolicy; 030 import org.apache.maven.settings.Server; 031 import org.apache.maven.settings.Settings; 032 import org.apache.maven.settings.TrackableBase; 033 import org.codehaus.plexus.util.xml.Xpp3Dom; 034 import org.codehaus.plexus.util.xml.pull.MXSerializer; 035 import org.codehaus.plexus.util.xml.pull.XmlSerializer; 036 037 /** 038 * Class SettingsXpp3Writer. 039 * 040 * @version $Revision$ $Date$ 041 */ 042 @SuppressWarnings( "all" ) 043 public class SettingsXpp3Writer 044 { 045 046 //--------------------------/ 047 //- Class/Member Variables -/ 048 //--------------------------/ 049 050 /** 051 * Field NAMESPACE. 052 */ 053 private static final String NAMESPACE = null; 054 055 056 //-----------/ 057 //- Methods -/ 058 //-----------/ 059 060 /** 061 * Method write. 062 * 063 * @param writer 064 * @param settings 065 * @throws java.io.IOException 066 */ 067 public void write( Writer writer, Settings settings ) 068 throws java.io.IOException 069 { 070 XmlSerializer serializer = new MXSerializer(); 071 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); 072 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); 073 serializer.setOutput( writer ); 074 serializer.startDocument( settings.getModelEncoding(), null ); 075 writeSettings( settings, "settings", serializer ); 076 serializer.endDocument(); 077 } //-- void write( Writer, Settings ) 078 079 /** 080 * Method write. 081 * 082 * @param stream 083 * @param settings 084 * @throws java.io.IOException 085 */ 086 public void write( OutputStream stream, Settings settings ) 087 throws java.io.IOException 088 { 089 XmlSerializer serializer = new MXSerializer(); 090 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); 091 serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); 092 serializer.setOutput( stream, settings.getModelEncoding() ); 093 serializer.startDocument( settings.getModelEncoding(), null ); 094 writeSettings( settings, "settings", serializer ); 095 serializer.endDocument(); 096 } //-- void write( OutputStream, Settings ) 097 098 /** 099 * Method writeActivation. 100 * 101 * @param activation 102 * @param serializer 103 * @param tagName 104 * @throws java.io.IOException 105 */ 106 private void writeActivation( Activation activation, String tagName, XmlSerializer serializer ) 107 throws java.io.IOException 108 { 109 serializer.startTag( NAMESPACE, tagName ); 110 if ( activation.isActiveByDefault() != false ) 111 { 112 serializer.startTag( NAMESPACE, "activeByDefault" ).text( String.valueOf( activation.isActiveByDefault() ) ).endTag( NAMESPACE, "activeByDefault" ); 113 } 114 if ( activation.getJdk() != null ) 115 { 116 serializer.startTag( NAMESPACE, "jdk" ).text( activation.getJdk() ).endTag( NAMESPACE, "jdk" ); 117 } 118 if ( activation.getOs() != null ) 119 { 120 writeActivationOS( (ActivationOS) activation.getOs(), "os", serializer ); 121 } 122 if ( activation.getProperty() != null ) 123 { 124 writeActivationProperty( (ActivationProperty) activation.getProperty(), "property", serializer ); 125 } 126 if ( activation.getFile() != null ) 127 { 128 writeActivationFile( (ActivationFile) activation.getFile(), "file", serializer ); 129 } 130 serializer.endTag( NAMESPACE, tagName ); 131 } //-- void writeActivation( Activation, String, XmlSerializer ) 132 133 /** 134 * Method writeActivationFile. 135 * 136 * @param activationFile 137 * @param serializer 138 * @param tagName 139 * @throws java.io.IOException 140 */ 141 private void writeActivationFile( ActivationFile activationFile, String tagName, XmlSerializer serializer ) 142 throws java.io.IOException 143 { 144 serializer.startTag( NAMESPACE, tagName ); 145 if ( activationFile.getMissing() != null ) 146 { 147 serializer.startTag( NAMESPACE, "missing" ).text( activationFile.getMissing() ).endTag( NAMESPACE, "missing" ); 148 } 149 if ( activationFile.getExists() != null ) 150 { 151 serializer.startTag( NAMESPACE, "exists" ).text( activationFile.getExists() ).endTag( NAMESPACE, "exists" ); 152 } 153 serializer.endTag( NAMESPACE, tagName ); 154 } //-- void writeActivationFile( ActivationFile, String, XmlSerializer ) 155 156 /** 157 * Method writeActivationOS. 158 * 159 * @param activationOS 160 * @param serializer 161 * @param tagName 162 * @throws java.io.IOException 163 */ 164 private void writeActivationOS( ActivationOS activationOS, String tagName, XmlSerializer serializer ) 165 throws java.io.IOException 166 { 167 serializer.startTag( NAMESPACE, tagName ); 168 if ( activationOS.getName() != null ) 169 { 170 serializer.startTag( NAMESPACE, "name" ).text( activationOS.getName() ).endTag( NAMESPACE, "name" ); 171 } 172 if ( activationOS.getFamily() != null ) 173 { 174 serializer.startTag( NAMESPACE, "family" ).text( activationOS.getFamily() ).endTag( NAMESPACE, "family" ); 175 } 176 if ( activationOS.getArch() != null ) 177 { 178 serializer.startTag( NAMESPACE, "arch" ).text( activationOS.getArch() ).endTag( NAMESPACE, "arch" ); 179 } 180 if ( activationOS.getVersion() != null ) 181 { 182 serializer.startTag( NAMESPACE, "version" ).text( activationOS.getVersion() ).endTag( NAMESPACE, "version" ); 183 } 184 serializer.endTag( NAMESPACE, tagName ); 185 } //-- void writeActivationOS( ActivationOS, String, XmlSerializer ) 186 187 /** 188 * Method writeActivationProperty. 189 * 190 * @param activationProperty 191 * @param serializer 192 * @param tagName 193 * @throws java.io.IOException 194 */ 195 private void writeActivationProperty( ActivationProperty activationProperty, String tagName, XmlSerializer serializer ) 196 throws java.io.IOException 197 { 198 serializer.startTag( NAMESPACE, tagName ); 199 if ( activationProperty.getName() != null ) 200 { 201 serializer.startTag( NAMESPACE, "name" ).text( activationProperty.getName() ).endTag( NAMESPACE, "name" ); 202 } 203 if ( activationProperty.getValue() != null ) 204 { 205 serializer.startTag( NAMESPACE, "value" ).text( activationProperty.getValue() ).endTag( NAMESPACE, "value" ); 206 } 207 serializer.endTag( NAMESPACE, tagName ); 208 } //-- void writeActivationProperty( ActivationProperty, String, XmlSerializer ) 209 210 /** 211 * Method writeIdentifiableBase. 212 * 213 * @param identifiableBase 214 * @param serializer 215 * @param tagName 216 * @throws java.io.IOException 217 */ 218 private void writeIdentifiableBase( IdentifiableBase identifiableBase, String tagName, XmlSerializer serializer ) 219 throws java.io.IOException 220 { 221 serializer.startTag( NAMESPACE, tagName ); 222 if ( ( identifiableBase.getId() != null ) && !identifiableBase.getId().equals( "default" ) ) 223 { 224 serializer.startTag( NAMESPACE, "id" ).text( identifiableBase.getId() ).endTag( NAMESPACE, "id" ); 225 } 226 serializer.endTag( NAMESPACE, tagName ); 227 } //-- void writeIdentifiableBase( IdentifiableBase, String, XmlSerializer ) 228 229 /** 230 * Method writeMirror. 231 * 232 * @param mirror 233 * @param serializer 234 * @param tagName 235 * @throws java.io.IOException 236 */ 237 private void writeMirror( Mirror mirror, String tagName, XmlSerializer serializer ) 238 throws java.io.IOException 239 { 240 serializer.startTag( NAMESPACE, tagName ); 241 if ( mirror.getMirrorOf() != null ) 242 { 243 serializer.startTag( NAMESPACE, "mirrorOf" ).text( mirror.getMirrorOf() ).endTag( NAMESPACE, "mirrorOf" ); 244 } 245 if ( mirror.getName() != null ) 246 { 247 serializer.startTag( NAMESPACE, "name" ).text( mirror.getName() ).endTag( NAMESPACE, "name" ); 248 } 249 if ( mirror.getUrl() != null ) 250 { 251 serializer.startTag( NAMESPACE, "url" ).text( mirror.getUrl() ).endTag( NAMESPACE, "url" ); 252 } 253 if ( mirror.getLayout() != null ) 254 { 255 serializer.startTag( NAMESPACE, "layout" ).text( mirror.getLayout() ).endTag( NAMESPACE, "layout" ); 256 } 257 if ( ( mirror.getMirrorOfLayouts() != null ) && !mirror.getMirrorOfLayouts().equals( "default,legacy" ) ) 258 { 259 serializer.startTag( NAMESPACE, "mirrorOfLayouts" ).text( mirror.getMirrorOfLayouts() ).endTag( NAMESPACE, "mirrorOfLayouts" ); 260 } 261 if ( ( mirror.getId() != null ) && !mirror.getId().equals( "default" ) ) 262 { 263 serializer.startTag( NAMESPACE, "id" ).text( mirror.getId() ).endTag( NAMESPACE, "id" ); 264 } 265 serializer.endTag( NAMESPACE, tagName ); 266 } //-- void writeMirror( Mirror, String, XmlSerializer ) 267 268 /** 269 * Method writeProfile. 270 * 271 * @param profile 272 * @param serializer 273 * @param tagName 274 * @throws java.io.IOException 275 */ 276 private void writeProfile( Profile profile, String tagName, XmlSerializer serializer ) 277 throws java.io.IOException 278 { 279 serializer.startTag( NAMESPACE, tagName ); 280 if ( profile.getActivation() != null ) 281 { 282 writeActivation( (Activation) profile.getActivation(), "activation", serializer ); 283 } 284 if ( ( profile.getProperties() != null ) && ( profile.getProperties().size() > 0 ) ) 285 { 286 serializer.startTag( NAMESPACE, "properties" ); 287 for ( Iterator iter = profile.getProperties().keySet().iterator(); iter.hasNext(); ) 288 { 289 String key = (String) iter.next(); 290 String value = (String) profile.getProperties().get( key ); 291 serializer.startTag( NAMESPACE, "" + key + "" ).text( value ).endTag( NAMESPACE, "" + key + "" ); 292 } 293 serializer.endTag( NAMESPACE, "properties" ); 294 } 295 if ( ( profile.getRepositories() != null ) && ( profile.getRepositories().size() > 0 ) ) 296 { 297 serializer.startTag( NAMESPACE, "repositories" ); 298 for ( Iterator iter = profile.getRepositories().iterator(); iter.hasNext(); ) 299 { 300 Repository o = (Repository) iter.next(); 301 writeRepository( o, "repository", serializer ); 302 } 303 serializer.endTag( NAMESPACE, "repositories" ); 304 } 305 if ( ( profile.getPluginRepositories() != null ) && ( profile.getPluginRepositories().size() > 0 ) ) 306 { 307 serializer.startTag( NAMESPACE, "pluginRepositories" ); 308 for ( Iterator iter = profile.getPluginRepositories().iterator(); iter.hasNext(); ) 309 { 310 Repository o = (Repository) iter.next(); 311 writeRepository( o, "pluginRepository", serializer ); 312 } 313 serializer.endTag( NAMESPACE, "pluginRepositories" ); 314 } 315 if ( ( profile.getId() != null ) && !profile.getId().equals( "default" ) ) 316 { 317 serializer.startTag( NAMESPACE, "id" ).text( profile.getId() ).endTag( NAMESPACE, "id" ); 318 } 319 serializer.endTag( NAMESPACE, tagName ); 320 } //-- void writeProfile( Profile, String, XmlSerializer ) 321 322 /** 323 * Method writeProxy. 324 * 325 * @param proxy 326 * @param serializer 327 * @param tagName 328 * @throws java.io.IOException 329 */ 330 private void writeProxy( Proxy proxy, String tagName, XmlSerializer serializer ) 331 throws java.io.IOException 332 { 333 serializer.startTag( NAMESPACE, tagName ); 334 if ( proxy.isActive() != true ) 335 { 336 serializer.startTag( NAMESPACE, "active" ).text( String.valueOf( proxy.isActive() ) ).endTag( NAMESPACE, "active" ); 337 } 338 if ( ( proxy.getProtocol() != null ) && !proxy.getProtocol().equals( "http" ) ) 339 { 340 serializer.startTag( NAMESPACE, "protocol" ).text( proxy.getProtocol() ).endTag( NAMESPACE, "protocol" ); 341 } 342 if ( proxy.getUsername() != null ) 343 { 344 serializer.startTag( NAMESPACE, "username" ).text( proxy.getUsername() ).endTag( NAMESPACE, "username" ); 345 } 346 if ( proxy.getPassword() != null ) 347 { 348 serializer.startTag( NAMESPACE, "password" ).text( proxy.getPassword() ).endTag( NAMESPACE, "password" ); 349 } 350 if ( proxy.getPort() != 8080 ) 351 { 352 serializer.startTag( NAMESPACE, "port" ).text( String.valueOf( proxy.getPort() ) ).endTag( NAMESPACE, "port" ); 353 } 354 if ( proxy.getHost() != null ) 355 { 356 serializer.startTag( NAMESPACE, "host" ).text( proxy.getHost() ).endTag( NAMESPACE, "host" ); 357 } 358 if ( proxy.getNonProxyHosts() != null ) 359 { 360 serializer.startTag( NAMESPACE, "nonProxyHosts" ).text( proxy.getNonProxyHosts() ).endTag( NAMESPACE, "nonProxyHosts" ); 361 } 362 if ( ( proxy.getId() != null ) && !proxy.getId().equals( "default" ) ) 363 { 364 serializer.startTag( NAMESPACE, "id" ).text( proxy.getId() ).endTag( NAMESPACE, "id" ); 365 } 366 serializer.endTag( NAMESPACE, tagName ); 367 } //-- void writeProxy( Proxy, String, XmlSerializer ) 368 369 /** 370 * Method writeRepository. 371 * 372 * @param repository 373 * @param serializer 374 * @param tagName 375 * @throws java.io.IOException 376 */ 377 private void writeRepository( Repository repository, String tagName, XmlSerializer serializer ) 378 throws java.io.IOException 379 { 380 serializer.startTag( NAMESPACE, tagName ); 381 if ( repository.getReleases() != null ) 382 { 383 writeRepositoryPolicy( (RepositoryPolicy) repository.getReleases(), "releases", serializer ); 384 } 385 if ( repository.getSnapshots() != null ) 386 { 387 writeRepositoryPolicy( (RepositoryPolicy) repository.getSnapshots(), "snapshots", serializer ); 388 } 389 if ( repository.getId() != null ) 390 { 391 serializer.startTag( NAMESPACE, "id" ).text( repository.getId() ).endTag( NAMESPACE, "id" ); 392 } 393 if ( repository.getName() != null ) 394 { 395 serializer.startTag( NAMESPACE, "name" ).text( repository.getName() ).endTag( NAMESPACE, "name" ); 396 } 397 if ( repository.getUrl() != null ) 398 { 399 serializer.startTag( NAMESPACE, "url" ).text( repository.getUrl() ).endTag( NAMESPACE, "url" ); 400 } 401 if ( ( repository.getLayout() != null ) && !repository.getLayout().equals( "default" ) ) 402 { 403 serializer.startTag( NAMESPACE, "layout" ).text( repository.getLayout() ).endTag( NAMESPACE, "layout" ); 404 } 405 serializer.endTag( NAMESPACE, tagName ); 406 } //-- void writeRepository( Repository, String, XmlSerializer ) 407 408 /** 409 * Method writeRepositoryBase. 410 * 411 * @param repositoryBase 412 * @param serializer 413 * @param tagName 414 * @throws java.io.IOException 415 */ 416 private void writeRepositoryBase( RepositoryBase repositoryBase, String tagName, XmlSerializer serializer ) 417 throws java.io.IOException 418 { 419 serializer.startTag( NAMESPACE, tagName ); 420 if ( repositoryBase.getId() != null ) 421 { 422 serializer.startTag( NAMESPACE, "id" ).text( repositoryBase.getId() ).endTag( NAMESPACE, "id" ); 423 } 424 if ( repositoryBase.getName() != null ) 425 { 426 serializer.startTag( NAMESPACE, "name" ).text( repositoryBase.getName() ).endTag( NAMESPACE, "name" ); 427 } 428 if ( repositoryBase.getUrl() != null ) 429 { 430 serializer.startTag( NAMESPACE, "url" ).text( repositoryBase.getUrl() ).endTag( NAMESPACE, "url" ); 431 } 432 if ( ( repositoryBase.getLayout() != null ) && !repositoryBase.getLayout().equals( "default" ) ) 433 { 434 serializer.startTag( NAMESPACE, "layout" ).text( repositoryBase.getLayout() ).endTag( NAMESPACE, "layout" ); 435 } 436 serializer.endTag( NAMESPACE, tagName ); 437 } //-- void writeRepositoryBase( RepositoryBase, String, XmlSerializer ) 438 439 /** 440 * Method writeRepositoryPolicy. 441 * 442 * @param repositoryPolicy 443 * @param serializer 444 * @param tagName 445 * @throws java.io.IOException 446 */ 447 private void writeRepositoryPolicy( RepositoryPolicy repositoryPolicy, String tagName, XmlSerializer serializer ) 448 throws java.io.IOException 449 { 450 serializer.startTag( NAMESPACE, tagName ); 451 if ( repositoryPolicy.isEnabled() != true ) 452 { 453 serializer.startTag( NAMESPACE, "enabled" ).text( String.valueOf( repositoryPolicy.isEnabled() ) ).endTag( NAMESPACE, "enabled" ); 454 } 455 if ( repositoryPolicy.getUpdatePolicy() != null ) 456 { 457 serializer.startTag( NAMESPACE, "updatePolicy" ).text( repositoryPolicy.getUpdatePolicy() ).endTag( NAMESPACE, "updatePolicy" ); 458 } 459 if ( repositoryPolicy.getChecksumPolicy() != null ) 460 { 461 serializer.startTag( NAMESPACE, "checksumPolicy" ).text( repositoryPolicy.getChecksumPolicy() ).endTag( NAMESPACE, "checksumPolicy" ); 462 } 463 serializer.endTag( NAMESPACE, tagName ); 464 } //-- void writeRepositoryPolicy( RepositoryPolicy, String, XmlSerializer ) 465 466 /** 467 * Method writeServer. 468 * 469 * @param server 470 * @param serializer 471 * @param tagName 472 * @throws java.io.IOException 473 */ 474 private void writeServer( Server server, String tagName, XmlSerializer serializer ) 475 throws java.io.IOException 476 { 477 serializer.startTag( NAMESPACE, tagName ); 478 if ( server.getUsername() != null ) 479 { 480 serializer.startTag( NAMESPACE, "username" ).text( server.getUsername() ).endTag( NAMESPACE, "username" ); 481 } 482 if ( server.getPassword() != null ) 483 { 484 serializer.startTag( NAMESPACE, "password" ).text( server.getPassword() ).endTag( NAMESPACE, "password" ); 485 } 486 if ( server.getPrivateKey() != null ) 487 { 488 serializer.startTag( NAMESPACE, "privateKey" ).text( server.getPrivateKey() ).endTag( NAMESPACE, "privateKey" ); 489 } 490 if ( server.getPassphrase() != null ) 491 { 492 serializer.startTag( NAMESPACE, "passphrase" ).text( server.getPassphrase() ).endTag( NAMESPACE, "passphrase" ); 493 } 494 if ( server.getFilePermissions() != null ) 495 { 496 serializer.startTag( NAMESPACE, "filePermissions" ).text( server.getFilePermissions() ).endTag( NAMESPACE, "filePermissions" ); 497 } 498 if ( server.getDirectoryPermissions() != null ) 499 { 500 serializer.startTag( NAMESPACE, "directoryPermissions" ).text( server.getDirectoryPermissions() ).endTag( NAMESPACE, "directoryPermissions" ); 501 } 502 if ( server.getConfiguration() != null ) 503 { 504 ((Xpp3Dom) server.getConfiguration()).writeToSerializer( NAMESPACE, serializer ); 505 } 506 if ( ( server.getId() != null ) && !server.getId().equals( "default" ) ) 507 { 508 serializer.startTag( NAMESPACE, "id" ).text( server.getId() ).endTag( NAMESPACE, "id" ); 509 } 510 serializer.endTag( NAMESPACE, tagName ); 511 } //-- void writeServer( Server, String, XmlSerializer ) 512 513 /** 514 * Method writeSettings. 515 * 516 * @param settings 517 * @param serializer 518 * @param tagName 519 * @throws java.io.IOException 520 */ 521 private void writeSettings( Settings settings, String tagName, XmlSerializer serializer ) 522 throws java.io.IOException 523 { 524 serializer.setPrefix( "", "http://maven.apache.org/SETTINGS/1.1.0" ); 525 serializer.setPrefix( "xsi", "http://www.w3.org/2001/XMLSchema-instance" ); 526 serializer.startTag( NAMESPACE, tagName ); 527 serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" ); 528 if ( settings.getLocalRepository() != null ) 529 { 530 serializer.startTag( NAMESPACE, "localRepository" ).text( settings.getLocalRepository() ).endTag( NAMESPACE, "localRepository" ); 531 } 532 if ( settings.isInteractiveMode() != true ) 533 { 534 serializer.startTag( NAMESPACE, "interactiveMode" ).text( String.valueOf( settings.isInteractiveMode() ) ).endTag( NAMESPACE, "interactiveMode" ); 535 } 536 if ( settings.isUsePluginRegistry() != false ) 537 { 538 serializer.startTag( NAMESPACE, "usePluginRegistry" ).text( String.valueOf( settings.isUsePluginRegistry() ) ).endTag( NAMESPACE, "usePluginRegistry" ); 539 } 540 if ( settings.isOffline() != false ) 541 { 542 serializer.startTag( NAMESPACE, "offline" ).text( String.valueOf( settings.isOffline() ) ).endTag( NAMESPACE, "offline" ); 543 } 544 if ( ( settings.getProxies() != null ) && ( settings.getProxies().size() > 0 ) ) 545 { 546 serializer.startTag( NAMESPACE, "proxies" ); 547 for ( Iterator iter = settings.getProxies().iterator(); iter.hasNext(); ) 548 { 549 Proxy o = (Proxy) iter.next(); 550 writeProxy( o, "proxy", serializer ); 551 } 552 serializer.endTag( NAMESPACE, "proxies" ); 553 } 554 if ( ( settings.getServers() != null ) && ( settings.getServers().size() > 0 ) ) 555 { 556 serializer.startTag( NAMESPACE, "servers" ); 557 for ( Iterator iter = settings.getServers().iterator(); iter.hasNext(); ) 558 { 559 Server o = (Server) iter.next(); 560 writeServer( o, "server", serializer ); 561 } 562 serializer.endTag( NAMESPACE, "servers" ); 563 } 564 if ( ( settings.getMirrors() != null ) && ( settings.getMirrors().size() > 0 ) ) 565 { 566 serializer.startTag( NAMESPACE, "mirrors" ); 567 for ( Iterator iter = settings.getMirrors().iterator(); iter.hasNext(); ) 568 { 569 Mirror o = (Mirror) iter.next(); 570 writeMirror( o, "mirror", serializer ); 571 } 572 serializer.endTag( NAMESPACE, "mirrors" ); 573 } 574 if ( ( settings.getProfiles() != null ) && ( settings.getProfiles().size() > 0 ) ) 575 { 576 serializer.startTag( NAMESPACE, "profiles" ); 577 for ( Iterator iter = settings.getProfiles().iterator(); iter.hasNext(); ) 578 { 579 Profile o = (Profile) iter.next(); 580 writeProfile( o, "profile", serializer ); 581 } 582 serializer.endTag( NAMESPACE, "profiles" ); 583 } 584 if ( ( settings.getActiveProfiles() != null ) && ( settings.getActiveProfiles().size() > 0 ) ) 585 { 586 serializer.startTag( NAMESPACE, "activeProfiles" ); 587 for ( Iterator iter = settings.getActiveProfiles().iterator(); iter.hasNext(); ) 588 { 589 String activeProfile = (String) iter.next(); 590 serializer.startTag( NAMESPACE, "activeProfile" ).text( activeProfile ).endTag( NAMESPACE, "activeProfile" ); 591 } 592 serializer.endTag( NAMESPACE, "activeProfiles" ); 593 } 594 if ( ( settings.getPluginGroups() != null ) && ( settings.getPluginGroups().size() > 0 ) ) 595 { 596 serializer.startTag( NAMESPACE, "pluginGroups" ); 597 for ( Iterator iter = settings.getPluginGroups().iterator(); iter.hasNext(); ) 598 { 599 String pluginGroup = (String) iter.next(); 600 serializer.startTag( NAMESPACE, "pluginGroup" ).text( pluginGroup ).endTag( NAMESPACE, "pluginGroup" ); 601 } 602 serializer.endTag( NAMESPACE, "pluginGroups" ); 603 } 604 serializer.endTag( NAMESPACE, tagName ); 605 } //-- void writeSettings( Settings, String, XmlSerializer ) 606 607 /** 608 * Method writeTrackableBase. 609 * 610 * @param trackableBase 611 * @param serializer 612 * @param tagName 613 * @throws java.io.IOException 614 */ 615 private void writeTrackableBase( TrackableBase trackableBase, String tagName, XmlSerializer serializer ) 616 throws java.io.IOException 617 { 618 serializer.startTag( NAMESPACE, tagName ); 619 serializer.endTag( NAMESPACE, tagName ); 620 } //-- void writeTrackableBase( TrackableBase, String, XmlSerializer ) 621 622 }