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.server;
027
028
029
030import java.util.SortedSet;
031import org.opends.server.admin.server.ConfigurationChangeListener;
032import org.opends.server.admin.std.meta.PluginCfgDefn.PluginType;
033import org.opends.server.admin.std.meta.ProfilerPluginCfgDefn.ProfileAction;
034
035
036
037/**
038 * A server-side interface for querying Profiler Plugin settings.
039 * <p>
040 * The Profiler plug-in captures profiling information about
041 * operations performed inside the JVM while the OpenDJ directory
042 * server is running.
043 */
044public interface ProfilerPluginCfg extends PluginCfg {
045
046  /**
047   * Gets the configuration class associated with this Profiler Plugin.
048   *
049   * @return Returns the configuration class associated with this Profiler Plugin.
050   */
051  Class<? extends ProfilerPluginCfg> configurationClass();
052
053
054
055  /**
056   * Register to be notified when this Profiler Plugin is changed.
057   *
058   * @param listener
059   *          The Profiler Plugin configuration change listener.
060   */
061  void addProfilerChangeListener(ConfigurationChangeListener<ProfilerPluginCfg> listener);
062
063
064
065  /**
066   * Deregister an existing Profiler Plugin configuration change listener.
067   *
068   * @param listener
069   *          The Profiler Plugin configuration change listener.
070   */
071  void removeProfilerChangeListener(ConfigurationChangeListener<ProfilerPluginCfg> listener);
072
073
074
075  /**
076   * Gets the "enable-profiling-on-startup" property.
077   * <p>
078   * Indicates whether the profiler plug-in is to start collecting
079   * data automatically when the directory server is started.
080   * <p>
081   * This property is read only when the server is started, and any
082   * changes take effect on the next restart. This property is
083   * typically set to "false" unless startup profiling is required,
084   * because otherwise the volume of data that can be collected can
085   * cause the server to run out of memory if it is not turned off in a
086   * timely manner.
087   *
088   * @return Returns the value of the "enable-profiling-on-startup" property.
089   */
090  boolean isEnableProfilingOnStartup();
091
092
093
094  /**
095   * Gets the "invoke-for-internal-operations" property.
096   * <p>
097   * Indicates whether the plug-in should be invoked for internal
098   * operations.
099   * <p>
100   * Any plug-in that can be invoked for internal operations must
101   * ensure that it does not create any new internal operatons that can
102   * cause the same plug-in to be re-invoked.
103   *
104   * @return Returns the value of the "invoke-for-internal-operations" property.
105   */
106  boolean isInvokeForInternalOperations();
107
108
109
110  /**
111   * Gets the "java-class" property.
112   * <p>
113   * Specifies the fully-qualified name of the Java class that
114   * provides the plug-in implementation.
115   *
116   * @return Returns the value of the "java-class" property.
117   */
118  String getJavaClass();
119
120
121
122  /**
123   * Gets the "plugin-type" property.
124   * <p>
125   * Specifies the set of plug-in types for the plug-in, which
126   * specifies the times at which the plug-in is invoked.
127   *
128   * @return Returns an unmodifiable set containing the values of the "plugin-type" property.
129   */
130  SortedSet<PluginType> getPluginType();
131
132
133
134  /**
135   * Gets the "profile-action" property.
136   * <p>
137   * Specifies the action that should be taken by the profiler.
138   * <p>
139   * A value of "start" causes the profiler thread to start collecting
140   * data if it is not already active. A value of "stop" causes the
141   * profiler thread to stop collecting data and write it to disk, and
142   * a value of "cancel" causes the profiler thread to stop collecting
143   * data and discard anything that has been captured. These operations
144   * occur immediately.
145   *
146   * @return Returns the value of the "profile-action" property.
147   */
148  ProfileAction getProfileAction();
149
150
151
152  /**
153   * Gets the "profile-directory" property.
154   * <p>
155   * Specifies the path to the directory where profile information is
156   * to be written. This path may be either an absolute path or a path
157   * that is relative to the root of the OpenDJ directory server
158   * instance.
159   * <p>
160   * The directory must exist and the directory server must have
161   * permission to create new files in it.
162   *
163   * @return Returns the value of the "profile-directory" property.
164   */
165  String getProfileDirectory();
166
167
168
169  /**
170   * Gets the "profile-sample-interval" property.
171   * <p>
172   * Specifies the sample interval in milliseconds to be used when
173   * capturing profiling information in the server.
174   * <p>
175   * When capturing data, the profiler thread sleeps for this length
176   * of time between calls to obtain traces for all threads running in
177   * the JVM.
178   *
179   * @return Returns the value of the "profile-sample-interval" property.
180   */
181  long getProfileSampleInterval();
182
183}