7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * CDDL HEADER START
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * The contents of this file are subject to the terms of the
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Common Development and Distribution License, Version 1.0 only
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * (the "License"). You may not use this file except in compliance
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * with the License.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * or http://forgerock.org/license/CDDLv1.0.html.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * See the License for the specific language governing permissions
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * and limitations under the License.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * When distributing Covered Code, include this CDDL HEADER in each
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * file and include the License file at legal-notices/CDDLv1_0.txt.
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * If applicable, add the following below this CDDL HEADER, with the
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * fields enclosed by brackets "[]" replaced with your own identifying
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac * information:
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Portions Copyright [yyyy] [name of copyright owner]
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * CDDL HEADER END
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Copyright 2009 Sun Microsystems, Inc.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrovimport static org.opends.messages.ProtocolMessages.*;
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrovimport static org.opends.server.protocols.asn1.ASN1Constants.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrovimport static org.opends.server.loggers.debug.DebugLogger.*;
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrovimport static org.opends.server.util.ServerConstants.*;
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * This class implements Subentries Control as defined in RFC 3672. It makes
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * it possible to control the visibility of entries and subentries which are
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * within scope of specific operation.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * ControlDecoder implentation to decode this control from a ByteString.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov private static final class Decoder
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * {@inheritDoc}
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov public SubentriesControl decode(boolean isCritical, ByteString value)
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov Message message = ERR_SUBENTRIES_NO_CONTROL_VALUE.get();
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov throw new DirectoryException(ResultCode.PROTOCOL_ERROR, message);
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov ERR_SUBENTRIES_CANNOT_DECODE_VALUE.get(getExceptionMessage(e));
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov throw new DirectoryException(ResultCode.PROTOCOL_ERROR, message, e);
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov return new SubentriesControl(isCritical, visibility);
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * The Control Decoder that can be used to decode this control.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov public static final ControlDecoder<SubentriesControl> DECODER =
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * The tracer object for the debug logger.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov private static final DebugTracer TRACER = getTracer();
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov // The visibility from the control value.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov private boolean visibility = false;
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Creates a new instance of the Subentries Control with the provided
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * information.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * @param isCritical Indicates whether support for this control
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * should be considered a critical part of the
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * server processing.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * @param visibility The visibility flag from the control value.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov public SubentriesControl(boolean isCritical, boolean visibility)
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Writes this control's value to an ASN.1 writer. The value must be
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * written as an ASN1OctetString.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * @param writer The ASN.1 writer to use.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * @throws IOException If a problem occurs while writing to the stream.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov protected void writeValue(ASN1Writer writer) throws IOException
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov writer.writeStartSequence(UNIVERSAL_OCTET_STRING_TYPE);
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Retrieves the visibility for this Subentries Control.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * @return The visibility for this Subentries Control.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov public boolean getVisibility()
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * Appends a string representation of this Subentries Control to the
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * provided buffer.
7e6345b129555b8ed3ec87d83b42a3cc55b66cf1abobrov * @param buffer The buffer to which the information should be appended.