BackendDescriptor.java revision e1cd6c2bc4addf80537e31f929118ac8f908ea63
/*
* 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-2011 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/** The class that describes the backend configuration. */
public class BackendDescriptor
{
private int entries;
private final boolean isConfigBackend;
private final boolean isEnabled;
private CustomSearchResult monitoringEntry;
private int hashCode;
/** An enumeration describing the type of backend. */
public enum Type
{
/** The backend is a local backend. */
/** The backend is a LDIF backend. */
LDIF,
/** The backend is a memory backend. */
/** The backend is a backup backend. */
/** The backend is a monitor backend. */
/** The backend is a task backend. */
TASK,
/** The backend is another type of backend (for instance user defined). */
}
/**
* Constructor for this class.
* @param backendID the backend ID of the Backend.
* @param baseDns the base DNs associated with the Backend.
* @param indexes the indexes defined in the backend.
* @param vlvIndexes the VLV indexes defined in the backend.
* @param entries the number of entries in the Backend.
* @param isEnabled whether the backend is enabled or not.
* @param type the type of the backend.
*/
{
}
/**
* Returns the ID of the Backend.
* @return the ID of the Backend.
*/
public String getBackendID()
{
return backendID;
}
/**
* Returns the Base DN objects associated with the backend.
* @return the Base DN objects associated with the backend.
*/
{
return baseDns;
}
/**
* Returns the vlv index objects associated with the backend.
* @return the vlv index objects associated with the backend.
*/
{
return vlvIndexes;
}
/**
* Returns the index objects associated with the backend.
* @return the index objects associated with the backend.
*/
{
return indexes;
}
/**
* Return the number of entries in the backend.
* -1 indicates that the number of entries could not be found.
* @return the number of entries in the backend.
*/
public int getEntries()
{
return entries;
}
/** {@inheritDoc} */
{
if (this == o)
{
return true;
}
if (o instanceof BackendDescriptor)
{
}
return false;
}
{
{
}
}
/**
* Returns the monitoring entry information.
* @return the monitoring entry information.
*/
public CustomSearchResult getMonitoringEntry()
{
return monitoringEntry;
}
/** {@inheritDoc} */
public int hashCode()
{
return hashCode;
}
/**
* Method called when one of the elements that affect the value of the
* hashcode is modified. It is used to minimize the time spent calculating
* hashCode.
*/
private void recalculateHashCode()
{
hashCode = 0;
{
}
{
}
{
}
}
/**
* Updates the base DNs and indexes contained in this backend so that they
* have a reference to this backend. It also initialize the members of this
* class with the base DNs and indexes.
* @param baseDns the base DNs associated with the Backend.
* @param indexes the indexes defined in the backend.
* @param vlvIndexes the VLV indexes defined in the backend.
*
*/
{
{
baseDN.setBackend(this);
}
{
index.setBackend(this);
}
{
index.setBackend(this);
}
}
/**
* An convenience method to know if the provided ID corresponds to a
* configuration backend or not.
* @param id the backend ID to analyze
* @return <CODE>true</CODE> if the the id corresponds to a configuration
* backend and <CODE>false</CODE> otherwise.
*/
{
}
/**
* Tells whether this is a configuration backend or not.
* @return <CODE>true</CODE> if this is a configuration backend and
* <CODE>false</CODE> otherwise.
*/
public boolean isConfigBackend()
{
return isConfigBackend;
}
/**
* Sets the number of entries contained in this backend.
* @param entries the number of entries contained in this backend.
*/
public void setEntries(int entries)
{
// Recalculate hashCode
}
/**
* Sets the monitoring entry corresponding to this backend.
* @param monitoringEntry the monitoring entry corresponding to this backend.
*/
{
this.monitoringEntry = monitoringEntry;
}
/**
* Returns the type of the backend.
* @return the type of the backend.
*/
{
return type;
}
/**
* Tells whether this backend is enabled or not.
* @return <CODE>true</CODE> if this is backend is enabled
* <CODE>false</CODE> otherwise.
*/
public boolean isEnabled()
{
return isEnabled;
}
}