InvocationCounterPlugin.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 2006-2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* This class defines a very simple plugin that simply increments a counter each
* time a plugin is called. There will be separate counters for each basic
* type of plugin, including:
* <BR>
* <UL>
* <LI>pre-parse</LI>
* <LI>pre-operation</LI>
* <LI>post-operation</LI>
* <LI>post-response</LI>
* <LI>search result entry</LI>
* <LI>search result reference</LI>
* <LI>intermediate response</LI>
* <LI>post-connect</LI>
* <LI>post-disconnect</LI>
* <LI>LDIF import</LI>
* <LI>LDIF export</LI>
* <LI>startup</LI>
* <LI>shutdown</LI>
* </UL>
*/
public class InvocationCounterPlugin
extends DirectoryServerPlugin<PluginCfg>
{
// Define the counters that will be used to keep track of everything.
private static AtomicInteger postSynchronizationCounter =
new AtomicInteger(0);
private static AtomicInteger subordinateModifyDNCounter =
new AtomicInteger(0);
private static AtomicInteger intermediateResponseCounter =
new AtomicInteger(0);
private static boolean startupCalled = false;
private static boolean shutdownCalled = false;
/**
* 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 InvocationCounterPlugin()
{
super();
}
/**
* {@inheritDoc}
*/
{
// No implementation required.
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreParse
{
}
/**
* Retrieves the number of times that the pre-parse plugins have been called
* since the last reset.
*
* @return The number of times that the pre-parse plugins have been called
* since the last reset.
*/
public static int getPreParseCount()
{
return preParseCounter.get();
}
/**
* Resets the pre-parse plugin invocation count to zero.
*
* @return The pre-parse plugin invocation count before it was reset.
*/
public static int resetPreParseCount()
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PreOperation
{
}
/**
* Retrieves the number of times that the pre-operation plugins have been
* called since the last reset.
*
* @return The number of times that the pre-operation plugins have been
* called since the last reset.
*/
public static int getPreOperationCount()
{
return preOperationCounter.get();
}
/**
* Resets the pre-operation plugin invocation count to zero.
*
* @return The pre-operation plugin invocation count before it was reset.
*/
public static int resetPreOperationCount()
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostOperation
{
}
/**
* Retrieves the number of times that the post-operation plugins have been
* called since the last reset.
*
* @return The number of times that the post-operation plugins have been
* called since the last reset.
*/
public static int getPostOperationCount()
{
return postOperationCounter.get();
}
/**
* Resets the post-operation plugin invocation count to zero.
*
* @return The post-operation plugin invocation count before it was reset.
*/
public static int resetPostOperationCount()
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* {@inheritDoc}
*/
public PluginResult.PostResponse
{
}
/**
* Retrieves the number of times that the post-response plugins have been
* called since the last reset.
*
* @return The number of times that the post-response plugins have been
* called since the last reset.
*/
public static int getPostResponseCount()
{
return postResponseCounter.get();
}
/**
* Resets the post-response plugin invocation count to zero.
*
* @return The post-response plugin invocation count before it was reset.
*/
public static int resetPostResponseCount()
{
}
/**
* {@inheritDoc}
*/
public void doPostSynchronization(PostSynchronizationAddOperation
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times that the post-synchronization plugins have
* been called since the last reset.
*
* @return The number of times that the post-synchronization plugins have
* been called since the last reset.
*/
public static int getPostSynchronizationCount()
{
return postSynchronizationCounter.get();
}
/**
* Resets the post-synchronization plugin invocation count to zero.
*
* @return The post-synchronization plugin invocation count before it was
* reset.
*/
public static int resetPostSynchronizationCount()
{
}
/**
* {@inheritDoc}
*/
public PluginResult.IntermediateResponse
{
}
/**
* Retrieves the number of times that the search result entry plugins have
* been called since the last reset.
*
* @return The number of times that the search result entry plugins have been
* called since the last reset.
*/
public static int getSearchEntryCount()
{
return searchEntryCounter.get();
}
/**
* Resets the search result entry plugin invocation count to zero.
*
* @return The search result entry plugin invocation count before it was
* reset.
*/
public static int resetSearchEntryCount()
{
}
/**
* {@inheritDoc}
*/
public PluginResult.IntermediateResponse
{
}
/**
* Retrieves the number of times that the search result reference plugins have
* been called since the last reset.
*
* @return The number of times that the search result reference plugins have
* been called since the last reset.
*/
public static int getSearchReferenceCount()
{
return searchReferenceCounter.get();
}
/**
* Resets the search result reference plugin invocation count to zero.
*
* @return The search result reference plugin invocation count before it was
* reset.
*/
public static int resetSearchReferenceCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times the subordinate modify DN plugins have been
* called since the last reset.
*
* @return The number of times the subordinate modify DN plugins have been
* called since the last reset.
*/
public static int getSubordinateModifyDNCount()
{
return subordinateModifyDNCounter.get();
}
/**
* Resets the subordinate modify DN plugin invocation count to zero.
*
* @return The subordinate modify DN plugin invocation count before it was
* reset.
*/
public static int resetSubordinateModifyDNCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times the intermediate response plugins have been
* called since the last reset.
*
* @return The number of times the intermediate response plugins have been
* called since the last reset.
*/
public static int getIntermediateResponseCount()
{
return intermediateResponseCounter.get();
}
/**
* Resets the intermediate response plugin invocation count to zero.
*
* @return The intermediate response plugin invocation count before it was
* reset.
*/
public static int resetIntermediateResponseCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times that the post-connect plugins have been
* called since the last reset.
*
* @return The number of times that the post-connect plugins have been called
* since the last reset.
*/
public static int getPostConnectCount()
{
return postConnectCounter.get();
}
/**
* Resets the post-connect plugin invocation count to zero.
*
* @return The post-connect plugin invocation count before it was reset.
*/
public static int resetPostConnectCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times that the post-disconnect plugins have been
* called since the last reset.
*
* @return The number of times that the post-disconnect plugins have been
* called since the last reset.
*/
public static int getPostDisconnectCount()
{
return postDisconnectCounter.get();
}
/**
* Resets the post-disconnect plugin invocation count to zero.
*
* @return The post-disconnect plugin invocation count before it was reset.
*/
public static int resetPostDisconnectCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times that the LDIF import plugins have been called
* since the last reset.
*
* @return The number of times that the LDIF import plugins have been called
* since the last reset.
*/
public static int getLDIFImportCount()
{
return ldifImportCounter.get();
}
/**
* Resets the LDIF import plugin invocation count to zero.
*
* @return The LDIF import plugin invocation count before it was reset.
*/
public static int resetLDIFImportCount()
{
}
/**
* {@inheritDoc}
*/
{
}
/**
* Retrieves the number of times that the LDIF export plugins have been called
* since the last reset.
*
* @return The number of times that the LDIF export plugins have been called
* since the last reset.
*/
public static int getLDIFExportCount()
{
return ldifExportCounter.get();
}
/**
* Resets the LDIF export plugin invocation count to zero.
*
* @return The LDIF export plugin invocation count before it was reset.
*/
public static int resetLDIFExportCount()
{
}
/**
* Resets all of the invocation counters. This does not impact the startup
* or shutdown flag.
*/
public static void resetAllCounters()
{
}
/**
* {@inheritDoc}
*/
{
startupCalled = true;
}
/**
* Indicates whether the server startup plugins have been called.
*
* @return <CODE>true</CODE> if the server startup plugins have been called,
* or <CODE>false</CODE> if not.
*/
public static boolean startupCalled()
{
return startupCalled;
}
/**
* Resets the flag that indicates whether the startup plugins have been
* called.
*/
public static void resetStartupCalled()
{
startupCalled = false;
}
/**
* {@inheritDoc}
*/
{
shutdownCalled = true;
}
/**
* Indicates whether the server shutdown plugins have been called.
*
* @return <CODE>true</CODE> if the server shutdown plugins have been called,
* or <CODE>false</CODE> if not.
*/
public static boolean shutdownCalled()
{
return shutdownCalled;
}
/**
* Resets the flag that indicates whether the shutdown plugins have been
* called.
*/
public static void resetShutdownCalled()
{
shutdownCalled = false;
}
/**
* Waits up to five seconds until the post-response plugins have been called
* at least once since the last reset.
* @return The number of times that the post-response plugins have been
* called since the last reset. The return value may be zero if the
* wait timed out.
* @throws InterruptedException If another thread interrupts this thread.
*/
public static int waitForPostResponse() throws InterruptedException
{
{
}
return postResponseCounter.get();
}
}