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