EntryCacheMonitorProvider.java revision 36f30207b4c132378c0471544202711ffd187da9
/*
* 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 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* This class defines a Directory Server monitor provider that can be used to
* obtain information about the entry cache state. Note that the information
* reported is obtained with no locking, so it may not be entirely consistent.
*/
public class EntryCacheMonitorProvider
{
/** The name for this monitor. */
private String monitorName;
/** The entry cache common name. */
private String entryCacheName;
/** The entry cache with which this monitor is associated. */
/** Entry cache monitor configuration. */
/**
* Creates default instance of this monitor provider.
*/
public EntryCacheMonitorProvider()
{
this.entryCacheName = "Entry Caches";
}
/**
* Creates implementation specific instance of this monitor provider.
*
* @param entryCacheName The name to use for this monitor provider.
* @param entryCache The entry cache to associate this monitor
* provider with.
*/
public EntryCacheMonitorProvider(
{
this.entryCache = entryCache;
}
/** {@inheritDoc} */
public void initializeMonitorProvider(
throws ConfigException
{
if (configuration != null) {
}
if (monitorConfiguration == null) {
throw new ConfigException(message);
}
if (!monitorConfiguration.isEnabled()) {
throw new ConfigException(message);
}
}
/** {@inheritDoc} */
public String getMonitorInstanceName()
{
return monitorName;
}
/** {@inheritDoc} */
{
if ((entryCache != null) &&
(monitorConfiguration != null) &&
(monitorConfiguration.isEnabled())) {
// Get monitor data from the cache.
return entryCache.getMonitorData();
}
return Collections.emptyList();
}
}