| | |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.RDN; |
| | | |
| | | 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.util.StaticUtils.*; |
| | | |
| | | |
| | |
| | | public class LazyDN |
| | | extends DN |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = "org.opends.server.interop.LazyDN"; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | public LazyDN(String dnString) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(dnString)); |
| | | |
| | | this.dnString = dnString; |
| | | this.decodedDN = null; |
| | |
| | | public boolean isNullDN() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isNullDN"); |
| | | |
| | | return getDecodedDN().isNullDN(); |
| | | } |
| | |
| | | public int getNumComponents() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getNumComponents"); |
| | | |
| | | return getDecodedDN().getNumComponents(); |
| | | } |
| | |
| | | public RDN getRDN() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getRDN"); |
| | | |
| | | return getDecodedDN().getRDN(); |
| | | } |
| | | |
| | |
| | | public RDN getRDN(int pos) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getRDN", String.valueOf(pos)); |
| | | |
| | | return getDecodedDN().getRDN(pos); |
| | | } |
| | |
| | | public DN getParent() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getParent"); |
| | | |
| | | return getDecodedDN().getParent(); |
| | | } |
| | |
| | | public DN getParentDNInSuffix() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getParentDNInSuffix"); |
| | | |
| | | return getDecodedDN().getParentDNInSuffix(); |
| | | } |
| | |
| | | public DN concat(RDN rdn) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "concat", String.valueOf(rdn)); |
| | | |
| | | return getDecodedDN().concat(rdn); |
| | | } |
| | |
| | | public DN concat(RDN[] rdnComponents) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "concat", String.valueOf(rdnComponents)); |
| | | |
| | | return getDecodedDN().concat(rdnComponents); |
| | | } |
| | |
| | | public DN concat(DN relativeBaseDN) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "concat", String.valueOf(relativeBaseDN)); |
| | | |
| | | return getDecodedDN().concat(relativeBaseDN); |
| | | } |
| | |
| | | public boolean isDescendantOf(DN dn) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isDescendantOf", String.valueOf(dn)); |
| | | |
| | | return getDecodedDN().isDescendantOf(dn); |
| | | } |
| | |
| | | public boolean isAncestorOf(DN dn) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isAncestorOf", String.valueOf(dn)); |
| | | |
| | | return getDecodedDN().isAncestorOf(dn); |
| | | } |
| | |
| | | public boolean equals(Object o) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "equals", String.valueOf(o)); |
| | | |
| | | return getDecodedDN().equals(o); |
| | | } |
| | |
| | | public int hashCode() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hashCode"); |
| | | |
| | | return getDecodedDN().hashCode(); |
| | | } |
| | |
| | | @Override() |
| | | public String toString() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString"); |
| | | |
| | | return dnString; |
| | | } |
| | |
| | | @Override() |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toString", "java.lang.StringBuilder"); |
| | | |
| | | buffer.append(dnString); |
| | | } |
| | |
| | | public String toNormalizedString() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toNormalizedString"); |
| | | |
| | | return getDecodedDN().toNormalizedString(); |
| | | } |
| | |
| | | public void toNormalizedString(StringBuilder buffer) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "toNormalizedString", |
| | | "java.lang.StringBuilder"); |
| | | |
| | | getDecodedDN().toNormalizedString(buffer); |
| | | } |
| | |
| | | public int compareTo(DN dn) |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "compareTo", String.valueOf(dn)); |
| | | |
| | | return getDecodedDN().compareTo(dn); |
| | | } |
| | |
| | | private DN getDecodedDN() |
| | | throws RuntimeException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getDecodedDN"); |
| | | |
| | | if (decodedDN == null) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "getDecodedDN", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | throw new RuntimeException(stackTraceToSingleLineString(e)); |
| | | } |