| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | public class LDAPPostReadResponseControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.controls.LDAPPostReadResponseControl"; |
| | | |
| | | |
| | | |
| | |
| | | super(OID_LDAP_READENTRY_POSTREAD, false, |
| | | encodeEntry(searchEntry)); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(searchEntry)); |
| | | |
| | | this.searchEntry = searchEntry; |
| | | } |
| | |
| | | { |
| | | super(oid, isCritical, encodeEntry(searchEntry)); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(oid), |
| | | String.valueOf(isCritical), |
| | | String.valueOf(searchEntry)); |
| | | |
| | | this.searchEntry = searchEntry; |
| | | } |
| | |
| | | { |
| | | super(oid, isCritical, encodedValue); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(oid), |
| | | String.valueOf(isCritical), |
| | | String.valueOf(searchEntry), |
| | | String.valueOf(encodedValue)); |
| | | |
| | | this.searchEntry = searchEntry; |
| | | } |
| | |
| | | public static LDAPPostReadResponseControl decodeControl(Control control) |
| | | throws LDAPException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "decodeControl", String.valueOf(control)); |
| | | |
| | | if (! control.hasValue()) |
| | | { |
| | |
| | | } |
| | | catch (ASN1Exception ae) |
| | | { |
| | | assert debugException(CLASS_NAME, "decodeControl", ae); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, ae); |
| | | } |
| | | |
| | | int msgID = MSGID_POSTREADRESP_CANNOT_DECODE_VALUE; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | |
| | | } |
| | | catch (LDAPException le) |
| | | { |
| | | assert debugException(CLASS_NAME, "decodeControl", le); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, le); |
| | | } |
| | | |
| | | int msgID = MSGID_POSTREADRESP_CANNOT_DECODE_VALUE; |
| | | String message = getMessage(msgID, le.getMessage()); |
| | |
| | | */ |
| | | private static ASN1OctetString encodeEntry(SearchResultEntry searchEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encodeEntry", String.valueOf(searchEntry)); |
| | | |
| | | |
| | | SearchResultEntryProtocolOp protocolOp = |
| | |
| | | */ |
| | | public SearchResultEntry getSearchEntry() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSearchEntry"); |
| | | |
| | | return searchEntry; |
| | | } |
| | |
| | | */ |
| | | public void setSearchEntry(SearchResultEntry searchEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setSearchEntry", |
| | | String.valueOf(searchEntry)); |
| | | |
| | | this.searchEntry = searchEntry; |
| | | setValue(encodeEntry(searchEntry)); |
| | |
| | | */ |
| | | public String toString() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString"); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | toString(buffer); |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString", "java.lang.StringBuilder"); |
| | | |
| | | buffer.append("LDAPPostReadResponseControl(criticality="); |
| | | buffer.append(isCritical()); |