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