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