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.util.Collection; 031import java.util.SortedSet; 032import java.util.TreeSet; 033import org.forgerock.opendj.config.AdministratorAction; 034import org.forgerock.opendj.config.AggregationPropertyDefinition; 035import org.forgerock.opendj.config.AliasDefaultBehaviorProvider; 036import org.forgerock.opendj.config.BooleanPropertyDefinition; 037import org.forgerock.opendj.config.ClassPropertyDefinition; 038import org.forgerock.opendj.config.client.ConcurrentModificationException; 039import org.forgerock.opendj.config.client.ManagedObject; 040import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException; 041import org.forgerock.opendj.config.client.OperationRejectedException; 042import org.forgerock.opendj.config.DefaultBehaviorProvider; 043import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider; 044import org.forgerock.opendj.config.DurationPropertyDefinition; 045import org.forgerock.opendj.config.EnumPropertyDefinition; 046import org.forgerock.opendj.config.IntegerPropertyDefinition; 047import org.forgerock.opendj.config.ManagedObjectAlreadyExistsException; 048import org.forgerock.opendj.config.ManagedObjectDefinition; 049import org.forgerock.opendj.config.PropertyOption; 050import org.forgerock.opendj.config.PropertyProvider; 051import org.forgerock.opendj.config.server.ConfigurationChangeListener; 052import org.forgerock.opendj.config.server.ServerManagedObject; 053import org.forgerock.opendj.config.SizePropertyDefinition; 054import org.forgerock.opendj.config.StringPropertyDefinition; 055import org.forgerock.opendj.config.Tag; 056import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider; 057import org.forgerock.opendj.ldap.DN; 058import org.forgerock.opendj.ldap.LdapException; 059import org.forgerock.opendj.server.config.client.FileBasedErrorLogPublisherCfgClient; 060import org.forgerock.opendj.server.config.client.LogRetentionPolicyCfgClient; 061import org.forgerock.opendj.server.config.client.LogRotationPolicyCfgClient; 062import org.forgerock.opendj.server.config.meta.ErrorLogPublisherCfgDefn.DefaultSeverity; 063import org.forgerock.opendj.server.config.server.ErrorLogPublisherCfg; 064import org.forgerock.opendj.server.config.server.FileBasedErrorLogPublisherCfg; 065import org.forgerock.opendj.server.config.server.LogPublisherCfg; 066import org.forgerock.opendj.server.config.server.LogRetentionPolicyCfg; 067import org.forgerock.opendj.server.config.server.LogRotationPolicyCfg; 068 069 070 071/** 072 * An interface for querying the File Based Error Log Publisher 073 * managed object definition meta information. 074 * <p> 075 * File Based Error Log Publishers publish error messages to the file 076 * system. 077 */ 078public final class FileBasedErrorLogPublisherCfgDefn extends ManagedObjectDefinition<FileBasedErrorLogPublisherCfgClient, FileBasedErrorLogPublisherCfg> { 079 080 /** The singleton configuration definition instance. */ 081 private static final FileBasedErrorLogPublisherCfgDefn INSTANCE = new FileBasedErrorLogPublisherCfgDefn(); 082 083 084 085 /** The "append" property definition. */ 086 private static final BooleanPropertyDefinition PD_APPEND; 087 088 089 090 /** The "asynchronous" property definition. */ 091 private static final BooleanPropertyDefinition PD_ASYNCHRONOUS; 092 093 094 095 /** The "auto-flush" property definition. */ 096 private static final BooleanPropertyDefinition PD_AUTO_FLUSH; 097 098 099 100 /** The "buffer-size" property definition. */ 101 private static final SizePropertyDefinition PD_BUFFER_SIZE; 102 103 104 105 /** The "java-class" property definition. */ 106 private static final ClassPropertyDefinition PD_JAVA_CLASS; 107 108 109 110 /** The "log-file" property definition. */ 111 private static final StringPropertyDefinition PD_LOG_FILE; 112 113 114 115 /** The "log-file-permissions" property definition. */ 116 private static final StringPropertyDefinition PD_LOG_FILE_PERMISSIONS; 117 118 119 120 /** The "queue-size" property definition. */ 121 private static final IntegerPropertyDefinition PD_QUEUE_SIZE; 122 123 124 125 /** The "retention-policy" property definition. */ 126 private static final AggregationPropertyDefinition<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> PD_RETENTION_POLICY; 127 128 129 130 /** The "rotation-policy" property definition. */ 131 private static final AggregationPropertyDefinition<LogRotationPolicyCfgClient, LogRotationPolicyCfg> PD_ROTATION_POLICY; 132 133 134 135 /** The "time-interval" property definition. */ 136 private static final DurationPropertyDefinition PD_TIME_INTERVAL; 137 138 139 140 /** Build the "append" property definition. */ 141 static { 142 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "append"); 143 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "append")); 144 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true"); 145 builder.setDefaultBehaviorProvider(provider); 146 PD_APPEND = builder.getInstance(); 147 INSTANCE.registerPropertyDefinition(PD_APPEND); 148 } 149 150 151 152 /** Build the "asynchronous" property definition. */ 153 static { 154 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "asynchronous"); 155 builder.setOption(PropertyOption.MANDATORY); 156 builder.setOption(PropertyOption.ADVANCED); 157 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "asynchronous")); 158 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("false"); 159 builder.setDefaultBehaviorProvider(provider); 160 PD_ASYNCHRONOUS = builder.getInstance(); 161 INSTANCE.registerPropertyDefinition(PD_ASYNCHRONOUS); 162 } 163 164 165 166 /** Build the "auto-flush" property definition. */ 167 static { 168 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "auto-flush"); 169 builder.setOption(PropertyOption.ADVANCED); 170 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "auto-flush")); 171 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true"); 172 builder.setDefaultBehaviorProvider(provider); 173 PD_AUTO_FLUSH = builder.getInstance(); 174 INSTANCE.registerPropertyDefinition(PD_AUTO_FLUSH); 175 } 176 177 178 179 /** Build the "buffer-size" property definition. */ 180 static { 181 SizePropertyDefinition.Builder builder = SizePropertyDefinition.createBuilder(INSTANCE, "buffer-size"); 182 builder.setOption(PropertyOption.ADVANCED); 183 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "buffer-size")); 184 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("64kb"); 185 builder.setDefaultBehaviorProvider(provider); 186 builder.setLowerLimit("1"); 187 PD_BUFFER_SIZE = builder.getInstance(); 188 INSTANCE.registerPropertyDefinition(PD_BUFFER_SIZE); 189 } 190 191 192 193 /** Build the "java-class" property definition. */ 194 static { 195 ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class"); 196 builder.setOption(PropertyOption.MANDATORY); 197 builder.setOption(PropertyOption.ADVANCED); 198 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class")); 199 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.loggers.TextErrorLogPublisher"); 200 builder.setDefaultBehaviorProvider(provider); 201 builder.addInstanceOf("org.opends.server.loggers.LogPublisher"); 202 PD_JAVA_CLASS = builder.getInstance(); 203 INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS); 204 } 205 206 207 208 /** Build the "log-file" property definition. */ 209 static { 210 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "log-file"); 211 builder.setOption(PropertyOption.MANDATORY); 212 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "log-file")); 213 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 214 PD_LOG_FILE = builder.getInstance(); 215 INSTANCE.registerPropertyDefinition(PD_LOG_FILE); 216 } 217 218 219 220 /** Build the "log-file-permissions" property definition. */ 221 static { 222 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "log-file-permissions"); 223 builder.setOption(PropertyOption.MANDATORY); 224 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "log-file-permissions")); 225 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("640"); 226 builder.setDefaultBehaviorProvider(provider); 227 builder.setPattern("^([0-7][0-7][0-7])$", "MODE"); 228 PD_LOG_FILE_PERMISSIONS = builder.getInstance(); 229 INSTANCE.registerPropertyDefinition(PD_LOG_FILE_PERMISSIONS); 230 } 231 232 233 234 /** Build the "queue-size" property definition. */ 235 static { 236 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "queue-size"); 237 builder.setOption(PropertyOption.ADVANCED); 238 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "queue-size")); 239 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("5000"); 240 builder.setDefaultBehaviorProvider(provider); 241 builder.setLowerLimit(1); 242 PD_QUEUE_SIZE = builder.getInstance(); 243 INSTANCE.registerPropertyDefinition(PD_QUEUE_SIZE); 244 } 245 246 247 248 /** Build the "retention-policy" property definition. */ 249 static { 250 AggregationPropertyDefinition.Builder<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "retention-policy"); 251 builder.setOption(PropertyOption.MULTI_VALUED); 252 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "retention-policy")); 253 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<String>(INSTANCE, "retention-policy")); 254 builder.setParentPath("/"); 255 builder.setRelationDefinition("log-retention-policy"); 256 PD_RETENTION_POLICY = builder.getInstance(); 257 INSTANCE.registerPropertyDefinition(PD_RETENTION_POLICY); 258 INSTANCE.registerConstraint(PD_RETENTION_POLICY.getSourceConstraint()); 259 } 260 261 262 263 /** Build the "rotation-policy" property definition. */ 264 static { 265 AggregationPropertyDefinition.Builder<LogRotationPolicyCfgClient, LogRotationPolicyCfg> builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "rotation-policy"); 266 builder.setOption(PropertyOption.MULTI_VALUED); 267 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "rotation-policy")); 268 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<String>(INSTANCE, "rotation-policy")); 269 builder.setParentPath("/"); 270 builder.setRelationDefinition("log-rotation-policy"); 271 PD_ROTATION_POLICY = builder.getInstance(); 272 INSTANCE.registerPropertyDefinition(PD_ROTATION_POLICY); 273 INSTANCE.registerConstraint(PD_ROTATION_POLICY.getSourceConstraint()); 274 } 275 276 277 278 /** Build the "time-interval" property definition. */ 279 static { 280 DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "time-interval"); 281 builder.setOption(PropertyOption.ADVANCED); 282 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "time-interval")); 283 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("5s"); 284 builder.setDefaultBehaviorProvider(provider); 285 builder.setBaseUnit("ms"); 286 builder.setLowerLimit("1"); 287 PD_TIME_INTERVAL = builder.getInstance(); 288 INSTANCE.registerPropertyDefinition(PD_TIME_INTERVAL); 289 } 290 291 292 293 // Register the tags associated with this managed object definition. 294 static { 295 INSTANCE.registerTag(Tag.valueOf("logging")); 296 } 297 298 299 300 /** 301 * Get the File Based Error Log Publisher configuration definition 302 * singleton. 303 * 304 * @return Returns the File Based Error Log Publisher configuration 305 * definition singleton. 306 */ 307 public static FileBasedErrorLogPublisherCfgDefn getInstance() { 308 return INSTANCE; 309 } 310 311 312 313 /** 314 * Private constructor. 315 */ 316 private FileBasedErrorLogPublisherCfgDefn() { 317 super("file-based-error-log-publisher", ErrorLogPublisherCfgDefn.getInstance()); 318 } 319 320 321 322 /** {@inheritDoc} */ 323 public FileBasedErrorLogPublisherCfgClient createClientConfiguration( 324 ManagedObject<? extends FileBasedErrorLogPublisherCfgClient> impl) { 325 return new FileBasedErrorLogPublisherCfgClientImpl(impl); 326 } 327 328 329 330 /** {@inheritDoc} */ 331 public FileBasedErrorLogPublisherCfg createServerConfiguration( 332 ServerManagedObject<? extends FileBasedErrorLogPublisherCfg> impl) { 333 return new FileBasedErrorLogPublisherCfgServerImpl(impl); 334 } 335 336 337 338 /** {@inheritDoc} */ 339 public Class<FileBasedErrorLogPublisherCfg> getServerConfigurationClass() { 340 return FileBasedErrorLogPublisherCfg.class; 341 } 342 343 344 345 /** 346 * Get the "append" property definition. 347 * <p> 348 * Specifies whether to append to existing log files. 349 * 350 * @return Returns the "append" property definition. 351 */ 352 public BooleanPropertyDefinition getAppendPropertyDefinition() { 353 return PD_APPEND; 354 } 355 356 357 358 /** 359 * Get the "asynchronous" property definition. 360 * <p> 361 * Indicates whether the File Based Error Log Publisher will publish 362 * records asynchronously. 363 * 364 * @return Returns the "asynchronous" property definition. 365 */ 366 public BooleanPropertyDefinition getAsynchronousPropertyDefinition() { 367 return PD_ASYNCHRONOUS; 368 } 369 370 371 372 /** 373 * Get the "auto-flush" property definition. 374 * <p> 375 * Specifies whether to flush the writer after every log record. 376 * <p> 377 * If the asynchronous writes option is used, the writer will be 378 * flushed after all the log records in the queue are written. 379 * 380 * @return Returns the "auto-flush" property definition. 381 */ 382 public BooleanPropertyDefinition getAutoFlushPropertyDefinition() { 383 return PD_AUTO_FLUSH; 384 } 385 386 387 388 /** 389 * Get the "buffer-size" property definition. 390 * <p> 391 * Specifies the log file buffer size. 392 * 393 * @return Returns the "buffer-size" property definition. 394 */ 395 public SizePropertyDefinition getBufferSizePropertyDefinition() { 396 return PD_BUFFER_SIZE; 397 } 398 399 400 401 /** 402 * Get the "default-severity" property definition. 403 * <p> 404 * Specifies the default severity levels for the logger. 405 * 406 * @return Returns the "default-severity" property definition. 407 */ 408 public EnumPropertyDefinition<DefaultSeverity> getDefaultSeverityPropertyDefinition() { 409 return ErrorLogPublisherCfgDefn.getInstance().getDefaultSeverityPropertyDefinition(); 410 } 411 412 413 414 /** 415 * Get the "enabled" property definition. 416 * <p> 417 * Indicates whether the File Based Error Log Publisher is enabled 418 * for use. 419 * 420 * @return Returns the "enabled" property definition. 421 */ 422 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 423 return ErrorLogPublisherCfgDefn.getInstance().getEnabledPropertyDefinition(); 424 } 425 426 427 428 /** 429 * Get the "java-class" property definition. 430 * <p> 431 * The fully-qualified name of the Java class that provides the File 432 * Based Error Log Publisher implementation. 433 * 434 * @return Returns the "java-class" property definition. 435 */ 436 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 437 return PD_JAVA_CLASS; 438 } 439 440 441 442 /** 443 * Get the "log-file" property definition. 444 * <p> 445 * The file name to use for the log files generated by the File 446 * Based Error Log Publisher . 447 * <p> 448 * The path to the file is relative to the server root. 449 * 450 * @return Returns the "log-file" property definition. 451 */ 452 public StringPropertyDefinition getLogFilePropertyDefinition() { 453 return PD_LOG_FILE; 454 } 455 456 457 458 /** 459 * Get the "log-file-permissions" property definition. 460 * <p> 461 * The UNIX permissions of the log files created by this File Based 462 * Error Log Publisher . 463 * 464 * @return Returns the "log-file-permissions" property definition. 465 */ 466 public StringPropertyDefinition getLogFilePermissionsPropertyDefinition() { 467 return PD_LOG_FILE_PERMISSIONS; 468 } 469 470 471 472 /** 473 * Get the "override-severity" property definition. 474 * <p> 475 * Specifies the override severity levels for the logger based on 476 * the category of the messages. 477 * <p> 478 * Each override severity level should include the category and the 479 * severity levels to log for that category, for example, 480 * core=error,info,warning. Valid categories are: core, extensions, 481 * protocol, config, log, util, schema, plugin, jeb, backend, tools, 482 * task, access-control, admin, sync, version, quicksetup, 483 * admin-tool, dsconfig, user-defined. Valid severities are: all, 484 * error, info, warning, notice, debug. 485 * 486 * @return Returns the "override-severity" property definition. 487 */ 488 public StringPropertyDefinition getOverrideSeverityPropertyDefinition() { 489 return ErrorLogPublisherCfgDefn.getInstance().getOverrideSeverityPropertyDefinition(); 490 } 491 492 493 494 /** 495 * Get the "queue-size" property definition. 496 * <p> 497 * The maximum number of log records that can be stored in the 498 * asynchronous queue. 499 * 500 * @return Returns the "queue-size" property definition. 501 */ 502 public IntegerPropertyDefinition getQueueSizePropertyDefinition() { 503 return PD_QUEUE_SIZE; 504 } 505 506 507 508 /** 509 * Get the "retention-policy" property definition. 510 * <p> 511 * The retention policy to use for the File Based Error Log 512 * Publisher . 513 * <p> 514 * When multiple policies are used, log files will be cleaned when 515 * any of the policy's conditions are met. 516 * 517 * @return Returns the "retention-policy" property definition. 518 */ 519 public AggregationPropertyDefinition<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> getRetentionPolicyPropertyDefinition() { 520 return PD_RETENTION_POLICY; 521 } 522 523 524 525 /** 526 * Get the "rotation-policy" property definition. 527 * <p> 528 * The rotation policy to use for the File Based Error Log Publisher 529 * . 530 * <p> 531 * When multiple policies are used, rotation will occur if any 532 * policy's conditions are met. 533 * 534 * @return Returns the "rotation-policy" property definition. 535 */ 536 public AggregationPropertyDefinition<LogRotationPolicyCfgClient, LogRotationPolicyCfg> getRotationPolicyPropertyDefinition() { 537 return PD_ROTATION_POLICY; 538 } 539 540 541 542 /** 543 * Get the "time-interval" property definition. 544 * <p> 545 * Specifies the interval at which to check whether the log files 546 * need to be rotated. 547 * 548 * @return Returns the "time-interval" property definition. 549 */ 550 public DurationPropertyDefinition getTimeIntervalPropertyDefinition() { 551 return PD_TIME_INTERVAL; 552 } 553 554 555 556 /** 557 * Managed object client implementation. 558 */ 559 private static class FileBasedErrorLogPublisherCfgClientImpl implements 560 FileBasedErrorLogPublisherCfgClient { 561 562 /** Private implementation. */ 563 private ManagedObject<? extends FileBasedErrorLogPublisherCfgClient> impl; 564 565 566 567 /** Private constructor. */ 568 private FileBasedErrorLogPublisherCfgClientImpl( 569 ManagedObject<? extends FileBasedErrorLogPublisherCfgClient> impl) { 570 this.impl = impl; 571 } 572 573 574 575 /** {@inheritDoc} */ 576 public boolean isAppend() { 577 return impl.getPropertyValue(INSTANCE.getAppendPropertyDefinition()); 578 } 579 580 581 582 /** {@inheritDoc} */ 583 public void setAppend(Boolean value) { 584 impl.setPropertyValue(INSTANCE.getAppendPropertyDefinition(), value); 585 } 586 587 588 589 /** {@inheritDoc} */ 590 public boolean isAsynchronous() { 591 return impl.getPropertyValue(INSTANCE.getAsynchronousPropertyDefinition()); 592 } 593 594 595 596 /** {@inheritDoc} */ 597 public void setAsynchronous(boolean value) { 598 impl.setPropertyValue(INSTANCE.getAsynchronousPropertyDefinition(), value); 599 } 600 601 602 603 /** {@inheritDoc} */ 604 public boolean isAutoFlush() { 605 return impl.getPropertyValue(INSTANCE.getAutoFlushPropertyDefinition()); 606 } 607 608 609 610 /** {@inheritDoc} */ 611 public void setAutoFlush(Boolean value) { 612 impl.setPropertyValue(INSTANCE.getAutoFlushPropertyDefinition(), value); 613 } 614 615 616 617 /** {@inheritDoc} */ 618 public long getBufferSize() { 619 return impl.getPropertyValue(INSTANCE.getBufferSizePropertyDefinition()); 620 } 621 622 623 624 /** {@inheritDoc} */ 625 public void setBufferSize(Long value) { 626 impl.setPropertyValue(INSTANCE.getBufferSizePropertyDefinition(), value); 627 } 628 629 630 631 /** {@inheritDoc} */ 632 public SortedSet<DefaultSeverity> getDefaultSeverity() { 633 return impl.getPropertyValues(INSTANCE.getDefaultSeverityPropertyDefinition()); 634 } 635 636 637 638 /** {@inheritDoc} */ 639 public void setDefaultSeverity(Collection<DefaultSeverity> values) { 640 impl.setPropertyValues(INSTANCE.getDefaultSeverityPropertyDefinition(), values); 641 } 642 643 644 645 /** {@inheritDoc} */ 646 public Boolean isEnabled() { 647 return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 648 } 649 650 651 652 /** {@inheritDoc} */ 653 public void setEnabled(boolean value) { 654 impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value); 655 } 656 657 658 659 /** {@inheritDoc} */ 660 public String getJavaClass() { 661 return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 662 } 663 664 665 666 /** {@inheritDoc} */ 667 public void setJavaClass(String value) { 668 impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value); 669 } 670 671 672 673 /** {@inheritDoc} */ 674 public String getLogFile() { 675 return impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition()); 676 } 677 678 679 680 /** {@inheritDoc} */ 681 public void setLogFile(String value) { 682 impl.setPropertyValue(INSTANCE.getLogFilePropertyDefinition(), value); 683 } 684 685 686 687 /** {@inheritDoc} */ 688 public String getLogFilePermissions() { 689 return impl.getPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition()); 690 } 691 692 693 694 /** {@inheritDoc} */ 695 public void setLogFilePermissions(String value) { 696 impl.setPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition(), value); 697 } 698 699 700 701 /** {@inheritDoc} */ 702 public SortedSet<String> getOverrideSeverity() { 703 return impl.getPropertyValues(INSTANCE.getOverrideSeverityPropertyDefinition()); 704 } 705 706 707 708 /** {@inheritDoc} */ 709 public void setOverrideSeverity(Collection<String> values) { 710 impl.setPropertyValues(INSTANCE.getOverrideSeverityPropertyDefinition(), values); 711 } 712 713 714 715 /** {@inheritDoc} */ 716 public int getQueueSize() { 717 return impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition()); 718 } 719 720 721 722 /** {@inheritDoc} */ 723 public void setQueueSize(Integer value) { 724 impl.setPropertyValue(INSTANCE.getQueueSizePropertyDefinition(), value); 725 } 726 727 728 729 /** {@inheritDoc} */ 730 public SortedSet<String> getRetentionPolicy() { 731 return impl.getPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition()); 732 } 733 734 735 736 /** {@inheritDoc} */ 737 public void setRetentionPolicy(Collection<String> values) { 738 impl.setPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition(), values); 739 } 740 741 742 743 /** {@inheritDoc} */ 744 public SortedSet<String> getRotationPolicy() { 745 return impl.getPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition()); 746 } 747 748 749 750 /** {@inheritDoc} */ 751 public void setRotationPolicy(Collection<String> values) { 752 impl.setPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition(), values); 753 } 754 755 756 757 /** {@inheritDoc} */ 758 public long getTimeInterval() { 759 return impl.getPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition()); 760 } 761 762 763 764 /** {@inheritDoc} */ 765 public void setTimeInterval(Long value) { 766 impl.setPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition(), value); 767 } 768 769 770 771 /** {@inheritDoc} */ 772 public ManagedObjectDefinition<? extends FileBasedErrorLogPublisherCfgClient, ? extends FileBasedErrorLogPublisherCfg> definition() { 773 return INSTANCE; 774 } 775 776 777 778 /** {@inheritDoc} */ 779 public PropertyProvider properties() { 780 return impl; 781 } 782 783 784 785 /** {@inheritDoc} */ 786 public void commit() throws ManagedObjectAlreadyExistsException, 787 MissingMandatoryPropertiesException, ConcurrentModificationException, 788 OperationRejectedException, LdapException { 789 impl.commit(); 790 } 791 792 793 794 /** {@inheritDoc} */ 795 public String toString() { 796 return impl.toString(); 797 } 798 } 799 800 801 802 /** 803 * Managed object server implementation. 804 */ 805 private static class FileBasedErrorLogPublisherCfgServerImpl implements 806 FileBasedErrorLogPublisherCfg { 807 808 /** Private implementation. */ 809 private ServerManagedObject<? extends FileBasedErrorLogPublisherCfg> impl; 810 811 /** The value of the "append" property. */ 812 private final boolean pAppend; 813 814 /** The value of the "asynchronous" property. */ 815 private final boolean pAsynchronous; 816 817 /** The value of the "auto-flush" property. */ 818 private final boolean pAutoFlush; 819 820 /** The value of the "buffer-size" property. */ 821 private final long pBufferSize; 822 823 /** The value of the "default-severity" property. */ 824 private final SortedSet<DefaultSeverity> pDefaultSeverity; 825 826 /** The value of the "enabled" property. */ 827 private final boolean pEnabled; 828 829 /** The value of the "java-class" property. */ 830 private final String pJavaClass; 831 832 /** The value of the "log-file" property. */ 833 private final String pLogFile; 834 835 /** The value of the "log-file-permissions" property. */ 836 private final String pLogFilePermissions; 837 838 /** The value of the "override-severity" property. */ 839 private final SortedSet<String> pOverrideSeverity; 840 841 /** The value of the "queue-size" property. */ 842 private final int pQueueSize; 843 844 /** The value of the "retention-policy" property. */ 845 private final SortedSet<String> pRetentionPolicy; 846 847 /** The value of the "rotation-policy" property. */ 848 private final SortedSet<String> pRotationPolicy; 849 850 /** The value of the "time-interval" property. */ 851 private final long pTimeInterval; 852 853 854 855 /** Private constructor. */ 856 private FileBasedErrorLogPublisherCfgServerImpl(ServerManagedObject<? extends FileBasedErrorLogPublisherCfg> impl) { 857 this.impl = impl; 858 this.pAppend = impl.getPropertyValue(INSTANCE.getAppendPropertyDefinition()); 859 this.pAsynchronous = impl.getPropertyValue(INSTANCE.getAsynchronousPropertyDefinition()); 860 this.pAutoFlush = impl.getPropertyValue(INSTANCE.getAutoFlushPropertyDefinition()); 861 this.pBufferSize = impl.getPropertyValue(INSTANCE.getBufferSizePropertyDefinition()); 862 this.pDefaultSeverity = impl.getPropertyValues(INSTANCE.getDefaultSeverityPropertyDefinition()); 863 this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 864 this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 865 this.pLogFile = impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition()); 866 this.pLogFilePermissions = impl.getPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition()); 867 this.pOverrideSeverity = impl.getPropertyValues(INSTANCE.getOverrideSeverityPropertyDefinition()); 868 this.pQueueSize = impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition()); 869 this.pRetentionPolicy = impl.getPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition()); 870 this.pRotationPolicy = impl.getPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition()); 871 this.pTimeInterval = impl.getPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition()); 872 } 873 874 875 876 /** {@inheritDoc} */ 877 public void addFileBasedErrorChangeListener( 878 ConfigurationChangeListener<FileBasedErrorLogPublisherCfg> listener) { 879 impl.registerChangeListener(listener); 880 } 881 882 883 884 /** {@inheritDoc} */ 885 public void removeFileBasedErrorChangeListener( 886 ConfigurationChangeListener<FileBasedErrorLogPublisherCfg> listener) { 887 impl.deregisterChangeListener(listener); 888 } 889 /** {@inheritDoc} */ 890 public void addErrorChangeListener( 891 ConfigurationChangeListener<ErrorLogPublisherCfg> listener) { 892 impl.registerChangeListener(listener); 893 } 894 895 896 897 /** {@inheritDoc} */ 898 public void removeErrorChangeListener( 899 ConfigurationChangeListener<ErrorLogPublisherCfg> listener) { 900 impl.deregisterChangeListener(listener); 901 } 902 /** {@inheritDoc} */ 903 public void addChangeListener( 904 ConfigurationChangeListener<LogPublisherCfg> listener) { 905 impl.registerChangeListener(listener); 906 } 907 908 909 910 /** {@inheritDoc} */ 911 public void removeChangeListener( 912 ConfigurationChangeListener<LogPublisherCfg> listener) { 913 impl.deregisterChangeListener(listener); 914 } 915 916 917 918 /** {@inheritDoc} */ 919 public boolean isAppend() { 920 return pAppend; 921 } 922 923 924 925 /** {@inheritDoc} */ 926 public boolean isAsynchronous() { 927 return pAsynchronous; 928 } 929 930 931 932 /** {@inheritDoc} */ 933 public boolean isAutoFlush() { 934 return pAutoFlush; 935 } 936 937 938 939 /** {@inheritDoc} */ 940 public long getBufferSize() { 941 return pBufferSize; 942 } 943 944 945 946 /** {@inheritDoc} */ 947 public SortedSet<DefaultSeverity> getDefaultSeverity() { 948 return pDefaultSeverity; 949 } 950 951 952 953 /** {@inheritDoc} */ 954 public boolean isEnabled() { 955 return pEnabled; 956 } 957 958 959 960 /** {@inheritDoc} */ 961 public String getJavaClass() { 962 return pJavaClass; 963 } 964 965 966 967 /** {@inheritDoc} */ 968 public String getLogFile() { 969 return pLogFile; 970 } 971 972 973 974 /** {@inheritDoc} */ 975 public String getLogFilePermissions() { 976 return pLogFilePermissions; 977 } 978 979 980 981 /** {@inheritDoc} */ 982 public SortedSet<String> getOverrideSeverity() { 983 return pOverrideSeverity; 984 } 985 986 987 988 /** {@inheritDoc} */ 989 public int getQueueSize() { 990 return pQueueSize; 991 } 992 993 994 995 /** {@inheritDoc} */ 996 public SortedSet<String> getRetentionPolicy() { 997 return pRetentionPolicy; 998 } 999 1000 1001 1002 /** 1003 * {@inheritDoc} 1004 */ 1005 public SortedSet<DN> getRetentionPolicyDNs() { 1006 SortedSet<String> values = getRetentionPolicy(); 1007 SortedSet<DN> dnValues = new TreeSet<DN>(); 1008 for (String value : values) { 1009 DN dn = INSTANCE.getRetentionPolicyPropertyDefinition().getChildDN(value); 1010 dnValues.add(dn); 1011 } 1012 return dnValues; 1013 } 1014 1015 1016 1017 /** {@inheritDoc} */ 1018 public SortedSet<String> getRotationPolicy() { 1019 return pRotationPolicy; 1020 } 1021 1022 1023 1024 /** 1025 * {@inheritDoc} 1026 */ 1027 public SortedSet<DN> getRotationPolicyDNs() { 1028 SortedSet<String> values = getRotationPolicy(); 1029 SortedSet<DN> dnValues = new TreeSet<DN>(); 1030 for (String value : values) { 1031 DN dn = INSTANCE.getRotationPolicyPropertyDefinition().getChildDN(value); 1032 dnValues.add(dn); 1033 } 1034 return dnValues; 1035 } 1036 1037 1038 1039 /** {@inheritDoc} */ 1040 public long getTimeInterval() { 1041 return pTimeInterval; 1042 } 1043 1044 1045 1046 /** {@inheritDoc} */ 1047 public Class<? extends FileBasedErrorLogPublisherCfg> configurationClass() { 1048 return FileBasedErrorLogPublisherCfg.class; 1049 } 1050 1051 1052 1053 /** {@inheritDoc} */ 1054 public DN dn() { 1055 return impl.getDN(); 1056 } 1057 1058 1059 1060 /** {@inheritDoc} */ 1061 public String toString() { 1062 return impl.toString(); 1063 } 1064 } 1065}