| | |
| | | import org.forgerock.opendj.ldap.responses.CompareResult; |
| | | import org.forgerock.opendj.ldap.responses.ExtendedResult; |
| | | import org.forgerock.opendj.ldap.responses.Result; |
| | | import org.opends.server.core.AbandonOperation; |
| | | import org.opends.server.core.AbandonOperationBasis; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.AddOperationBasis; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.BindOperationBasis; |
| | | import org.opends.server.core.BoundedWorkQueueStrategy; |
| | | import org.opends.server.core.CompareOperation; |
| | | import org.opends.server.core.CompareOperationBasis; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DeleteOperationBasis; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.opends.server.core.ExtendedOperationBasis; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyDNOperationBasis; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.core.QueueingStrategy; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.SearchOperationBasis; |
| | | import org.opends.server.core.UnbindOperation; |
| | | import org.opends.server.core.UnbindOperationBasis; |
| | | import org.opends.server.loggers.HTTPRequestInfo; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.protocols.ldap.AbandonRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.CompareRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.protocols.ldap.ModifyDNRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ModifyRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.ProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.UnbindRequestProtocolOp; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.DebugLogLevel; |
| | |
| | | { |
| | | operation.setInnerOperation(this.clientConnection.isInnerConnection()); |
| | | |
| | | HTTPConnectionHandler connHandler = |
| | | this.clientConnection.getConnectionHandler(); |
| | | if (connHandler.keepStats()) |
| | | { |
| | | connHandler.getStatTracker().updateMessageRead( |
| | | new LDAPMessage(operation.getMessageID(), |
| | | toRequestProtocolOp(operation))); |
| | | } |
| | | |
| | | // need this raw cast here to fool the compiler's generic type safety |
| | | // Problem here is due to the generic type R on enqueueOperation() |
| | | clientConnection.addOperationInProgress(operation, |
| | |
| | | return futureResult; |
| | | } |
| | | |
| | | private ProtocolOp toRequestProtocolOp(Operation operation) |
| | | { |
| | | operation.getResultCode().getIntValue(); |
| | | if (operation instanceof AbandonOperation) |
| | | { |
| | | final AbandonOperation op = (AbandonOperation) operation; |
| | | return new AbandonRequestProtocolOp(op.getIDToAbandon()); |
| | | } |
| | | else if (operation instanceof AddOperation) |
| | | { |
| | | final AddOperation op = (AddOperation) operation; |
| | | return new AddRequestProtocolOp(op.getRawEntryDN(), |
| | | op.getRawAttributes()); |
| | | } |
| | | else if (operation instanceof BindOperation) |
| | | { |
| | | final BindOperation op = (BindOperation) operation; |
| | | return new BindRequestProtocolOp(op.getRawBindDN(), |
| | | op.getSASLMechanism(), op.getSASLCredentials()); |
| | | } |
| | | else if (operation instanceof CompareOperation) |
| | | { |
| | | final CompareOperation op = (CompareOperation) operation; |
| | | return new CompareRequestProtocolOp(op.getRawEntryDN(), op |
| | | .getRawAttributeType(), op.getAssertionValue()); |
| | | } |
| | | else if (operation instanceof DeleteOperation) |
| | | { |
| | | final DeleteOperation op = (DeleteOperation) operation; |
| | | return new DeleteRequestProtocolOp(op.getRawEntryDN()); |
| | | } |
| | | else if (operation instanceof ExtendedOperation) |
| | | { |
| | | final ExtendedOperation op = (ExtendedOperation) operation; |
| | | return new ExtendedRequestProtocolOp(op.getRequestOID(), op |
| | | .getRequestValue()); |
| | | } |
| | | else if (operation instanceof ModifyDNOperation) |
| | | { |
| | | final ModifyDNOperation op = (ModifyDNOperation) operation; |
| | | return new ModifyDNRequestProtocolOp(op.getRawEntryDN(), op |
| | | .getRawNewRDN(), op.deleteOldRDN(), op.getRawNewSuperior()); |
| | | } |
| | | else if (operation instanceof ModifyOperation) |
| | | { |
| | | final ModifyOperation op = (ModifyOperation) operation; |
| | | return new ModifyRequestProtocolOp(op.getRawEntryDN(), op |
| | | .getRawModifications()); |
| | | } |
| | | else if (operation instanceof SearchOperation) |
| | | { |
| | | final SearchOperation op = (SearchOperation) operation; |
| | | return new SearchRequestProtocolOp(op.getRawBaseDN(), op.getScope(), op |
| | | .getDerefPolicy(), op.getSizeLimit(), op.getTimeLimit(), op |
| | | .getTypesOnly(), op.getRawFilter(), op.getAttributes()); |
| | | } |
| | | else if (operation instanceof UnbindOperation) |
| | | { |
| | | return new UnbindRequestProtocolOp(); |
| | | } |
| | | throw new RuntimeException("Not implemented for operation " + operation); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public FutureResult<Void> abandonAsync(AbandonRequest request) |