org.lsc
Class Configuration

java.lang.Object
  extended by org.lsc.Configuration

public class Configuration
extends Object

Ldap Synchronization Connector Configuration.

Author:
Sebastien Bahloul , Remy-Christophe Schermesser

Field Summary
static String DATABASE_PROPERTIES_FILENAME
           
static int DAYS_BEFORE_SUPPRESSION
          Numbers of days between an entry is set to be deleted and its actual deletion.
static String DN_ACCOUNTS
           
static String DN_ENHANCED_SCHEMA
           
static String DN_LDAP_SCHEMA
           
static String DN_PEOPLE
           
static String DN_REAL_ROOT
           
static String DN_STRUCTURES
           
static String location
          Default location for configuration filename
static String OBJECTCLASS_EMPLOYEE
           
static String OBJECTCLASS_PERSON
           
static String PROPERTIES_FILENAME
           
static int UID_MAX_LENGTH
           
 
Method Summary
static void assertPropertyNotEmpty(String propertyName, String propertyValue, String location)
          Helper method to check that a String read in from a property is not empty or null
static Properties getAsProperties(String prefix)
          Create a Properties object that is a subset of this configuration.
static String getConfigurationDirectory()
          Get the path to the directory where configuration files are stored, with a "/" at the end (or "\" on Windows).
static Properties getDstProperties()
          Get data destination connection properties.
static int getInt(String key, int defaultValue)
          Get a int associated with the given property key
static Properties getPropertiesFromFile(String pathToFile)
          Helper method to read a file from the filesystem and return it as Properties.
static Properties getPropertiesFromFileInConfigDir(String fileName)
          Helper method to read a file from the configuration directory and return it as Properties.
static String getSeparator()
           
static Properties getSrcProperties()
          Get data source connection properties.
static String getString(String key)
          Get a string associated with the given property key
static String getString(String key, String defaultValue)
          Get a string associated with the given property key
static boolean isLoggingSetup()
          Get the flag to determine if logging is configured or not yet
static void setLocation(String configurationLocation)
          Set the configuration properties location
static void setLoggingSetup(boolean loggingSetup)
          Set the flag to determine if logging is configured or not yet
static void setProperties(String prefix, Properties props)
          Set the new properties
static void setUp(String configurationLocation)
          Set up configuration for the given location, including logback.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_FILENAME

public static final String PROPERTIES_FILENAME
See Also:
Constant Field Values

DATABASE_PROPERTIES_FILENAME

public static final String DATABASE_PROPERTIES_FILENAME
See Also:
Constant Field Values

location

public static String location
Default location for configuration filename


DN_PEOPLE

public static String DN_PEOPLE

DN_LDAP_SCHEMA

public static String DN_LDAP_SCHEMA

DN_ENHANCED_SCHEMA

public static String DN_ENHANCED_SCHEMA

DN_STRUCTURES

public static String DN_STRUCTURES

DN_ACCOUNTS

public static String DN_ACCOUNTS

OBJECTCLASS_PERSON

public static String OBJECTCLASS_PERSON

OBJECTCLASS_EMPLOYEE

public static String OBJECTCLASS_EMPLOYEE

DAYS_BEFORE_SUPPRESSION

public static int DAYS_BEFORE_SUPPRESSION
Numbers of days between an entry is set to be deleted and its actual deletion.


DN_REAL_ROOT

public static String DN_REAL_ROOT

UID_MAX_LENGTH

public static int UID_MAX_LENGTH
Method Detail

getSrcProperties

public static Properties getSrcProperties()
Get data source connection properties.

Returns:
the data source connection properties

getDstProperties

public static Properties getDstProperties()
Get data destination connection properties.

Returns:
the data destination connection properties

getAsProperties

public static Properties getAsProperties(String prefix)
Create a Properties object that is a subset of this configuration. If there are no properties matching the prefix, an empty Properties object is returned.

Parameters:
prefix - The prefix used to select the properties.
Returns:
Properties object with the requests properties without the prefix

getInt

public static int getInt(String key,
                         int defaultValue)
Get a int associated with the given property key

Parameters:
key - The property key.
defaultValue - The default value.
Returns:
The associated int.

getString

public static String getString(String key)
Get a string associated with the given property key

Parameters:
key - The property key.
Returns:
The associated string.

getString

public static String getString(String key,
                               String defaultValue)
Get a string associated with the given property key

Parameters:
key - The property key.
defaultValue - The default value.
Returns:
The associated string.

setLocation

public static void setLocation(String configurationLocation)
Set the configuration properties location

Parameters:
configurationLocation - the user defined location

getConfigurationDirectory

public static String getConfigurationDirectory()
Get the path to the directory where configuration files are stored, with a "/" at the end (or "\" on Windows). All configuration files MUST be read from this directory. If no directory is specified when launching LSC, this returns the user's current directory.

Returns:
Path to configuration directory

setProperties

public static void setProperties(String prefix,
                                 Properties props)
                          throws org.apache.commons.configuration.ConfigurationException
Set the new properties

Parameters:
prefix - the prefix or null
props - the news properties
Throws:
org.apache.commons.configuration.ConfigurationException

getPropertiesFromFile

public static Properties getPropertiesFromFile(String pathToFile)
                                        throws FileNotFoundException,
                                               IOException
Helper method to read a file from the filesystem and return it as Properties.

Parameters:
pathToFile - Absolute filename on the filesystem to read.
Returns:
Properties from the file
Throws:
FileNotFoundException
IOException

getPropertiesFromFileInConfigDir

public static Properties getPropertiesFromFileInConfigDir(String fileName)
                                                   throws FileNotFoundException,
                                                          IOException
Helper method to read a file from the configuration directory and return it as Properties.

Parameters:
fileName - Filename relative to the configuration directory.
Returns:
Properties from the file
Throws:
FileNotFoundException
IOException

getSeparator

public static String getSeparator()

setUp

public static void setUp(String configurationLocation)
Set up configuration for the given location, including logback. IMPORTANT: don't log ANYTHING before calling this method!

Parameters:
configurationLocation -

assertPropertyNotEmpty

public static void assertPropertyNotEmpty(String propertyName,
                                          String propertyValue,
                                          String location)
                                   throws RuntimeException

Helper method to check that a String read in from a property is not empty or null

Parameters:
propertyName - Name of the property key as read from lsc.properties
propertyValue - Value read from the configuration
location - Where this property is read from, to display a meaningful error message (example: class name, task name, etc)
Throws:
RuntimeException - If the property is null or empty.

setLoggingSetup

public static void setLoggingSetup(boolean loggingSetup)
Set the flag to determine if logging is configured or not yet

Parameters:
loggingSetup - Is logging setup yet?

isLoggingSetup

public static boolean isLoggingSetup()
Get the flag to determine if logging is configured or not yet

Returns:
boolean loggingSetup


Copyright © 2005-2010 LSC project. All Rights Reserved.