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