321N/A/*
321N/A * CDDL HEADER START
321N/A *
321N/A * The contents of this file are subject to the terms of the
321N/A * Common Development and Distribution License, Version 1.0 only
321N/A * (the "License"). You may not use this file except in compliance
321N/A * with the License.
321N/A *
321N/A * You can obtain a copy of the license at
321N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
321N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
321N/A * See the License for the specific language governing permissions
321N/A * and limitations under the License.
321N/A *
321N/A * When distributing Covered Code, include this CDDL HEADER in each
321N/A * file and include the License file at
321N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
321N/A * add the following below this CDDL HEADER, with the fields enclosed
873N/A * by brackets "[]" replaced with your own identifying information:
321N/A * Portions Copyright [yyyy] [name of copyright owner]
321N/A *
321N/A * CDDL HEADER END
321N/A *
321N/A *
3232N/A * Copyright 2006-2008 Sun Microsystems, Inc.
321N/A */
321N/Apackage org.opends.server.plugins;
321N/A
321N/A
321N/A
2031N/Aimport java.util.List;
321N/Aimport java.util.Set;
321N/Aimport java.util.concurrent.atomic.AtomicInteger;
321N/A
1008N/Aimport org.opends.server.admin.std.server.PluginCfg;
321N/Aimport org.opends.server.api.ClientConnection;
3352N/Aimport org.opends.server.api.plugin.*;
321N/Aimport org.opends.server.types.DisconnectReason;
321N/Aimport org.opends.server.types.Entry;
321N/Aimport org.opends.server.types.IntermediateResponse;
321N/Aimport org.opends.server.types.LDIFExportConfig;
321N/Aimport org.opends.server.types.LDIFImportConfig;
2031N/Aimport org.opends.server.types.Modification;
321N/Aimport org.opends.server.types.SearchResultEntry;
321N/Aimport org.opends.server.types.SearchResultReference;
338N/Aimport org.opends.server.types.operation.*;
2086N/Aimport org.opends.messages.Message;
321N/A
321N/A
321N/A/**
321N/A * This class defines a very simple plugin that simply increments a counter each
321N/A * time a plugin is called. There will be separate counters for each basic
321N/A * type of plugin, including:
321N/A * <BR>
321N/A * <UL>
321N/A * <LI>pre-parse</LI>
321N/A * <LI>pre-operation</LI>
321N/A * <LI>post-operation</LI>
321N/A * <LI>post-response</LI>
321N/A * <LI>search result entry</LI>
321N/A * <LI>search result reference</LI>
321N/A * <LI>intermediate response</LI>
321N/A * <LI>post-connect</LI>
321N/A * <LI>post-disconnect</LI>
321N/A * <LI>LDIF import</LI>
321N/A * <LI>LDIF export</LI>
321N/A * <LI>startup</LI>
321N/A * <LI>shutdown</LI>
321N/A * </UL>
321N/A */
321N/Apublic class InvocationCounterPlugin
1008N/A extends DirectoryServerPlugin<PluginCfg>
321N/A{
321N/A // Define the counters that will be used to keep track of everything.
321N/A private static AtomicInteger preParseCounter = new AtomicInteger(0);
321N/A private static AtomicInteger preOperationCounter = new AtomicInteger(0);
321N/A private static AtomicInteger postOperationCounter = new AtomicInteger(0);
321N/A private static AtomicInteger postResponseCounter = new AtomicInteger(0);
2439N/A private static AtomicInteger postSynchronizationCounter =
2439N/A new AtomicInteger(0);
321N/A private static AtomicInteger searchEntryCounter = new AtomicInteger(0);
321N/A private static AtomicInteger searchReferenceCounter = new AtomicInteger(0);
2031N/A private static AtomicInteger subordinateModifyDNCounter =
2031N/A new AtomicInteger(0);
321N/A private static AtomicInteger intermediateResponseCounter =
321N/A new AtomicInteger(0);
321N/A private static AtomicInteger postConnectCounter = new AtomicInteger(0);
321N/A private static AtomicInteger postDisconnectCounter = new AtomicInteger(0);
321N/A private static AtomicInteger ldifImportCounter = new AtomicInteger(0);
321N/A private static AtomicInteger ldifExportCounter = new AtomicInteger(0);
321N/A private static boolean startupCalled = false;
321N/A private static boolean shutdownCalled = false;
321N/A
321N/A
321N/A
321N/A /**
321N/A * Creates a new instance of this Directory Server plugin. Every
321N/A * plugin must implement a default constructor (it is the only one
321N/A * that will be used to create plugins defined in the
321N/A * configuration), and every plugin constructor must call
321N/A * <CODE>super()</CODE> as its first element.
321N/A */
321N/A public InvocationCounterPlugin()
321N/A {
321N/A super();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
353N/A public void initializePlugin(Set<PluginType> pluginTypes,
1008N/A PluginCfg configuration)
321N/A {
321N/A // No implementation required.
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseAbandonOperation abandonOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse doPreParse(PreParseAddOperation addOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse doPreParse(PreParseBindOperation bindOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseCompareOperation compareOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseDeleteOperation deleteOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseExtendedOperation extendedOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseModifyOperation modifyOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseModifyDNOperation modifyDNOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseSearchOperation searchOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreParse
338N/A doPreParse(PreParseUnbindOperation unbindOperation)
321N/A {
321N/A preParseCounter.incrementAndGet();
3352N/A return PluginResult.PreParse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the pre-parse plugins have been called
321N/A * since the last reset.
321N/A *
321N/A * @return The number of times that the pre-parse plugins have been called
321N/A * since the last reset.
321N/A */
321N/A public static int getPreParseCount()
321N/A {
321N/A return preParseCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the pre-parse plugin invocation count to zero.
321N/A *
321N/A * @return The pre-parse plugin invocation count before it was reset.
321N/A */
321N/A public static int resetPreParseCount()
321N/A {
321N/A return preParseCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationAddOperation addOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationBindOperation bindOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationCompareOperation compareOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationDeleteOperation deleteOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationExtendedOperation extendedOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationModifyOperation modifyOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationModifyDNOperation modifyDNOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PreOperation
338N/A doPreOperation(PreOperationSearchOperation searchOperation)
321N/A {
321N/A preOperationCounter.incrementAndGet();
3352N/A return PluginResult.PreOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the pre-operation plugins have been
321N/A * called since the last reset.
321N/A *
321N/A * @return The number of times that the pre-operation plugins have been
321N/A * called since the last reset.
321N/A */
321N/A public static int getPreOperationCount()
321N/A {
321N/A return preOperationCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the pre-operation plugin invocation count to zero.
321N/A *
321N/A * @return The pre-operation plugin invocation count before it was reset.
321N/A */
321N/A public static int resetPreOperationCount()
321N/A {
321N/A return preOperationCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationAbandonOperation abandonOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationAddOperation addOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationBindOperation bindOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationCompareOperation compareOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationDeleteOperation deleteOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationExtendedOperation extendedOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationModifyOperation modifyOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationModifyDNOperation modifyDNOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationSearchOperation searchOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostOperation
338N/A doPostOperation(PostOperationUnbindOperation unbindOperation)
321N/A {
321N/A postOperationCounter.incrementAndGet();
3352N/A return PluginResult.PostOperation.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the post-operation plugins have been
321N/A * called since the last reset.
321N/A *
321N/A * @return The number of times that the post-operation plugins have been
321N/A * called since the last reset.
321N/A */
321N/A public static int getPostOperationCount()
321N/A {
321N/A return postOperationCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the post-operation plugin invocation count to zero.
321N/A *
321N/A * @return The post-operation plugin invocation count before it was reset.
321N/A */
321N/A public static int resetPostOperationCount()
321N/A {
321N/A return postOperationCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseAddOperation addOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseBindOperation bindOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseCompareOperation compareOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseDeleteOperation deleteOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseExtendedOperation extendedOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseModifyOperation modifyOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseModifyDNOperation modifyDNOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostResponse
338N/A doPostResponse(PostResponseSearchOperation searchOperation)
321N/A {
321N/A postResponseCounter.incrementAndGet();
3352N/A return PluginResult.PostResponse.continueOperationProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the post-response plugins have been
321N/A * called since the last reset.
321N/A *
321N/A * @return The number of times that the post-response plugins have been
321N/A * called since the last reset.
321N/A */
321N/A public static int getPostResponseCount()
321N/A {
321N/A return postResponseCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the post-response plugin invocation count to zero.
321N/A *
321N/A * @return The post-response plugin invocation count before it was reset.
321N/A */
321N/A public static int resetPostResponseCount()
321N/A {
321N/A return postResponseCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
2439N/A public void doPostSynchronization(PostSynchronizationAddOperation
2439N/A addOperation)
2439N/A {
2439N/A postSynchronizationCounter.incrementAndGet();
2439N/A }
2439N/A
2439N/A
2439N/A
2439N/A /**
2439N/A * {@inheritDoc}
2439N/A */
2439N/A @Override()
2439N/A public void doPostSynchronization(PostSynchronizationModifyOperation
2439N/A modifyOperation)
2439N/A {
2439N/A postSynchronizationCounter.incrementAndGet();
2439N/A }
2439N/A
2439N/A
2439N/A
2439N/A /**
2439N/A * {@inheritDoc}
2439N/A */
2439N/A @Override()
2439N/A public void doPostSynchronization(PostSynchronizationModifyDNOperation
2439N/A modifyDNOperation)
2439N/A {
2439N/A postSynchronizationCounter.incrementAndGet();
2439N/A }
2439N/A
2439N/A
2439N/A
2439N/A /**
2439N/A * Retrieves the number of times that the post-synchronization plugins have
2439N/A * been called since the last reset.
2439N/A *
2439N/A * @return The number of times that the post-synchronization plugins have
2439N/A * been called since the last reset.
2439N/A */
2439N/A public static int getPostSynchronizationCount()
2439N/A {
2439N/A return postSynchronizationCounter.get();
2439N/A }
2439N/A
2439N/A
2439N/A
2439N/A /**
2439N/A * Resets the post-synchronization plugin invocation count to zero.
2439N/A *
2439N/A * @return The post-synchronization plugin invocation count before it was
2439N/A * reset.
2439N/A */
2439N/A public static int resetPostSynchronizationCount()
2439N/A {
2439N/A return postSynchronizationCounter.getAndSet(0);
2439N/A }
2439N/A
2439N/A
2439N/A
2439N/A /**
2439N/A * {@inheritDoc}
2439N/A */
2439N/A @Override()
3352N/A public PluginResult.IntermediateResponse
338N/A processSearchEntry(SearchEntrySearchOperation searchOperation,
338N/A SearchResultEntry searchEntry)
321N/A {
321N/A searchEntryCounter.incrementAndGet();
3352N/A return PluginResult.IntermediateResponse.continueOperationProcessing(true);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the search result entry plugins have
321N/A * been called since the last reset.
321N/A *
321N/A * @return The number of times that the search result entry plugins have been
321N/A * called since the last reset.
321N/A */
321N/A public static int getSearchEntryCount()
321N/A {
321N/A return searchEntryCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the search result entry plugin invocation count to zero.
321N/A *
321N/A * @return The search result entry plugin invocation count before it was
321N/A * reset.
321N/A */
321N/A public static int resetSearchEntryCount()
321N/A {
321N/A return searchEntryCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.IntermediateResponse
338N/A processSearchReference(SearchReferenceSearchOperation searchOperation,
338N/A SearchResultReference searchReference)
321N/A {
321N/A searchReferenceCounter.incrementAndGet();
3352N/A return PluginResult.IntermediateResponse.continueOperationProcessing(true);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the search result reference plugins have
321N/A * been called since the last reset.
321N/A *
321N/A * @return The number of times that the search result reference plugins have
321N/A * been called since the last reset.
321N/A */
321N/A public static int getSearchReferenceCount()
321N/A {
321N/A return searchReferenceCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the search result reference plugin invocation count to zero.
321N/A *
321N/A * @return The search result reference plugin invocation count before it was
321N/A * reset.
321N/A */
321N/A public static int resetSearchReferenceCount()
321N/A {
321N/A return searchReferenceCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.SubordinateModifyDN processSubordinateModifyDN(
2031N/A SubordinateModifyDNOperation modifyDNOperation, Entry oldEntry,
2031N/A Entry newEntry, List<Modification> modifications)
2031N/A {
2031N/A subordinateModifyDNCounter.incrementAndGet();
3352N/A return PluginResult.SubordinateModifyDN.continueOperationProcessing();
2031N/A }
2031N/A
2031N/A
2031N/A
2031N/A
2031N/A /**
2031N/A * Retrieves the number of times the subordinate modify DN plugins have been
2031N/A * called since the last reset.
2031N/A *
2031N/A * @return The number of times the subordinate modify DN plugins have been
2031N/A * called since the last reset.
2031N/A */
2031N/A public static int getSubordinateModifyDNCount()
2031N/A {
2031N/A return subordinateModifyDNCounter.get();
2031N/A }
2031N/A
2031N/A
2031N/A
2031N/A /**
2031N/A * Resets the subordinate modify DN plugin invocation count to zero.
2031N/A *
2031N/A * @return The subordinate modify DN plugin invocation count before it was
2031N/A * reset.
2031N/A */
2031N/A public static int resetSubordinateModifyDNCount()
2031N/A {
2031N/A return subordinateModifyDNCounter.getAndSet(0);
2031N/A }
2031N/A
2031N/A
2031N/A
2031N/A /**
2031N/A * {@inheritDoc}
2031N/A */
2031N/A @Override()
3352N/A public PluginResult.IntermediateResponse processIntermediateResponse(
321N/A IntermediateResponse intermediateResponse)
321N/A {
321N/A intermediateResponseCounter.incrementAndGet();
3352N/A return PluginResult.IntermediateResponse.continueOperationProcessing(true);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times the intermediate response plugins have been
321N/A * called since the last reset.
321N/A *
321N/A * @return The number of times the intermediate response plugins have been
321N/A * called since the last reset.
321N/A */
321N/A public static int getIntermediateResponseCount()
321N/A {
321N/A return intermediateResponseCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the intermediate response plugin invocation count to zero.
321N/A *
321N/A * @return The intermediate response plugin invocation count before it was
321N/A * reset.
321N/A */
321N/A public static int resetIntermediateResponseCount()
321N/A {
321N/A return intermediateResponseCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostConnect doPostConnect(ClientConnection
321N/A clientConnection)
321N/A {
321N/A postConnectCounter.incrementAndGet();
3352N/A return PluginResult.PostConnect.continueConnectProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the post-connect plugins have been
321N/A * called since the last reset.
321N/A *
321N/A * @return The number of times that the post-connect plugins have been called
321N/A * since the last reset.
321N/A */
321N/A public static int getPostConnectCount()
321N/A {
321N/A return postConnectCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the post-connect plugin invocation count to zero.
321N/A *
321N/A * @return The post-connect plugin invocation count before it was reset.
321N/A */
321N/A public static int resetPostConnectCount()
321N/A {
321N/A return postConnectCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.PostDisconnect doPostDisconnect(
2086N/A ClientConnection clientConnection, DisconnectReason disconnectReason,
2086N/A Message message)
321N/A {
321N/A postDisconnectCounter.incrementAndGet();
3352N/A return PluginResult.PostDisconnect.continueDisconnectProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the post-disconnect plugins have been
321N/A * called since the last reset.
321N/A *
321N/A * @return The number of times that the post-disconnect plugins have been
321N/A * called since the last reset.
321N/A */
321N/A public static int getPostDisconnectCount()
321N/A {
321N/A return postDisconnectCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the post-disconnect plugin invocation count to zero.
321N/A *
321N/A * @return The post-disconnect plugin invocation count before it was reset.
321N/A */
321N/A public static int resetPostDisconnectCount()
321N/A {
321N/A return postDisconnectCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.ImportLDIF doLDIFImport(LDIFImportConfig importConfig,
3352N/A Entry entry)
321N/A {
321N/A ldifImportCounter.incrementAndGet();
3352N/A return PluginResult.ImportLDIF.continueEntryProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the LDIF import plugins have been called
321N/A * since the last reset.
321N/A *
321N/A * @return The number of times that the LDIF import plugins have been called
321N/A * since the last reset.
321N/A */
321N/A public static int getLDIFImportCount()
321N/A {
321N/A return ldifImportCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the LDIF import plugin invocation count to zero.
321N/A *
321N/A * @return The LDIF import plugin invocation count before it was reset.
321N/A */
321N/A public static int resetLDIFImportCount()
321N/A {
321N/A return ldifImportCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.ImportLDIF doLDIFExport(LDIFExportConfig exportConfig,
321N/A Entry entry)
321N/A {
321N/A ldifExportCounter.incrementAndGet();
3352N/A return PluginResult.ImportLDIF.continueEntryProcessing();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Retrieves the number of times that the LDIF export plugins have been called
321N/A * since the last reset.
321N/A *
321N/A * @return The number of times that the LDIF export plugins have been called
321N/A * since the last reset.
321N/A */
321N/A public static int getLDIFExportCount()
321N/A {
321N/A return ldifExportCounter.get();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the LDIF export plugin invocation count to zero.
321N/A *
321N/A * @return The LDIF export plugin invocation count before it was reset.
321N/A */
321N/A public static int resetLDIFExportCount()
321N/A {
321N/A return ldifExportCounter.getAndSet(0);
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets all of the invocation counters. This does not impact the startup
321N/A * or shutdown flag.
321N/A */
321N/A public static void resetAllCounters()
321N/A {
321N/A resetPreParseCount();
321N/A resetPreOperationCount();
321N/A resetPostOperationCount();
321N/A resetPostResponseCount();
2439N/A resetPostSynchronizationCount();
321N/A resetSearchEntryCount();
321N/A resetSearchReferenceCount();
2031N/A resetSubordinateModifyDNCount();
321N/A resetIntermediateResponseCount();
321N/A resetPostConnectCount();
321N/A resetPostDisconnectCount();
321N/A resetLDIFImportCount();
321N/A resetLDIFExportCount();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
3352N/A public PluginResult.Startup doStartup()
321N/A {
321N/A startupCalled = true;
3352N/A return PluginResult.Startup.continueStartup();
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Indicates whether the server startup plugins have been called.
321N/A *
321N/A * @return <CODE>true</CODE> if the server startup plugins have been called,
321N/A * or <CODE>false</CODE> if not.
321N/A */
321N/A public static boolean startupCalled()
321N/A {
321N/A return startupCalled;
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the flag that indicates whether the startup plugins have been
321N/A * called.
321N/A */
321N/A public static void resetStartupCalled()
321N/A {
321N/A startupCalled = false;
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * {@inheritDoc}
321N/A */
321N/A @Override()
2086N/A public void doShutdown(Message reason)
321N/A {
321N/A shutdownCalled = true;
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Indicates whether the server shutdown plugins have been called.
321N/A *
321N/A * @return <CODE>true</CODE> if the server shutdown plugins have been called,
321N/A * or <CODE>false</CODE> if not.
321N/A */
321N/A public static boolean shutdownCalled()
321N/A {
321N/A return shutdownCalled;
321N/A }
321N/A
321N/A
321N/A
321N/A /**
321N/A * Resets the flag that indicates whether the shutdown plugins have been
321N/A * called.
321N/A */
321N/A public static void resetShutdownCalled()
321N/A {
321N/A shutdownCalled = false;
321N/A }
389N/A
389N/A
389N/A
389N/A /**
389N/A * Waits up to five seconds until the post-response plugins have been called
389N/A * at least once since the last reset.
389N/A * @return The number of times that the post-response plugins have been
389N/A * called since the last reset. The return value may be zero if the
389N/A * wait timed out.
389N/A * @throws InterruptedException If another thread interrupts this thread.
389N/A */
389N/A public static int waitForPostResponse() throws InterruptedException
389N/A {
389N/A long timeout = System.currentTimeMillis() + 5000;
389N/A while (postResponseCounter.get() == 0 &&
389N/A System.currentTimeMillis() < timeout)
389N/A {
389N/A Thread.sleep(10);
389N/A }
389N/A return postResponseCounter.get();
389N/A }
321N/A}
321N/A