/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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-2009 Sun Microsystems, Inc.
*/
/**
* An abstract class providing some common interface for the class that read
* the configuration (and if the server is running, the monitoring information).
*
*/
public abstract class ConfigReader
{
/**
* The class used to read the configuration from a file.
*/
/**
* The configuration file full path (-INSTANCE_ROOT-/config/config.ldif).
* of the installation of the control panel.
*/
/**
* The error that occurred when setting the environment (null if no error
* occurred).
*/
static
{
// This allows testing of configuration components when the OpenDS.jar
// in the classpath does not necessarily point to the server's
// This is done here since both implementations of ConfigReader require it.
if (installRoot == null) {
}
"config.ldif";
try
{
}
catch (Throwable t)
{
}
}
/**
* The exceptions that occurred reading the configuration.
*/
/**
* Whether the configuration has already been read or not.
*/
protected boolean configRead = false;
/**
* The set of connection listeners.
*/
/**
* The administration connector.
*/
/**
* The set of backend descriptors.
*/
/**
* The set of administrative users.
*/
/**
* The replication serve port (-1 if the replication server port is not
* defined).
*/
/**
* The java version used to run the server.
*/
/**
* The number of connections opened on the server.
*/
protected int numberConnections;
/**
* Whether the schema checking is enabled or not.
*/
protected boolean isSchemaEnabled;
/**
* The schema used by the server.
*/
/**
* The task entries.
**/
/**
* Returns the Administrative User DNs found in the config.ldif. The set
* must be unmodifiable (the inheriting classes must take care of this).
* @return the Administrative User DNs found in the config.ldif.
*/
{
return administrativeUsers;
}
/**
* Returns the backend descriptors found in the config.ldif. The set
* must be unmodifiable (the inheriting classes must take care of this).
* @return the backend descriptors found in the config.ldif.
*/
{
return backends;
}
/**
* Returns the listener descriptors found in the config.ldif. The set
* must be unmodifiable (the inheriting classes must take care of this).
* @return the listeners descriptors found in the config.ldif.
*/
{
return listeners;
}
/**
* Returns the admin connector.
* @return the admin connector.
*/
{
return adminConnector;
}
/**
* Returns the list of exceptions that were encountered reading the
* configuration. The list must be unmodifiable (the inheriting classes must
* take care of this).
* @return the list of exceptions that were encountered reading the
* configuration.
*/
{
return exceptions;
}
/**
* Returns <CODE>true</CODE> if the configuration has been read at least once
* and <CODE>false</CODE> otherwise.
* @return <CODE>true</CODE> if the configuration has been read at least once
* and <CODE>false</CODE> otherwise.
*/
public boolean isConfigRead()
{
return configRead;
}
/**
* Returns the replication server port. -1 if no replication server port is
* defined.
* @return the replication server port. -1 if no replication server port is
* defined.
*/
public int getReplicationPort()
{
return replicationPort;
}
/**
* Returns <CODE>true</CODE> if the schema check is enabled and
* <CODE>false</CODE> otherwise.
* @return <CODE>true</CODE> if the schema check is enabled and
* <CODE>false</CODE> otherwise.
*/
public boolean isSchemaEnabled()
{
return isSchemaEnabled;
}
/**
* Returns the java version used to run the server. <CODE>null</CODE> if no
* java version is used (because the server is down).
* @return the java version used to run the server. <CODE>null</CODE> if no
* java version is used (because the server is down).
*/
{
return javaVersion;
}
/**
* Returns the number of open connections on the server. -1 if the server
* is down.
* @return the number of open connections on the server.
*/
public int getOpenConnections()
{
return numberConnections;
}
/**
* Returns the schema of the server.
* @return the schema of the server.
*/
{
return schema;
}
/**
* Returns the task entries.
* @return the task entries.
*/
{
return taskEntries;
}
/**
* Reads the schema from the files.
* @throws ConfigException if an error occurs reading the schema.
* @throws InitializationException if an error occurs initializing
* configuration to read schema.
* @throws DirectoryException if there is an error registering the minimal
* objectclasses.
*/
{
loader.readSchema();
}
/**
* Method that transforms the VLV sort order value as it is defined in the
* schema to a list of VLVSortOrder objects.
* @param s the string in the configuration.
* @return a list of VLVSortOrder objects.
*/
{
if (s != null)
{
{
{
}
{
}
else
{
}
}
}
return sortOrder;
}
/**
* Returns the comparator to be used to sort InetAddresses.
* @return the comparator to be used to sort InetAddresses.
*/
{
return AdministrationConnectorCfgDefn.getInstance().
}
/**
* Returns <CODE>true</CODE> if the schema must be read and
* <CODE>false</CODE> otherwise.
* @return <CODE>true</CODE> if the schema must be read and
* <CODE>false</CODE> otherwise.
*/
protected boolean mustReadSchema()
{
return true;
}
}