AttributeCleanupPlugin.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* 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 2011 profiq s.r.o.
* Portions Copyright 2011-2015 ForgeRock AS.
*/
/**
* renames the configured parameters from the incoming ADD and MODIFY requests.
*/
public class AttributeCleanupPlugin extends
DirectoryServerPlugin<AttributeCleanupPluginCfg> implements
{
/**
* Plugin configuration.
*/
private AttributeCleanupPluginCfg config;
/**
* Debug tracer.
*/
/**
* A table of attributes to be renamed.
*/
/**
* The set of attributes to be removed.
*/
/**
* This lock prevents concurrent updates to the configuration while operations
* are being processed.
*/
/**
* Default constructor.
*/
public AttributeCleanupPlugin()
{
super();
}
/**
* {@inheritDoc}
*/
final AttributeCleanupPluginCfg config)
{
try
{
/* Apply the change, as at this point is has been validated. */
{
}
{
}
/* Update was successful, no restart required. */
return new ConfigChangeResult();
}
finally
{
}
}
/**
* {@inheritDoc}
*/
final PreParseAddOperation addOperation)
{
sharedLock.lock();
try
{
/*
* First strip the listed attributes, then rename the ones that remain.
*/
}
finally
{
sharedLock.unlock();
}
}
/**
* {@inheritDoc}
*/
{
sharedLock.lock();
try
{
/*
* First strip the listed attributes, then rename the ones that remain.
*/
/*
* If the MODIFY request has been stripped of ALL modifications, stop the
* processing and return SUCCESS to the client.
*/
{
if (logger.isTraceEnabled())
{
+ "modifications. The processing should be stopped.");
}
}
}
finally
{
sharedLock.unlock();
}
}
/**
* {@inheritDoc}
*/
public void finalizePlugin()
{
/*
* It's not essential to take the lock here, but we will anyhow for
* consistency with other methods.
*/
try
{
/* Deregister change listeners. */
}
finally
{
}
}
/**
* {@inheritDoc}
*/
{
/*
* The plugin should be invoked only for pre-parse ADD and MODIFY
* operations.
*/
for (final PluginType t : pluginTypes)
{
switch (t)
{
case PRE_PARSE_ADD:
break;
case PRE_PARSE_MODIFY:
break;
default:
}
}
/* Verify the current configuration. */
{
}
/* Register change listeners. */
/* Save the configuration. */
}
/**
* {@inheritDoc}
*/
{
final AttributeCleanupPluginCfg cfg =
}
/**
* {@inheritDoc}
*/
public boolean isConfigurationChangeAcceptable(
{
/*
* The admin framework will ensure that there are no duplicate attributes to
* be removed.
*/
boolean isValid = true;
/*
* Verify that there are no duplicate mappings and that attributes are
* renamed to valid attribute types.
*/
{
/*
* The format is: from:to where each 'from' and 'to' are attribute
* descriptions. The admin framework ensures that the format is correct.
*/
/*
* Make sure that toAttr is defined within the server, being careful to
* ignore attribute options.
*/
{
isValid = false;
}
/*
* Check for duplicates.
*/
{
isValid = false;
}
else
{
}
/*
* Check that attribute does not map to itself.
*/
{
isValid = false;
}
}
return isValid;
}
/**
* Remove the attributes listed in the configuration under
* ds-cfg-remove-inbound-attributes from the incoming ADD request.
*
* @param addOperation
* Current ADD operation.
*/
{
{
{
if (logger.isTraceEnabled())
{
}
}
}
}
/**
* Remove the attributes listed in the configuration under
* ds-cfg-remove-inbound-attributes from the incoming MODIFY request.
*
* @param modifyOperation
* Current MODIFY operation.
*/
private void processInboundRemove(
{
{
{
if (logger.isTraceEnabled())
{
}
}
}
}
/**
* Map the incoming attributes to the local ones.
*
* @param addOperation
* Current ADD operation.
*/
{
{
{
if (logger.isTraceEnabled())
{
}
}
}
}
/**
* Rename the attributes in the incoming MODIFY request to names that exist in
* the local schema as defined in the configuration.
*
* @param modifyOperation
* Current MODIFY operation.
*/
private void processInboundRename(
{
{
{
if (logger.isTraceEnabled())
{
}
}
}
}
}