EntryEncodeConfig.java revision 3c1fa5e3bbf2c06153a060f0490c5f10668f42e3
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2009 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS.
*/
/**
* This class defines a data structure that contains configuration
* information about how an entry should be encoded.
*/
mayInstantiate=true,
mayExtend=false,
mayInvoke=true)
public final class EntryEncodeConfig
{
/**
* The encode mask value that can be used to indicate that the
* encoded entry should not contain a DN.
*/
private static final byte ENCODE_FLAG_EXCLUDE_DN = 0x01;
/**
* The encode mask value that can be used that the encoded
* representation should compress the set of object classes.
*/
private static final byte ENCODE_FLAG_COMPRESS_OCS = 0x02;
/**
* The encode mask value that can be used that the encoded
* representation should compress the set of attribute descriptions
* to conserve space and improve performance.
*/
private static final byte ENCODE_FLAG_COMPRESS_ADS = 0x04;
/**
* A reference to an entry encode configuration with all the default
* settings.
*/
public static final EntryEncodeConfig
DEFAULT_CONFIG = new EntryEncodeConfig();
// Indicates whether to compress the attribute descriptions.
private final boolean compressAttrDescriptions;
// Indicates whether to compress the object class sets.
private final boolean compressObjectClassSets;
// Indicates whether to exclude the DN.
private final boolean excludeDN;
// The encoded representation of this encode configuration.
private final byte encodedRepresentation;
// The compressed schema handler for this encode configuration.
private final CompressedSchema compressedSchema;
/**
* Creates a new encoded entry configuration with the default
* settings.
*/
public EntryEncodeConfig()
{
excludeDN = false;
compressAttrDescriptions = false;
compressObjectClassSets = false;
encodedRepresentation = 0x00;
}
/**
* Creates a new encoded entry configuration with the specified
* settings.
*
* @param excludeDN Indicates whether to exclude
* the DN from the encoded entry.
* @param compressAttrDescriptions Indicates whether to compress
* attribute descriptions.
* @param compressObjectClassSets Indicates whether to compress
* object class sets.
*/
public EntryEncodeConfig(boolean excludeDN,
boolean compressAttrDescriptions,
boolean compressObjectClassSets)
{
byte flagByte = 0x00;
if (excludeDN)
{
}
{
}
{
}
}
/**
* Creates a new encoded entry configuration with the specified
* settings.
*
* @param excludeDN Indicates whether to exclude
* the DN from the encoded entry.
* @param compressAttrDescriptions Indicates whether to compress
* attribute descriptions.
* @param compressObjectClassSets Indicates whether to compress
* object class sets.
* @param compressedSchema The compressed schema manager
* for this encode config.
*/
public EntryEncodeConfig(boolean excludeDN,
boolean compressAttrDescriptions,
boolean compressObjectClassSets,
{
this.compressedSchema = compressedSchema;
byte flagByte = 0x00;
if (excludeDN)
{
}
{
}
{
}
}
/**
* Indicates whether the encoded entry should exclude the DN.
*
* @return {@code true} if the encoded entry should exclude the DN,
* or {@code false} if not.
*/
public boolean excludeDN()
{
return excludeDN;
}
/**
* Indicates whether the encoded entry should use compressed
* attribute descriptions.
*
* @return {@code true} if the encoded entry should use compressed
* attribute descriptions, or {@code false} if not.
*/
public boolean compressAttributeDescriptions()
{
return compressAttrDescriptions;
}
/**
* Indicates whether the encoded entry should use compressed object
* class sets.
*
* @return {@code true} if the encoded entry should use compressed
* object class sets, or {@code false} if not.
*/
public boolean compressObjectClassSets()
{
return compressObjectClassSets;
}
/**
* Retrieves the compressed schema manager that may be used to
* generate compact schema encodings with this entry encode
* configuration.
*
* @return The compressed schema manager that may be used to
* generate compact schema encodings with this entry encode
* configuration.
*/
public CompressedSchema getCompressedSchema()
{
return compressedSchema;
}
/**
* Encodes this entry encode configuration into a byte array
* suitable for inclusion in the encoded entry.
*
* @param buffer The buffer to encode this configuration to.
*/
{
}
/**
* Decodes the entry encode configuration from current position and
* length of the given byte array.
*
* @param buffer The byte array containing the encoded
* entry.
* @param length The number of bytes contained in the
* encode configuration.
* @param compressedSchema The compressed schema manager to use
* when decoding.
*
* @return The decoded configuration.
*
* @throws DirectoryException If the configuration cannot be
* properly decoded.
*/
public static EntryEncodeConfig
throws DirectoryException
{
if (length != 1)
{
throw new DirectoryException(
message);
}
}
{
}
/**
* Retrieves a string representation of this entry encode
* configuration.
*
* @return A string representation of this entry encode
* configuration.
*/
{
}
/**
* Appends a string representation of this entry encode
* configuration to the provided buffer.
*
* @param buffer The buffer to which the information should be
* appended.
*/
{
}
}