From a76738453f128ab5b83f0185082aadb516518fbd Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 04 Nov 2014 10:25:05 +0000
Subject: [PATCH] OPENDJ-1545 Remove Workflow, NetworkGroups and related attempts at building a proxy
---
/dev/null | 124 -----------------
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java | 12 -
opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java | 280 ---------------------------------------
3 files changed, 4 insertions(+), 412 deletions(-)
diff --git a/opendj-config-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/QOSPolicyConfiguration.xml b/opendj-config-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/QOSPolicyConfiguration.xml
deleted file mode 100644
index 601a640..0000000
--- a/opendj-config-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/QOSPolicyConfiguration.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ! 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
- ! or http://forgerock.org/license/CDDLv1.0.html.
- ! 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.
- !
--->
-<adm:managed-object name="qos-policy"
- plural-name="qos-policies"
- abstract="true"
- package="org.forgerock.opendj.server.config"
- xmlns:adm="http://opendj.forgerock.org/admin"
- xmlns:ldap="http://opendj.forgerock.org/admin-ldap">
- <adm:synopsis>
- <adm:user-friendly-plural-name/>
- determine the quality of service (QoS) clients receive when
- interacting with the server.
- </adm:synopsis>
- <adm:tag name="core-server"/>
- <adm:profile name="ldap">
- <ldap:object-class>
- <ldap:name>ds-cfg-qos-policy</ldap:name>
- <ldap:superior>top</ldap:superior>
- </ldap:object-class>
- </adm:profile>
- <adm:property name="java-class" mandatory="true">
- <adm:synopsis>
- Specifies the fully-qualified name of the Java class that provides the
- <adm:user-friendly-name />
- implementation.
- </adm:synopsis>
- <adm:requires-admin-action>
- <adm:component-restart />
- </adm:requires-admin-action>
- <adm:syntax>
- <adm:java-class>
- <adm:instance-of>
- org.opends.server.api.QOSPolicyFactory
- </adm:instance-of>
- </adm:java-class>
- </adm:syntax>
- <adm:profile name="ldap">
- <ldap:attribute>
- <ldap:name>ds-cfg-java-class</ldap:name>
- </ldap:attribute>
- </adm:profile>
- </adm:property>
-</adm:managed-object>
diff --git a/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/QOSPolicyConfiguration.xml b/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/QOSPolicyConfiguration.xml
deleted file mode 100644
index 34343f9..0000000
--- a/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/QOSPolicyConfiguration.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ! 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
- ! or http://forgerock.org/license/CDDLv1.0.html.
- ! 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.
- !
--->
-<adm:managed-object name="qos-policy"
- plural-name="qos-policies"
- abstract="true"
- package="org.opends.server.admin.std"
- xmlns:adm="http://www.opends.org/admin"
- xmlns:ldap="http://www.opends.org/admin-ldap">
- <adm:synopsis>
- <adm:user-friendly-plural-name/>
- determine the quality of service (QoS) clients receive when
- interacting with the server.
- </adm:synopsis>
- <adm:tag name="core-server"/>
- <adm:profile name="ldap">
- <ldap:object-class>
- <ldap:name>ds-cfg-qos-policy</ldap:name>
- <ldap:superior>top</ldap:superior>
- </ldap:object-class>
- </adm:profile>
- <adm:property name="java-class" mandatory="true">
- <adm:synopsis>
- Specifies the fully-qualified name of the Java class that provides the
- <adm:user-friendly-name />
- implementation.
- </adm:synopsis>
- <adm:requires-admin-action>
- <adm:component-restart />
- </adm:requires-admin-action>
- <adm:syntax>
- <adm:java-class>
- <adm:instance-of>
- org.opends.server.api.QOSPolicyFactory
- </adm:instance-of>
- </adm:java-class>
- </adm:syntax>
- <adm:profile name="ldap">
- <ldap:attribute>
- <ldap:name>ds-cfg-java-class</ldap:name>
- </ldap:attribute>
- </adm:profile>
- </adm:property>
-</adm:managed-object>
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/QOSPolicy.java b/opendj3-server-dev/src/server/org/opends/server/api/QOSPolicy.java
deleted file mode 100644
index 0e71b99..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/api/QOSPolicy.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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.
- */
-
-package org.opends.server.api;
-
-
-
-/**
- * An abstract QOS policy.
- */
-public abstract class QOSPolicy
-{
- /**
- * Creates a new abstract QOS Policy.
- */
- protected QOSPolicy()
- {
- // No implementation required.
- }
-
-
-
- /**
- * Performs any necessary work to finalize this QOS policy.
- * <p>
- * The default implementation is to do nothing.
- */
- public void finalizeQOSPolicy()
- {
- // Do nothing by default.
- }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/QOSPolicyFactory.java b/opendj3-server-dev/src/server/org/opends/server/api/QOSPolicyFactory.java
deleted file mode 100644
index 2761550..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/api/QOSPolicyFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 2014 ForgeRock AS
- */
-
-package org.opends.server.api;
-
-
-
-import java.util.List;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.admin.std.server.QOSPolicyCfg;
-import org.forgerock.opendj.config.server.ConfigException;
-import org.opends.server.types.InitializationException;
-
-
-
-/**
- * A factory for creating configurable quality of service (QOS)
- * policies.
- * <p>
- * All implementations must have a default constructor, i.e. one that
- * does not require and arguments.
- *
- * @param <T>
- * The type of QOS policy configuration handled by this
- * factory.
- */
-public interface QOSPolicyFactory<T extends QOSPolicyCfg>
-{
- /**
- * Creates a new QOS policy using the provided configuration.
- *
- * @param configuration
- * The configuration.
- * @return The new QOS policy configured using the provided
- * configuration.
- * @throws ConfigException
- * If an unrecoverable problem arises during
- * initialization of the QOS policy as a result
- * of the server configuration.
- * @throws InitializationException
- * If a problem occurs during initialization of the QOS
- * policy.
- */
- QOSPolicy createQOSPolicy(T configuration) throws ConfigException,
- InitializationException;
-
-
-
- /**
- * Indicates whether the provided QOS policy configuration is
- * acceptable.
- *
- * @param configuration
- * The QOS policy configuration.
- * @param unacceptableReasons
- * A list that can be used to hold messages about why the
- * provided configuration is not acceptable.
- * @return Returns <code>true</code> if the provided QOS policy
- * configuration is acceptable, or <code>false</code> if
- * it is not.
- */
- boolean isConfigurationAcceptable(T configuration,
- List<LocalizableMessage> unacceptableReasons);
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
index 82d3097..67ebf5b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -26,24 +26,14 @@
*/
package org.opends.server.core.networkgroups;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import java.util.TreeMap;
-import java.util.concurrent.ConcurrentHashMap;
import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ResultCode;
-import org.opends.server.admin.ClassPropertyDefinition;
-import org.opends.server.admin.std.meta.QOSPolicyCfgDefn;
-import org.opends.server.admin.std.server.QOSPolicyCfg;
import org.opends.server.api.ClientConnection;
-import org.opends.server.api.QOSPolicy;
-import org.opends.server.api.QOSPolicyFactory;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.RootDseWorkflowTopology;
import org.opends.server.core.Workflow;
@@ -53,12 +43,9 @@
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
-import org.opends.server.types.operation.PreParseOperation;
import static org.forgerock.util.Reject.*;
-import static org.opends.messages.ConfigMessages.*;
import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.util.StaticUtils.*;
/**
* This class defines the network group. A network group is used to
@@ -108,8 +95,6 @@
// A lock to protect concurrent access to the registeredNetworkGroups.
private static final Object registeredNetworkGroupsLock = new Object();
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
/**
@@ -141,36 +126,6 @@
}
-
- /**
- * Gets the highest priority matching network group for a BIND op.
- *
- * @param connection
- * the client connection
- * @param dn
- * the operation bindDN
- * @param authType
- * the operation authentication type
- * @param isSecure
- * a boolean indicating whether the operation is secured
- * @return matching network group
- */
- static NetworkGroup findBindMatchingNetworkGroup(
- ClientConnection connection, DN dn, AuthenticationType authType,
- boolean isSecure)
- {
- for (NetworkGroup ng : orderedNetworkGroups)
- {
- if (ng.matchAfterBind(connection, dn, authType, isSecure))
- {
- return ng;
- }
- }
- return defaultNetworkGroup;
- }
-
-
-
/**
* Gets the highest priority matching network group.
*
@@ -246,7 +201,7 @@
}
// The network group connection criteria.
- private ConnectionCriteria criteria = ConnectionCriteria.TRUE;
+ private final ConnectionCriteria criteria = ConnectionCriteria.TRUE;
private final boolean isAdminNetworkGroup;
private final boolean isDefaultNetworkGroup;
@@ -259,10 +214,6 @@
// The network group internal identifier.
private final String networkGroupID;
- // All network group policies mapping factory class name to policy.
- private final Map<DN, QOSPolicy> policies =
- new ConcurrentHashMap<DN, QOSPolicy>();
-
// The network group priority.
private int priority = 100;
@@ -275,12 +226,6 @@
// nodes.
private final Object registeredWorkflowNodesLock = new Object();
- // The network group request filtering policy.
- private RequestFilteringPolicy requestFilteringPolicy = null;
-
- // The network group resource limits policy.
- private ResourceLimitsPolicy resourceLimitsPolicy = null;
-
// The workflow node for the rootDSE entry. The RootDSE workflow node
// is not stored in the list of registered workflow nodes.
private RootDseWorkflowTopology rootDSEWorkflowNode = null;
@@ -310,69 +255,8 @@
*/
public void addConnection(ClientConnection connection)
{
- if (resourceLimitsPolicy != null)
- {
- resourceLimitsPolicy.addConnection(connection);
- }
}
-
-
- /**
- * Checks the request filtering policy.
- *
- * @param operation
- * the operation to be checked
- * @param messages
- * the error messages
- * @return boolean indicating whether the operation conforms to the
- * network group request filtering policy
- */
- boolean checkRequestFilteringPolicy(
- PreParseOperation operation, List<LocalizableMessage> messages)
- {
- if (requestFilteringPolicy != null)
- {
- return requestFilteringPolicy.isAllowed(operation, messages);
- }
- else
- {
- return true;
- }
- }
-
-
-
- /**
- * Checks the resource limits policy.
- *
- * @param connection
- * the client connection
- * @param operation
- * the ongoing operation
- * @param fullCheck
- * a boolean indicating the level of checking: full/partial
- * @param messages
- * the messages indicating the cause of the failure.
- * @return a boolean indicating whether resource limits are exceeded
- */
- boolean checkResourceLimitsPolicy(ClientConnection connection,
- PreParseOperation operation, boolean fullCheck,
- List<LocalizableMessage> messages)
- {
- if (resourceLimitsPolicy != null)
- {
- return resourceLimitsPolicy.isAllowed(connection, operation,
- fullCheck, messages);
- }
- else
- {
- return true;
- }
- }
-
-
-
/**
* Deregisters a workflow with the network group. The workflow to
* deregister is identified by its baseDN.
@@ -494,29 +378,6 @@
return workflow;
}
-
-
- /**
- * Performs any finalization that might be required when this network
- * group is unloaded. No action is taken in the default
- * implementation.
- */
- void finalizeNetworkGroup()
- {
- // Clean up policies.
- for (QOSPolicy policy : policies.values())
- {
- policy.finalizeQOSPolicy();
- }
-
- requestFilteringPolicy = null;
- resourceLimitsPolicy = null;
- criteria = ConnectionCriteria.TRUE;
- policies.clear();
- }
-
-
-
/**
* Retrieves the network group ID.
*
@@ -537,14 +398,7 @@
*/
public int getMinSubstring()
{
- if (resourceLimitsPolicy != null)
- {
- return resourceLimitsPolicy.getMinSubstring();
- }
- else
- {
- return 0;
- }
+ return 0;
}
@@ -562,32 +416,6 @@
/**
- * Returns the QOS policy associated with this network group having
- * the specified class.
- *
- * @param <T>
- * The type of QOS policy.
- * @param clazz
- * The class of QOS policy requested.
- * @return The QOS policy associated with this network group having
- * the specified class, or <code>null</code> if none was
- * found.
- */
- <T extends QOSPolicy> T getNetworkGroupQOSPolicy(Class<T> clazz)
- {
- for (QOSPolicy policy : policies.values())
- {
- if (clazz.isAssignableFrom(policy.getClass()))
- {
- return clazz.cast(policy);
- }
- }
- return null;
- }
-
-
-
- /**
* Gets the search size limit, i.e. the maximum number of entries
* returned by a search.
*
@@ -595,14 +423,7 @@
*/
public int getSizeLimit()
{
- if (resourceLimitsPolicy != null)
- {
- return resourceLimitsPolicy.getSizeLimit();
- }
- else
- {
- return DirectoryServer.getSizeLimit();
- }
+ return DirectoryServer.getSizeLimit();
}
@@ -615,14 +436,7 @@
*/
public int getTimeLimit()
{
- if (resourceLimitsPolicy != null)
- {
- return resourceLimitsPolicy.getTimeLimit();
- }
- else
- {
- return DirectoryServer.getTimeLimit();
- }
+ return DirectoryServer.getTimeLimit();
}
@@ -691,10 +505,6 @@
*/
public void removeConnection(ClientConnection connection)
{
- if (resourceLimitsPolicy != null)
- {
- resourceLimitsPolicy.removeConnection(connection);
- }
}
/**
@@ -778,23 +588,6 @@
}
}
-
-
- /**
- * Sets the network group connection criteria.
- * <p>
- * This method is intended for testing only.
- *
- * @param criteria
- * The connection criteria.
- */
- void setConnectionCriteria(ConnectionCriteria criteria)
- {
- this.criteria = criteria;
- }
-
-
-
/**
* Sets the network group priority.
* <p>
@@ -880,71 +673,6 @@
}
}
-
-
- // Creates and registers the provided network group policy
- // configuration.
- private void createNetworkGroupQOSPolicy(
- QOSPolicyCfg policyConfiguration) throws ConfigException,
- InitializationException
- {
- String className = policyConfiguration.getJavaClass();
- QOSPolicyCfgDefn d = QOSPolicyCfgDefn.getInstance();
- ClassPropertyDefinition pd = d.getJavaClassPropertyDefinition();
-
- QOSPolicy policy;
- try
- {
- Class<? extends QOSPolicyFactory> theClass =
- pd.loadClass(className, QOSPolicyFactory.class);
- QOSPolicyFactory factory = theClass.newInstance();
-
- policy = factory.createQOSPolicy(policyConfiguration);
- }
- catch (Exception e)
- {
- if (e instanceof InvocationTargetException)
- {
- Throwable t = e.getCause();
-
- if (t instanceof InitializationException)
- {
- throw (InitializationException) t;
- }
- else if (t instanceof ConfigException)
- {
- throw (ConfigException) t;
- }
- }
-
- logger.traceException(e);
-
- LocalizableMessage message = ERR_CONFIG_NETWORK_GROUP_POLICY_CANNOT_INITIALIZE.get(
- className, policyConfiguration.dn(), stackTraceToSingleLineString(e));
- throw new InitializationException(message, e);
- }
-
- // The network group has been successfully initialized - so register it.
- QOSPolicy oldPolicy =
- policies.put(policyConfiguration.dn(), policy);
-
- if (policy instanceof RequestFilteringPolicy)
- {
- requestFilteringPolicy = (RequestFilteringPolicy) policy;
- }
- else if (policy instanceof ResourceLimitsPolicy)
- {
- resourceLimitsPolicy = (ResourceLimitsPolicy) policy;
- }
-
- if (oldPolicy != null)
- {
- oldPolicy.finalizeQOSPolicy();
- }
- }
-
-
-
/**
* Deregisters a workflow node with the network group.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/RequestFilteringPolicy.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/RequestFilteringPolicy.java
deleted file mode 100644
index 632b4e8..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/RequestFilteringPolicy.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 2014 ForgeRock AS
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import java.util.List;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.api.QOSPolicy;
-import org.opends.server.types.operation.PreParseOperation;
-
-
-
-/**
- * This class defines the request filtering policy applicable to all
- * connections inside the same network group.
- */
-abstract class RequestFilteringPolicy extends QOSPolicy
-{
- /**
- * Creates a new request filtering policy.
- */
- protected RequestFilteringPolicy()
- {
- // No implementation required.
- }
-
- /**
- * Determines if the provided operation is allowed according to this
- * request filtering policy.
- *
- * @param operation
- * The operation
- * @param messages
- * The messages to include in the disconnect notification
- * response. It may be <CODE>null</CODE> if no message is to
- * be sent.
- * @return {@code true} if the operation is allowed.
- */
- abstract boolean isAllowed(PreParseOperation operation,
- List<LocalizableMessage> messages);
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ResourceLimitsPolicy.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ResourceLimitsPolicy.java
deleted file mode 100644
index 49af40e..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/ResourceLimitsPolicy.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
- */
-package org.opends.server.core.networkgroups;
-
-
-
-import java.util.List;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.api.QOSPolicy;
-import org.opends.server.types.operation.PreParseOperation;
-
-
-
-/**
- * This class defines the resource limits policy applicable to all
- * connections inside the same network group.
- */
-abstract class ResourceLimitsPolicy extends QOSPolicy
-{
- /**
- * Creates a new resource limits policy.
- */
- protected ResourceLimitsPolicy()
- {
- // No implementation required.
- }
-
-
-
- /**
- * Adds a connection to the network group.
- *
- * @param connection
- * The client connection.
- */
- abstract void addConnection(ClientConnection connection);
-
-
-
- /**
- * Returns the minimum string length for a substring filter.
- *
- * @return The minimum string length for a substring filter.
- */
- abstract int getMinSubstring();
-
-
-
- /**
- * Returns the default maximum number of entries that should be
- * returned for a searches processed by this network group.
- *
- * @return The default maximum number of entries that should be
- * returned for a searches processed by this network group.
- */
- abstract int getSizeLimit();
-
- /**
- * Returns the maximum length of time in seconds permitted for a
- * search operation processed by this network group.
- *
- * @return The maximum length of time in seconds permitted for a
- * search operation processed by this network group.
- */
- abstract int getTimeLimit();
-
-
-
- /**
- * Determines if the provided operation is allowed according to this
- * resource limits policy.
- *
- * @param connection
- * the ClientConnection to check
- * @param operation
- * the ongoing operation
- * @param fullCheck
- * a boolean indicating if full checks must be done
- * @param messages
- * the messages to include in the disconnect notification
- * response. It may be <CODE>null</CODE> if no message is to
- * be sent.
- * @return a boolean indicating whether the connection is allowed
- */
- abstract boolean isAllowed(ClientConnection connection,
- PreParseOperation operation, boolean fullCheck,
- List<LocalizableMessage> messages);
-
-
-
- /**
- * Removes a connection from the network group.
- *
- * @param connection
- * The client connection to remove.
- */
- abstract void removeConnection(ClientConnection connection);
-}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
index 9f6b478..ff3c846 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
@@ -677,15 +677,7 @@
"--set", "size-limit:" + searchSizeLimit,
"--set", "time-limit:" + searchTimeLimit + "s");
- // Check that the policy was created.
- ResourceLimitsPolicy policy = networkGroup.getNetworkGroupQOSPolicy(ResourceLimitsPolicy.class);
- assertNotNull(policy, "The policy was not registered.");
-
// Check the resource limits are set properly.
- assertEquals(policy.getTimeLimit(), searchTimeLimit);
- assertEquals(policy.getSizeLimit(), searchSizeLimit);
- assertEquals(policy.getMinSubstring(), minSubstringLength);
-
assertEquals(networkGroup.getTimeLimit(), searchTimeLimit);
assertEquals(networkGroup.getSizeLimit(), searchSizeLimit);
assertEquals(networkGroup.getMinSubstring(), minSubstringLength);
@@ -694,10 +686,6 @@
"delete-network-group-qos-policy",
"--group-name", networkGroupID,
"--policy-type", "resource-limits");
-
- // Check that the policy was removed.
- policy = networkGroup.getNetworkGroupQOSPolicy(ResourceLimitsPolicy.class);
- assertNull(policy, "The policy was not deregistered.");
}
finally
{
--
Gitblit v1.10.0