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