| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.ModificationType; |
| | | |
| | | 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 org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ProtocolMessages.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | |
| | | */ |
| | | public class LDAPModification |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class to use for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.protocols.ldap.LDAPModification"; |
| | | |
| | | |
| | | |
| | |
| | | public LDAPModification(ModificationType modificationType, |
| | | LDAPAttribute attribute) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(modificationType), |
| | | String.valueOf(attribute)); |
| | | |
| | | this.modificationType = modificationType; |
| | | this.attribute = attribute; |
| | |
| | | */ |
| | | public ModificationType getModificationType() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getModificationType"); |
| | | |
| | | return modificationType; |
| | | } |
| | |
| | | */ |
| | | public void setModificationType(ModificationType modificationType) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setModificationType", |
| | | String.valueOf(modificationType)); |
| | | |
| | | this.modificationType = modificationType; |
| | | } |
| | |
| | | */ |
| | | public LDAPAttribute getAttribute() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAttribute"); |
| | | |
| | | return attribute; |
| | | } |
| | |
| | | */ |
| | | public void setAttribute(LDAPAttribute attribute) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setAttribute", String.valueOf(attribute)); |
| | | |
| | | this.attribute = attribute; |
| | | } |
| | |
| | | */ |
| | | public ASN1Element encode() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encode"); |
| | | |
| | | ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2); |
| | | elements.add(new ASN1Enumerated(modificationType.intValue())); |
| | |
| | | public static LDAPModification decode(ASN1Element element) |
| | | throws LDAPException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "decode", String.valueOf(element)); |
| | | |
| | | ArrayList<ASN1Element> elements; |
| | | try |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "decode", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_LDAP_MODIFICATION_DECODE_SEQUENCE; |
| | | int msgID = MSGID_LDAP_MODIFICATION_DECODE_SEQUENCE; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | throw new LDAPException(PROTOCOL_ERROR, msgID, message, e); |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "decode", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_LDAP_MODIFICATION_DECODE_MOD_TYPE; |
| | | int msgID = MSGID_LDAP_MODIFICATION_DECODE_MOD_TYPE; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | throw new LDAPException(PROTOCOL_ERROR, msgID, message, e); |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "decode", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_LDAP_MODIFICATION_DECODE_ATTR; |
| | | int msgID = MSGID_LDAP_MODIFICATION_DECODE_ATTR; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | throw new LDAPException(PROTOCOL_ERROR, msgID, message, e); |
| | | } |
| | |
| | | */ |
| | | 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("LDAPModification(type="); |
| | | buffer.append(String.valueOf(modificationType)); |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer, int indent) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString", "java.lang.StringBuilder", |
| | | String.valueOf(indent)); |
| | | |
| | | StringBuilder indentBuf = new StringBuilder(indent); |
| | | for (int i=0 ; i < indent; i++) |