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.IllegalManagedObjectNameException; 043 import org.opends.server.admin.client.ManagedObject; 044 import org.opends.server.admin.client.ManagedObjectDecodingException; 045 import org.opends.server.admin.client.MissingMandatoryPropertiesException; 046 import org.opends.server.admin.client.OperationRejectedException; 047 import org.opends.server.admin.DefaultBehaviorException; 048 import org.opends.server.admin.DefaultBehaviorProvider; 049 import org.opends.server.admin.DefinedDefaultBehaviorProvider; 050 import org.opends.server.admin.DefinitionDecodingException; 051 import org.opends.server.admin.DurationPropertyDefinition; 052 import org.opends.server.admin.EnumPropertyDefinition; 053 import org.opends.server.admin.InstantiableRelationDefinition; 054 import org.opends.server.admin.IntegerPropertyDefinition; 055 import org.opends.server.admin.ManagedObjectAlreadyExistsException; 056 import org.opends.server.admin.ManagedObjectDefinition; 057 import org.opends.server.admin.ManagedObjectNotFoundException; 058 import org.opends.server.admin.PropertyOption; 059 import org.opends.server.admin.PropertyProvider; 060 import org.opends.server.admin.server.ConfigurationAddListener; 061 import org.opends.server.admin.server.ConfigurationChangeListener; 062 import org.opends.server.admin.server.ConfigurationDeleteListener; 063 import org.opends.server.admin.server.ServerManagedObject; 064 import org.opends.server.admin.SizePropertyDefinition; 065 import org.opends.server.admin.std.client.DebugTargetCfgClient; 066 import org.opends.server.admin.std.client.FileBasedDebugLogPublisherCfgClient; 067 import org.opends.server.admin.std.client.LogRetentionPolicyCfgClient; 068 import org.opends.server.admin.std.client.LogRotationPolicyCfgClient; 069 import org.opends.server.admin.std.meta.DebugLogPublisherCfgDefn.DefaultDebugCategory; 070 import org.opends.server.admin.std.meta.DebugLogPublisherCfgDefn.DefaultDebugLevel; 071 import org.opends.server.admin.std.server.DebugLogPublisherCfg; 072 import org.opends.server.admin.std.server.DebugTargetCfg; 073 import org.opends.server.admin.std.server.FileBasedDebugLogPublisherCfg; 074 import org.opends.server.admin.std.server.LogPublisherCfg; 075 import org.opends.server.admin.std.server.LogRetentionPolicyCfg; 076 import org.opends.server.admin.std.server.LogRotationPolicyCfg; 077 import org.opends.server.admin.StringPropertyDefinition; 078 import org.opends.server.admin.Tag; 079 import org.opends.server.admin.UndefinedDefaultBehaviorProvider; 080 import org.opends.server.config.ConfigException; 081 import org.opends.server.types.DN; 082 083 084 085 /** 086 * An interface for querying the File Based Debug Log Publisher 087 * managed object definition meta information. 088 * <p> 089 * File Based Debug Log Publishers publish debug messages to the file 090 * system. 091 */ 092 public final class FileBasedDebugLogPublisherCfgDefn extends ManagedObjectDefinition<FileBasedDebugLogPublisherCfgClient, FileBasedDebugLogPublisherCfg> { 093 094 // The singleton configuration definition instance. 095 private static final FileBasedDebugLogPublisherCfgDefn INSTANCE = new FileBasedDebugLogPublisherCfgDefn(); 096 097 098 099 // The "append" property definition. 100 private static final BooleanPropertyDefinition PD_APPEND; 101 102 103 104 // The "asynchronous" property definition. 105 private static final BooleanPropertyDefinition PD_ASYNCHRONOUS; 106 107 108 109 // The "auto-flush" property definition. 110 private static final BooleanPropertyDefinition PD_AUTO_FLUSH; 111 112 113 114 // The "buffer-size" property definition. 115 private static final SizePropertyDefinition PD_BUFFER_SIZE; 116 117 118 119 // The "java-class" property definition. 120 private static final ClassPropertyDefinition PD_JAVA_CLASS; 121 122 123 124 // The "log-file" property definition. 125 private static final StringPropertyDefinition PD_LOG_FILE; 126 127 128 129 // The "log-file-permissions" property definition. 130 private static final StringPropertyDefinition PD_LOG_FILE_PERMISSIONS; 131 132 133 134 // The "queue-size" property definition. 135 private static final IntegerPropertyDefinition PD_QUEUE_SIZE; 136 137 138 139 // The "retention-policy" property definition. 140 private static final AggregationPropertyDefinition<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> PD_RETENTION_POLICY; 141 142 143 144 // The "rotation-policy" property definition. 145 private static final AggregationPropertyDefinition<LogRotationPolicyCfgClient, LogRotationPolicyCfg> PD_ROTATION_POLICY; 146 147 148 149 // The "time-interval" property definition. 150 private static final DurationPropertyDefinition PD_TIME_INTERVAL; 151 152 153 154 // Build the "append" property definition. 155 static { 156 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "append"); 157 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "append")); 158 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true"); 159 builder.setDefaultBehaviorProvider(provider); 160 PD_APPEND = builder.getInstance(); 161 INSTANCE.registerPropertyDefinition(PD_APPEND); 162 } 163 164 165 166 // Build the "asynchronous" property definition. 167 static { 168 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "asynchronous"); 169 builder.setOption(PropertyOption.MANDATORY); 170 builder.setOption(PropertyOption.ADVANCED); 171 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "asynchronous")); 172 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("false"); 173 builder.setDefaultBehaviorProvider(provider); 174 PD_ASYNCHRONOUS = builder.getInstance(); 175 INSTANCE.registerPropertyDefinition(PD_ASYNCHRONOUS); 176 } 177 178 179 180 // Build the "auto-flush" property definition. 181 static { 182 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "auto-flush"); 183 builder.setOption(PropertyOption.ADVANCED); 184 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "auto-flush")); 185 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("true"); 186 builder.setDefaultBehaviorProvider(provider); 187 PD_AUTO_FLUSH = builder.getInstance(); 188 INSTANCE.registerPropertyDefinition(PD_AUTO_FLUSH); 189 } 190 191 192 193 // Build the "buffer-size" property definition. 194 static { 195 SizePropertyDefinition.Builder builder = SizePropertyDefinition.createBuilder(INSTANCE, "buffer-size"); 196 builder.setOption(PropertyOption.ADVANCED); 197 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "buffer-size")); 198 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("64kb"); 199 builder.setDefaultBehaviorProvider(provider); 200 builder.setLowerLimit("1"); 201 PD_BUFFER_SIZE = builder.getInstance(); 202 INSTANCE.registerPropertyDefinition(PD_BUFFER_SIZE); 203 } 204 205 206 207 // Build the "java-class" property definition. 208 static { 209 ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class"); 210 builder.setOption(PropertyOption.MANDATORY); 211 builder.setOption(PropertyOption.ADVANCED); 212 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class")); 213 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.loggers.debug.TextDebugLogPublisher"); 214 builder.setDefaultBehaviorProvider(provider); 215 builder.addInstanceOf("org.opends.server.api.DebugLogPublisher"); 216 PD_JAVA_CLASS = builder.getInstance(); 217 INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS); 218 } 219 220 221 222 // Build the "log-file" property definition. 223 static { 224 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "log-file"); 225 builder.setOption(PropertyOption.MANDATORY); 226 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "log-file")); 227 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 228 PD_LOG_FILE = builder.getInstance(); 229 INSTANCE.registerPropertyDefinition(PD_LOG_FILE); 230 } 231 232 233 234 // Build the "log-file-permissions" property definition. 235 static { 236 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "log-file-permissions"); 237 builder.setOption(PropertyOption.MANDATORY); 238 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "log-file-permissions")); 239 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("640"); 240 builder.setDefaultBehaviorProvider(provider); 241 builder.setPattern("^([0-7][0-7][0-7])$", "MODE"); 242 PD_LOG_FILE_PERMISSIONS = builder.getInstance(); 243 INSTANCE.registerPropertyDefinition(PD_LOG_FILE_PERMISSIONS); 244 } 245 246 247 248 // Build the "queue-size" property definition. 249 static { 250 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "queue-size"); 251 builder.setOption(PropertyOption.ADVANCED); 252 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "queue-size")); 253 DefaultBehaviorProvider<Integer> provider = new DefinedDefaultBehaviorProvider<Integer>("5000"); 254 builder.setDefaultBehaviorProvider(provider); 255 builder.setLowerLimit(1); 256 PD_QUEUE_SIZE = builder.getInstance(); 257 INSTANCE.registerPropertyDefinition(PD_QUEUE_SIZE); 258 } 259 260 261 262 // Build the "retention-policy" property definition. 263 static { 264 AggregationPropertyDefinition.Builder<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "retention-policy"); 265 builder.setOption(PropertyOption.MULTI_VALUED); 266 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "retention-policy")); 267 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<String>(INSTANCE, "retention-policy")); 268 builder.setParentPath("/"); 269 builder.setRelationDefinition("log-retention-policy"); 270 PD_RETENTION_POLICY = builder.getInstance(); 271 INSTANCE.registerPropertyDefinition(PD_RETENTION_POLICY); 272 INSTANCE.registerConstraint(PD_RETENTION_POLICY.getSourceConstraint()); 273 } 274 275 276 277 // Build the "rotation-policy" property definition. 278 static { 279 AggregationPropertyDefinition.Builder<LogRotationPolicyCfgClient, LogRotationPolicyCfg> builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "rotation-policy"); 280 builder.setOption(PropertyOption.MULTI_VALUED); 281 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "rotation-policy")); 282 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<String>(INSTANCE, "rotation-policy")); 283 builder.setParentPath("/"); 284 builder.setRelationDefinition("log-rotation-policy"); 285 PD_ROTATION_POLICY = builder.getInstance(); 286 INSTANCE.registerPropertyDefinition(PD_ROTATION_POLICY); 287 INSTANCE.registerConstraint(PD_ROTATION_POLICY.getSourceConstraint()); 288 } 289 290 291 292 // Build the "time-interval" property definition. 293 static { 294 DurationPropertyDefinition.Builder builder = DurationPropertyDefinition.createBuilder(INSTANCE, "time-interval"); 295 builder.setOption(PropertyOption.ADVANCED); 296 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "time-interval")); 297 DefaultBehaviorProvider<Long> provider = new DefinedDefaultBehaviorProvider<Long>("5s"); 298 builder.setDefaultBehaviorProvider(provider); 299 builder.setBaseUnit("ms"); 300 builder.setLowerLimit("1"); 301 PD_TIME_INTERVAL = builder.getInstance(); 302 INSTANCE.registerPropertyDefinition(PD_TIME_INTERVAL); 303 } 304 305 306 307 // Register the tags associated with this managed object definition. 308 static { 309 INSTANCE.registerTag(Tag.valueOf("logging")); 310 } 311 312 313 314 /** 315 * Get the File Based Debug Log Publisher configuration definition 316 * singleton. 317 * 318 * @return Returns the File Based Debug Log Publisher configuration 319 * definition singleton. 320 */ 321 public static FileBasedDebugLogPublisherCfgDefn getInstance() { 322 return INSTANCE; 323 } 324 325 326 327 /** 328 * Private constructor. 329 */ 330 private FileBasedDebugLogPublisherCfgDefn() { 331 super("file-based-debug-log-publisher", DebugLogPublisherCfgDefn.getInstance()); 332 } 333 334 335 336 /** 337 * {@inheritDoc} 338 */ 339 public FileBasedDebugLogPublisherCfgClient createClientConfiguration( 340 ManagedObject<? extends FileBasedDebugLogPublisherCfgClient> impl) { 341 return new FileBasedDebugLogPublisherCfgClientImpl(impl); 342 } 343 344 345 346 /** 347 * {@inheritDoc} 348 */ 349 public FileBasedDebugLogPublisherCfg createServerConfiguration( 350 ServerManagedObject<? extends FileBasedDebugLogPublisherCfg> impl) { 351 return new FileBasedDebugLogPublisherCfgServerImpl(impl); 352 } 353 354 355 356 /** 357 * {@inheritDoc} 358 */ 359 public Class<FileBasedDebugLogPublisherCfg> getServerConfigurationClass() { 360 return FileBasedDebugLogPublisherCfg.class; 361 } 362 363 364 365 /** 366 * Get the "append" property definition. 367 * <p> 368 * Specifies whether to append to existing log files. 369 * 370 * @return Returns the "append" property definition. 371 */ 372 public BooleanPropertyDefinition getAppendPropertyDefinition() { 373 return PD_APPEND; 374 } 375 376 377 378 /** 379 * Get the "asynchronous" property definition. 380 * <p> 381 * Indicates whether the File Based Debug Log Publisher will publish 382 * records asynchronously. 383 * 384 * @return Returns the "asynchronous" property definition. 385 */ 386 public BooleanPropertyDefinition getAsynchronousPropertyDefinition() { 387 return PD_ASYNCHRONOUS; 388 } 389 390 391 392 /** 393 * Get the "auto-flush" property definition. 394 * <p> 395 * Specifies whether to flush the writer after every log record. 396 * <p> 397 * If the asynchronous writes option is used, the writer is flushed 398 * after all the log records in the queue are written. 399 * 400 * @return Returns the "auto-flush" property definition. 401 */ 402 public BooleanPropertyDefinition getAutoFlushPropertyDefinition() { 403 return PD_AUTO_FLUSH; 404 } 405 406 407 408 /** 409 * Get the "buffer-size" property definition. 410 * <p> 411 * Specifies the log file buffer size. 412 * 413 * @return Returns the "buffer-size" property definition. 414 */ 415 public SizePropertyDefinition getBufferSizePropertyDefinition() { 416 return PD_BUFFER_SIZE; 417 } 418 419 420 421 /** 422 * Get the "default-debug-category" property definition. 423 * <p> 424 * The debug message categories to be logged when none of the 425 * defined targets match the message. 426 * 427 * @return Returns the "default-debug-category" property definition. 428 */ 429 public EnumPropertyDefinition<DefaultDebugCategory> getDefaultDebugCategoryPropertyDefinition() { 430 return DebugLogPublisherCfgDefn.getInstance().getDefaultDebugCategoryPropertyDefinition(); 431 } 432 433 434 435 /** 436 * Get the "default-debug-level" property definition. 437 * <p> 438 * The lowest severity level of debug messages to log when none of 439 * the defined targets match the message. 440 * 441 * @return Returns the "default-debug-level" property definition. 442 */ 443 public EnumPropertyDefinition<DefaultDebugLevel> getDefaultDebugLevelPropertyDefinition() { 444 return DebugLogPublisherCfgDefn.getInstance().getDefaultDebugLevelPropertyDefinition(); 445 } 446 447 448 449 /** 450 * Get the "default-include-throwable-cause" property definition. 451 * <p> 452 * Indicates whether to include the cause of exceptions in exception 453 * thrown and caught messages logged by default. 454 * 455 * @return Returns the "default-include-throwable-cause" property definition. 456 */ 457 public BooleanPropertyDefinition getDefaultIncludeThrowableCausePropertyDefinition() { 458 return DebugLogPublisherCfgDefn.getInstance().getDefaultIncludeThrowableCausePropertyDefinition(); 459 } 460 461 462 463 /** 464 * Get the "default-omit-method-entry-arguments" property definition. 465 * <p> 466 * Indicates whether to include method arguments in debug messages 467 * logged by default. 468 * 469 * @return Returns the "default-omit-method-entry-arguments" property definition. 470 */ 471 public BooleanPropertyDefinition getDefaultOmitMethodEntryArgumentsPropertyDefinition() { 472 return DebugLogPublisherCfgDefn.getInstance().getDefaultOmitMethodEntryArgumentsPropertyDefinition(); 473 } 474 475 476 477 /** 478 * Get the "default-omit-method-return-value" property definition. 479 * <p> 480 * Indicates whether to include the return value in debug messages 481 * logged by default. 482 * 483 * @return Returns the "default-omit-method-return-value" property definition. 484 */ 485 public BooleanPropertyDefinition getDefaultOmitMethodReturnValuePropertyDefinition() { 486 return DebugLogPublisherCfgDefn.getInstance().getDefaultOmitMethodReturnValuePropertyDefinition(); 487 } 488 489 490 491 /** 492 * Get the "default-throwable-stack-frames" property definition. 493 * <p> 494 * Indicates the number of stack frames to include in the stack 495 * trace for method entry and exception thrown messages. 496 * 497 * @return Returns the "default-throwable-stack-frames" property definition. 498 */ 499 public IntegerPropertyDefinition getDefaultThrowableStackFramesPropertyDefinition() { 500 return DebugLogPublisherCfgDefn.getInstance().getDefaultThrowableStackFramesPropertyDefinition(); 501 } 502 503 504 505 /** 506 * Get the "enabled" property definition. 507 * <p> 508 * Indicates whether the File Based Debug Log Publisher is enabled 509 * for use. 510 * 511 * @return Returns the "enabled" property definition. 512 */ 513 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 514 return DebugLogPublisherCfgDefn.getInstance().getEnabledPropertyDefinition(); 515 } 516 517 518 519 /** 520 * Get the "java-class" property definition. 521 * <p> 522 * The fully-qualified name of the Java class that provides the File 523 * Based Debug Log Publisher implementation. 524 * 525 * @return Returns the "java-class" property definition. 526 */ 527 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 528 return PD_JAVA_CLASS; 529 } 530 531 532 533 /** 534 * Get the "log-file" property definition. 535 * <p> 536 * The file name to use for the log files generated by the File 537 * Based Debug Log Publisher . 538 * <p> 539 * The path to the file is relative to the server root. 540 * 541 * @return Returns the "log-file" property definition. 542 */ 543 public StringPropertyDefinition getLogFilePropertyDefinition() { 544 return PD_LOG_FILE; 545 } 546 547 548 549 /** 550 * Get the "log-file-permissions" property definition. 551 * <p> 552 * The UNIX permissions of the log files created by this File Based 553 * Debug Log Publisher . 554 * 555 * @return Returns the "log-file-permissions" property definition. 556 */ 557 public StringPropertyDefinition getLogFilePermissionsPropertyDefinition() { 558 return PD_LOG_FILE_PERMISSIONS; 559 } 560 561 562 563 /** 564 * Get the "queue-size" property definition. 565 * <p> 566 * The maximum number of log records that can be stored in the 567 * asynchronous queue. 568 * 569 * @return Returns the "queue-size" property definition. 570 */ 571 public IntegerPropertyDefinition getQueueSizePropertyDefinition() { 572 return PD_QUEUE_SIZE; 573 } 574 575 576 577 /** 578 * Get the "retention-policy" property definition. 579 * <p> 580 * The retention policy to use for the File Based Debug Log 581 * Publisher . 582 * <p> 583 * When multiple policies are used, log files are cleaned when any 584 * of the policy's conditions are met. 585 * 586 * @return Returns the "retention-policy" property definition. 587 */ 588 public AggregationPropertyDefinition<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> getRetentionPolicyPropertyDefinition() { 589 return PD_RETENTION_POLICY; 590 } 591 592 593 594 /** 595 * Get the "rotation-policy" property definition. 596 * <p> 597 * The rotation policy to use for the File Based Debug Log Publisher 598 * . 599 * <p> 600 * When multiple policies are used, rotation will occur if any 601 * policy's conditions are met. 602 * 603 * @return Returns the "rotation-policy" property definition. 604 */ 605 public AggregationPropertyDefinition<LogRotationPolicyCfgClient, LogRotationPolicyCfg> getRotationPolicyPropertyDefinition() { 606 return PD_ROTATION_POLICY; 607 } 608 609 610 611 /** 612 * Get the "time-interval" property definition. 613 * <p> 614 * Specifies the interval at which to check whether the log files 615 * need to be rotated. 616 * 617 * @return Returns the "time-interval" property definition. 618 */ 619 public DurationPropertyDefinition getTimeIntervalPropertyDefinition() { 620 return PD_TIME_INTERVAL; 621 } 622 623 624 625 /** 626 * Get the "debug-targets" relation definition. 627 * 628 * @return Returns the "debug-targets" relation definition. 629 */ 630 public InstantiableRelationDefinition<DebugTargetCfgClient,DebugTargetCfg> getDebugTargetsRelationDefinition() { 631 return DebugLogPublisherCfgDefn.getInstance().getDebugTargetsRelationDefinition(); 632 } 633 634 635 636 /** 637 * Managed object client implementation. 638 */ 639 private static class FileBasedDebugLogPublisherCfgClientImpl implements 640 FileBasedDebugLogPublisherCfgClient { 641 642 // Private implementation. 643 private ManagedObject<? extends FileBasedDebugLogPublisherCfgClient> impl; 644 645 646 647 // Private constructor. 648 private FileBasedDebugLogPublisherCfgClientImpl( 649 ManagedObject<? extends FileBasedDebugLogPublisherCfgClient> impl) { 650 this.impl = impl; 651 } 652 653 654 655 /** 656 * {@inheritDoc} 657 */ 658 public boolean isAppend() { 659 return impl.getPropertyValue(INSTANCE.getAppendPropertyDefinition()); 660 } 661 662 663 664 /** 665 * {@inheritDoc} 666 */ 667 public void setAppend(Boolean value) { 668 impl.setPropertyValue(INSTANCE.getAppendPropertyDefinition(), value); 669 } 670 671 672 673 /** 674 * {@inheritDoc} 675 */ 676 public boolean isAsynchronous() { 677 return impl.getPropertyValue(INSTANCE.getAsynchronousPropertyDefinition()); 678 } 679 680 681 682 /** 683 * {@inheritDoc} 684 */ 685 public void setAsynchronous(boolean value) { 686 impl.setPropertyValue(INSTANCE.getAsynchronousPropertyDefinition(), value); 687 } 688 689 690 691 /** 692 * {@inheritDoc} 693 */ 694 public boolean isAutoFlush() { 695 return impl.getPropertyValue(INSTANCE.getAutoFlushPropertyDefinition()); 696 } 697 698 699 700 /** 701 * {@inheritDoc} 702 */ 703 public void setAutoFlush(Boolean value) { 704 impl.setPropertyValue(INSTANCE.getAutoFlushPropertyDefinition(), value); 705 } 706 707 708 709 /** 710 * {@inheritDoc} 711 */ 712 public long getBufferSize() { 713 return impl.getPropertyValue(INSTANCE.getBufferSizePropertyDefinition()); 714 } 715 716 717 718 /** 719 * {@inheritDoc} 720 */ 721 public void setBufferSize(Long value) { 722 impl.setPropertyValue(INSTANCE.getBufferSizePropertyDefinition(), value); 723 } 724 725 726 727 /** 728 * {@inheritDoc} 729 */ 730 public SortedSet<DefaultDebugCategory> getDefaultDebugCategory() { 731 return impl.getPropertyValues(INSTANCE.getDefaultDebugCategoryPropertyDefinition()); 732 } 733 734 735 736 /** 737 * {@inheritDoc} 738 */ 739 public void setDefaultDebugCategory(Collection<DefaultDebugCategory> values) { 740 impl.setPropertyValues(INSTANCE.getDefaultDebugCategoryPropertyDefinition(), values); 741 } 742 743 744 745 /** 746 * {@inheritDoc} 747 */ 748 public DefaultDebugLevel getDefaultDebugLevel() { 749 return impl.getPropertyValue(INSTANCE.getDefaultDebugLevelPropertyDefinition()); 750 } 751 752 753 754 /** 755 * {@inheritDoc} 756 */ 757 public void setDefaultDebugLevel(DefaultDebugLevel value) { 758 impl.setPropertyValue(INSTANCE.getDefaultDebugLevelPropertyDefinition(), value); 759 } 760 761 762 763 /** 764 * {@inheritDoc} 765 */ 766 public boolean isDefaultIncludeThrowableCause() { 767 return impl.getPropertyValue(INSTANCE.getDefaultIncludeThrowableCausePropertyDefinition()); 768 } 769 770 771 772 /** 773 * {@inheritDoc} 774 */ 775 public void setDefaultIncludeThrowableCause(Boolean value) { 776 impl.setPropertyValue(INSTANCE.getDefaultIncludeThrowableCausePropertyDefinition(), value); 777 } 778 779 780 781 /** 782 * {@inheritDoc} 783 */ 784 public boolean isDefaultOmitMethodEntryArguments() { 785 return impl.getPropertyValue(INSTANCE.getDefaultOmitMethodEntryArgumentsPropertyDefinition()); 786 } 787 788 789 790 /** 791 * {@inheritDoc} 792 */ 793 public void setDefaultOmitMethodEntryArguments(Boolean value) { 794 impl.setPropertyValue(INSTANCE.getDefaultOmitMethodEntryArgumentsPropertyDefinition(), value); 795 } 796 797 798 799 /** 800 * {@inheritDoc} 801 */ 802 public boolean isDefaultOmitMethodReturnValue() { 803 return impl.getPropertyValue(INSTANCE.getDefaultOmitMethodReturnValuePropertyDefinition()); 804 } 805 806 807 808 /** 809 * {@inheritDoc} 810 */ 811 public void setDefaultOmitMethodReturnValue(Boolean value) { 812 impl.setPropertyValue(INSTANCE.getDefaultOmitMethodReturnValuePropertyDefinition(), value); 813 } 814 815 816 817 /** 818 * {@inheritDoc} 819 */ 820 public int getDefaultThrowableStackFrames() { 821 return impl.getPropertyValue(INSTANCE.getDefaultThrowableStackFramesPropertyDefinition()); 822 } 823 824 825 826 /** 827 * {@inheritDoc} 828 */ 829 public void setDefaultThrowableStackFrames(Integer value) { 830 impl.setPropertyValue(INSTANCE.getDefaultThrowableStackFramesPropertyDefinition(), value); 831 } 832 833 834 835 /** 836 * {@inheritDoc} 837 */ 838 public Boolean isEnabled() { 839 return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 840 } 841 842 843 844 /** 845 * {@inheritDoc} 846 */ 847 public void setEnabled(boolean value) { 848 impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value); 849 } 850 851 852 853 /** 854 * {@inheritDoc} 855 */ 856 public String getJavaClass() { 857 return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 858 } 859 860 861 862 /** 863 * {@inheritDoc} 864 */ 865 public void setJavaClass(String value) { 866 impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value); 867 } 868 869 870 871 /** 872 * {@inheritDoc} 873 */ 874 public String getLogFile() { 875 return impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition()); 876 } 877 878 879 880 /** 881 * {@inheritDoc} 882 */ 883 public void setLogFile(String value) { 884 impl.setPropertyValue(INSTANCE.getLogFilePropertyDefinition(), value); 885 } 886 887 888 889 /** 890 * {@inheritDoc} 891 */ 892 public String getLogFilePermissions() { 893 return impl.getPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition()); 894 } 895 896 897 898 /** 899 * {@inheritDoc} 900 */ 901 public void setLogFilePermissions(String value) { 902 impl.setPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition(), value); 903 } 904 905 906 907 /** 908 * {@inheritDoc} 909 */ 910 public int getQueueSize() { 911 return impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition()); 912 } 913 914 915 916 /** 917 * {@inheritDoc} 918 */ 919 public void setQueueSize(Integer value) { 920 impl.setPropertyValue(INSTANCE.getQueueSizePropertyDefinition(), value); 921 } 922 923 924 925 /** 926 * {@inheritDoc} 927 */ 928 public SortedSet<String> getRetentionPolicy() { 929 return impl.getPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition()); 930 } 931 932 933 934 /** 935 * {@inheritDoc} 936 */ 937 public void setRetentionPolicy(Collection<String> values) { 938 impl.setPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition(), values); 939 } 940 941 942 943 /** 944 * {@inheritDoc} 945 */ 946 public SortedSet<String> getRotationPolicy() { 947 return impl.getPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition()); 948 } 949 950 951 952 /** 953 * {@inheritDoc} 954 */ 955 public void setRotationPolicy(Collection<String> values) { 956 impl.setPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition(), values); 957 } 958 959 960 961 /** 962 * {@inheritDoc} 963 */ 964 public long getTimeInterval() { 965 return impl.getPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition()); 966 } 967 968 969 970 /** 971 * {@inheritDoc} 972 */ 973 public void setTimeInterval(Long value) { 974 impl.setPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition(), value); 975 } 976 977 978 979 /** 980 * {@inheritDoc} 981 */ 982 public String[] listDebugTargets() throws ConcurrentModificationException, 983 AuthorizationException, CommunicationException { 984 return impl.listChildren(INSTANCE.getDebugTargetsRelationDefinition()); 985 } 986 987 988 989 /** 990 * {@inheritDoc} 991 */ 992 public DebugTargetCfgClient getDebugTarget(String name) 993 throws DefinitionDecodingException, ManagedObjectDecodingException, 994 ManagedObjectNotFoundException, ConcurrentModificationException, 995 AuthorizationException, CommunicationException { 996 return impl.getChild(INSTANCE.getDebugTargetsRelationDefinition(), name).getConfiguration(); 997 } 998 999 1000 1001 /** 1002 * {@inheritDoc} 1003 */ 1004 public <M extends DebugTargetCfgClient> M createDebugTarget( 1005 ManagedObjectDefinition<M, ? extends DebugTargetCfg> d, String name, Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException { 1006 return impl.createChild(INSTANCE.getDebugTargetsRelationDefinition(), d, name, exceptions).getConfiguration(); 1007 } 1008 1009 1010 1011 /** 1012 * {@inheritDoc} 1013 */ 1014 public void removeDebugTarget(String name) 1015 throws ManagedObjectNotFoundException, ConcurrentModificationException, 1016 OperationRejectedException, AuthorizationException, CommunicationException { 1017 impl.removeChild(INSTANCE.getDebugTargetsRelationDefinition(), name); 1018 } 1019 1020 1021 1022 /** 1023 * {@inheritDoc} 1024 */ 1025 public ManagedObjectDefinition<? extends FileBasedDebugLogPublisherCfgClient, ? extends FileBasedDebugLogPublisherCfg> definition() { 1026 return INSTANCE; 1027 } 1028 1029 1030 1031 /** 1032 * {@inheritDoc} 1033 */ 1034 public PropertyProvider properties() { 1035 return impl; 1036 } 1037 1038 1039 1040 /** 1041 * {@inheritDoc} 1042 */ 1043 public void commit() throws ManagedObjectAlreadyExistsException, 1044 MissingMandatoryPropertiesException, ConcurrentModificationException, 1045 OperationRejectedException, AuthorizationException, 1046 CommunicationException { 1047 impl.commit(); 1048 } 1049 1050 } 1051 1052 1053 1054 /** 1055 * Managed object server implementation. 1056 */ 1057 private static class FileBasedDebugLogPublisherCfgServerImpl implements 1058 FileBasedDebugLogPublisherCfg { 1059 1060 // Private implementation. 1061 private ServerManagedObject<? extends FileBasedDebugLogPublisherCfg> impl; 1062 1063 // The value of the "append" property. 1064 private final boolean pAppend; 1065 1066 // The value of the "asynchronous" property. 1067 private final boolean pAsynchronous; 1068 1069 // The value of the "auto-flush" property. 1070 private final boolean pAutoFlush; 1071 1072 // The value of the "buffer-size" property. 1073 private final long pBufferSize; 1074 1075 // The value of the "default-debug-category" property. 1076 private final SortedSet<DefaultDebugCategory> pDefaultDebugCategory; 1077 1078 // The value of the "default-debug-level" property. 1079 private final DefaultDebugLevel pDefaultDebugLevel; 1080 1081 // The value of the "default-include-throwable-cause" property. 1082 private final boolean pDefaultIncludeThrowableCause; 1083 1084 // The value of the "default-omit-method-entry-arguments" property. 1085 private final boolean pDefaultOmitMethodEntryArguments; 1086 1087 // The value of the "default-omit-method-return-value" property. 1088 private final boolean pDefaultOmitMethodReturnValue; 1089 1090 // The value of the "default-throwable-stack-frames" property. 1091 private final int pDefaultThrowableStackFrames; 1092 1093 // The value of the "enabled" property. 1094 private final boolean pEnabled; 1095 1096 // The value of the "java-class" property. 1097 private final String pJavaClass; 1098 1099 // The value of the "log-file" property. 1100 private final String pLogFile; 1101 1102 // The value of the "log-file-permissions" property. 1103 private final String pLogFilePermissions; 1104 1105 // The value of the "queue-size" property. 1106 private final int pQueueSize; 1107 1108 // The value of the "retention-policy" property. 1109 private final SortedSet<String> pRetentionPolicy; 1110 1111 // The value of the "rotation-policy" property. 1112 private final SortedSet<String> pRotationPolicy; 1113 1114 // The value of the "time-interval" property. 1115 private final long pTimeInterval; 1116 1117 1118 1119 // Private constructor. 1120 private FileBasedDebugLogPublisherCfgServerImpl(ServerManagedObject<? extends FileBasedDebugLogPublisherCfg> impl) { 1121 this.impl = impl; 1122 this.pAppend = impl.getPropertyValue(INSTANCE.getAppendPropertyDefinition()); 1123 this.pAsynchronous = impl.getPropertyValue(INSTANCE.getAsynchronousPropertyDefinition()); 1124 this.pAutoFlush = impl.getPropertyValue(INSTANCE.getAutoFlushPropertyDefinition()); 1125 this.pBufferSize = impl.getPropertyValue(INSTANCE.getBufferSizePropertyDefinition()); 1126 this.pDefaultDebugCategory = impl.getPropertyValues(INSTANCE.getDefaultDebugCategoryPropertyDefinition()); 1127 this.pDefaultDebugLevel = impl.getPropertyValue(INSTANCE.getDefaultDebugLevelPropertyDefinition()); 1128 this.pDefaultIncludeThrowableCause = impl.getPropertyValue(INSTANCE.getDefaultIncludeThrowableCausePropertyDefinition()); 1129 this.pDefaultOmitMethodEntryArguments = impl.getPropertyValue(INSTANCE.getDefaultOmitMethodEntryArgumentsPropertyDefinition()); 1130 this.pDefaultOmitMethodReturnValue = impl.getPropertyValue(INSTANCE.getDefaultOmitMethodReturnValuePropertyDefinition()); 1131 this.pDefaultThrowableStackFrames = impl.getPropertyValue(INSTANCE.getDefaultThrowableStackFramesPropertyDefinition()); 1132 this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 1133 this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 1134 this.pLogFile = impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition()); 1135 this.pLogFilePermissions = impl.getPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition()); 1136 this.pQueueSize = impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition()); 1137 this.pRetentionPolicy = impl.getPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition()); 1138 this.pRotationPolicy = impl.getPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition()); 1139 this.pTimeInterval = impl.getPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition()); 1140 } 1141 1142 1143 1144 /** 1145 * {@inheritDoc} 1146 */ 1147 public void addFileBasedDebugChangeListener( 1148 ConfigurationChangeListener<FileBasedDebugLogPublisherCfg> listener) { 1149 impl.registerChangeListener(listener); 1150 } 1151 1152 1153 1154 /** 1155 * {@inheritDoc} 1156 */ 1157 public void removeFileBasedDebugChangeListener( 1158 ConfigurationChangeListener<FileBasedDebugLogPublisherCfg> listener) { 1159 impl.deregisterChangeListener(listener); 1160 } 1161 /** 1162 * {@inheritDoc} 1163 */ 1164 public void addDebugChangeListener( 1165 ConfigurationChangeListener<DebugLogPublisherCfg> listener) { 1166 impl.registerChangeListener(listener); 1167 } 1168 1169 1170 1171 /** 1172 * {@inheritDoc} 1173 */ 1174 public void removeDebugChangeListener( 1175 ConfigurationChangeListener<DebugLogPublisherCfg> listener) { 1176 impl.deregisterChangeListener(listener); 1177 } 1178 /** 1179 * {@inheritDoc} 1180 */ 1181 public void addChangeListener( 1182 ConfigurationChangeListener<LogPublisherCfg> listener) { 1183 impl.registerChangeListener(listener); 1184 } 1185 1186 1187 1188 /** 1189 * {@inheritDoc} 1190 */ 1191 public void removeChangeListener( 1192 ConfigurationChangeListener<LogPublisherCfg> listener) { 1193 impl.deregisterChangeListener(listener); 1194 } 1195 1196 1197 1198 /** 1199 * {@inheritDoc} 1200 */ 1201 public boolean isAppend() { 1202 return pAppend; 1203 } 1204 1205 1206 1207 /** 1208 * {@inheritDoc} 1209 */ 1210 public boolean isAsynchronous() { 1211 return pAsynchronous; 1212 } 1213 1214 1215 1216 /** 1217 * {@inheritDoc} 1218 */ 1219 public boolean isAutoFlush() { 1220 return pAutoFlush; 1221 } 1222 1223 1224 1225 /** 1226 * {@inheritDoc} 1227 */ 1228 public long getBufferSize() { 1229 return pBufferSize; 1230 } 1231 1232 1233 1234 /** 1235 * {@inheritDoc} 1236 */ 1237 public SortedSet<DefaultDebugCategory> getDefaultDebugCategory() { 1238 return pDefaultDebugCategory; 1239 } 1240 1241 1242 1243 /** 1244 * {@inheritDoc} 1245 */ 1246 public DefaultDebugLevel getDefaultDebugLevel() { 1247 return pDefaultDebugLevel; 1248 } 1249 1250 1251 1252 /** 1253 * {@inheritDoc} 1254 */ 1255 public boolean isDefaultIncludeThrowableCause() { 1256 return pDefaultIncludeThrowableCause; 1257 } 1258 1259 1260 1261 /** 1262 * {@inheritDoc} 1263 */ 1264 public boolean isDefaultOmitMethodEntryArguments() { 1265 return pDefaultOmitMethodEntryArguments; 1266 } 1267 1268 1269 1270 /** 1271 * {@inheritDoc} 1272 */ 1273 public boolean isDefaultOmitMethodReturnValue() { 1274 return pDefaultOmitMethodReturnValue; 1275 } 1276 1277 1278 1279 /** 1280 * {@inheritDoc} 1281 */ 1282 public int getDefaultThrowableStackFrames() { 1283 return pDefaultThrowableStackFrames; 1284 } 1285 1286 1287 1288 /** 1289 * {@inheritDoc} 1290 */ 1291 public boolean isEnabled() { 1292 return pEnabled; 1293 } 1294 1295 1296 1297 /** 1298 * {@inheritDoc} 1299 */ 1300 public String getJavaClass() { 1301 return pJavaClass; 1302 } 1303 1304 1305 1306 /** 1307 * {@inheritDoc} 1308 */ 1309 public String getLogFile() { 1310 return pLogFile; 1311 } 1312 1313 1314 1315 /** 1316 * {@inheritDoc} 1317 */ 1318 public String getLogFilePermissions() { 1319 return pLogFilePermissions; 1320 } 1321 1322 1323 1324 /** 1325 * {@inheritDoc} 1326 */ 1327 public int getQueueSize() { 1328 return pQueueSize; 1329 } 1330 1331 1332 1333 /** 1334 * {@inheritDoc} 1335 */ 1336 public SortedSet<String> getRetentionPolicy() { 1337 return pRetentionPolicy; 1338 } 1339 1340 1341 1342 /** 1343 * {@inheritDoc} 1344 */ 1345 public SortedSet<DN> getRetentionPolicyDNs() { 1346 SortedSet<String> values = getRetentionPolicy(); 1347 SortedSet<DN> dnValues = new TreeSet<DN>(); 1348 for (String value : values) { 1349 DN dn = INSTANCE.getRetentionPolicyPropertyDefinition().getChildDN(value); 1350 dnValues.add(dn); 1351 } 1352 return dnValues; 1353 } 1354 1355 1356 1357 /** 1358 * {@inheritDoc} 1359 */ 1360 public SortedSet<String> getRotationPolicy() { 1361 return pRotationPolicy; 1362 } 1363 1364 1365 1366 /** 1367 * {@inheritDoc} 1368 */ 1369 public SortedSet<DN> getRotationPolicyDNs() { 1370 SortedSet<String> values = getRotationPolicy(); 1371 SortedSet<DN> dnValues = new TreeSet<DN>(); 1372 for (String value : values) { 1373 DN dn = INSTANCE.getRotationPolicyPropertyDefinition().getChildDN(value); 1374 dnValues.add(dn); 1375 } 1376 return dnValues; 1377 } 1378 1379 1380 1381 /** 1382 * {@inheritDoc} 1383 */ 1384 public long getTimeInterval() { 1385 return pTimeInterval; 1386 } 1387 1388 1389 1390 /** 1391 * {@inheritDoc} 1392 */ 1393 public String[] listDebugTargets() { 1394 return impl.listChildren(INSTANCE.getDebugTargetsRelationDefinition()); 1395 } 1396 1397 1398 1399 /** 1400 * {@inheritDoc} 1401 */ 1402 public DebugTargetCfg getDebugTarget(String name) throws ConfigException { 1403 return impl.getChild(INSTANCE.getDebugTargetsRelationDefinition(), name).getConfiguration(); 1404 } 1405 1406 1407 1408 /** 1409 * {@inheritDoc} 1410 */ 1411 public void addDebugTargetAddListener( 1412 ConfigurationAddListener<DebugTargetCfg> listener) throws ConfigException { 1413 impl.registerAddListener(INSTANCE.getDebugTargetsRelationDefinition(), listener); 1414 } 1415 1416 1417 1418 /** 1419 * {@inheritDoc} 1420 */ 1421 public void removeDebugTargetAddListener( 1422 ConfigurationAddListener<DebugTargetCfg> listener) { 1423 impl.deregisterAddListener(INSTANCE.getDebugTargetsRelationDefinition(), listener); 1424 } 1425 1426 1427 1428 /** 1429 * {@inheritDoc} 1430 */ 1431 public void addDebugTargetDeleteListener( 1432 ConfigurationDeleteListener<DebugTargetCfg> listener) throws ConfigException { 1433 impl.registerDeleteListener(INSTANCE.getDebugTargetsRelationDefinition(), listener); 1434 } 1435 1436 1437 1438 /** 1439 * {@inheritDoc} 1440 */ 1441 public void removeDebugTargetDeleteListener( 1442 ConfigurationDeleteListener<DebugTargetCfg> listener) { 1443 impl.deregisterDeleteListener(INSTANCE.getDebugTargetsRelationDefinition(), listener); 1444 } 1445 1446 1447 1448 /** 1449 * {@inheritDoc} 1450 */ 1451 public Class<? extends FileBasedDebugLogPublisherCfg> configurationClass() { 1452 return FileBasedDebugLogPublisherCfg.class; 1453 } 1454 1455 1456 1457 /** 1458 * {@inheritDoc} 1459 */ 1460 public DN dn() { 1461 return impl.getDN(); 1462 } 1463 1464 } 1465 }