ModifyMsg.java revision 698a6b7c3937597f6d6e0ec3dbc79d9b9fc8a085
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2013 ForgeRock AS
*/
/**
* Message used to send Modify information.
*/
public class ModifyMsg extends ModifyCommonMsg
{
/**
* Creates a new Modify message from a ModifyOperation.
*
* @param op The operation to use for building the message
*/
{
}
/**
* Creates a new Modify message using the provided information.
*
* @param changeNumber The ChangeNumber for the operation.
* @param dn The baseDN of the operation.
* @param mods The mod of the operation.
* @param entryUUID The unique id of the entry on which the modification
* needs to apply.
*/
{
dn.toNormalizedString());
}
/**
* Creates a new Modify message from a byte[].
*
* @param in The byte[] from which the operation must be read.
* @throws DataFormatException If the input byte[] is not a valid ModifyMsg
* @throws UnsupportedEncodingException If UTF8 is not supported by the JVM.
*/
{
// Decode header
byte[] allowedPduTypes = new byte[2];
// protocol version has been read as part of the header
if (protocolVersion <= 3)
else
{
}
}
/**
* Creates a new Modify message from a V1 byte[].
*
* @param in The byte[] from which the operation must be read.
* @throws DataFormatException If the input byte[] is not a valid ModifyMsg
* @throws UnsupportedEncodingException If UTF8 is not supported by the JVM.
*
* @return The created ModifyMsg.
*/
{
// bytes is only for current version (of the protocol) bytes !
return msg;
}
/**
* {@inheritDoc}
*/
{
return mod;
}
/**
* {@inheritDoc}
*/
{
{
return "ModifyMsg content: " +
" protocolVersion: " + protocolVersion +
" dn: " + dn +
" changeNumber: " + changeNumber +
" uniqueId: " + entryUUID +
" assuredFlag: " + assuredFlag;
}
{
try
{
{
}
} catch (LDAPException e)
{
} catch (ASN1Exception e)
{
}
return "ModifyMsg content: " +
" protocolVersion: " + protocolVersion +
" dn: " + dn +
" changeNumber: " + changeNumber +
" uniqueId: " + entryUUID +
" assuredFlag: " + assuredFlag +
" assuredMode: " + assuredMode +
" safeDataLevel: " + safeDataLevel +
mods;
}
}
/**
* {@inheritDoc}
*/
public int size()
{
// The ModifyMsg can be very large when added or deleted attribute
// values are very large.
// We therefore need to count the whole encoded msg.
}
// ============
// Msg Encoding
// ============
/**
* {@inheritDoc}
*/
public byte[] getBytes_V1() throws UnsupportedEncodingException
{
/* encode the header in a byte[] large enough to also contain the mods */
1);
/* add the mods */
return encodedMsg;
}
/**
* {@inheritDoc}
*/
public byte[] getBytes_V23() throws UnsupportedEncodingException
{
// Encoding V2 / V3
/* encode the header in a byte[] large enough to also contain mods */
/* add the mods */
return encodedMsg;
}
/**
* {@inheritDoc}
*/
public byte[] getBytes_V45(short reqProtocolVersion)
throws UnsupportedEncodingException
{
int bodyLength = 0;
byte[] byteModsLen =
byte[] byteEntryAttrLen =
/* encode the header in a byte[] large enough to also contain the mods */
return encodedMsg;
}
// ============
// Msg decoding
// ============
throws DataFormatException
{
// Read and store the mods, in encoded form
// all the remaining bytes but the terminating 0 */
encodedMods = new byte[length];
try
{
} catch (IndexOutOfBoundsException e)
{
throw new DataFormatException(e.getMessage());
} catch (ArrayStoreException e)
{
throw new DataFormatException(e.getMessage());
} catch (NullPointerException e)
{
throw new DataFormatException(e.getMessage());
}
}
{
// Read mods len
this.encodedMods = new byte[modsLen];
try
{
} catch (IndexOutOfBoundsException e)
{
throw new DataFormatException(e.getMessage());
} catch (ArrayStoreException e)
{
throw new DataFormatException(e.getMessage());
} catch (NullPointerException e)
{
throw new DataFormatException(e.getMessage());
}
// Read ecl attr len
encodedEclIncludes = new byte[eclAttrLen];
try
{
} catch (IndexOutOfBoundsException e)
{
throw new DataFormatException(e.getMessage());
} catch (ArrayStoreException e)
{
throw new DataFormatException(e.getMessage());
} catch (NullPointerException e)
{
throw new DataFormatException(e.getMessage());
}
}
}