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 org.forgerock.opendj.config.AbstractManagedObjectDefinition;
021import org.forgerock.opendj.config.AdministratorAction;
022import org.forgerock.opendj.config.BooleanPropertyDefinition;
023import org.forgerock.opendj.config.ClassPropertyDefinition;
024import org.forgerock.opendj.config.PropertyOption;
025import org.forgerock.opendj.config.Tag;
026import org.forgerock.opendj.config.TopCfgDefn;
027import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider;
028import org.forgerock.opendj.server.config.client.LogPublisherCfgClient;
029import org.forgerock.opendj.server.config.server.LogPublisherCfg;
030
031
032
033/**
034 * An interface for querying the Log Publisher managed object
035 * definition meta information.
036 * <p>
037 * Log Publishers are responsible for distributing log messages from
038 * different loggers to a destination.
039 */
040public final class LogPublisherCfgDefn extends AbstractManagedObjectDefinition<LogPublisherCfgClient, LogPublisherCfg> {
041
042  /** The singleton configuration definition instance. */
043  private static final LogPublisherCfgDefn INSTANCE = new LogPublisherCfgDefn();
044
045
046
047  /** The "enabled" property definition. */
048  private static final BooleanPropertyDefinition PD_ENABLED;
049
050
051
052  /** The "java-class" property definition. */
053  private static final ClassPropertyDefinition PD_JAVA_CLASS;
054
055
056
057  /** Build the "enabled" property definition. */
058  static {
059      BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "enabled");
060      builder.setOption(PropertyOption.MANDATORY);
061      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "enabled"));
062      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Boolean>());
063      PD_ENABLED = builder.getInstance();
064      INSTANCE.registerPropertyDefinition(PD_ENABLED);
065  }
066
067
068
069  /** Build the "java-class" property definition. */
070  static {
071      ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class");
072      builder.setOption(PropertyOption.MANDATORY);
073      builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class"));
074      builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>());
075      builder.addInstanceOf("org.opends.server.loggers.LogPublisher");
076      PD_JAVA_CLASS = builder.getInstance();
077      INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS);
078  }
079
080
081
082  // Register the tags associated with this managed object definition.
083  static {
084    INSTANCE.registerTag(Tag.valueOf("logging"));
085  }
086
087
088
089  /**
090   * Get the Log Publisher configuration definition singleton.
091   *
092   * @return Returns the Log Publisher configuration definition
093   *         singleton.
094   */
095  public static LogPublisherCfgDefn getInstance() {
096    return INSTANCE;
097  }
098
099
100
101  /**
102   * Private constructor.
103   */
104  private LogPublisherCfgDefn() {
105    super("log-publisher", TopCfgDefn.getInstance());
106  }
107
108
109
110  /**
111   * Get the "enabled" property definition.
112   * <p>
113   * Indicates whether the Log Publisher is enabled for use.
114   *
115   * @return Returns the "enabled" property definition.
116   */
117  public BooleanPropertyDefinition getEnabledPropertyDefinition() {
118    return PD_ENABLED;
119  }
120
121
122
123  /**
124   * Get the "java-class" property definition.
125   * <p>
126   * The fully-qualified name of the Java class that provides the Log
127   * Publisher implementation.
128   *
129   * @return Returns the "java-class" property definition.
130   */
131  public ClassPropertyDefinition getJavaClassPropertyDefinition() {
132    return PD_JAVA_CLASS;
133  }
134}