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