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  /**
332   * {@inheritDoc}
333   */
334  public FileBasedDebugLogPublisherCfgClient createClientConfiguration(
335      ManagedObject<? extends FileBasedDebugLogPublisherCfgClient> impl) {
336    return new FileBasedDebugLogPublisherCfgClientImpl(impl);
337  }
338
339
340
341  /**
342   * {@inheritDoc}
343   */
344  public FileBasedDebugLogPublisherCfg createServerConfiguration(
345      ServerManagedObject<? extends FileBasedDebugLogPublisherCfg> impl) {
346    return new FileBasedDebugLogPublisherCfgServerImpl(impl);
347  }
348
349
350
351  /**
352   * {@inheritDoc}
353   */
354  public Class<FileBasedDebugLogPublisherCfg> getServerConfigurationClass() {
355    return FileBasedDebugLogPublisherCfg.class;
356  }
357
358
359
360  /**
361   * Get the "append" property definition.
362   * <p>
363   * Specifies whether to append to existing log files.
364   *
365   * @return Returns the "append" property definition.
366   */
367  public BooleanPropertyDefinition getAppendPropertyDefinition() {
368    return PD_APPEND;
369  }
370
371
372
373  /**
374   * Get the "asynchronous" property definition.
375   * <p>
376   * Indicates whether the File Based Debug Log Publisher will publish
377   * records asynchronously.
378   *
379   * @return Returns the "asynchronous" property definition.
380   */
381  public BooleanPropertyDefinition getAsynchronousPropertyDefinition() {
382    return PD_ASYNCHRONOUS;
383  }
384
385
386
387  /**
388   * Get the "auto-flush" property definition.
389   * <p>
390   * Specifies whether to flush the writer after every log record.
391   * <p>
392   * If the asynchronous writes option is used, the writer is flushed
393   * after all the log records in the queue are written.
394   *
395   * @return Returns the "auto-flush" property definition.
396   */
397  public BooleanPropertyDefinition getAutoFlushPropertyDefinition() {
398    return PD_AUTO_FLUSH;
399  }
400
401
402
403  /**
404   * Get the "buffer-size" property definition.
405   * <p>
406   * Specifies the log file buffer size.
407   *
408   * @return Returns the "buffer-size" property definition.
409   */
410  public SizePropertyDefinition getBufferSizePropertyDefinition() {
411    return PD_BUFFER_SIZE;
412  }
413
414
415
416  /**
417   * Get the "default-debug-exceptions-only" property definition.
418   * <p>
419   * Indicates whether only logs with exception should be logged.
420   *
421   * @return Returns the "default-debug-exceptions-only" property definition.
422   */
423  public BooleanPropertyDefinition getDefaultDebugExceptionsOnlyPropertyDefinition() {
424    return DebugLogPublisherCfgDefn.getInstance().getDefaultDebugExceptionsOnlyPropertyDefinition();
425  }
426
427
428
429  /**
430   * Get the "default-include-throwable-cause" property definition.
431   * <p>
432   * Indicates whether to include the cause of exceptions in exception
433   * thrown and caught messages logged by default.
434   *
435   * @return Returns the "default-include-throwable-cause" property definition.
436   */
437  public BooleanPropertyDefinition getDefaultIncludeThrowableCausePropertyDefinition() {
438    return DebugLogPublisherCfgDefn.getInstance().getDefaultIncludeThrowableCausePropertyDefinition();
439  }
440
441
442
443  /**
444   * Get the "default-omit-method-entry-arguments" property definition.
445   * <p>
446   * Indicates whether to include method arguments in debug messages
447   * logged by default.
448   *
449   * @return Returns the "default-omit-method-entry-arguments" property definition.
450   */
451  public BooleanPropertyDefinition getDefaultOmitMethodEntryArgumentsPropertyDefinition() {
452    return DebugLogPublisherCfgDefn.getInstance().getDefaultOmitMethodEntryArgumentsPropertyDefinition();
453  }
454
455
456
457  /**
458   * Get the "default-omit-method-return-value" property definition.
459   * <p>
460   * Indicates whether to include the return value in debug messages
461   * logged by default.
462   *
463   * @return Returns the "default-omit-method-return-value" property definition.
464   */
465  public BooleanPropertyDefinition getDefaultOmitMethodReturnValuePropertyDefinition() {
466    return DebugLogPublisherCfgDefn.getInstance().getDefaultOmitMethodReturnValuePropertyDefinition();
467  }
468
469
470
471  /**
472   * Get the "default-throwable-stack-frames" property definition.
473   * <p>
474   * Indicates the number of stack frames to include in the stack
475   * trace for method entry and exception thrown messages.
476   *
477   * @return Returns the "default-throwable-stack-frames" property definition.
478   */
479  public IntegerPropertyDefinition getDefaultThrowableStackFramesPropertyDefinition() {
480    return DebugLogPublisherCfgDefn.getInstance().getDefaultThrowableStackFramesPropertyDefinition();
481  }
482
483
484
485  /**
486   * Get the "enabled" property definition.
487   * <p>
488   * Indicates whether the File Based Debug Log Publisher is enabled
489   * for use.
490   *
491   * @return Returns the "enabled" property definition.
492   */
493  public BooleanPropertyDefinition getEnabledPropertyDefinition() {
494    return DebugLogPublisherCfgDefn.getInstance().getEnabledPropertyDefinition();
495  }
496
497
498
499  /**
500   * Get the "java-class" property definition.
501   * <p>
502   * The fully-qualified name of the Java class that provides the File
503   * Based Debug Log Publisher implementation.
504   *
505   * @return Returns the "java-class" property definition.
506   */
507  public ClassPropertyDefinition getJavaClassPropertyDefinition() {
508    return PD_JAVA_CLASS;
509  }
510
511
512
513  /**
514   * Get the "log-file" property definition.
515   * <p>
516   * The file name to use for the log files generated by the File
517   * Based Debug Log Publisher .
518   * <p>
519   * The path to the file is relative to the server root.
520   *
521   * @return Returns the "log-file" property definition.
522   */
523  public StringPropertyDefinition getLogFilePropertyDefinition() {
524    return PD_LOG_FILE;
525  }
526
527
528
529  /**
530   * Get the "log-file-permissions" property definition.
531   * <p>
532   * The UNIX permissions of the log files created by this File Based
533   * Debug Log Publisher .
534   *
535   * @return Returns the "log-file-permissions" property definition.
536   */
537  public StringPropertyDefinition getLogFilePermissionsPropertyDefinition() {
538    return PD_LOG_FILE_PERMISSIONS;
539  }
540
541
542
543  /**
544   * Get the "queue-size" property definition.
545   * <p>
546   * The maximum number of log records that can be stored in the
547   * asynchronous queue.
548   *
549   * @return Returns the "queue-size" property definition.
550   */
551  public IntegerPropertyDefinition getQueueSizePropertyDefinition() {
552    return PD_QUEUE_SIZE;
553  }
554
555
556
557  /**
558   * Get the "retention-policy" property definition.
559   * <p>
560   * The retention policy to use for the File Based Debug Log
561   * Publisher .
562   * <p>
563   * When multiple policies are used, log files are cleaned when any
564   * of the policy's conditions are met.
565   *
566   * @return Returns the "retention-policy" property definition.
567   */
568  public AggregationPropertyDefinition<LogRetentionPolicyCfgClient, LogRetentionPolicyCfg> getRetentionPolicyPropertyDefinition() {
569    return PD_RETENTION_POLICY;
570  }
571
572
573
574  /**
575   * Get the "rotation-policy" property definition.
576   * <p>
577   * The rotation policy to use for the File Based Debug Log Publisher
578   * .
579   * <p>
580   * When multiple policies are used, rotation will occur if any
581   * policy's conditions are met.
582   *
583   * @return Returns the "rotation-policy" property definition.
584   */
585  public AggregationPropertyDefinition<LogRotationPolicyCfgClient, LogRotationPolicyCfg> getRotationPolicyPropertyDefinition() {
586    return PD_ROTATION_POLICY;
587  }
588
589
590
591  /**
592   * Get the "time-interval" property definition.
593   * <p>
594   * Specifies the interval at which to check whether the log files
595   * need to be rotated.
596   *
597   * @return Returns the "time-interval" property definition.
598   */
599  public DurationPropertyDefinition getTimeIntervalPropertyDefinition() {
600    return PD_TIME_INTERVAL;
601  }
602
603
604
605  /**
606   * Get the "debug-targets" relation definition.
607   *
608   * @return Returns the "debug-targets" relation definition.
609   */
610  public InstantiableRelationDefinition<DebugTargetCfgClient,DebugTargetCfg> getDebugTargetsRelationDefinition() {
611    return DebugLogPublisherCfgDefn.getInstance().getDebugTargetsRelationDefinition();
612  }
613
614
615
616  /**
617   * Managed object client implementation.
618   */
619  private static class FileBasedDebugLogPublisherCfgClientImpl implements
620    FileBasedDebugLogPublisherCfgClient {
621
622    // Private implementation.
623    private ManagedObject<? extends FileBasedDebugLogPublisherCfgClient> impl;
624
625
626
627    // Private constructor.
628    private FileBasedDebugLogPublisherCfgClientImpl(
629        ManagedObject<? extends FileBasedDebugLogPublisherCfgClient> impl) {
630      this.impl = impl;
631    }
632
633
634
635    /**
636     * {@inheritDoc}
637     */
638    public boolean isAppend() {
639      return impl.getPropertyValue(INSTANCE.getAppendPropertyDefinition());
640    }
641
642
643
644    /**
645     * {@inheritDoc}
646     */
647    public void setAppend(Boolean value) {
648      impl.setPropertyValue(INSTANCE.getAppendPropertyDefinition(), value);
649    }
650
651
652
653    /**
654     * {@inheritDoc}
655     */
656    public boolean isAsynchronous() {
657      return impl.getPropertyValue(INSTANCE.getAsynchronousPropertyDefinition());
658    }
659
660
661
662    /**
663     * {@inheritDoc}
664     */
665    public void setAsynchronous(boolean value) {
666      impl.setPropertyValue(INSTANCE.getAsynchronousPropertyDefinition(), value);
667    }
668
669
670
671    /**
672     * {@inheritDoc}
673     */
674    public boolean isAutoFlush() {
675      return impl.getPropertyValue(INSTANCE.getAutoFlushPropertyDefinition());
676    }
677
678
679
680    /**
681     * {@inheritDoc}
682     */
683    public void setAutoFlush(Boolean value) {
684      impl.setPropertyValue(INSTANCE.getAutoFlushPropertyDefinition(), value);
685    }
686
687
688
689    /**
690     * {@inheritDoc}
691     */
692    public long getBufferSize() {
693      return impl.getPropertyValue(INSTANCE.getBufferSizePropertyDefinition());
694    }
695
696
697
698    /**
699     * {@inheritDoc}
700     */
701    public void setBufferSize(Long value) {
702      impl.setPropertyValue(INSTANCE.getBufferSizePropertyDefinition(), value);
703    }
704
705
706
707    /**
708     * {@inheritDoc}
709     */
710    public boolean isDefaultDebugExceptionsOnly() {
711      return impl.getPropertyValue(INSTANCE.getDefaultDebugExceptionsOnlyPropertyDefinition());
712    }
713
714
715
716    /**
717     * {@inheritDoc}
718     */
719    public void setDefaultDebugExceptionsOnly(Boolean value) {
720      impl.setPropertyValue(INSTANCE.getDefaultDebugExceptionsOnlyPropertyDefinition(), value);
721    }
722
723
724
725    /**
726     * {@inheritDoc}
727     */
728    public boolean isDefaultIncludeThrowableCause() {
729      return impl.getPropertyValue(INSTANCE.getDefaultIncludeThrowableCausePropertyDefinition());
730    }
731
732
733
734    /**
735     * {@inheritDoc}
736     */
737    public void setDefaultIncludeThrowableCause(Boolean value) {
738      impl.setPropertyValue(INSTANCE.getDefaultIncludeThrowableCausePropertyDefinition(), value);
739    }
740
741
742
743    /**
744     * {@inheritDoc}
745     */
746    public boolean isDefaultOmitMethodEntryArguments() {
747      return impl.getPropertyValue(INSTANCE.getDefaultOmitMethodEntryArgumentsPropertyDefinition());
748    }
749
750
751
752    /**
753     * {@inheritDoc}
754     */
755    public void setDefaultOmitMethodEntryArguments(Boolean value) {
756      impl.setPropertyValue(INSTANCE.getDefaultOmitMethodEntryArgumentsPropertyDefinition(), value);
757    }
758
759
760
761    /**
762     * {@inheritDoc}
763     */
764    public boolean isDefaultOmitMethodReturnValue() {
765      return impl.getPropertyValue(INSTANCE.getDefaultOmitMethodReturnValuePropertyDefinition());
766    }
767
768
769
770    /**
771     * {@inheritDoc}
772     */
773    public void setDefaultOmitMethodReturnValue(Boolean value) {
774      impl.setPropertyValue(INSTANCE.getDefaultOmitMethodReturnValuePropertyDefinition(), value);
775    }
776
777
778
779    /**
780     * {@inheritDoc}
781     */
782    public int getDefaultThrowableStackFrames() {
783      return impl.getPropertyValue(INSTANCE.getDefaultThrowableStackFramesPropertyDefinition());
784    }
785
786
787
788    /**
789     * {@inheritDoc}
790     */
791    public void setDefaultThrowableStackFrames(Integer value) {
792      impl.setPropertyValue(INSTANCE.getDefaultThrowableStackFramesPropertyDefinition(), value);
793    }
794
795
796
797    /**
798     * {@inheritDoc}
799     */
800    public Boolean isEnabled() {
801      return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition());
802    }
803
804
805
806    /**
807     * {@inheritDoc}
808     */
809    public void setEnabled(boolean value) {
810      impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value);
811    }
812
813
814
815    /**
816     * {@inheritDoc}
817     */
818    public String getJavaClass() {
819      return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition());
820    }
821
822
823
824    /**
825     * {@inheritDoc}
826     */
827    public void setJavaClass(String value) {
828      impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value);
829    }
830
831
832
833    /**
834     * {@inheritDoc}
835     */
836    public String getLogFile() {
837      return impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition());
838    }
839
840
841
842    /**
843     * {@inheritDoc}
844     */
845    public void setLogFile(String value) {
846      impl.setPropertyValue(INSTANCE.getLogFilePropertyDefinition(), value);
847    }
848
849
850
851    /**
852     * {@inheritDoc}
853     */
854    public String getLogFilePermissions() {
855      return impl.getPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition());
856    }
857
858
859
860    /**
861     * {@inheritDoc}
862     */
863    public void setLogFilePermissions(String value) {
864      impl.setPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition(), value);
865    }
866
867
868
869    /**
870     * {@inheritDoc}
871     */
872    public int getQueueSize() {
873      return impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition());
874    }
875
876
877
878    /**
879     * {@inheritDoc}
880     */
881    public void setQueueSize(Integer value) {
882      impl.setPropertyValue(INSTANCE.getQueueSizePropertyDefinition(), value);
883    }
884
885
886
887    /**
888     * {@inheritDoc}
889     */
890    public SortedSet<String> getRetentionPolicy() {
891      return impl.getPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition());
892    }
893
894
895
896    /**
897     * {@inheritDoc}
898     */
899    public void setRetentionPolicy(Collection<String> values) {
900      impl.setPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition(), values);
901    }
902
903
904
905    /**
906     * {@inheritDoc}
907     */
908    public SortedSet<String> getRotationPolicy() {
909      return impl.getPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition());
910    }
911
912
913
914    /**
915     * {@inheritDoc}
916     */
917    public void setRotationPolicy(Collection<String> values) {
918      impl.setPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition(), values);
919    }
920
921
922
923    /**
924     * {@inheritDoc}
925     */
926    public long getTimeInterval() {
927      return impl.getPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition());
928    }
929
930
931
932    /**
933     * {@inheritDoc}
934     */
935    public void setTimeInterval(Long value) {
936      impl.setPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition(), value);
937    }
938
939
940
941    /**
942     * {@inheritDoc}
943     */
944    public String[] listDebugTargets() throws ConcurrentModificationException,
945        LdapException {
946      return impl.listChildren(INSTANCE.getDebugTargetsRelationDefinition());
947    }
948
949
950
951    /**
952     * {@inheritDoc}
953     */
954    public DebugTargetCfgClient getDebugTarget(String name)
955        throws DefinitionDecodingException, ManagedObjectDecodingException,
956        ManagedObjectNotFoundException, ConcurrentModificationException,
957        LdapException {
958      return impl.getChild(INSTANCE.getDebugTargetsRelationDefinition(), name).getConfiguration();
959    }
960
961
962
963    /**
964     * {@inheritDoc}
965     */
966    public <M extends DebugTargetCfgClient> M createDebugTarget(
967        ManagedObjectDefinition<M, ? extends DebugTargetCfg> d, String name, Collection<PropertyException> exceptions) throws IllegalManagedObjectNameException {
968      return impl.createChild(INSTANCE.getDebugTargetsRelationDefinition(), d, name, exceptions).getConfiguration();
969    }
970
971
972
973    /**
974     * {@inheritDoc}
975     */
976    public void removeDebugTarget(String name)
977        throws ManagedObjectNotFoundException, ConcurrentModificationException,
978        OperationRejectedException, LdapException {
979      impl.removeChild(INSTANCE.getDebugTargetsRelationDefinition(), name);
980    }
981
982
983
984    /**
985     * {@inheritDoc}
986     */
987    public ManagedObjectDefinition<? extends FileBasedDebugLogPublisherCfgClient, ? extends FileBasedDebugLogPublisherCfg> definition() {
988      return INSTANCE;
989    }
990
991
992
993    /**
994     * {@inheritDoc}
995     */
996    public PropertyProvider properties() {
997      return impl;
998    }
999
1000
1001
1002    /**
1003     * {@inheritDoc}
1004     */
1005    public void commit() throws ManagedObjectAlreadyExistsException,
1006        MissingMandatoryPropertiesException, ConcurrentModificationException,
1007        OperationRejectedException, LdapException {
1008      impl.commit();
1009    }
1010
1011  }
1012
1013
1014
1015  /**
1016   * Managed object server implementation.
1017   */
1018  private static class FileBasedDebugLogPublisherCfgServerImpl implements
1019    FileBasedDebugLogPublisherCfg {
1020
1021    // Private implementation.
1022    private ServerManagedObject<? extends FileBasedDebugLogPublisherCfg> impl;
1023
1024    // The value of the "append" property.
1025    private final boolean pAppend;
1026
1027    // The value of the "asynchronous" property.
1028    private final boolean pAsynchronous;
1029
1030    // The value of the "auto-flush" property.
1031    private final boolean pAutoFlush;
1032
1033    // The value of the "buffer-size" property.
1034    private final long pBufferSize;
1035
1036    // The value of the "default-debug-exceptions-only" property.
1037    private final boolean pDefaultDebugExceptionsOnly;
1038
1039    // The value of the "default-include-throwable-cause" property.
1040    private final boolean pDefaultIncludeThrowableCause;
1041
1042    // The value of the "default-omit-method-entry-arguments" property.
1043    private final boolean pDefaultOmitMethodEntryArguments;
1044
1045    // The value of the "default-omit-method-return-value" property.
1046    private final boolean pDefaultOmitMethodReturnValue;
1047
1048    // The value of the "default-throwable-stack-frames" property.
1049    private final int pDefaultThrowableStackFrames;
1050
1051    // The value of the "enabled" property.
1052    private final boolean pEnabled;
1053
1054    // The value of the "java-class" property.
1055    private final String pJavaClass;
1056
1057    // The value of the "log-file" property.
1058    private final String pLogFile;
1059
1060    // The value of the "log-file-permissions" property.
1061    private final String pLogFilePermissions;
1062
1063    // The value of the "queue-size" property.
1064    private final int pQueueSize;
1065
1066    // The value of the "retention-policy" property.
1067    private final SortedSet<String> pRetentionPolicy;
1068
1069    // The value of the "rotation-policy" property.
1070    private final SortedSet<String> pRotationPolicy;
1071
1072    // The value of the "time-interval" property.
1073    private final long pTimeInterval;
1074
1075
1076
1077    // Private constructor.
1078    private FileBasedDebugLogPublisherCfgServerImpl(ServerManagedObject<? extends FileBasedDebugLogPublisherCfg> impl) {
1079      this.impl = impl;
1080      this.pAppend = impl.getPropertyValue(INSTANCE.getAppendPropertyDefinition());
1081      this.pAsynchronous = impl.getPropertyValue(INSTANCE.getAsynchronousPropertyDefinition());
1082      this.pAutoFlush = impl.getPropertyValue(INSTANCE.getAutoFlushPropertyDefinition());
1083      this.pBufferSize = impl.getPropertyValue(INSTANCE.getBufferSizePropertyDefinition());
1084      this.pDefaultDebugExceptionsOnly = impl.getPropertyValue(INSTANCE.getDefaultDebugExceptionsOnlyPropertyDefinition());
1085      this.pDefaultIncludeThrowableCause = impl.getPropertyValue(INSTANCE.getDefaultIncludeThrowableCausePropertyDefinition());
1086      this.pDefaultOmitMethodEntryArguments = impl.getPropertyValue(INSTANCE.getDefaultOmitMethodEntryArgumentsPropertyDefinition());
1087      this.pDefaultOmitMethodReturnValue = impl.getPropertyValue(INSTANCE.getDefaultOmitMethodReturnValuePropertyDefinition());
1088      this.pDefaultThrowableStackFrames = impl.getPropertyValue(INSTANCE.getDefaultThrowableStackFramesPropertyDefinition());
1089      this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition());
1090      this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition());
1091      this.pLogFile = impl.getPropertyValue(INSTANCE.getLogFilePropertyDefinition());
1092      this.pLogFilePermissions = impl.getPropertyValue(INSTANCE.getLogFilePermissionsPropertyDefinition());
1093      this.pQueueSize = impl.getPropertyValue(INSTANCE.getQueueSizePropertyDefinition());
1094      this.pRetentionPolicy = impl.getPropertyValues(INSTANCE.getRetentionPolicyPropertyDefinition());
1095      this.pRotationPolicy = impl.getPropertyValues(INSTANCE.getRotationPolicyPropertyDefinition());
1096      this.pTimeInterval = impl.getPropertyValue(INSTANCE.getTimeIntervalPropertyDefinition());
1097    }
1098
1099
1100
1101    /**
1102     * {@inheritDoc}
1103     */
1104    public void addFileBasedDebugChangeListener(
1105        ConfigurationChangeListener<FileBasedDebugLogPublisherCfg> listener) {
1106      impl.registerChangeListener(listener);
1107    }
1108
1109
1110
1111    /**
1112     * {@inheritDoc}
1113     */
1114    public void removeFileBasedDebugChangeListener(
1115        ConfigurationChangeListener<FileBasedDebugLogPublisherCfg> listener) {
1116      impl.deregisterChangeListener(listener);
1117    }
1118    /**
1119     * {@inheritDoc}
1120     */
1121    public void addDebugChangeListener(
1122        ConfigurationChangeListener<DebugLogPublisherCfg> listener) {
1123      impl.registerChangeListener(listener);
1124    }
1125
1126
1127
1128    /**
1129     * {@inheritDoc}
1130     */
1131    public void removeDebugChangeListener(
1132        ConfigurationChangeListener<DebugLogPublisherCfg> listener) {
1133      impl.deregisterChangeListener(listener);
1134    }
1135    /**
1136     * {@inheritDoc}
1137     */
1138    public void addChangeListener(
1139        ConfigurationChangeListener<LogPublisherCfg> listener) {
1140      impl.registerChangeListener(listener);
1141    }
1142
1143
1144
1145    /**
1146     * {@inheritDoc}
1147     */
1148    public void removeChangeListener(
1149        ConfigurationChangeListener<LogPublisherCfg> listener) {
1150      impl.deregisterChangeListener(listener);
1151    }
1152
1153
1154
1155    /**
1156     * {@inheritDoc}
1157     */
1158    public boolean isAppend() {
1159      return pAppend;
1160    }
1161
1162
1163
1164    /**
1165     * {@inheritDoc}
1166     */
1167    public boolean isAsynchronous() {
1168      return pAsynchronous;
1169    }
1170
1171
1172
1173    /**
1174     * {@inheritDoc}
1175     */
1176    public boolean isAutoFlush() {
1177      return pAutoFlush;
1178    }
1179
1180
1181
1182    /**
1183     * {@inheritDoc}
1184     */
1185    public long getBufferSize() {
1186      return pBufferSize;
1187    }
1188
1189
1190
1191    /**
1192     * {@inheritDoc}
1193     */
1194    public boolean isDefaultDebugExceptionsOnly() {
1195      return pDefaultDebugExceptionsOnly;
1196    }
1197
1198
1199
1200    /**
1201     * {@inheritDoc}
1202     */
1203    public boolean isDefaultIncludeThrowableCause() {
1204      return pDefaultIncludeThrowableCause;
1205    }
1206
1207
1208
1209    /**
1210     * {@inheritDoc}
1211     */
1212    public boolean isDefaultOmitMethodEntryArguments() {
1213      return pDefaultOmitMethodEntryArguments;
1214    }
1215
1216
1217
1218    /**
1219     * {@inheritDoc}
1220     */
1221    public boolean isDefaultOmitMethodReturnValue() {
1222      return pDefaultOmitMethodReturnValue;
1223    }
1224
1225
1226
1227    /**
1228     * {@inheritDoc}
1229     */
1230    public int getDefaultThrowableStackFrames() {
1231      return pDefaultThrowableStackFrames;
1232    }
1233
1234
1235
1236    /**
1237     * {@inheritDoc}
1238     */
1239    public boolean isEnabled() {
1240      return pEnabled;
1241    }
1242
1243
1244
1245    /**
1246     * {@inheritDoc}
1247     */
1248    public String getJavaClass() {
1249      return pJavaClass;
1250    }
1251
1252
1253
1254    /**
1255     * {@inheritDoc}
1256     */
1257    public String getLogFile() {
1258      return pLogFile;
1259    }
1260
1261
1262
1263    /**
1264     * {@inheritDoc}
1265     */
1266    public String getLogFilePermissions() {
1267      return pLogFilePermissions;
1268    }
1269
1270
1271
1272    /**
1273     * {@inheritDoc}
1274     */
1275    public int getQueueSize() {
1276      return pQueueSize;
1277    }
1278
1279
1280
1281    /**
1282     * {@inheritDoc}
1283     */
1284    public SortedSet<String> getRetentionPolicy() {
1285      return pRetentionPolicy;
1286    }
1287
1288
1289
1290    /**
1291     * {@inheritDoc}
1292     */
1293    public SortedSet<DN> getRetentionPolicyDNs() {
1294      SortedSet<String> values = getRetentionPolicy();
1295      SortedSet<DN> dnValues = new TreeSet<DN>();
1296      for (String value : values) {
1297        DN dn = INSTANCE.getRetentionPolicyPropertyDefinition().getChildDN(value);
1298        dnValues.add(dn);
1299      }
1300      return dnValues;
1301    }
1302
1303
1304
1305    /**
1306     * {@inheritDoc}
1307     */
1308    public SortedSet<String> getRotationPolicy() {
1309      return pRotationPolicy;
1310    }
1311
1312
1313
1314    /**
1315     * {@inheritDoc}
1316     */
1317    public SortedSet<DN> getRotationPolicyDNs() {
1318      SortedSet<String> values = getRotationPolicy();
1319      SortedSet<DN> dnValues = new TreeSet<DN>();
1320      for (String value : values) {
1321        DN dn = INSTANCE.getRotationPolicyPropertyDefinition().getChildDN(value);
1322        dnValues.add(dn);
1323      }
1324      return dnValues;
1325    }
1326
1327
1328
1329    /**
1330     * {@inheritDoc}
1331     */
1332    public long getTimeInterval() {
1333      return pTimeInterval;
1334    }
1335
1336
1337
1338    /**
1339     * {@inheritDoc}
1340     */
1341    public String[] listDebugTargets() {
1342      return impl.listChildren(INSTANCE.getDebugTargetsRelationDefinition());
1343    }
1344
1345
1346
1347    /**
1348     * {@inheritDoc}
1349     */
1350    public DebugTargetCfg getDebugTarget(String name) throws ConfigException {
1351      return impl.getChild(INSTANCE.getDebugTargetsRelationDefinition(), name).getConfiguration();
1352    }
1353
1354
1355
1356    /**
1357     * {@inheritDoc}
1358     */
1359    public void addDebugTargetAddListener(
1360        ConfigurationAddListener<DebugTargetCfg> listener) throws ConfigException {
1361      impl.registerAddListener(INSTANCE.getDebugTargetsRelationDefinition(), listener);
1362    }
1363
1364
1365
1366    /**
1367     * {@inheritDoc}
1368     */
1369    public void removeDebugTargetAddListener(
1370        ConfigurationAddListener<DebugTargetCfg> listener) {
1371      impl.deregisterAddListener(INSTANCE.getDebugTargetsRelationDefinition(), listener);
1372    }
1373
1374
1375
1376    /**
1377     * {@inheritDoc}
1378     */
1379    public void addDebugTargetDeleteListener(
1380        ConfigurationDeleteListener<DebugTargetCfg> listener) throws ConfigException {
1381      impl.registerDeleteListener(INSTANCE.getDebugTargetsRelationDefinition(), listener);
1382    }
1383
1384
1385
1386    /**
1387     * {@inheritDoc}
1388     */
1389    public void removeDebugTargetDeleteListener(
1390        ConfigurationDeleteListener<DebugTargetCfg> listener) {
1391      impl.deregisterDeleteListener(INSTANCE.getDebugTargetsRelationDefinition(), listener);
1392    }
1393
1394
1395
1396    /**
1397     * {@inheritDoc}
1398     */
1399    public Class<? extends FileBasedDebugLogPublisherCfg> configurationClass() {
1400      return FileBasedDebugLogPublisherCfg.class;
1401    }
1402
1403
1404
1405    /**
1406     * {@inheritDoc}
1407     */
1408    public DN dn() {
1409      return impl.getDN();
1410    }
1411
1412  }
1413}