Operation.java:
Removed unused methods getCommonLogElements(), getRequestLogElements() and getResponseLogElements().
*.java:
Consequence of the change to Operation.
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ID_TO_ABANDON; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE; |
| | | import static org.opends.server.loggers.AccessLogger.logAbandonRequest; |
| | | import static org.opends.server.loggers.AccessLogger.logAbandonResult; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostOperationAbandonOperation; |
| | | import org.opends.server.types.operation.PreParseAbandonOperation; |
| | | |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to abandon an operation |
| | | * that may already be in progress in the Directory Server. |
| | | */ |
| | | public class AbandonOperationBasis extends AbstractOperation |
| | | implements Runnable, |
| | | AbandonOperation, |
| | | implements AbandonOperation, |
| | | PreParseAbandonOperation, |
| | | PostOperationAbandonOperation |
| | | { |
| | | |
| | | // The message ID of the operation that should be abandoned. |
| | | /** The message ID of the operation that should be abandoned. */ |
| | | private final int idToAbandon; |
| | | |
| | | |
| | |
| | | * |
| | | * @return The message ID of the operation that should be abandoned. |
| | | */ |
| | | @Override |
| | | public final int getIDToAbandon() |
| | | { |
| | | return idToAbandon; |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_ID_TO_ABANDON, String.valueOf(idToAbandon) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | // There is no response for an abandon. However, we will still want to log |
| | | // information about whether it was successful. |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | // An abandon operation can never have a response, so just return an empty |
| | |
| | | * managing synchronization, and any other work that might need to |
| | | * be done in the course of processing. |
| | | */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | | setResultCode(ResultCode.UNDEFINED); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | |
| | | import static org.opends.server.config.ConfigConstants.ATTR_OBJECTCLASS; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ENTRY_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE; |
| | | import static org.opends.server.loggers.AccessLogger.logAddRequest; |
| | | import static org.opends.server.loggers.AccessLogger.logAddResponse; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.util.StaticUtils.toLowerCase; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | import org.opends.server.loggers.debug.DebugLogger; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostResponseAddOperation; |
| | | import org.opends.server.types.operation.PreParseAddOperation; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendAddOperation; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to add a new entry to the |
| | |
| | | */ |
| | | public class AddOperationBasis |
| | | extends AbstractOperation |
| | | implements PreParseAddOperation, AddOperation, Runnable, |
| | | PostResponseAddOperation |
| | | implements PreParseAddOperation, AddOperation, PostResponseAddOperation |
| | | { |
| | | |
| | | /** |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // The set of response controls to send to the client. |
| | | /** The set of response controls to send to the client. */ |
| | | private ArrayList<Control> responseControls; |
| | | |
| | | // The raw, unprocessed entry DN as provided in the request. This may or may |
| | | // not be a valid DN. |
| | | /** |
| | | * The raw, unprocessed entry DN as provided in the request. This may or may |
| | | * not be a valid DN. |
| | | */ |
| | | private ByteString rawEntryDN; |
| | | |
| | | // The processed DN of the entry to add. |
| | | /** The processed DN of the entry to add. */ |
| | | private DN entryDN; |
| | | |
| | | // The proxied authorization target DN for this operation. |
| | | /** The proxied authorization target DN for this operation. */ |
| | | private DN proxiedAuthorizationDN; |
| | | |
| | | // The set of attributes (including the objectclass attribute) in a raw, |
| | | // unprocessed form as provided in the request. One or more of these |
| | | // attributes may be invalid. |
| | | /** |
| | | * The set of attributes (including the objectclass attribute) in a raw, |
| | | * unprocessed form as provided in the request. One or more of these |
| | | * attributes may be invalid. |
| | | */ |
| | | private List<RawAttribute> rawAttributes; |
| | | |
| | | // The set of operational attributes for the entry to add. |
| | | /** The set of operational attributes for the entry to add. */ |
| | | private Map<AttributeType,List<Attribute>> operationalAttributes; |
| | | |
| | | // The set of user attributes for the entry to add. |
| | | /** The set of user attributes for the entry to add. */ |
| | | private Map<AttributeType,List<Attribute>> userAttributes; |
| | | |
| | | // The set of objectclasses for the entry to add. |
| | | /** The set of objectclasses for the entry to add. */ |
| | | private Map<ObjectClass,String> objectClasses; |
| | | |
| | | // The change number that has been assigned to this operation. |
| | | /** The change number that has been assigned to this operation. */ |
| | | private long changeNumber; |
| | | |
| | | // The flag indicates if an LDAP error was reported. |
| | | /** The flag indicates if an LDAP error was reported. */ |
| | | private boolean ldapError; |
| | | |
| | | /** |
| | | * Creates a new add operation with the provided information. |
| | | * |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawEntryDN() |
| | | { |
| | | return rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | this.rawEntryDN = rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | | try |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<RawAttribute> getRawAttributes() |
| | | { |
| | | return rawAttributes; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addRawAttribute(RawAttribute rawAttribute) |
| | | { |
| | | rawAttributes.add(rawAttribute); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawAttributes(List<RawAttribute> rawAttributes) |
| | | { |
| | | this.rawAttributes = rawAttributes; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final Map<ObjectClass,String> getObjectClasses() |
| | | { |
| | | if (objectClasses == null){ |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addObjectClass(ObjectClass objectClass, String name) |
| | | { |
| | | objectClasses.put(objectClass, name); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void removeObjectClass(ObjectClass objectClass) |
| | | { |
| | | objectClasses.remove(objectClass); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final Map<AttributeType,List<Attribute>> getUserAttributes() |
| | | { |
| | | if (userAttributes == null){ |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final Map<AttributeType,List<Attribute>> getOperationalAttributes() |
| | | { |
| | | if (operationalAttributes == null){ |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setAttribute(AttributeType attributeType, |
| | | List<Attribute> attributeList) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void removeAttribute(AttributeType attributeType) |
| | | { |
| | | if (attributeType.isOperational()) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final long getChangeNumber() |
| | | { |
| | | return changeNumber; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setChangeNumber(long changeNumber) |
| | | { |
| | | this.changeNumber = changeNumber; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ArrayList<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | responseControls.add(control); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | | responseControls.remove(control); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("AddOperation(connID="); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | this.proxiedAuthorizationDN = proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | | setResultCode(ResultCode.UNDEFINED); |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public Entry getEntryToAdd() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | |
| | | import static org.opends.server.config.ConfigConstants.DN_CONFIG_ROOT; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_AUTH_TYPE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_BIND_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_SASL_MECHANISM; |
| | | import static org.opends.server.loggers.AccessLogger.logBindRequest; |
| | | import static org.opends.server.loggers.AccessLogger.logBindResponse; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.core.networkgroups.NetworkGroup; |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PreParseBindOperation; |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendBindOperation; |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to authenticate a user to |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // The credentials used for SASL authentication. |
| | | /** The credentials used for SASL authentication. */ |
| | | private ByteString saslCredentials; |
| | | |
| | | // The server SASL credentials provided to the client in the response. |
| | | /** The server SASL credentials provided to the client in the response. */ |
| | | private ByteString serverSASLCredentials; |
| | | |
| | | // The authentication info for this bind operation. |
| | | /** The authentication info for this bind operation. */ |
| | | private AuthenticationInfo authInfo = null; |
| | | |
| | | // The authentication type used for this bind operation. |
| | | /** The authentication type used for this bind operation. */ |
| | | private AuthenticationType authType; |
| | | |
| | | // The raw, unprocessed bind DN as contained in the client request. |
| | | /** The raw, unprocessed bind DN as contained in the client request. */ |
| | | private ByteString rawBindDN; |
| | | |
| | | // The password used for simple authentication. |
| | | /** The password used for simple authentication. */ |
| | | private ByteString simplePassword; |
| | | |
| | | // The bind DN used for this bind operation. |
| | | /** The bind DN used for this bind operation. */ |
| | | private DN bindDN; |
| | | |
| | | // The DN of the user entry that is attempting to authenticate. |
| | | /** The DN of the user entry that is attempting to authenticate. */ |
| | | private DN userEntryDN; |
| | | |
| | | // The DN of the user as whom a SASL authentication was attempted (regardless |
| | | // of whether the authentication was successful) for the purpose of updating |
| | | // password policy state information. |
| | | /** |
| | | * The DN of the user as whom a SASL authentication was attempted (regardless |
| | | * of whether the authentication was successful) for the purpose of updating |
| | | * password policy state information. |
| | | */ |
| | | private Entry saslAuthUserEntry; |
| | | |
| | | // The set of response controls for this bind operation. |
| | | /** The set of response controls for this bind operation. */ |
| | | private List<Control> responseControls; |
| | | |
| | | // A message explaining the reason for the authentication failure. |
| | | /** A message explaining the reason for the authentication failure. */ |
| | | private Message authFailureReason; |
| | | |
| | | // The SASL mechanism used for SASL authentication. |
| | | /** The SASL mechanism used for SASL authentication. */ |
| | | private String saslMechanism; |
| | | |
| | | // A string representation of the protocol version for this bind operation. |
| | | /** |
| | | * A string representation of the protocol version for this bind operation. |
| | | */ |
| | | private String protocolVersion; |
| | | |
| | | /** |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | if (authType == AuthenticationType.SASL) |
| | | { |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_BIND_DN, String.valueOf(rawBindDN) }, |
| | | new String[] { LOG_ELEMENT_AUTH_TYPE, authType.toString() }, |
| | | new String[] { LOG_ELEMENT_SASL_MECHANISM, saslMechanism } |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_BIND_DN, String.valueOf(rawBindDN) }, |
| | | new String[] { LOG_ELEMENT_AUTH_TYPE, authType.toString() } |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | import static org.opends.server.core.CoreConstants.*; |
| | | import static org.opends.server.loggers.AccessLogger.logCompareRequest; |
| | | import static org.opends.server.loggers.AccessLogger.logCompareResponse; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostResponseCompareOperation; |
| | | import org.opends.server.types.operation.PreParseCompareOperation; |
| | | import org.opends.server.workflowelement.localbackend. |
| | | LocalBackendCompareOperation; |
| | | |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to determine whether a |
| | |
| | | public class CompareOperationBasis |
| | | extends AbstractOperation |
| | | implements PreParseCompareOperation, CompareOperation, |
| | | Runnable, PostResponseCompareOperation |
| | | PostResponseCompareOperation |
| | | { |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // The attribute type for this compare operation. |
| | | /** The attribute type for this compare operation. */ |
| | | private AttributeType attributeType; |
| | | |
| | | // The assertion value for the compare operation. |
| | | /** The assertion value for the compare operation. */ |
| | | private ByteString assertionValue; |
| | | |
| | | // The set of attribute options |
| | | /** The set of attribute options. */ |
| | | private Set<String> attributeOptions; |
| | | |
| | | // The raw, unprocessed entry DN as included in the client request. |
| | | /** The raw, unprocessed entry DN as included in the client request. */ |
| | | private ByteString rawEntryDN; |
| | | |
| | | // The DN of the entry for the compare operation. |
| | | /** The DN of the entry for the compare operation. */ |
| | | private DN entryDN; |
| | | |
| | | // The proxied authorization target DN for this operation. |
| | | /** The proxied authorization target DN for this operation. */ |
| | | private DN proxiedAuthorizationDN; |
| | | |
| | | // The set of response controls for this compare operation. |
| | | /** The set of response controls for this compare operation. */ |
| | | private List<Control> responseControls; |
| | | |
| | | // The attribute type for the compare operation. |
| | | /** The attribute type for the compare operation. */ |
| | | private String rawAttributeType; |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawEntryDN() |
| | | { |
| | | return rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | this.rawEntryDN = rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | | if (entryDN == null) { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String getRawAttributeType() |
| | | { |
| | | return rawAttributeType; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawAttributeType(String rawAttributeType) |
| | | { |
| | | this.rawAttributeType = rawAttributeType; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final AttributeType getAttributeType() |
| | | { |
| | | if (attributeType == null) { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setAttributeType(AttributeType attributeType) |
| | | { |
| | | this.attributeType = attributeType; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Set<String> getAttributeOptions() |
| | | { |
| | | if (attributeOptions == null) { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setAttributeOptions(Set<String> attributeOptions) |
| | | { |
| | | this.attributeOptions = attributeOptions; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getAssertionValue() |
| | | { |
| | | return assertionValue; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setAssertionValue(ByteString assertionValue) |
| | | { |
| | | this.assertionValue = assertionValue; |
| | |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return OperationType.COMPARE; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) }, |
| | | new String[] { LOG_ELEMENT_COMPARE_ATTR, rawAttributeType } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the proxied authorization DN for this operation if proxied |
| | | * authorization has been requested. |
| | | * |
| | |
| | | * authorization has been requested, or {@code null} if proxied |
| | | * authorization has not been requested. |
| | | */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | this.proxiedAuthorizationDN = proxiedAuthorizationDN; |
| | |
| | | * managing synchronization, and any other work that might need to |
| | | * be done in the course of processing. |
| | | */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | | setResultCode(ResultCode.UNDEFINED); |
| | |
| | | { |
| | | // Invoke the post response plugins that have been registered by |
| | | // the workflow elements |
| | | List localOperations = |
| | | List<LocalBackendCompareOperation> localOperations = |
| | | (List)getAttachment(Operation.LOCALBACKENDOPERATIONS); |
| | | |
| | | if (localOperations != null) |
| | | { |
| | | for (Object localOp : localOperations) |
| | | for (LocalBackendCompareOperation localOperation : localOperations) |
| | | { |
| | | LocalBackendCompareOperation localOperation = |
| | | (LocalBackendCompareOperation)localOp; |
| | | pluginConfigManager.invokePostResponseComparePlugins(localOperation); |
| | | } |
| | | } |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public Entry getEntryToCompare() |
| | | { |
| | | return null; |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ENTRY_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE; |
| | | import static org.opends.server.loggers.AccessLogger.logDeleteRequest; |
| | | import static org.opends.server.loggers.AccessLogger.logDeleteResponse; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.api.ClientConnection; |
| | |
| | | import org.opends.server.types.operation.PreParseDeleteOperation; |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to remove an entry from the |
| | | * Directory Server. |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // The raw, unprocessed entry DN as included in the client request. |
| | | /** The raw, unprocessed entry DN as included in the client request. */ |
| | | private ByteString rawEntryDN; |
| | | |
| | | // The DN of the entry for the delete operation. |
| | | /** The DN of the entry for the delete operation. */ |
| | | private DN entryDN; |
| | | |
| | | // The proxied authorization target DN for this operation. |
| | | /** The proxied authorization target DN for this operation. */ |
| | | private DN proxiedAuthorizationDN; |
| | | |
| | | // The set of response controls for this delete operation. |
| | | /** The set of response controls for this delete operation. */ |
| | | private List<Control> responseControls; |
| | | |
| | | // The change number that has been assigned to this operation. |
| | | /** The change number that has been assigned to this operation. */ |
| | | private long changeNumber; |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawEntryDN() |
| | | { |
| | | return rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | this.rawEntryDN = rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | | try |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final long getChangeNumber() |
| | | { |
| | | return changeNumber; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setChangeNumber(long changeNumber) |
| | | { |
| | | this.changeNumber = changeNumber; |
| | |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return OperationType.DELETE; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | this.proxiedAuthorizationDN = proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | | setResultCode(ResultCode.UNDEFINED); |
| | |
| | | { |
| | | // Invoke the post response plugins that have been registered by |
| | | // the workflow elements |
| | | List localOperations = |
| | | List<LocalBackendDeleteOperation> localOperations = |
| | | (List)getAttachment(Operation.LOCALBACKENDOPERATIONS); |
| | | |
| | | if (localOperations != null) |
| | | { |
| | | for (Object localOp : localOperations) |
| | | for (LocalBackendDeleteOperation localOperation : localOperations) |
| | | { |
| | | LocalBackendDeleteOperation localOperation = |
| | | (LocalBackendDeleteOperation)localOp; |
| | | pluginConfigManager.invokePostResponseDeletePlugins(localOperation); |
| | | } |
| | | } |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public Entry getEntryToDelete() { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ExtendedOperationHandler; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.loggers.debug.DebugLogger; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostOperationExtendedOperation; |
| | | import org.opends.server.types.operation.PostResponseExtendedOperation; |
| | | import org.opends.server.types.operation.PreOperationExtendedOperation; |
| | | import org.opends.server.types.operation.PreParseExtendedOperation; |
| | | |
| | | import static org.opends.server.core.CoreConstants.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import org.opends.server.loggers.debug.DebugLogger; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines an extended operation, which can perform virtually any |
| | | * kind of task. |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // The value for the request associated with this extended operation. |
| | | /** The value for the request associated with this extended operation. */ |
| | | private ByteString requestValue; |
| | | |
| | | // The value for the response associated with this extended operation. |
| | | /** The value for the response associated with this extended operation. */ |
| | | private ByteString responseValue; |
| | | |
| | | // The set of response controls for this extended operation. |
| | | /** The set of response controls for this extended operation. */ |
| | | private List<Control> responseControls; |
| | | |
| | | // The OID for the request associated with this extended operation. |
| | | /** The OID for the request associated with this extended operation. */ |
| | | private String requestOID; |
| | | |
| | | // The OID for the response associated with this extended operation. |
| | | /** The OID for the response associated with this extended operation. */ |
| | | private String responseOID; |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String getRequestOID() |
| | | { |
| | | return requestOID; |
| | |
| | | * @param requestOID The OID for the request associated with this extended |
| | | * operation. |
| | | */ |
| | | @Override |
| | | public final void setRequestOID(String requestOID) |
| | | { |
| | | this.requestOID = requestOID; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRequestValue() |
| | | { |
| | | return requestValue; |
| | |
| | | * @param requestValue The value for the request associated with this |
| | | * extended operation. |
| | | */ |
| | | @Override |
| | | public final void setRequestValue(ByteString requestValue) |
| | | { |
| | | this.requestValue = requestValue; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final String getResponseOID() |
| | | { |
| | | return responseOID; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setResponseOID(String responseOID) |
| | | { |
| | | this.responseOID = responseOID; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getResponseValue() |
| | | { |
| | | return responseValue; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setResponseValue(ByteString responseValue) |
| | | { |
| | | this.responseValue = responseValue; |
| | |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return OperationType.EXTENDED; |
| | | } |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_EXTENDED_REQUEST_OID, requestOID } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_EXTENDED_RESPONSE_OID, responseOID }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.MessageBuilder; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.core.networkgroups.NetworkGroup; |
| | | import org.opends.server.types.operation.PostResponseModifyDNOperation; |
| | | import org.opends.server.types.operation.PreParseModifyDNOperation; |
| | | import static org.opends.server.core.CoreConstants.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import org.opends.server.loggers.debug.DebugLogger; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostResponseModifyDNOperation; |
| | | import org.opends.server.types.operation.PreParseModifyDNOperation; |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to alter the DN of an entry |
| | |
| | | implements ModifyDNOperation, |
| | | PreParseModifyDNOperation, |
| | | PostResponseModifyDNOperation |
| | | { |
| | | { |
| | | |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // Indicates whether to delete the old RDN value from the entry. |
| | | /** Indicates whether to delete the old RDN value from the entry. */ |
| | | private boolean deleteOldRDN; |
| | | |
| | | // The raw, unprocessed current DN of the entry as included in the request |
| | | // from the client. |
| | | /** |
| | | * The raw, unprocessed current DN of the entry as included in the request |
| | | * from the client. |
| | | */ |
| | | private ByteString rawEntryDN; |
| | | |
| | | // The raw, unprocessed newRDN as included in the request from the client. |
| | | /** The raw, unprocessed newRDN as included in the request from the client. */ |
| | | private ByteString rawNewRDN; |
| | | |
| | | // The raw, unprocessed newSuperior as included in the request from the |
| | | // client. |
| | | /** |
| | | * The raw, unprocessed newSuperior as included in the request from the |
| | | * client. |
| | | */ |
| | | private ByteString rawNewSuperior; |
| | | |
| | | // The current DN of the entry. |
| | | /** The current DN of the entry. */ |
| | | private DN entryDN; |
| | | |
| | | // The new parent for the entry. |
| | | /** The new parent for the entry. */ |
| | | private DN newSuperior; |
| | | |
| | | // The proxied authorization target DN for this operation. |
| | | /** The proxied authorization target DN for this operation. */ |
| | | private DN proxiedAuthorizationDN; |
| | | |
| | | // The set of response controls for this modify DN operation. |
| | | /** The set of response controls for this modify DN operation. */ |
| | | private List<Control> responseControls; |
| | | |
| | | // The set of modifications applied to attributes in the entry in the course |
| | | // of processing the modify DN. |
| | | /** |
| | | * The set of modifications applied to attributes in the entry in the course |
| | | * of processing the modify DN. |
| | | */ |
| | | private List<Modification> modifications; |
| | | |
| | | // The change number that has been assigned to this operation. |
| | | /** The change number that has been assigned to this operation. */ |
| | | private long changeNumber; |
| | | |
| | | // The new RDN for the entry. |
| | | /** The new RDN for the entry. */ |
| | | private RDN newRDN; |
| | | |
| | | // The new entry DN |
| | | /** The new entry DN. */ |
| | | private DN newDN = null; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawEntryDN() |
| | | { |
| | | return rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | this.rawEntryDN = rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | | try |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawNewRDN() |
| | | { |
| | | return rawNewRDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawNewRDN(ByteString rawNewRDN) |
| | | { |
| | | this.rawNewRDN = rawNewRDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final RDN getNewRDN() |
| | | { |
| | | try |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final boolean deleteOldRDN() |
| | | { |
| | | return deleteOldRDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setDeleteOldRDN(boolean deleteOldRDN) |
| | | { |
| | | this.deleteOldRDN = deleteOldRDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawNewSuperior() |
| | | { |
| | | return rawNewSuperior; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawNewSuperior(ByteString rawNewSuperior) |
| | | { |
| | | this.rawNewSuperior = rawNewSuperior; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final DN getNewSuperior() |
| | | { |
| | | if (rawNewSuperior == null) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Modification> getModifications() |
| | | { |
| | | return modifications; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addModification(Modification modification) |
| | | { |
| | | if (modifications == null) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final Entry getOriginalEntry() |
| | | { |
| | | return null; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final Entry getUpdatedEntry() |
| | | { |
| | | return null; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final long getChangeNumber() |
| | | { |
| | | return changeNumber; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setChangeNumber(long changeNumber) |
| | | { |
| | | this.changeNumber = changeNumber; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String newSuperiorStr; |
| | | if (rawNewSuperior == null) |
| | | { |
| | | newSuperiorStr = null; |
| | | } |
| | | else |
| | | { |
| | | newSuperiorStr = rawNewSuperior.toString(); |
| | | } |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) }, |
| | | new String[] { LOG_ELEMENT_NEW_RDN, String.valueOf(newRDN) }, |
| | | new String[] { LOG_ELEMENT_DELETE_OLD_RDN, |
| | | String.valueOf(deleteOldRDN) }, |
| | | new String[] { LOG_ELEMENT_NEW_SUPERIOR, newSuperiorStr } |
| | | }; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN dn) |
| | | { |
| | | proxiedAuthorizationDN = dn; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getNewDN() |
| | | { |
| | | if (newDN == null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import org.opends.messages.MessageBuilder; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ENTRY_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS; |
| | | import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE; |
| | | import static org.opends.server.loggers.AccessLogger.logModifyRequest; |
| | | import static org.opends.server.loggers.AccessLogger.logModifyResponse; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.api.ClientConnection; |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.PostResponseModifyOperation; |
| | | import org.opends.server.types.operation.PreParseModifyOperation; |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to modify an entry in the |
| | |
| | | extends AbstractOperation implements ModifyOperation, |
| | | PreParseModifyOperation, |
| | | PostResponseModifyOperation |
| | | { |
| | | { |
| | | |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | |
| | | // The raw, unprocessed entry DN as included by the client request. |
| | | /** The raw, unprocessed entry DN as included by the client request. */ |
| | | private ByteString rawEntryDN; |
| | | |
| | | // The DN of the entry for the modify operation. |
| | | /** The DN of the entry for the modify operation. */ |
| | | private DN entryDN; |
| | | |
| | | // The proxied authorization target DN for this operation. |
| | | /** The proxied authorization target DN for this operation. */ |
| | | private DN proxiedAuthorizationDN; |
| | | |
| | | // The set of response controls for this modify operation. |
| | | /** The set of response controls for this modify operation. */ |
| | | private List<Control> responseControls; |
| | | |
| | | // The raw, unprocessed set of modifications as included in the client |
| | | // request. |
| | | /** |
| | | * The raw, unprocessed set of modifications as included in the client |
| | | * request. |
| | | */ |
| | | private List<RawModification> rawModifications; |
| | | |
| | | // The set of modifications for this modify operation. |
| | | /** The set of modifications for this modify operation. */ |
| | | private List<Modification> modifications; |
| | | |
| | | // The change number that has been assigned to this operation. |
| | | /** The change number that has been assigned to this operation. */ |
| | | private long changeNumber; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final ByteString getRawEntryDN() |
| | | { |
| | | return rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawEntryDN(ByteString rawEntryDN) |
| | | { |
| | | this.rawEntryDN = rawEntryDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final DN getEntryDN() |
| | | { |
| | | if (entryDN == null){ |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<RawModification> getRawModifications() |
| | | { |
| | | return rawModifications; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addRawModification(RawModification rawModification) |
| | | { |
| | | rawModifications.add(rawModification); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void setRawModifications(List<RawModification> rawModifications) |
| | | { |
| | | this.rawModifications = rawModifications; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Modification> getModifications() |
| | | { |
| | | if (modifications == null) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addModification(Modification modification) |
| | | throws DirectoryException |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final OperationType getOperationType() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(getProcessingTime()); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | | return proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final List<Control> getResponseControls() |
| | | { |
| | | return responseControls; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void addResponseControl(Control control) |
| | | { |
| | | responseControls.add(control); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void removeResponseControl(Control control) |
| | | { |
| | | responseControls.remove(control); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("ModifyOperation(connID="); |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final long getChangeNumber(){ |
| | | return changeNumber; |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setChangeNumber(long changeNumber) |
| | | { |
| | | this.changeNumber = changeNumber; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) |
| | | { |
| | | this.proxiedAuthorizationDN = proxiedAuthorizationDN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | | setResultCode(ResultCode.UNDEFINED); |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public Entry getCurrentEntry() { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public List<AttributeValue> getCurrentPasswords() |
| | | { |
| | | return null; |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public Entry getModifiedEntry() |
| | | { |
| | | return null; |
| | |
| | | * |
| | | * This method always returns null. |
| | | */ |
| | | @Override |
| | | public List<AttributeValue> getNewPasswords() |
| | | { |
| | | return null; |
| | |
| | | import org.opends.server.controls.ControlDecoder; |
| | | import org.opends.server.types.*; |
| | | |
| | | |
| | | /** |
| | | * This abstract class is a generic operation wrapper intended to be subclassed |
| | | * by a specific operation wrapper. |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String[][] getCommonLogElements() |
| | | { |
| | | return operation.getCommonLogElements(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public long getConnectionID() |
| | | { |
| | | return operation.getConnectionID(); |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String[][] getRequestLogElements() |
| | | { |
| | | return operation.getRequestLogElements(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public List<Control> getResponseControls() |
| | | { |
| | | return operation.getResponseControls(); |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public String[][] getResponseLogElements() |
| | | { |
| | | return operation.getResponseLogElements(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ResultCode getResultCode() |
| | | { |
| | | return operation.getResultCode(); |
| | |
| | | operation.setSynchronizationOperation(isSynchronizationOperation); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | return getClientConnection().hashCode() * (int) getOperationID(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.server.api.AuthenticationPolicyState; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | |
| | | import org.opends.server.types.operation.SearchReferenceSearchOperation; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.core.CoreConstants.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class defines an operation that may be used to locate entries in the |
| | | * Directory Server based on a given set of criteria. |
| | |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return OperationType.SEARCH; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String attrs; |
| | | if ((attributes == null) || attributes.isEmpty()) |
| | | { |
| | | attrs = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder attrBuffer = new StringBuilder(); |
| | | Iterator<String> iterator = attributes.iterator(); |
| | | attrBuffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | attrBuffer.append(", "); |
| | | attrBuffer.append(iterator.next()); |
| | | } |
| | | |
| | | attrs = attrBuffer.toString(); |
| | | } |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_BASE_DN, String.valueOf(rawBaseDN) }, |
| | | new String[] { LOG_ELEMENT_SCOPE, String.valueOf(scope) }, |
| | | new String[] { LOG_ELEMENT_SIZE_LIMIT, String.valueOf(sizeLimit) }, |
| | | new String[] { LOG_ELEMENT_TIME_LIMIT, String.valueOf(timeLimit) }, |
| | | new String[] { LOG_ELEMENT_FILTER, String.valueOf(rawFilter) }, |
| | | new String[] { LOG_ELEMENT_REQUESTED_ATTRIBUTES, attrs } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | String resultCode = String.valueOf(getResultCode().getIntValue()); |
| | | |
| | | String errorMessage; |
| | | MessageBuilder errorMessageBuffer = getErrorMessage(); |
| | | if (errorMessageBuffer == null) |
| | | { |
| | | errorMessage = null; |
| | | } |
| | | else |
| | | { |
| | | errorMessage = errorMessageBuffer.toString(); |
| | | } |
| | | |
| | | String matchedDNStr; |
| | | DN matchedDN = getMatchedDN(); |
| | | if (matchedDN == null) |
| | | { |
| | | matchedDNStr = null; |
| | | } |
| | | else |
| | | { |
| | | matchedDNStr = matchedDN.toString(); |
| | | } |
| | | |
| | | String referrals; |
| | | List<String> referralURLs = getReferralURLs(); |
| | | if ((referralURLs == null) || referralURLs.isEmpty()) |
| | | { |
| | | referrals = null; |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | Iterator<String> iterator = referralURLs.iterator(); |
| | | buffer.append(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(", "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | |
| | | referrals = buffer.toString(); |
| | | } |
| | | |
| | | String processingTime = |
| | | String.valueOf(processingStopTime - processingStartTime); |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_RESULT_CODE, resultCode }, |
| | | new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage }, |
| | | new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr }, |
| | | new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals }, |
| | | new String[] { LOG_ELEMENT_ENTRIES_SENT, String.valueOf(entriesSent) }, |
| | | new String[] { LOG_ELEMENT_REFERENCES_SENT, |
| | | String.valueOf(referencesSent ) }, |
| | | new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public DN getProxiedAuthorizationDN() |
| | | { |
| | |
| | | if (filter.getAttributeType().isObjectClassType()) |
| | | { |
| | | AttributeValue v = filter.getAssertionValue(); |
| | | // FIXME : technically this is not correct since the presense |
| | | // FIXME : technically this is not correct since the presence |
| | | // of draft oc would trigger rfc oc visibility and visa versa. |
| | | String stringValueLC = toLowerCase(v.getValue().toString()); |
| | | if (stringValueLC.equals(OC_LDAP_SUBENTRY_LC) || |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.api.ClientConnection; |
| | |
| | | import org.opends.server.types.operation.PostOperationUnbindOperation; |
| | | import org.opends.server.types.operation.PreParseUnbindOperation; |
| | | |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | /** |
| | | * This class defines an operation that may be used to close the connection |
| | | * between the client and the Directory Server. |
| | |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | return OperationType.UNBIND; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getRequestLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | // There are no special elements that should be logged for an unbind |
| | | // request. |
| | | return new String[0][]; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public final String[][] getResponseLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because it is a likely |
| | | // candidate for being called by the logging subsystem. |
| | | |
| | | // There is no unbind response, nor are there any special elements that |
| | | // should be logged when an unbind occurs. |
| | | return new String[0][]; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | * managing synchronization, and any other work that might need to |
| | | * be done in the course of processing. |
| | | */ |
| | | @Override |
| | | public final void run() |
| | | { |
| | | // Get the plugin config manager that will be used for invoking plugins. |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import static org.opends.server.core.CoreConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import java.util.*; |
| | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a set of standard elements that should be logged in all |
| | | * requests and responses for all types of operations. Each element |
| | | * in the array will itself be a two-element array in which the |
| | | * first element is the name of the field and the second is a string |
| | | * representation of the value, or {@code null} if there is no value |
| | | * for that field. |
| | | * |
| | | * @return A standard set of elements that should be logged in |
| | | * requests and responses for all types of operations. |
| | | */ |
| | | @Override |
| | | public final String[][] getCommonLogElements() |
| | | { |
| | | // Note that no debugging will be done in this method because |
| | | // it is a likely candidate for being called by the logging |
| | | // subsystem. |
| | | |
| | | return new String[][] |
| | | { |
| | | new String[] { LOG_ELEMENT_CONNECTION_ID, |
| | | String.valueOf(getConnectionID()) }, |
| | | new String[] { LOG_ELEMENT_OPERATION_ID, |
| | | String.valueOf(operationID) }, |
| | | new String[] { LOG_ELEMENT_MESSAGE_ID, |
| | | String.valueOf(messageID) } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the client connection with which this operation is |
| | | * associated. |
| | | * |
| | |
| | | ); |
| | | |
| | | /** |
| | | * Retrieves a set of standard elements that should be logged in all |
| | | * requests and responses for all types of operations. Each element |
| | | * in the array will itself be a two-element array in which the |
| | | * first element is the name of the field and the second is a string |
| | | * representation of the value, or {@code null} if there is no value |
| | | * for that field. |
| | | * |
| | | * @return A standard set of elements that should be logged in |
| | | * requests and responses for all types of operations. |
| | | */ |
| | | public abstract String[][] getCommonLogElements(); |
| | | |
| | | /** |
| | | * Retrieves a standard set of elements that should be logged in |
| | | * requests for this type of operation. Each element in the array |
| | | * will itself be a two-element array in which the first element is |
| | | * the name of the field and the second is a string representation |
| | | * of the value, or {@code null} if there is no value for that |
| | | * field. |
| | | * |
| | | * @return A standard set of elements that should be logged in |
| | | * requests for this type of operation. |
| | | */ |
| | | public abstract String[][] getRequestLogElements(); |
| | | |
| | | /** |
| | | * Retrieves a standard set of elements that should be logged in |
| | | * responses for this type of operation. Each element in the array |
| | | * will itself be a two-element array in which the first element is |
| | | * the name of the field and the second is a string representation |
| | | * of the value, or {@code null} if there is no value for that |
| | | * field. |
| | | * |
| | | * @return A standard set of elements that should be logged in |
| | | * responses for this type of operation. |
| | | */ |
| | | public abstract String[][] getResponseLogElements(); |
| | | |
| | | /** |
| | | * Retrieves the client connection with which this operation is |
| | | * associated. |
| | | * |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.ServerConstants.OID_WHO_AM_I_REQUEST; |
| | | import static org.testng.Assert.assertEquals; |
| | | import static org.testng.Assert.assertNotNull; |
| | | import static org.testng.Assert.assertNull; |
| | | import static org.testng.Assert.assertTrue; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.plugins.DelayPreOpPlugin; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.AbandonRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.protocols.ldap.ModifyDNRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyDNResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.testng.annotations.Test; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * For some reason, the @BeforeClass method in the super class is not called. |
| | | */ |
| | | @Override |
| | | @BeforeClass() |
| | | public void startServer() throws Exception { |
| | | super.startServer(); |
| | |
| | | assertTrue(abandonOperation.getProcessingStartTime() > 0); |
| | | assertTrue(abandonOperation.getProcessingStopTime() > 0); |
| | | assertTrue(abandonOperation.getProcessingTime() >= 0); |
| | | assertNotNull(abandonOperation.getResponseLogElements()); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | Thread.sleep(3000); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | |
| | | // NOTE: We can't check to see if pre-parse plugins were called yet |
| | | // because there's no plugin ordering. It's possible that the |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for add operations |
| | | */ |
| | |
| | | extends OperationTestCase |
| | | { |
| | | |
| | | // Some of the tests disable the backends, so we reenable them here. |
| | | /** Some of the tests disable the backends, so we reenable them here. */ |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | |
| | | assertTrue(addOperation.getProcessingStopTime() >= |
| | | addOperation.getProcessingStartTime()); |
| | | assertTrue(addOperation.getProcessingTime() >= 0); |
| | | assertNotNull(addOperation.getResponseLogElements()); |
| | | |
| | | long changeNumber = addOperation.getChangeNumber(); |
| | | addOperation.setChangeNumber(changeNumber); |
| | |
| | | assertEquals(ldapStatistics.getAddRequests(), addRequests+1); |
| | | waitForAddResponsesStat(addResponses+1); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(ldapStatistics.getAddRequests(), addRequests+1); |
| | | waitForAddResponsesStat(addResponses+1); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | assertEquals(ldapStatistics.getAddRequests(), addRequests+1); |
| | | waitForAddResponsesStat(addResponses+1); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | break responseLoop; |
| | | default: |
| | | // This is a problem. It's an unexpected response. |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | |
| | | StaticUtils.close(s); |
| | | |
| | | throw new Exception("Unexpected response message " + message + |
| | | " encountered in " + |
| | |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.InvocationCounterPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.tools.LDAPSearch; |
| | | import org.opends.server.tools.*; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.tools.LDAPDelete; |
| | | import org.opends.server.tools.LDAPModify; |
| | | |
| | | import static org.testng.Assert.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of test cases for bind operations |
| | |
| | | Operation[] bindOps = new Operation[simpleBinds.length + saslBinds.length]; |
| | | |
| | | int pos = 0; |
| | | for (int i=0; i < simpleBinds.length; i++) |
| | | for (Object[] simpleBind : simpleBinds) |
| | | { |
| | | bindOps[pos++] = (BindOperation) simpleBinds[i][0]; |
| | | bindOps[pos++] = (BindOperation) simpleBind[0]; |
| | | } |
| | | |
| | | for (int i=0; i < saslBinds.length; i++) |
| | | for (Object[] saslBind : saslBinds) |
| | | { |
| | | bindOps[pos++] = (BindOperation) saslBinds[i][0]; |
| | | bindOps[pos++] = (BindOperation) saslBind[0]; |
| | | } |
| | | |
| | | return bindOps; |
| | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getResponseLogElements</CODE> method for a completed |
| | | * successful bind operation using simple authentication. |
| | | */ |
| | | @Test() |
| | | public void testGetResponseLogElementsSimple() |
| | | { |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(ByteString.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("password")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(bindOperation.getResponseLogElements()); |
| | | assertTrue(bindOperation.getResponseLogElements().length > 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getResponseLogElements</CODE> method for a completed bind |
| | | * operation using SASL authentication. |
| | | */ |
| | | @Test() |
| | | public void testGetResponseLogElementsSASL() |
| | | { |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | ByteString saslCreds = |
| | | ByteString.valueOf("\u0000dn:cn=Directory Manager\u0000password"); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), "PLAIN", saslCreds); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(bindOperation.getResponseLogElements()); |
| | | assertTrue(bindOperation.getResponseLogElements().length > 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getResponseLogElements</CODE> method for a failed simple |
| | | * bind attempt in which the target user didn't exist. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test() |
| | | public void testGetResponseLogElementsSimpleNoSuchUser() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(ByteString.valueOf("uid=test,o=test"), |
| | | ByteString.valueOf("password")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS); |
| | | assertNotNull(bindOperation.getResponseLogElements()); |
| | | assertTrue(bindOperation.getResponseLogElements().length > 0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests a simple bind operation to ensure that all plugin types are invoked |
| | | * as expected. |
| | | */ |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | message = r.readMessage(); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | message = r.readMessage(); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | message = r.readMessage(); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 80); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 80); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 80); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 80); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 80); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 80); |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | package org.opends.server.core; |
| | | |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.types.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.controls.LDAPAssertionRequestControl; |
| | | import org.opends.server.controls.ProxiedAuthV1Control; |
| | | import org.opends.server.controls.ProxiedAuthV2Control; |
| | | import org.opends.server.plugins.InvocationCounterPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | | import java.net.Socket; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class CompareOperationTestCase extends OperationTestCase |
| | | { |
| | | private Entry entry; |
| | |
| | | assertTrue(compareOperation.getProcessingStartTime() > 0); |
| | | assertTrue(compareOperation.getProcessingStopTime() > 0); |
| | | assertTrue(compareOperation.getProcessingTime() >= 0); |
| | | assertNotNull(compareOperation.getResponseLogElements()); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | | // assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1); |
| | |
| | | assertTrue(compareOperation.getProcessingStartTime() > 0); |
| | | assertTrue(compareOperation.getProcessingStopTime() > 0); |
| | | assertTrue(compareOperation.getProcessingTime() >= 0); |
| | | assertNotNull(compareOperation.getResponseLogElements()); |
| | | assertTrue(compareOperation.getErrorMessage().length() > 0); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | |
| | | assertTrue(compareOperation.getProcessingStartTime() > 0); |
| | | assertTrue(compareOperation.getProcessingStopTime() > 0); |
| | | assertTrue(compareOperation.getProcessingTime() >= 0); |
| | | assertNotNull(compareOperation.getResponseLogElements()); |
| | | assertTrue(compareOperation.getErrorMessage().length() > 0); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.AfterMethod; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | |
| | | import org.opends.server.tools.LDAPDelete; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendDeleteOperation; |
| | | |
| | | import static org.testng.Assert.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | |
| | | |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of test cases for delete operations |
| | |
| | | public class DeleteOperationTestCase |
| | | extends OperationTestCase |
| | | { |
| | | // Some of the tests disable the backends, so we reenable them here. |
| | | /** Some of the tests disable the backends, so we reenable them here. */ |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | |
| | | assertTrue(deleteOperation.getProcessingStopTime() >= |
| | | deleteOperation.getProcessingStartTime()); |
| | | assertTrue(deleteOperation.getProcessingTime() >= 0); |
| | | assertNotNull(deleteOperation.getResponseLogElements()); |
| | | |
| | | |
| | | long changeNumber = deleteOperation.getChangeNumber(); |
| | |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | List localOps = |
| | | List<LocalBackendDeleteOperation> localOps = |
| | | (List) (deleteOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS)); |
| | | assertNotNull(localOps); |
| | | for (Object localOp : localOps){ |
| | | LocalBackendDeleteOperation curOp = (LocalBackendDeleteOperation) localOp; |
| | | for (LocalBackendDeleteOperation curOp : localOps) |
| | | { |
| | | assertNotNull(curOp.getEntryToDelete()); |
| | | } |
| | | } |
| | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("ou=People,o=test")); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | List localOps = |
| | | List<LocalBackendDeleteOperation> localOps = |
| | | (List) (deleteOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS)); |
| | | assertNotNull(localOps); |
| | | for (Object localOp : localOps){ |
| | | LocalBackendDeleteOperation curOp = (LocalBackendDeleteOperation) localOp; |
| | | for (LocalBackendDeleteOperation curOp : localOps) |
| | | { |
| | | assertNull(curOp.getEntryToDelete()); |
| | | } |
| | | } |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.locks.Lock; |
| | | |
| | | import org.testng.annotations.BeforeMethod; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.BeforeClass; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.LDAPModification; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import static org.opends.server.TestCaseUtils.TEST_BACKEND_ID; |
| | | import static org.opends.server.TestCaseUtils.applyModifications; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | |
| | | |
| | | import org.testng.annotations.*; |
| | | |
| | | /** |
| | | * A set of test cases for modify operations |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class ModifyOperationTestCase |
| | | extends OperationTestCase |
| | | { |
| | |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Object[][] backendBaseDNs = getBaseDNs(); |
| | | for (int i = 0; i < backendBaseDNs.length; i++) { |
| | | String backendBaseDN = backendBaseDNs[i][0].toString(); |
| | | for (Object[] backendBaseDN2 : backendBaseDNs) |
| | | { |
| | | String backendBaseDN = backendBaseDN2[0].toString(); |
| | | Backend b = DirectoryServer.getBackend(DN.decode(backendBaseDN)); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | assertTrue(modifyOperation.getProcessingStopTime() >= |
| | | modifyOperation.getProcessingStartTime()); |
| | | assertTrue(modifyOperation.getProcessingTime() >= 0); |
| | | assertNotNull(modifyOperation.getResponseLogElements()); |
| | | |
| | | List localOps = |
| | | List<LocalBackendModifyOperation> localOps = |
| | | (List) (modifyOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS)); |
| | | assertNotNull(localOps); |
| | | for (Object localOp : localOps){ |
| | | LocalBackendModifyOperation curOp = (LocalBackendModifyOperation) localOp; |
| | | for (LocalBackendModifyOperation curOp : localOps) |
| | | { |
| | | curOp.getNewPasswords(); |
| | | curOp.getCurrentPasswords(); |
| | | assertNotNull(curOp.getCurrentEntry()); |
| | |
| | | assertTrue(modifyOperation.getProcessingStopTime() >= |
| | | modifyOperation.getProcessingStartTime()); |
| | | assertTrue(modifyOperation.getProcessingTime() >= 0); |
| | | assertNotNull(modifyOperation.getResponseLogElements()); |
| | | |
| | | long changeNumber = modifyOperation.getChangeNumber(); |
| | | modifyOperation.setChangeNumber(changeNumber); |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE); |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | break responseLoop; |
| | | default: |
| | | // This is a problem. It's an unexpected response. |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | |
| | | throw new Exception("Unexpected response message " + message + |
| | | " encountered in " + |
| | |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | break responseLoop; |
| | | default: |
| | | // This is a problem. It's an unexpected response. |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | |
| | | throw new Exception("Unexpected response message " + message + |
| | | " encountered in " + |
| | |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | s.close(); |
| | | } catch (Exception e) {} |
| | | StaticUtils.close(s); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.BeforeMethod; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.opends.server.protocols.ldap.LDAPConnectionHandler; |
| | | import org.opends.server.protocols.ldap.LDAPStatistics; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.LDAPStatistics; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.Operation; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.BeforeMethod; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of generic test cases for operations |
| | |
| | | public abstract class OperationTestCase |
| | | extends CoreTestCase |
| | | { |
| | | // The LDAPStatistics object associated with the LDAP connection handler. |
| | | /** The LDAPStatistics object associated with the LDAP connection handler. */ |
| | | protected LDAPStatistics ldapStatistics; |
| | | |
| | | // The LDAPStatistics object associated with the LDAPS connection handler. |
| | | /** The LDAPStatistics object associated with the LDAPS connection handler. */ |
| | | protected LDAPStatistics ldapsStatistics; |
| | | |
| | | @BeforeMethod |
| | |
| | | TestCaseUtils.quiesceServer(); |
| | | } |
| | | |
| | | // When this was part of an @BeforeClass method, it was not called reliably |
| | | // for each subclass. |
| | | /** |
| | | * When this was part of an @BeforeClass method, it was not called reliably |
| | | * for each subclass. |
| | | */ |
| | | @BeforeMethod |
| | | public void initializeLDAPStatistics() |
| | | { |
| | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getCommonLogElements</CODE> method for the provided |
| | | * operation. |
| | | * |
| | | * @param operation The operation to test. |
| | | */ |
| | | @Test(dataProvider = "testOperations") |
| | | public void testGetCommonLogElements(Operation operation) |
| | | { |
| | | assertNotNull(operation.getCommonLogElements()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getRequestLogElements</CODE> method for the provided |
| | | * operation. |
| | | * |
| | | * @param operation The operation to test. |
| | | */ |
| | | @Test(dataProvider = "testOperations") |
| | | public void testGetRequestLogElements(Operation operation) |
| | | { |
| | | assertNotNull(operation.getRequestLogElements()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getClientConnection</CODE> method for the provided |
| | | * operation. |
| | | * |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.server.util.ServerConstants.OID_LDUP_SUBENTRIES; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.io.IOException; |
| | |
| | | import org.opends.server.protocols.asn1.ASN1Exception; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPConstants; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.protocols.ldap.SearchRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DereferencePolicy; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchResultReference; |
| | | import org.opends.server.types.SearchScope; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class SearchOperationTestCase extends OperationTestCase |
| | | { |
| | | private static final String SUFFIX = "dc=example,dc=com"; |
| | |
| | | assertTrue(searchOperation.getProcessingStartTime() > 0); |
| | | assertTrue(searchOperation.getProcessingStopTime() > 0); |
| | | assertTrue(searchOperation.getProcessingTime() >= 0); |
| | | assertNotNull(searchOperation.getResponseLogElements()); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | | // assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1); |
| | |
| | | assertTrue(modifyDNOperation.getProcessingStartTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingStopTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingTime() >= 0); |
| | | assertNotNull(modifyDNOperation.getResponseLogElements()); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | | // assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1); |
| | |
| | | assertTrue(modifyDNOperation.getProcessingStartTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingStopTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingTime() >= 0); |
| | | assertNotNull(modifyDNOperation.getResponseLogElements()); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 2); |
| | | // assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1); |
| | |
| | | assertTrue(modifyDNOperation.getProcessingStartTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingStopTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingTime() >= 0); |
| | | assertNotNull(modifyDNOperation.getResponseLogElements()); |
| | | assertTrue(modifyDNOperation.getErrorMessage().length() > 0); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | |
| | | assertTrue(modifyDNOperation.getProcessingStartTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingStopTime() > 0); |
| | | assertTrue(modifyDNOperation.getProcessingTime() >= 0); |
| | | assertNotNull(modifyDNOperation.getResponseLogElements()); |
| | | assertTrue(modifyDNOperation.getErrorMessage().length() > 0); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.plugins.InvocationCounterPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | import org.opends.server.types.CancelRequest; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of test cases for unbind operations |
| | |
| | | assertTrue(unbindOperation.getProcessingStartTime() > 0); |
| | | assertTrue(unbindOperation.getProcessingStopTime() > 0); |
| | | assertTrue(unbindOperation.getProcessingTime() >= 0); |
| | | assertNotNull(unbindOperation.getResponseLogElements()); |
| | | } |
| | | |
| | | |