/*
* 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-2008 Sun Microsystems, Inc.
* Portions Copyright 2011-2012 ForgeRock AS
*/
/**
* This class implements a Directory Server plugin that will add the
* replication CSN to a response whenever the CSN control is received.
*/
public final class ChangeNumberControlPlugin
{
// The current configuration for this plugin.
/**
* The control used by this plugin.
*/
{
/**
* Constructs a new change number control.
*
* @param isCritical Indicates whether support for this control should be
* considered a critical part of the server processing.
* @param cn The change number.
*/
{
super(OID_CSN_CONTROL, isCritical);
}
/**
* Writes this control's value to an ASN.1 writer. The value (if any) must
* be written as an ASN1OctetString.
*
* @param writer The ASN.1 writer to use.
* @throws IOException If a problem occurs while writing to the stream.
*/
}
/**
* Retrieves the change number.
*
* @return The change number.
*/
{
return cn;
}
}
/**
* Creates a new instance of this Directory Server plugin. Every plugin must
* implement a default constructor (it is the only one that will be used to
* create plugins defined in the configuration), and every plugin constructor
* must call <CODE>super()</CODE> as its first element.
*/
public ChangeNumberControlPlugin()
{
super();
}
/**
* {@inheritDoc}
*/
@Override()
throws ConfigException
{
// Make sure that the plugin has been enabled for the appropriate types.
for (PluginType t : pluginTypes)
{
switch (t)
{
case POST_OPERATION_ADD:
case POST_OPERATION_DELETE:
case POST_OPERATION_MODIFY:
case POST_OPERATION_MODIFY_DN:
// These are acceptable.
break;
default:
throw new ConfigException(message);
}
}
boolean first = true;
for (PluginType t : types) {
if (first) {
first = false;
} else {
}
}
throw new ConfigException(message);
}
}
/**
* {@inheritDoc}
*/
@Override()
public final void finalizePlugin()
{
}
/**
* {@inheritDoc}
*/
@Override()
public final PluginResult.PostOperation
{
// We shouldn't ever need to return a non-success result.
}
/**
* {@inheritDoc}
*/
@Override()
public final PluginResult.PostOperation
{
// We shouldn't ever need to return a non-success result.
}
/**
* {@inheritDoc}
*/
@Override()
public final PluginResult.PostOperation
{
// We shouldn't ever need to return a non-success result.
}
/**
* {@inheritDoc}
*/
@Override()
public final PluginResult.PostOperation
{
// We shouldn't ever need to return a non-success result.
}
/**
* {@inheritDoc}
*/
@Override()
{
}
/**
* {@inheritDoc}
*/
public boolean isConfigurationChangeAcceptable(
{
boolean configAcceptable = true;
// Ensure that the set of plugin types contains only pre-operation add,
// pre-operation modify, and pre-operation modify DN.
{
switch (pluginType)
{
case POSTOPERATIONADD:
case POSTOPERATIONDELETE:
case POSTOPERATIONMODIFY:
case POSTOPERATIONMODIFYDN:
// These are acceptable.
break;
default:
pluginType.toString());
configAcceptable = false;
}
}
return configAcceptable;
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the Change number from the synchronization context
* and sets the control response in the operation.
*
* @param operation the operation
*/
for (Control c : requestControls) {
}
}
break;
}
}
}
}
}