| | |
| | | * 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.LDAPException; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.Control; |
| | | 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 PasswordExpiringControl |
| | | extends Control |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.controls.PasswordExpiringControl"; |
| | | |
| | | |
| | | |
| | |
| | | super(OID_NS_PASSWORD_EXPIRING, false, |
| | | new ASN1OctetString(String.valueOf(secondsUntilExpiration))); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | |
| | | this.secondsUntilExpiration = secondsUntilExpiration; |
| | | } |
| | |
| | | super(oid, isCritical, |
| | | new ASN1OctetString(String.valueOf(secondsUntilExpiration))); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(oid), |
| | | String.valueOf(isCritical)); |
| | | |
| | | this.secondsUntilExpiration = secondsUntilExpiration; |
| | | } |
| | |
| | | { |
| | | super(oid, isCritical, encodedValue); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(oid), |
| | | String.valueOf(isCritical)); |
| | | |
| | | this.secondsUntilExpiration = secondsUntilExpiration; |
| | | } |
| | |
| | | public static PasswordExpiringControl decodeControl(Control control) |
| | | throws LDAPException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "decodeControl", String.valueOf(control)); |
| | | |
| | | if (! control.hasValue()) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "decodeControl", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION; |
| | | String message = getMessage(msgID, stackTraceToSingleLineString(e)); |
| | |
| | | */ |
| | | public int getSecondsUntilExpiration() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSecondsUntilExpiration"); |
| | | |
| | | return secondsUntilExpiration; |
| | | } |
| | |
| | | */ |
| | | 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("PasswordExpiringControl(secondsUntilExpiration="); |
| | | buffer.append(secondsUntilExpiration); |