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