mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
04.27.2007 917e6c0007804bfc28caec753977b2b40f301e7e
Perform some minor reformatting in the new log publisher classes in the
org.opends.server.api package to make them more consistent with the formatting
used by other classes in that package and to fix some javadoc typos.
3 files modified
371 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java 97 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/api/DebugLogPublisher.java 223 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogPublisher.java 51 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java
@@ -22,17 +22,21 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.api;
import org.opends.server.admin.std.server.AccessLogPublisherCfg;
import org.opends.server.config.ConfigException;
import org.opends.server.core.*;
import org.opends.server.types.InitializationException;
import org.opends.server.types.DisconnectReason;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchResultReference;
import org.opends.server.core.*;
/**
 * This class defines the set of methods and structures that must be
@@ -50,29 +54,38 @@
   */
  protected boolean suppressInternalOperations = true;
  /**
   * Initializes this access publisher provider based on the
   * information in the provided debug publisher configuration.
   *
   * @param config
   *          The access publisher configuration that contains the
   *          information to use to initialize this access publisher.
   * @throws org.opends.server.config.ConfigException
   *           If an unrecoverable problem arises in the process of
   *           performing the initialization as a result of the server
   * @param  config  The access publisher configuration that contains
   *                 the information to use to initialize this access
   *                 publisher.
   *
   * @throws  ConfigException  If an unrecoverable problem arises in
   *                           the process of performing the
   *                           initialization as a result of the
   *                           server configuration.
   *
   * @throws  InitializationException  If a problem occurs during
   *                                   initialization that is not
   *                                   related to the server
   *           configuration.
   * @throws org.opends.server.types.InitializationException
   *           If a problem occurs during initialization that is not
   *           related to the server configuration.
   */
  public abstract void initializeAccessLogPublisher(T config)
      throws ConfigException, InitializationException;
  /**
   * Close this publisher.
   */
  public abstract void close();
  /**
   * Writes a message to the access logger with information about a
   * new client connection that has been established, regardless of
@@ -97,8 +110,8 @@
   *                           provide additional information about
   *                           the disconnect.
   */
  public abstract void
  logDisconnect(ClientConnection clientConnection,
  public abstract void logDisconnect(
                            ClientConnection clientConnection,
                DisconnectReason disconnectReason,
                String message);
@@ -112,8 +125,9 @@
   *                           information to use to log the abandon
   *                           request.
   */
  public abstract void logAbandonRequest(AbandonOperation
      abandonOperation);
  public abstract void logAbandonRequest(
                            AbandonOperation abandonOperation);
  /**
@@ -124,8 +138,8 @@
   *                           information to use to log the abandon
   *                           request.
   */
  public abstract void logAbandonResult(AbandonOperation
      abandonOperation);
  public abstract void logAbandonResult(
                            AbandonOperation abandonOperation);
@@ -183,8 +197,8 @@
   *                           information to use to log the compare
   *                           request.
   */
  public abstract void logCompareRequest(CompareOperation
      compareOperation);
  public abstract void logCompareRequest(
                            CompareOperation compareOperation);
@@ -196,8 +210,8 @@
   *                           information to use to log the compare
   *                           response.
   */
  public abstract void logCompareResponse(CompareOperation
      compareOperation);
  public abstract void logCompareResponse(
                            CompareOperation compareOperation);
@@ -209,8 +223,8 @@
   *                          information to use to log the delete
   *                          request.
   */
  public abstract void logDeleteRequest(DeleteOperation
      deleteOperation);
  public abstract void logDeleteRequest(
                            DeleteOperation deleteOperation);
@@ -222,8 +236,8 @@
   *                          information to use to log the delete
   *                          response.
   */
  public abstract void logDeleteResponse(DeleteOperation
      deleteOperation);
  public abstract void logDeleteResponse(
                            DeleteOperation deleteOperation);
@@ -235,8 +249,8 @@
   *                            information to use to log the extended
   *                            request.
   */
  public abstract void logExtendedRequest(ExtendedOperation
      extendedOperation);
  public abstract void logExtendedRequest(
                            ExtendedOperation extendedOperation);
@@ -249,8 +263,8 @@
   *                            information to use to log the extended
   *                            response.
   */
  public abstract void logExtendedResponse(ExtendedOperation
      extendedOperation);
  public abstract void logExtendedResponse(
                            ExtendedOperation extendedOperation);
@@ -262,8 +276,8 @@
   *                          information to use to log the modify
   *                          request.
   */
  public abstract void logModifyRequest(ModifyOperation
      modifyOperation);
  public abstract void logModifyRequest(
                            ModifyOperation modifyOperation);
@@ -275,8 +289,8 @@
   *                          information to use to log the modify
   *                          response.
   */
  public abstract void logModifyResponse(ModifyOperation
      modifyOperation);
  public abstract void logModifyResponse(
                            ModifyOperation modifyOperation);
@@ -289,8 +303,8 @@
   *                            information to use to log the modify
   *                            DN request.
   */
  public abstract void logModifyDNRequest(ModifyDNOperation
      modifyDNOperation);
  public abstract void logModifyDNRequest(
                            ModifyDNOperation modifyDNOperation);
@@ -303,8 +317,8 @@
   *                            information to use to log the modify
   *                            DN response.
   */
  public abstract void logModifyDNResponse(ModifyDNOperation
      modifyDNOperation);
  public abstract void logModifyDNResponse(
                            ModifyDNOperation modifyDNOperation);
@@ -316,8 +330,8 @@
   *                          information to use to log the search
   *                          request.
   */
  public abstract void logSearchRequest(SearchOperation
      searchOperation);
  public abstract void logSearchRequest(
                            SearchOperation searchOperation);
@@ -360,8 +374,8 @@
   *                          information to use to log the search
   *                          result done message.
   */
  public abstract void logSearchResultDone(SearchOperation
      searchOperation);
  public abstract void logSearchResultDone(
                            SearchOperation searchOperation);
@@ -375,3 +389,4 @@
   */
  public abstract void logUnbind(UnbindOperation unbindOperation);
}
opendj-sdk/opends/src/server/org/opends/server/api/DebugLogPublisher.java
@@ -22,21 +22,29 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.api;
import org.opends.server.loggers.LogLevel;
import org.opends.server.loggers.debug.TraceSettings;
import org.opends.server.types.*;
import org.opends.server.admin.std.server.DebugLogPublisherCfg;
import org.opends.server.config.ConfigException;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import com.sleepycat.je.Transaction;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.OperationStatus;
import java.util.*;
import org.opends.server.admin.std.server.DebugLogPublisherCfg;
import org.opends.server.config.ConfigException;
import org.opends.server.loggers.LogLevel;
import org.opends.server.loggers.debug.TraceSettings;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.InitializationException;
/**
 * This class defines the set of methods and structures that must be
@@ -57,6 +65,8 @@
  //The map of class names to their method trace settings.
  private Map<String, Map<String, TraceSettings>> methodTraceSettings;
  /**
   * Construct a default configuration where the global scope will
   * only log at the ERROR level.
@@ -70,49 +80,55 @@
    addTraceSettings(null, new TraceSettings(DebugLogLevel.ERROR));
  }
  /**
   * Initializes this debug publisher provider based on the
   * information in the provided debug publisher configuration.
   *
   * @param config
   *          The debug publisher configuration that contains the
   *          information to use to initialize this debug publisher.
   * @throws org.opends.server.config.ConfigException
   *           If an unrecoverable problem arises in the process of
   *           performing the initialization as a result of the server
   * @param  config  The debug publisher configuration that contains
   *                 the information to use to initialize this debug
   *                 publisher.
   *
   * @throws  ConfigException  If an unrecoverable problem arises in
   *                           the process of performing the
   *                           initialization as a result of the
   *                           server configuration.
   *
   * @throws   InitializationException  If a problem occurs during
   *                                    initialization that is not
   *                                    related to the server
   *           configuration.
   * @throws org.opends.server.types.InitializationException
   *           If a problem occurs during initialization that is not
   *           related to the server configuration.
   */
  public abstract void initializeDebugLogPublisher(T config)
      throws ConfigException, InitializationException;
  /**
   * Gets the method trace levels for a specified class.
   * @param className - a fully qualified class name to get method
   * trace levels for
   * @return an unmodifiable map of trace levels keyed by method name.
   * If no method level tracing is configured for the scope,
   * <b>null</b> is returned.
   *
   * @param  className  The fully-qualified name of the class for
   *                    which to get the trace levels.
   *
   *@return  An unmodifiable map of trace levels keyed by method name,
   *         or {@code null} if no method-level tracing is configured
   *         for the scope.
   */
  public Map<String, TraceSettings> getMethodSettings(
      String className)
  public Map<String,TraceSettings> getMethodSettings(String className)
  {
    /*if (methodTraceSettings != null) {
      // Method levels are always at leaves in the
      // hierarchy, so don't bother searching up.
      return methodTraceSettings.get(className);
    }
    return null;*/
    return new HashMap<String, TraceSettings>();
  }
  /**
   * Get the trace settings for a specified class.
   * @param className - a fully qualified class name to get the
   * trace level for
   * @return the current trace settings for the class.
   *
   * @param  className  The fully-qualified name of the class for
   *                    which to get the trace levels.
   *
   * @return  The current trace settings for the class.
   */
  public TraceSettings getClassSettings(String className)
  {
@@ -148,16 +164,19 @@
    return settings;
  }
  /**
   * Adds a trace settings to the current set for a specified scope.
   * If a scope is not specified, the settings will be set for the
   * global scope. The global scope settings are used when no other
   * scope matches.
   *
   * @param scope - the scope to set trace settings for; this is a
   * fully qualified class name or null to set the trace settings for
   * the global scope.
   * @param settings - the trace settings for the scope
   * @param  scope     The scope for which to set the trace settings.
   *                   This should be a fully-qualified class name, or
   *                   {@code null} to set the trace settings for the
   *                   global scope.
   * @param  settings  The trace settings for the specified scope.
   */
  public void addTraceSettings(String scope, TraceSettings settings)
  {
@@ -177,15 +196,20 @@
    }
  }
  /**
   * See if a trace setting is alreadly defined for a particular
   * scope.
   * Determine whether a trace setting is alreadly defined for a
   * particular scope.
   *
   * @param scope - the scope to test; this is a fully
   * qualified class name or null to set the trace settings for the
   * @param  scope  The scope for which to make the determination.
   *                This should be a fully-qualified class name, or
   *                {@code null} to make the determination for the
   * globalscope.
   * @return The trace settings for that scope or null if it doesn't
   *       exist.
   *
   * @return  The trace settings for the specified scope, or
   *          {@code null} if no trace setting is defined for that
   *          scope.
   */
  public TraceSettings getTraceSettings(String scope)
  {
@@ -223,14 +247,19 @@
    }
  }
  /**
   * Remove a trace setting by scope.
   *
   * @param scope - the scope to remove; this is a fully
   * qualified class name or null to set the trace settings for the
   * @param  scope  The scope for which to remove the trace setting.
   *                This should be a fully-qualified class name, or
   *                {@code null} to remove the trace setting for the
   * global scope.
   * @return The trace settings for that scope or null if it doesn't
   *       exist.
   *
   * @return  The trace settings for the specified scope, or
   *          {@code null} if no trace setting is defined for that
   *          scope.
   */
  public TraceSettings removeTraceSettings(String scope)
  {
@@ -271,6 +300,8 @@
    return removedSettings;
  }
  /**
   * Set the trace settings for a class.
   *
@@ -286,6 +317,8 @@
    classTraceSettings.put(className, settings);
  }
  /**
   * Set the method settings for a particular method in a class.
   *
@@ -309,14 +342,17 @@
    methodLevels.put(methodName, settings);
  }
  /**
   * Log a constructor entry.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The constuctor signature.
   * @param sourceLocation The location of the method in the source.
   * @param args The parameters provided to the constructor call.
   * @param  args            The parameters provided to the
   *                         constructor.
   */
  public abstract void traceConstructor(LogLevel level,
                                        TraceSettings settings,
@@ -324,15 +360,18 @@
                                        String sourceLocation,
                                        Object[] args);
  /**
   * Log a non static method entry.
   * Log a non-static method entry.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param obj the object this method operations on.
   * @param args The parameters provided to the constructor call
   * @param  obj             The object instance on which the method
   *                         has been invoked.
   * @param  args            The parameters provided to the method.
   */
  public abstract void traceNonStaticMethodEntry(LogLevel level,
                                               TraceSettings settings,
@@ -341,14 +380,16 @@
                                               Object obj,
                                               Object[] args);
  /**
   * Log a static method entry.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param args The parameters provided to the constructor call
   * @param  args            The parameters provided to the method.
   */
  public abstract void traceStaticMethodEntry(LogLevel level,
                                              TraceSettings settings,
@@ -356,14 +397,16 @@
                                              String sourceLocation,
                                              Object[] args);
  /**
   * Log a method return.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param ret the return value of the method.
   * @param  ret             The return value for the method.
   */
  public abstract void traceReturn(LogLevel level,
                                   TraceSettings settings,
@@ -371,14 +414,16 @@
                                   String sourceLocation,
                                   Object ret);
  /**
   * Log an arbitrary event in a method.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param msg message to format and log.
   * @param  msg             The message to be logged.
   */
  public abstract void traceMessage(LogLevel level,
                                    TraceSettings settings,
@@ -386,14 +431,16 @@
                                    String sourceLocation,
                                    String msg);
  /**
   * Log a thrown exception in a method.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param ex the exception thrown.
   * @param  ex              The exception that was thrown.
   */
  public abstract void traceThrown(LogLevel level,
                                   TraceSettings settings,
@@ -401,14 +448,16 @@
                                   String sourceLocation,
                                   Throwable ex);
  /**
   * Log a caught exception in a method.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param ex the exception caught.
   * @param  ex              The exception that was caught.
   */
  public abstract void traceCaught(LogLevel level,
                                   TraceSettings settings,
@@ -416,18 +465,21 @@
                                   String sourceLocation,
                                   Throwable ex);
  /**
   * Log an JE database access in a method.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param status status of the JE operation.
   * @param database the database handle.
   * @param txn  transaction handle (may be null).
   * @param key  the key to dump.
   * @param data the data to dump.
   * @param  status          The status of the JE operation.
   * @param  database        The database handle.
   * @param  txn             The transaction handle (may be
   *                         {@code null}).
   * @param  key             The key to dump.
   * @param  data            The data to dump.
   */
  public abstract void traceJEAccess(LogLevel level,
                                     TraceSettings settings,
@@ -439,14 +491,16 @@
                                     DatabaseEntry key,
                                     DatabaseEntry data);
  /**
   * Log raw data in a method.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param data the data to dump.
   * @param  data            The data to dump.
   */
  public abstract void traceData(LogLevel level,
                                 TraceSettings settings,
@@ -454,14 +508,16 @@
                                 String sourceLocation,
                                 byte[] data);
  /**
   * Log a protocol element in a method.
   *
   * @param level The level of the log message.
   * @param  level           The log level for the message.
   * @param settings The current trace settings in effect.
   * @param signature The constuctor method signature.
   * @param  signature       The method signature.
   * @param sourceLocation The location of the method in the source.
   * @param element the protocol element to dump.
   * @param  element         The protocol element to dump.
   */
  public abstract void traceProtocolElement(LogLevel level,
                                            TraceSettings settings,
@@ -469,8 +525,11 @@
                                            String sourceLocation,
                                            ProtocolElement element);
  /**
   * Close this publisher.
   */
  public abstract void close();
}
opendj-sdk/opends/src/server/org/opends/server/api/ErrorLogPublisher.java
@@ -22,19 +22,23 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.api;
import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
import org.opends.server.config.ConfigException;
import org.opends.server.types.InitializationException;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import java.util.HashSet;
import java.util.HashMap;
import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
import org.opends.server.config.ConfigException;
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.InitializationException;
/**
 * This class defines the set of methods and structures that must be
 * implemented for a Directory Server error log publisher.
@@ -53,35 +57,47 @@
      definedSeverities =
      new HashMap<ErrorLogCategory, HashSet<ErrorLogSeverity>>();
  /**
   * The set of default log severities that will be used if no custom
   * severities have been defined for the associated category.
   */
  protected HashSet<ErrorLogSeverity> defaultSeverities =
      new HashSet<ErrorLogSeverity>();
  protected HashSet<ErrorLogSeverity>
       defaultSeverities = new HashSet<ErrorLogSeverity>();
  /**
   * Initializes this access publisher provider based on the
   * information in the provided debug publisher configuration.
   *
   * @param config
   *          The error publisher configuration that contains the
   *          information to use to initialize this error publisher.
   * @throws org.opends.server.config.ConfigException
   *           If an unrecoverable problem arises in the process of
   *           performing the initialization as a result of the server
   * @param  config  The error publisher configuration that contains
   *                 the information to use to initialize this error
   *                 publisher.
   *
   * @throws  ConfigException  If an unrecoverable problem arises in
   *                           the process of performing the
   *                           initialization as a result of the
   *                           server configuration.
   *
   * @throws  InitializationException  If a problem occurs during
   *                                   initialization that is not
   *                                   related to the server
   *           configuration.
   * @throws org.opends.server.types.InitializationException
   *           If a problem occurs during initialization that is not
   *           related to the server configuration.
   */
  public abstract void initializeErrorLogPublisher(T config)
      throws ConfigException, InitializationException;
  /**
   * Close this publisher.
   */
  public abstract void close();
  /**
   * Writes a message to the error log using the provided information.
   *
@@ -99,3 +115,4 @@
                                String message, int errorID);
}