001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008 Sun Microsystems, Inc. 025 */ 026package org.opends.server.admin.std.meta; 027 028 029 030import java.net.InetAddress; 031import java.util.Collection; 032import java.util.SortedSet; 033import org.opends.server.admin.AdministratorAction; 034import org.opends.server.admin.AliasDefaultBehaviorProvider; 035import org.opends.server.admin.BooleanPropertyDefinition; 036import org.opends.server.admin.client.AuthorizationException; 037import org.opends.server.admin.client.CommunicationException; 038import org.opends.server.admin.client.ConcurrentModificationException; 039import org.opends.server.admin.client.ManagedObject; 040import org.opends.server.admin.client.MissingMandatoryPropertiesException; 041import org.opends.server.admin.client.OperationRejectedException; 042import org.opends.server.admin.DefaultBehaviorProvider; 043import org.opends.server.admin.DefinedDefaultBehaviorProvider; 044import org.opends.server.admin.DurationPropertyDefinition; 045import org.opends.server.admin.EnumPropertyDefinition; 046import org.opends.server.admin.IntegerPropertyDefinition; 047import org.opends.server.admin.IPAddressPropertyDefinition; 048import org.opends.server.admin.ManagedObjectAlreadyExistsException; 049import org.opends.server.admin.ManagedObjectDefinition; 050import org.opends.server.admin.PropertyException; 051import org.opends.server.admin.PropertyOption; 052import org.opends.server.admin.PropertyProvider; 053import org.opends.server.admin.server.ConfigurationChangeListener; 054import org.opends.server.admin.server.ServerManagedObject; 055import org.opends.server.admin.std.client.ReplicationServerCfgClient; 056import org.opends.server.admin.std.server.ReplicationServerCfg; 057import org.opends.server.admin.StringPropertyDefinition; 058import org.opends.server.admin.Tag; 059import org.opends.server.admin.TopCfgDefn; 060import org.opends.server.admin.UndefinedDefaultBehaviorProvider; 061import org.opends.server.types.DN; 062 063 064 065/** 066 * An interface for querying the Replication Server managed object 067 * definition meta information. 068 * <p> 069 * Replication Servers publish updates to Directory Servers within a 070 * Replication Domain. 071 */ 072public final class ReplicationServerCfgDefn extends ManagedObjectDefinition<ReplicationServerCfgClient, ReplicationServerCfg> { 073 074 // The singleton configuration definition instance. 075 private static final ReplicationServerCfgDefn INSTANCE = new ReplicationServerCfgDefn(); 076 077 078 079 /** 080 * Defines the set of permissable values for the "replication-db-implementation" property. 081 * <p> 082 * The Replication Server database implementation that stores all 083 * persistent information. 084 */ 085 public static enum ReplicationDBImplementation { 086 087 /** 088 * Implementation based on Berkeley DB JE database. 089 */ 090 JE("je"), 091 092 093 094 /** 095 * Implementation based on log file. 096 */ 097 LOG("log"); 098 099 100 101 // String representation of the value. 102 private final String name; 103 104 105 106 // Private constructor. 107 private ReplicationDBImplementation(String name) { this.name = name; } 108 109 110 111 /** 112 * {@inheritDoc} 113 */ 114 public String toString() { return name; } 115 116 } 117 118 119 120 // The "assured-timeout" property definition. 121 private static final DurationPropertyDefinition PD_ASSURED_TIMEOUT; 122 123 124 125 // The "compute-change-number" property definition. 126 private static final BooleanPropertyDefinition PD_COMPUTE_CHANGE_NUMBER; 127 128 129 130 // The "degraded-status-threshold" property definition. 131 private static final IntegerPropertyDefinition PD_DEGRADED_STATUS_THRESHOLD; 132 133 134 135 // The "group-id" property definition. 136 private static final IntegerPropertyDefinition PD_GROUP_ID; 137 138 139 140 // The "monitoring-period" property definition. 141 private static final DurationPropertyDefinition PD_MONITORING_PERIOD; 142 143 144 145 // The "queue-size" property definition. 146 private static final IntegerPropertyDefinition PD_QUEUE_SIZE; 147 148 149 150 // The "replication-db-directory" property definition. 151 private static final StringPropertyDefinition PD_REPLICATION_DB_DIRECTORY; 152 153 154 155 // The "replication-db-implementation" property definition. 156 private static final EnumPropertyDefinition<ReplicationDBImplementation> PD_REPLICATION_DB_IMPLEMENTATION; 157 158 159 160 // The "replication-port" property definition. 161 private static final IntegerPropertyDefinition PD_REPLICATION_PORT; 162 163 164 165 // The "replication-purge-delay" property definition. 166 private static final DurationPropertyDefinition PD_REPLICATION_PURGE_DELAY; 167 168 169 170 // The "replication-server" property definition. 171 private static final StringPropertyDefinition PD_REPLICATION_SERVER; 172 173 174 175 // The "replication-server-id" property definition. 176 private static final IntegerPropertyDefinition PD_REPLICATION_SERVER_ID; 177 178 179 180 // The "source-address" property definition. 181 private static final IPAddressPropertyDefinition PD_SOURCE_ADDRESS; 182 183 184 185 // The "weight" property definition. 186 private static final IntegerPropertyDefinition PD_WEIGHT; 187 188 189 190 // The "window-size" property definition. 191 private static final IntegerPropertyDefinition PD_WINDOW_SIZE; 192 193 194 195 // Build the "assured-timeout" property definition. 196 static { 197 DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "assured-timeout"); 198 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "assured-timeout")); 199 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("1000ms"); 200 builder.setDefaultBehaviorProvider(provider); 201 builder.setBaseUnit("ms"); 202 builder.setLowerLimit("1"); 203 PD_ASSURED_TIMEOUT = builder.getInstance(); 204 INSTANCE.registerPropertyDefinition(PD_ASSURED_TIMEOUT); 205 } 206 207 208 209 // Build the "compute-change-number" property definition. 210 static { 211 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "compute-change-number"); 212 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "compute-change-number")); 213 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true"); 214 builder.setDefaultBehaviorProvider(provider); 215 PD_COMPUTE_CHANGE_NUMBER = builder.getInstance(); 216 INSTANCE.registerPropertyDefinition(PD_COMPUTE_CHANGE_NUMBER); 217 } 218 219 220 221 // Build the "degraded-status-threshold" property definition. 222 static { 223 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "degraded-status-threshold"); 224 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "degraded-status-threshold")); 225 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("5000"); 226 builder.setDefaultBehaviorProvider(provider); 227 builder.setLowerLimit(0); 228 PD_DEGRADED_STATUS_THRESHOLD = builder.getInstance(); 229 INSTANCE.registerPropertyDefinition(PD_DEGRADED_STATUS_THRESHOLD); 230 } 231 232 233 234 // Build the "group-id" property definition. 235 static { 236 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "group-id"); 237 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "group-id")); 238 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("1"); 239 builder.setDefaultBehaviorProvider(provider); 240 builder.setUpperLimit(127); 241 builder.setLowerLimit(1); 242 PD_GROUP_ID = builder.getInstance(); 243 INSTANCE.registerPropertyDefinition(PD_GROUP_ID); 244 } 245 246 247 248 // Build the "monitoring-period" property definition. 249 static { 250 DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "monitoring-period"); 251 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "monitoring-period")); 252 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("60s"); 253 builder.setDefaultBehaviorProvider(provider); 254 builder.setBaseUnit("ms"); 255 builder.setLowerLimit("0"); 256 PD_MONITORING_PERIOD = builder.getInstance(); 257 INSTANCE.registerPropertyDefinition(PD_MONITORING_PERIOD); 258 } 259 260 261 262 // Build the "queue-size" property definition. 263 static { 264 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "queue-size"); 265 builder.setOption(PropertyOption.ADVANCED); 266 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "queue-size")); 267 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("10000"); 268 builder.setDefaultBehaviorProvider(provider); 269 PD_QUEUE_SIZE = builder.getInstance(); 270 INSTANCE.registerPropertyDefinition(PD_QUEUE_SIZE); 271 } 272 273 274 275 // Build the "replication-db-directory" property definition. 276 static { 277 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "replication-db-directory"); 278 builder.setOption(PropertyOption.READ_ONLY); 279 builder.setOption(PropertyOption.MANDATORY); 280 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-db-directory")); 281 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("changelogDb"); 282 builder.setDefaultBehaviorProvider(provider); 283 PD_REPLICATION_DB_DIRECTORY = builder.getInstance(); 284 INSTANCE.registerPropertyDefinition(PD_REPLICATION_DB_DIRECTORY); 285 } 286 287 288 289 // Build the "replication-db-implementation" property definition. 290 static { 291 EnumPropertyDefinition.Builder<ReplicationDBImplementation> builder = EnumPropertyDefinition.createBuilder(INSTANCE, "replication-db-implementation"); 292 builder.setOption(PropertyOption.ADVANCED); 293 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-db-implementation")); 294 DefaultBehaviorProvider<ReplicationDBImplementation> provider = new DefinedDefaultBehaviorProvider<ReplicationDBImplementation>("log"); 295 builder.setDefaultBehaviorProvider(provider); 296 builder.setEnumClass(ReplicationDBImplementation.class); 297 PD_REPLICATION_DB_IMPLEMENTATION = builder.getInstance(); 298 INSTANCE.registerPropertyDefinition(PD_REPLICATION_DB_IMPLEMENTATION); 299 } 300 301 302 303 // Build the "replication-port" property definition. 304 static { 305 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "replication-port"); 306 builder.setOption(PropertyOption.MANDATORY); 307 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-port")); 308 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Integer>()); 309 builder.setUpperLimit(65535); 310 builder.setLowerLimit(1); 311 PD_REPLICATION_PORT = builder.getInstance(); 312 INSTANCE.registerPropertyDefinition(PD_REPLICATION_PORT); 313 } 314 315 316 317 // Build the "replication-purge-delay" property definition. 318 static { 319 DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "replication-purge-delay"); 320 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-purge-delay")); 321 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("3 days"); 322 builder.setDefaultBehaviorProvider(provider); 323 builder.setAllowUnlimited(false); 324 builder.setBaseUnit("s"); 325 PD_REPLICATION_PURGE_DELAY = builder.getInstance(); 326 INSTANCE.registerPropertyDefinition(PD_REPLICATION_PURGE_DELAY); 327 } 328 329 330 331 // Build the "replication-server" property definition. 332 static { 333 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "replication-server"); 334 builder.setOption(PropertyOption.MULTI_VALUED); 335 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-server")); 336 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 337 builder.setPattern("^.+:[0-9]+$", "HOST:PORT"); 338 PD_REPLICATION_SERVER = builder.getInstance(); 339 INSTANCE.registerPropertyDefinition(PD_REPLICATION_SERVER); 340 } 341 342 343 344 // Build the "replication-server-id" property definition. 345 static { 346 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "replication-server-id"); 347 builder.setOption(PropertyOption.READ_ONLY); 348 builder.setOption(PropertyOption.MANDATORY); 349 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "replication-server-id")); 350 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Integer>()); 351 builder.setUpperLimit(65535); 352 builder.setLowerLimit(1); 353 PD_REPLICATION_SERVER_ID = builder.getInstance(); 354 INSTANCE.registerPropertyDefinition(PD_REPLICATION_SERVER_ID); 355 } 356 357 358 359 // Build the "source-address" property definition. 360 static { 361 IPAddressPropertyDefinition.Builder builder = IPAddressPropertyDefinition.createBuilder(INSTANCE, "source-address"); 362 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "source-address")); 363 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<InetAddress>(INSTANCE, "source-address")); 364 PD_SOURCE_ADDRESS = builder.getInstance(); 365 INSTANCE.registerPropertyDefinition(PD_SOURCE_ADDRESS); 366 } 367 368 369 370 // Build the "weight" property definition. 371 static { 372 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "weight"); 373 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "weight")); 374 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("1"); 375 builder.setDefaultBehaviorProvider(provider); 376 builder.setLowerLimit(1); 377 PD_WEIGHT = builder.getInstance(); 378 INSTANCE.registerPropertyDefinition(PD_WEIGHT); 379 } 380 381 382 383 // Build the "window-size" property definition. 384 static { 385 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "window-size"); 386 builder.setOption(PropertyOption.ADVANCED); 387 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "window-size")); 388 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("100000"); 389 builder.setDefaultBehaviorProvider(provider); 390 PD_WINDOW_SIZE = builder.getInstance(); 391 INSTANCE.registerPropertyDefinition(PD_WINDOW_SIZE); 392 } 393 394 395 396 // Register the tags associated with this managed object definition. 397 static { 398 INSTANCE.registerTag(Tag.valueOf("replication")); 399 } 400 401 402 403 /** 404 * Get the Replication Server configuration definition singleton. 405 * 406 * @return Returns the Replication Server configuration definition 407 * singleton. 408 */ 409 public static ReplicationServerCfgDefn getInstance() { 410 return INSTANCE; 411 } 412 413 414 415 /** 416 * Private constructor. 417 */ 418 private ReplicationServerCfgDefn() { 419 super("replication-server", TopCfgDefn.getInstance()); 420 } 421 422 423 424 /** 425 * {@inheritDoc} 426 */ 427 public ReplicationServerCfgClient createClientConfiguration( 428 ManagedObject<? extends ReplicationServerCfgClient> impl) { 429 return new ReplicationServerCfgClientImpl(impl); 430 } 431 432 433 434 /** 435 * {@inheritDoc} 436 */ 437 public ReplicationServerCfg createServerConfiguration( 438 ServerManagedObject<? extends ReplicationServerCfg> impl) { 439 return new ReplicationServerCfgServerImpl(impl); 440 } 441 442 443 444 /** 445 * {@inheritDoc} 446 */ 447 public Class<ReplicationServerCfg> getServerConfigurationClass() { 448 return ReplicationServerCfg.class; 449 } 450 451 452 453 /** 454 * Get the "assured-timeout" property definition. 455 * <p> 456 * The timeout value when waiting for assured mode acknowledgments. 457 * <p> 458 * Defines the number of milliseconds that the replication server 459 * will wait for assured acknowledgments (in either Safe Data or Safe 460 * Read assured sub modes) before forgetting them and answer to the 461 * entity that sent an update and is waiting for acknowledgment. 462 * 463 * @return Returns the "assured-timeout" property definition. 464 */ 465 public DurationPropertyDefinition getAssuredTimeoutPropertyDefinition() { 466 return PD_ASSURED_TIMEOUT; 467 } 468 469 470 471 /** 472 * Get the "compute-change-number" property definition. 473 * <p> 474 * Whether the replication server will compute change numbers. 475 * <p> 476 * This boolean tells the replication server to compute change 477 * numbers for each replicated change by maintaining a change number 478 * index database. Changenumbers are computed according to 479 * http://tools.ietf.org/html/draft-good-ldap-changelog-04. Note this 480 * functionality has an impact on CPU, disk accesses and storage. If 481 * changenumbers are not required, it is advisable to set this value 482 * to false. 483 * 484 * @return Returns the "compute-change-number" property definition. 485 */ 486 public BooleanPropertyDefinition getComputeChangeNumberPropertyDefinition() { 487 return PD_COMPUTE_CHANGE_NUMBER; 488 } 489 490 491 492 /** 493 * Get the "degraded-status-threshold" property definition. 494 * <p> 495 * The number of pending changes as threshold value for putting a 496 * directory server in degraded status. 497 * <p> 498 * This value represents a number of pending changes a replication 499 * server has in queue for sending to a directory server. Once this 500 * value is crossed, the matching directory server goes in degraded 501 * status. When number of pending changes goes back under this value, 502 * the directory server is put back in normal status. 0 means status 503 * analyzer is disabled and directory servers are never put in 504 * degraded status. 505 * 506 * @return Returns the "degraded-status-threshold" property definition. 507 */ 508 public IntegerPropertyDefinition getDegradedStatusThresholdPropertyDefinition() { 509 return PD_DEGRADED_STATUS_THRESHOLD; 510 } 511 512 513 514 /** 515 * Get the "group-id" property definition. 516 * <p> 517 * The group id for the replication server. 518 * <p> 519 * This value defines the group id of the replication server. The 520 * replication system of a LDAP server uses the group id of the 521 * replicated domain and tries to connect, if possible, to a 522 * replication with the same group id. 523 * 524 * @return Returns the "group-id" property definition. 525 */ 526 public IntegerPropertyDefinition getGroupIdPropertyDefinition() { 527 return PD_GROUP_ID; 528 } 529 530 531 532 /** 533 * Get the "monitoring-period" property definition. 534 * <p> 535 * The period between sending of monitoring messages. 536 * <p> 537 * Defines the duration that the replication server will wait before 538 * sending new monitoring messages to its peers (replication servers 539 * and directory servers). Larger values increase the length of time 540 * it takes for a directory server to detect and switch to a more 541 * suitable replication server, whereas smaller values increase the 542 * amount of background network traffic. 543 * 544 * @return Returns the "monitoring-period" property definition. 545 */ 546 public DurationPropertyDefinition getMonitoringPeriodPropertyDefinition() { 547 return PD_MONITORING_PERIOD; 548 } 549 550 551 552 /** 553 * Get the "queue-size" property definition. 554 * <p> 555 * Specifies the number of changes that are kept in memory for each 556 * directory server in the Replication Domain. 557 * 558 * @return Returns the "queue-size" property definition. 559 */ 560 public IntegerPropertyDefinition getQueueSizePropertyDefinition() { 561 return PD_QUEUE_SIZE; 562 } 563 564 565 566 /** 567 * Get the "replication-db-directory" property definition. 568 * <p> 569 * The path where the Replication Server stores all persistent 570 * information. 571 * 572 * @return Returns the "replication-db-directory" property definition. 573 */ 574 public StringPropertyDefinition getReplicationDBDirectoryPropertyDefinition() { 575 return PD_REPLICATION_DB_DIRECTORY; 576 } 577 578 579 580 /** 581 * Get the "replication-db-implementation" property definition. 582 * <p> 583 * The Replication Server database implementation that stores all 584 * persistent information. 585 * 586 * @return Returns the "replication-db-implementation" property definition. 587 */ 588 public EnumPropertyDefinition<ReplicationDBImplementation> getReplicationDBImplementationPropertyDefinition() { 589 return PD_REPLICATION_DB_IMPLEMENTATION; 590 } 591 592 593 594 /** 595 * Get the "replication-port" property definition. 596 * <p> 597 * The port on which this Replication Server waits for connections 598 * from other Replication Servers or Directory Servers. 599 * 600 * @return Returns the "replication-port" property definition. 601 */ 602 public IntegerPropertyDefinition getReplicationPortPropertyDefinition() { 603 return PD_REPLICATION_PORT; 604 } 605 606 607 608 /** 609 * Get the "replication-purge-delay" property definition. 610 * <p> 611 * The time (in seconds) after which the Replication Server erases 612 * all persistent information. 613 * 614 * @return Returns the "replication-purge-delay" property definition. 615 */ 616 public DurationPropertyDefinition getReplicationPurgeDelayPropertyDefinition() { 617 return PD_REPLICATION_PURGE_DELAY; 618 } 619 620 621 622 /** 623 * Get the "replication-server" property definition. 624 * <p> 625 * Specifies the addresses of other Replication Servers to which 626 * this Replication Server tries to connect at startup time. 627 * <p> 628 * Addresses must be specified using the syntax: "hostname:port". If 629 * IPv6 addresses are used as the hostname, they must be specified 630 * using the syntax "[IPv6Address]:port". 631 * 632 * @return Returns the "replication-server" property definition. 633 */ 634 public StringPropertyDefinition getReplicationServerPropertyDefinition() { 635 return PD_REPLICATION_SERVER; 636 } 637 638 639 640 /** 641 * Get the "replication-server-id" property definition. 642 * <p> 643 * Specifies a unique identifier for the Replication Server. 644 * <p> 645 * Each Replication Server must have a different server ID. 646 * 647 * @return Returns the "replication-server-id" property definition. 648 */ 649 public IntegerPropertyDefinition getReplicationServerIdPropertyDefinition() { 650 return PD_REPLICATION_SERVER_ID; 651 } 652 653 654 655 /** 656 * Get the "source-address" property definition. 657 * <p> 658 * If specified, the server will bind to the address before 659 * connecting to the remote server. 660 * <p> 661 * The address must be one assigned to an existing network 662 * interface. 663 * 664 * @return Returns the "source-address" property definition. 665 */ 666 public IPAddressPropertyDefinition getSourceAddressPropertyDefinition() { 667 return PD_SOURCE_ADDRESS; 668 } 669 670 671 672 /** 673 * Get the "weight" property definition. 674 * <p> 675 * The weight of the replication server. 676 * <p> 677 * The weight affected to the replication server. Each replication 678 * server of the topology has a weight. When combined together, the 679 * weights of the replication servers of a same group can be 680 * translated to a percentage that determines the quantity of 681 * directory servers of the topology that should be connected to a 682 * replication server. For instance imagine a topology with 3 683 * replication servers (with the same group id) with the following 684 * weights: RS1=1, RS2=1, RS3=2. This means that RS1 should have 25% 685 * of the directory servers connected in the topology, RS2 25%, and 686 * RS3 50%. This may be useful if the replication servers of the 687 * topology have a different power and one wants to spread the load 688 * between the replication servers according to their power. 689 * 690 * @return Returns the "weight" property definition. 691 */ 692 public IntegerPropertyDefinition getWeightPropertyDefinition() { 693 return PD_WEIGHT; 694 } 695 696 697 698 /** 699 * Get the "window-size" property definition. 700 * <p> 701 * Specifies the window size that the Replication Server uses when 702 * communicating with other Replication Servers. 703 * <p> 704 * This option may be deprecated and removed in future releases. 705 * 706 * @return Returns the "window-size" property definition. 707 */ 708 public IntegerPropertyDefinition getWindowSizePropertyDefinition() { 709 return PD_WINDOW_SIZE; 710 } 711 712 713 714 /** 715 * Managed object client implementation. 716 */ 717 private static class ReplicationServerCfgClientImpl implements 718 ReplicationServerCfgClient { 719 720 // Private implementation. 721 private ManagedObject<? extends ReplicationServerCfgClient> impl; 722 723 724 725 // Private constructor. 726 private ReplicationServerCfgClientImpl( 727 ManagedObject<? extends ReplicationServerCfgClient> impl) { 728 this.impl = impl; 729 } 730 731 732 733 /** 734 * {@inheritDoc} 735 */ 736 public long getAssuredTimeout() { 737 return impl.getPropertyValue(INSTANCE.getAssuredTimeoutPropertyDefinition()); 738 } 739 740 741 742 /** 743 * {@inheritDoc} 744 */ 745 public void setAssuredTimeout(Long value) { 746 impl.setPropertyValue(INSTANCE.getAssuredTimeoutPropertyDefinition(), value); 747 } 748 749 750 751 /** 752 * {@inheritDoc} 753 */ 754 public boolean isComputeChangeNumber() { 755 return impl.getPropertyValue(INSTANCE.getComputeChangeNumberPropertyDefinition()); 756 } 757 758 759 760 /** 761 * {@inheritDoc} 762 */ 763 public void setComputeChangeNumber(Boolean value) { 764 impl.setPropertyValue(INSTANCE.getComputeChangeNumberPropertyDefinition(), value); 765 } 766 767 768 769 /** 770 * {@inheritDoc} 771 */ 772 public int getDegradedStatusThreshold() { 773 return impl.getPropertyValue(INSTANCE.getDegradedStatusThresholdPropertyDefinition()); 774 } 775 776 777 778 /** 779 * {@inheritDoc} 780 */ 781 public void setDegradedStatusThreshold(Integer value) { 782 impl.setPropertyValue(INSTANCE.getDegradedStatusThresholdPropertyDefinition(), value); 783 } 784 785 786 787 /** 788 * {@inheritDoc} 789 */ 790 public int getGroupId() { 791 return impl.getPropertyValue(INSTANCE.getGroupIdPropertyDefinition()); 792 } 793 794 795 796 /** 797 * {@inheritDoc} 798 */ 799 public void setGroupId(Integer value) { 800 impl.setPropertyValue(INSTANCE.getGroupIdPropertyDefinition(), value); 801 } 802 803 804 805 /** 806 * {@inheritDoc} 807 */ 808 public long getMonitoringPeriod() { 809 return impl.getPropertyValue(INSTANCE.getMonitoringPeriodPropertyDefinition()); 810 } 811 812 813 814 /** 815 * {@inheritDoc} 816 */ 817 public void setMonitoringPeriod(Long value) { 818 impl.setPropertyValue(INSTANCE.getMonitoringPeriodPropertyDefinition(), value); 819 } 820 821 822 823 /** 824 * {@inheritDoc} 825 */ 826 public int getQueueSize() { 827 return impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition()); 828 } 829 830 831 832 /** 833 * {@inheritDoc} 834 */ 835 public void setQueueSize(Integer value) { 836 impl.setPropertyValue(INSTANCE.getQueueSizePropertyDefinition(), value); 837 } 838 839 840 841 /** 842 * {@inheritDoc} 843 */ 844 public String getReplicationDBDirectory() { 845 return impl.getPropertyValue(INSTANCE.getReplicationDBDirectoryPropertyDefinition()); 846 } 847 848 849 850 /** 851 * {@inheritDoc} 852 */ 853 public void setReplicationDBDirectory(String value) throws PropertyException { 854 impl.setPropertyValue(INSTANCE.getReplicationDBDirectoryPropertyDefinition(), value); 855 } 856 857 858 859 /** 860 * {@inheritDoc} 861 */ 862 public ReplicationDBImplementation getReplicationDBImplementation() { 863 return impl.getPropertyValue(INSTANCE.getReplicationDBImplementationPropertyDefinition()); 864 } 865 866 867 868 /** 869 * {@inheritDoc} 870 */ 871 public void setReplicationDBImplementation(ReplicationDBImplementation value) { 872 impl.setPropertyValue(INSTANCE.getReplicationDBImplementationPropertyDefinition(), value); 873 } 874 875 876 877 /** 878 * {@inheritDoc} 879 */ 880 public Integer getReplicationPort() { 881 return impl.getPropertyValue(INSTANCE.getReplicationPortPropertyDefinition()); 882 } 883 884 885 886 /** 887 * {@inheritDoc} 888 */ 889 public void setReplicationPort(int value) { 890 impl.setPropertyValue(INSTANCE.getReplicationPortPropertyDefinition(), value); 891 } 892 893 894 895 /** 896 * {@inheritDoc} 897 */ 898 public long getReplicationPurgeDelay() { 899 return impl.getPropertyValue(INSTANCE.getReplicationPurgeDelayPropertyDefinition()); 900 } 901 902 903 904 /** 905 * {@inheritDoc} 906 */ 907 public void setReplicationPurgeDelay(Long value) { 908 impl.setPropertyValue(INSTANCE.getReplicationPurgeDelayPropertyDefinition(), value); 909 } 910 911 912 913 /** 914 * {@inheritDoc} 915 */ 916 public SortedSet<String> getReplicationServer() { 917 return impl.getPropertyValues(INSTANCE.getReplicationServerPropertyDefinition()); 918 } 919 920 921 922 /** 923 * {@inheritDoc} 924 */ 925 public void setReplicationServer(Collection<String> values) { 926 impl.setPropertyValues(INSTANCE.getReplicationServerPropertyDefinition(), values); 927 } 928 929 930 931 /** 932 * {@inheritDoc} 933 */ 934 public Integer getReplicationServerId() { 935 return impl.getPropertyValue(INSTANCE.getReplicationServerIdPropertyDefinition()); 936 } 937 938 939 940 /** 941 * {@inheritDoc} 942 */ 943 public void setReplicationServerId(int value) throws PropertyException { 944 impl.setPropertyValue(INSTANCE.getReplicationServerIdPropertyDefinition(), value); 945 } 946 947 948 949 /** 950 * {@inheritDoc} 951 */ 952 public InetAddress getSourceAddress() { 953 return impl.getPropertyValue(INSTANCE.getSourceAddressPropertyDefinition()); 954 } 955 956 957 958 /** 959 * {@inheritDoc} 960 */ 961 public void setSourceAddress(InetAddress value) { 962 impl.setPropertyValue(INSTANCE.getSourceAddressPropertyDefinition(), value); 963 } 964 965 966 967 /** 968 * {@inheritDoc} 969 */ 970 public int getWeight() { 971 return impl.getPropertyValue(INSTANCE.getWeightPropertyDefinition()); 972 } 973 974 975 976 /** 977 * {@inheritDoc} 978 */ 979 public void setWeight(Integer value) { 980 impl.setPropertyValue(INSTANCE.getWeightPropertyDefinition(), value); 981 } 982 983 984 985 /** 986 * {@inheritDoc} 987 */ 988 public int getWindowSize() { 989 return impl.getPropertyValue(INSTANCE.getWindowSizePropertyDefinition()); 990 } 991 992 993 994 /** 995 * {@inheritDoc} 996 */ 997 public void setWindowSize(Integer value) { 998 impl.setPropertyValue(INSTANCE.getWindowSizePropertyDefinition(), value); 999 } 1000 1001 1002 1003 /** 1004 * {@inheritDoc} 1005 */ 1006 public ManagedObjectDefinition<? extends ReplicationServerCfgClient, ? extends ReplicationServerCfg> definition() { 1007 return INSTANCE; 1008 } 1009 1010 1011 1012 /** 1013 * {@inheritDoc} 1014 */ 1015 public PropertyProvider properties() { 1016 return impl; 1017 } 1018 1019 1020 1021 /** 1022 * {@inheritDoc} 1023 */ 1024 public void commit() throws ManagedObjectAlreadyExistsException, 1025 MissingMandatoryPropertiesException, ConcurrentModificationException, 1026 OperationRejectedException, AuthorizationException, 1027 CommunicationException { 1028 impl.commit(); 1029 } 1030 1031 } 1032 1033 1034 1035 /** 1036 * Managed object server implementation. 1037 */ 1038 private static class ReplicationServerCfgServerImpl implements 1039 ReplicationServerCfg { 1040 1041 // Private implementation. 1042 private ServerManagedObject<? extends ReplicationServerCfg> impl; 1043 1044 // The value of the "assured-timeout" property. 1045 private final long pAssuredTimeout; 1046 1047 // The value of the "compute-change-number" property. 1048 private final boolean pComputeChangeNumber; 1049 1050 // The value of the "degraded-status-threshold" property. 1051 private final int pDegradedStatusThreshold; 1052 1053 // The value of the "group-id" property. 1054 private final int pGroupId; 1055 1056 // The value of the "monitoring-period" property. 1057 private final long pMonitoringPeriod; 1058 1059 // The value of the "queue-size" property. 1060 private final int pQueueSize; 1061 1062 // The value of the "replication-db-directory" property. 1063 private final String pReplicationDBDirectory; 1064 1065 // The value of the "replication-db-implementation" property. 1066 private final ReplicationDBImplementation pReplicationDBImplementation; 1067 1068 // The value of the "replication-port" property. 1069 private final int pReplicationPort; 1070 1071 // The value of the "replication-purge-delay" property. 1072 private final long pReplicationPurgeDelay; 1073 1074 // The value of the "replication-server" property. 1075 private final SortedSet<String> pReplicationServer; 1076 1077 // The value of the "replication-server-id" property. 1078 private final int pReplicationServerId; 1079 1080 // The value of the "source-address" property. 1081 private final InetAddress pSourceAddress; 1082 1083 // The value of the "weight" property. 1084 private final int pWeight; 1085 1086 // The value of the "window-size" property. 1087 private final int pWindowSize; 1088 1089 1090 1091 // Private constructor. 1092 private ReplicationServerCfgServerImpl(ServerManagedObject<? extends ReplicationServerCfg> impl) { 1093 this.impl = impl; 1094 this.pAssuredTimeout = impl.getPropertyValue(INSTANCE.getAssuredTimeoutPropertyDefinition()); 1095 this.pComputeChangeNumber = impl.getPropertyValue(INSTANCE.getComputeChangeNumberPropertyDefinition()); 1096 this.pDegradedStatusThreshold = impl.getPropertyValue(INSTANCE.getDegradedStatusThresholdPropertyDefinition()); 1097 this.pGroupId = impl.getPropertyValue(INSTANCE.getGroupIdPropertyDefinition()); 1098 this.pMonitoringPeriod = impl.getPropertyValue(INSTANCE.getMonitoringPeriodPropertyDefinition()); 1099 this.pQueueSize = impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition()); 1100 this.pReplicationDBDirectory = impl.getPropertyValue(INSTANCE.getReplicationDBDirectoryPropertyDefinition()); 1101 this.pReplicationDBImplementation = impl.getPropertyValue(INSTANCE.getReplicationDBImplementationPropertyDefinition()); 1102 this.pReplicationPort = impl.getPropertyValue(INSTANCE.getReplicationPortPropertyDefinition()); 1103 this.pReplicationPurgeDelay = impl.getPropertyValue(INSTANCE.getReplicationPurgeDelayPropertyDefinition()); 1104 this.pReplicationServer = impl.getPropertyValues(INSTANCE.getReplicationServerPropertyDefinition()); 1105 this.pReplicationServerId = impl.getPropertyValue(INSTANCE.getReplicationServerIdPropertyDefinition()); 1106 this.pSourceAddress = impl.getPropertyValue(INSTANCE.getSourceAddressPropertyDefinition()); 1107 this.pWeight = impl.getPropertyValue(INSTANCE.getWeightPropertyDefinition()); 1108 this.pWindowSize = impl.getPropertyValue(INSTANCE.getWindowSizePropertyDefinition()); 1109 } 1110 1111 1112 1113 /** 1114 * {@inheritDoc} 1115 */ 1116 public void addChangeListener( 1117 ConfigurationChangeListener<ReplicationServerCfg> listener) { 1118 impl.registerChangeListener(listener); 1119 } 1120 1121 1122 1123 /** 1124 * {@inheritDoc} 1125 */ 1126 public void removeChangeListener( 1127 ConfigurationChangeListener<ReplicationServerCfg> listener) { 1128 impl.deregisterChangeListener(listener); 1129 } 1130 1131 1132 1133 /** 1134 * {@inheritDoc} 1135 */ 1136 public long getAssuredTimeout() { 1137 return pAssuredTimeout; 1138 } 1139 1140 1141 1142 /** 1143 * {@inheritDoc} 1144 */ 1145 public boolean isComputeChangeNumber() { 1146 return pComputeChangeNumber; 1147 } 1148 1149 1150 1151 /** 1152 * {@inheritDoc} 1153 */ 1154 public int getDegradedStatusThreshold() { 1155 return pDegradedStatusThreshold; 1156 } 1157 1158 1159 1160 /** 1161 * {@inheritDoc} 1162 */ 1163 public int getGroupId() { 1164 return pGroupId; 1165 } 1166 1167 1168 1169 /** 1170 * {@inheritDoc} 1171 */ 1172 public long getMonitoringPeriod() { 1173 return pMonitoringPeriod; 1174 } 1175 1176 1177 1178 /** 1179 * {@inheritDoc} 1180 */ 1181 public int getQueueSize() { 1182 return pQueueSize; 1183 } 1184 1185 1186 1187 /** 1188 * {@inheritDoc} 1189 */ 1190 public String getReplicationDBDirectory() { 1191 return pReplicationDBDirectory; 1192 } 1193 1194 1195 1196 /** 1197 * {@inheritDoc} 1198 */ 1199 public ReplicationDBImplementation getReplicationDBImplementation() { 1200 return pReplicationDBImplementation; 1201 } 1202 1203 1204 1205 /** 1206 * {@inheritDoc} 1207 */ 1208 public int getReplicationPort() { 1209 return pReplicationPort; 1210 } 1211 1212 1213 1214 /** 1215 * {@inheritDoc} 1216 */ 1217 public long getReplicationPurgeDelay() { 1218 return pReplicationPurgeDelay; 1219 } 1220 1221 1222 1223 /** 1224 * {@inheritDoc} 1225 */ 1226 public SortedSet<String> getReplicationServer() { 1227 return pReplicationServer; 1228 } 1229 1230 1231 1232 /** 1233 * {@inheritDoc} 1234 */ 1235 public int getReplicationServerId() { 1236 return pReplicationServerId; 1237 } 1238 1239 1240 1241 /** 1242 * {@inheritDoc} 1243 */ 1244 public InetAddress getSourceAddress() { 1245 return pSourceAddress; 1246 } 1247 1248 1249 1250 /** 1251 * {@inheritDoc} 1252 */ 1253 public int getWeight() { 1254 return pWeight; 1255 } 1256 1257 1258 1259 /** 1260 * {@inheritDoc} 1261 */ 1262 public int getWindowSize() { 1263 return pWindowSize; 1264 } 1265 1266 1267 1268 /** 1269 * {@inheritDoc} 1270 */ 1271 public Class<? extends ReplicationServerCfg> configurationClass() { 1272 return ReplicationServerCfg.class; 1273 } 1274 1275 1276 1277 /** 1278 * {@inheritDoc} 1279 */ 1280 public DN dn() { 1281 return impl.getDN(); 1282 } 1283 1284 } 1285}