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