NetworkGroupPlugin.java revision d25372dc8e65a9ed019a88fdf659ca61313f1b31
/*
* 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.
*/
/**
* This class implements a Directory Server plugin that will evaluate
* the appropriate network group for each client connection.
* A network group enforces specific resource limits.
*/
public final class NetworkGroupPlugin
implements ConfigurationChangeListener<NetworkGroupPluginCfg>
{
// The current configuration for this plugin.
private NetworkGroupPluginCfg currentConfig;
/**
* 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 NetworkGroupPlugin()
{
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_CONNECT:
case PRE_PARSE_ADD:
case PRE_PARSE_BIND:
case PRE_PARSE_COMPARE:
case PRE_PARSE_DELETE:
case PRE_PARSE_EXTENDED:
case PRE_PARSE_MODIFY:
case PRE_PARSE_MODIFY_DN:
case PRE_PARSE_SEARCH:
case PRE_PARSE_UNBIND:
case POST_RESPONSE_BIND:
case POST_RESPONSE_EXTENDED:
// These are acceptable
break;
default:
throw new ConfigException(message);
}
}
}
/**
* {@inheritDoc}
*/
@Override()
public final void finalizePlugin()
{
}
/**
* Performs resource limits checks and request filtering policy checks.
*
* @param connection The client connection on which the operation is done
* @param operation The operation to be performed
* @param fullCheck boolean indicating whether all the resource limit checks
* must be performed or only a limited set
* @param messages The list of error messages returned during the checking
*/
private boolean checkNetworkGroup(
boolean fullCheck,
{
return false;
}
return false;
}
}
return true;
}
/**
* Sets the network group and checks resource limits + request
* filtering policy.
*
* @param connection The client connection on which the operation is
* executed
*/
private boolean setAndCheckNetworkGroup(
{
boolean fullCheck = false;
if (connection.mustEvaluateNetworkGroup()) {
fullCheck = true;
}
connection.mustEvaluateNetworkGroup(false);
}
}
/**
* {@inheritDoc}
*/
@Override()
public final PluginResult.PostConnect
{
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
boolean fullCheck = false;
try {
} catch (DirectoryException ex) {
ex.getMessageObject());
}
fullCheck = true;
}
connection.mustEvaluateNetworkGroup(false);
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
} else {
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
}
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
}
}
/**
* {@inheritDoc}
*/
@Override()
{
}
/**
* {@inheritDoc}
*/
public boolean isConfigurationChangeAcceptable(
{
boolean configAcceptable = true;
// Ensure that the set of plugin types contains only LDIF import and
// pre-operation add.
{
switch (pluginType)
{
case POSTCONNECT:
case PREPARSEADD:
case PREPARSEBIND:
case PREPARSECOMPARE:
case PREPARSEDELETE:
case PREPARSEEXTENDED:
case PREPARSEMODIFY:
case PREPARSEMODIFYDN:
case PREPARSESEARCH:
case PREPARSEUNBIND:
case POSTRESPONSEBIND:
case POSTRESPONSEEXTENDED:
// These are acceptable.
break;
default:
pluginType.toString());
configAcceptable = false;
}
}
return configAcceptable;
}
/**
* {@inheritDoc}
*/
{
}
}