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