opends/src/server/org/opends/server/api/AccessLogPublisher.java
@@ -23,13 +23,13 @@ * * * Copyright 2008-2009 Sun Microsystems, Inc. * Portions copyright 2011 ForgeRock AS. */ package org.opends.server.api; import java.util.List; import java.util.Map; import org.opends.server.admin.std.server.AccessLogPublisherCfg; import org.opends.server.config.ConfigException; @@ -133,30 +133,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided client connection. * <p> * The default implementation is to not log anything. * * @param clientConnection * The client connection that has been established. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logConnectIntermediateMessage( ClientConnection clientConnection, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * termination of an existing client connection. * <p> @@ -180,30 +156,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided client disconnection. * <p> * The default implementation is to not log anything. * * @param clientConnection * The client connection that has been terminated. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logDisconnectIntermediateMessage( ClientConnection clientConnection, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * abandon request associated with the provided abandon operation. * <p> @@ -221,35 +173,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided abandon operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param abandonOperation * The abandon operation containing the information to use * to log the abandon request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logAbandonIntermediateMessage( AbandonOperation abandonOperation, String category, Map<String, String> content) { // Do nothing. } /** * Writes a message to the access logger with information about the * result of the provided abandon operation. * <p> @@ -284,34 +207,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided add operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param addOperation * The add operation containing the information to use to * log the add request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logAddIntermediateMessage(AddOperation addOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * add response associated with the provided add operation. * <p> @@ -346,34 +241,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided bind operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param bindOperation * The bind operation containing the information to use to * log the bind request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logBindIntermediateMessage(BindOperation bindOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * bind response associated with the provided bind operation. * <p> @@ -408,35 +275,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided compare operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param compareOperation * The compare operation containing the information to use * to log the abandon compare. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logCompareIntermediateMessage( CompareOperation compareOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * compare response associated with the provided compare operation. * <p> @@ -471,35 +309,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided delete operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param deleteOperation * The delete operation containing the information to use * to log the delete request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logDeleteIntermediateMessage( DeleteOperation deleteOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * delete response associated with the provided delete operation. * <p> @@ -534,35 +343,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided extended operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param extendedOperation * The extended operation containing the information to use * to log the extended request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logExtendedIntermediateMessage( ExtendedOperation extendedOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * extended response associated with the provided extended * operation. @@ -598,35 +378,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided modify operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param modifyOperation * The modify operation containing the information to use * to log the modify request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logModifyIntermediateMessage( ModifyOperation modifyOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * modify response associated with the provided modify operation. * <p> @@ -662,35 +413,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided modify DN operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param modifyDNOperation * The modify DN operation containing the information to * use to log the modify DN request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logModifyDNIntermediateMessage( ModifyDNOperation modifyDNOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * modify DN response associated with the provided modify DN * operation. @@ -726,35 +448,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided search operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * <p> * The default implementation is to not log anything. * * @param searchOperation * The search operation containing the information to use * to log the search request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public void logSearchIntermediateMessage( SearchOperation searchOperation, String category, Map<String, String> content) { // Do nothing } /** * Writes a message to the access logger with information about the * search result entry that matches the criteria associated with the * provided search operation. opends/src/server/org/opends/server/loggers/AccessLogger.java
@@ -23,6 +23,7 @@ * * * Copyright 2006-2009 Sun Microsystems, Inc. * Portions copyright 2011 ForgeRock AS. */ package org.opends.server.loggers; import org.opends.messages.Message; @@ -32,7 +33,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; @@ -340,6 +340,7 @@ return new ConfigChangeResult(resultCode, adminActionRequired); } @SuppressWarnings("unchecked") private boolean isJavaClassAcceptable(AccessLogPublisherCfg config, List<Message> unacceptableReasons) { @@ -349,9 +350,10 @@ d.getJavaClassPropertyDefinition(); // Load the class and cast it to a DebugLogPublisher. AccessLogPublisher<?> publisher = null; Class<? extends AccessLogPublisher> theClass; Class<? extends AccessLogPublisher<?>> theClass; try { theClass = pd.loadClass(className, AccessLogPublisher.class); theClass = (Class<? extends AccessLogPublisher<?>>) pd.loadClass(className, AccessLogPublisher.class); publisher = theClass.newInstance(); } catch (Exception e) { Message message = ERR_CONFIG_LOGGER_INVALID_ACCESS_LOGGER_CLASS.get( @@ -395,18 +397,20 @@ ClassPropertyDefinition pd = d.getJavaClassPropertyDefinition(); // Load the class and cast it to a AccessLogPublisher. Class<? extends AccessLogPublisher> theClass; AccessLogPublisher<?> AccessLogPublisher; AccessLogPublisher<?> accessLogPublisher; try { theClass = pd.loadClass(className, AccessLogPublisher.class); AccessLogPublisher = theClass.newInstance(); @SuppressWarnings("unchecked") Class<? extends AccessLogPublisher<?>> theClass = (Class<? extends AccessLogPublisher<?>>) pd .loadClass(className, AccessLogPublisher.class); accessLogPublisher = theClass.newInstance(); // Determine the initialization method to use: it must take a // single parameter which is the exact type of the configuration // object. Method method = theClass.getMethod("initializeAccessLogPublisher", config .configurationClass()); method.invoke(AccessLogPublisher, config); method.invoke(accessLogPublisher, config); } catch (InvocationTargetException ite) { @@ -424,7 +428,7 @@ } // The access publisher has been successfully initialized. return AccessLogPublisher; return accessLogPublisher; } @@ -448,32 +452,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided client connection. * * @param clientConnection * The client connection that has been established. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises of * one or more key/value pairs which form the content of the * intermediate message. */ public static void logConnectIntermediateMessage( ClientConnection clientConnection, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logConnectIntermediateMessage(clientConnection, category, content); } } /** * Writes a message to the access logger with information about the * termination of an existing client connection. * @@ -496,32 +474,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided client disconnection. * * @param clientConnection * The client connection that has been terminated. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises of * one or more key/value pairs which form the content of the * intermediate message. */ public static void logDisconnectIntermediateMessage( ClientConnection clientConnection, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logDisconnectIntermediateMessage(clientConnection, category, content); } } /** * Writes a message to the access logger with information about the abandon * request associated with the provided abandon operation. * @@ -539,37 +491,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided abandon operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param abandonOperation * The abandon operation containing the information to use * to log the abandon request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logAbandonIntermediateMessage( AbandonOperation abandonOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logAbandonIntermediateMessage(abandonOperation, category, content); } } /** * Writes a message to the access logger with information about the result of * the provided abandon operation. * @@ -604,37 +525,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided add operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param addOperation * The add operation containing the information to use * to log the add request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logAddIntermediateMessage( AddOperation addOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logAddIntermediateMessage(addOperation, category, content); } } /** * Writes a message to the access logger with information about the add * response associated with the provided add operation. * @@ -669,37 +559,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided bind operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param bindOperation * The bind operation containing the information to use * to log the bind request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logBindIntermediateMessage( BindOperation bindOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logBindIntermediateMessage(bindOperation, category, content); } } /** * Writes a message to the access logger with information about the bind * response associated with the provided bind operation. * @@ -734,37 +593,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided compare operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param compareOperation * The compare operation containing the information to use * to log the compare request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logCompareIntermediateMessage( CompareOperation compareOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logCompareIntermediateMessage(compareOperation, category, content); } } /** * Writes a message to the access logger with information about the compare * response associated with the provided compare operation. * @@ -799,37 +627,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided delete operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param deleteOperation * The delete operation containing the information to use * to log the delete request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logDeleteIntermediateMessage( DeleteOperation deleteOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logDeleteIntermediateMessage(deleteOperation, category, content); } } /** * Writes a message to the access logger with information about the delete * response associated with the provided delete operation. * @@ -864,37 +661,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided extended operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param extendedOperation * The extended operation containing the information to use * to log the extended request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logExtendedIntermediateMessage( ExtendedOperation extendedOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logExtendedIntermediateMessage(extendedOperation, category, content); } } /** * Writes a message to the access logger with information about the extended * response associated with the provided extended operation. * @@ -929,37 +695,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided modify operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param modifyOperation * The modify operation containing the information to use * to log the modify request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logModifyIntermediateMessage( ModifyOperation modifyOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logModifyIntermediateMessage(modifyOperation, category, content); } } /** * Writes a message to the access logger with information about the modify * response associated with the provided modify operation. * @@ -994,37 +729,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided modify DN operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param modifyDNOperation * The modify DN operation containing the information to use * to log the modify DN request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logModifyDNIntermediateMessage( ModifyDNOperation modifyDNOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logModifyDNIntermediateMessage(modifyDNOperation, category, content); } } /** * Writes a message to the access logger with information about the modify DN * response associated with the provided modify DN operation. * @@ -1060,37 +764,6 @@ /** * Writes a message to the access logger containing additional * information associated with the provided search operation. * <p> * This method will only be called after the request has been logged * and before the response. Implementations can choose to ignore * intermediate responses or filter them based on their category. * * @param searchOperation * The search operation containing the information to use * to log the search request. * @param category * The category of the intermediate message. * @param content * The content of the intermediate message. This comprises * of one or more key/value pairs which form the content of * the intermediate message. */ public static void logSearchIntermediateMessage( SearchOperation searchOperation, String category, Map<String, String> content) { for (AccessLogPublisher<?> publisher : accessPublishers) { publisher.logSearchIntermediateMessage(searchOperation, category, content); } } /** * Writes a message to the access logger with information about the search * result entry that matches the criteria associated with the provided search * operation. opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
@@ -38,7 +38,6 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import org.opends.messages.Message; import org.opends.messages.MessageBuilder; @@ -409,18 +408,6 @@ /** * {@inheritDoc} */ @Override public void logAbandonIntermediateMessage(AbandonOperation abandonOperation, String category, Map<String, String> content) { logIntermediateMessage(abandonOperation, "ABANDON", category, content); } /** * Writes a message to the access logger with information about the * abandon request associated with the provided abandon operation. * @@ -487,18 +474,6 @@ /** * {@inheritDoc} */ @Override public void logAddIntermediateMessage(AddOperation addOperation, String category, Map<String, String> content) { logIntermediateMessage(addOperation, "ADD", category, content); } /** * Writes a message to the access logger with information about the * add request associated with the provided add operation. * @@ -580,18 +555,6 @@ /** * {@inheritDoc} */ @Override public void logBindIntermediateMessage(BindOperation bindOperation, String category, Map<String, String> content) { logIntermediateMessage(bindOperation, "BIND", category, content); } /** * Writes a message to the access logger with information about the * bind request associated with the provided bind operation. * @@ -728,18 +691,6 @@ /** * {@inheritDoc} */ @Override public void logCompareIntermediateMessage(CompareOperation compareOperation, String category, Map<String, String> content) { logIntermediateMessage(compareOperation, "COMPARE", category, content); } /** * Writes a message to the access logger with information about the * compare request associated with the provided compare operation. * @@ -858,32 +809,6 @@ /** * {@inheritDoc} */ @Override public void logConnectIntermediateMessage( ClientConnection clientConnection, String category, Map<String, String> content) { logIntermediateMessage(clientConnection, "CONNECT", category, content); } /** * {@inheritDoc} */ @Override public void logDeleteIntermediateMessage(DeleteOperation deleteOperation, String category, Map<String, String> content) { logIntermediateMessage(deleteOperation, "DELETE", category, content); } /** * Writes a message to the access logger with information about the * delete request associated with the provided delete operation. * @@ -1009,33 +934,6 @@ /** * {@inheritDoc} */ @Override public void logDisconnectIntermediateMessage( ClientConnection clientConnection, String category, Map<String, String> content) { logIntermediateMessage(clientConnection, "DISCONNECT", category, content); } /** * {@inheritDoc} */ @Override public void logExtendedIntermediateMessage( ExtendedOperation extendedOperation, String category, Map<String, String> content) { logIntermediateMessage(extendedOperation, "EXTENDED", category, content); } /** * Writes a message to the access logger with information about the * extended request associated with the provided extended operation. * @@ -1143,19 +1041,6 @@ /** * {@inheritDoc} */ @Override public void logModifyDNIntermediateMessage( ModifyDNOperation modifyDNOperation, String category, Map<String, String> content) { logIntermediateMessage(modifyDNOperation, "MODIFY", category, content); } /** * Writes a message to the access logger with information about the * modify DN request associated with the provided modify DN * operation. @@ -1249,18 +1134,6 @@ /** * {@inheritDoc} */ @Override public void logModifyIntermediateMessage(ModifyOperation modifyOperation, String category, Map<String, String> content) { logIntermediateMessage(modifyOperation, "MODIFY", category, content); } /** * Writes a message to the access logger with information about the * modify request associated with the provided modify operation. * @@ -1342,18 +1215,6 @@ /** * {@inheritDoc} */ @Override public void logSearchIntermediateMessage(SearchOperation searchOperation, String category, Map<String, String> content) { logIntermediateMessage(searchOperation, "SEARCH", category, content); } /** * Writes a message to the access logger with information about the * search request associated with the provided search operation. * @@ -1542,65 +1403,4 @@ item.toString(builder); } } // Writes an intermediate message to the log. private void logIntermediateMessage(Operation operation, String opType, String category, Map<String, String> content) { if (!isLoggable(operation)) { return; } StringBuilder buffer = new StringBuilder(100); appendHeader(operation, opType, category, buffer); for (Map.Entry<String, String> entry : content.entrySet()) { buffer.append(' '); buffer.append(entry.getKey()); buffer.append('='); buffer.append(entry.getValue()); } writer.writeRecord(buffer.toString()); } //Writes an intermediate message to the log. private void logIntermediateMessage( ClientConnection clientConnection, String type, String category, Map<String, String> content) { long connectionID = clientConnection.getConnectionID(); if (connectionID < 0 && suppressInternalOperations) { return; } StringBuilder buffer = new StringBuilder(100); buffer.append('['); buffer.append(TimeThread.getLocalTime()); buffer.append("] "); buffer.append(type); buffer.append(' '); buffer.append(category); buffer.append(" conn="); buffer.append(connectionID); for (Map.Entry<String, String> entry : content.entrySet()) { buffer.append(' '); buffer.append(entry.getKey()); buffer.append('='); buffer.append(entry.getValue()); } writer.writeRecord(buffer.toString()); } }