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