2.17.2: 2011-06-17

net.sf.basedb.core
Class ExtendedProperties

java.lang.Object
  extended by net.sf.basedb.core.ExtendedProperties

public class ExtendedProperties
extends Object

This class is used for reading XML files with information about extended properties. All files returned by Application.getExtendedPropertyFiles() are parsed.

Version:
2.0
Author:
Nicklas
See Also:
ExtendableData, ExtendedProperty

Field Summary
private static Map<String,List<ExtendedProperty>> allProperties
          A map from class name --> a list of extended properties of for that class.
private static List<String> classes
          A list with the name attribute of all classes found in the xml file.
private static URL dtdFile
          The DTD which is used to validate the XML file.
private static boolean isInitialised
           
private static Logger log
          Log core events.
 
Constructor Summary
ExtendedProperties()
           
 
Method Summary
static List<String> getClasses()
          Get a list with the name of all classes.
static List<ExtendedProperty> getProperties(String className)
          Get a list of extended properties for the specified class.
static ExtendedProperty getProperty(String className, String property)
          Find an extended property in a given class.
(package private) static void init()
          Initialize the class.
static boolean isExtendable(String className)
          Check if extended properties has been defined for the specified class.
private static void loadClasses(Set<String> usedNames, Document dom, String xmlFile)
          Load the classes and put their names in the classes variable.
private static void loadExtendedPropertiesFile()
          Load and parse the file with predefined queries.
private static void loadProperties(Set<String> usedNames, Element classElement, String xmlFile)
          Load the properties for the specified class node and put the list in the allProperties variable.
(package private) static void unload()
          Unload all settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log
Log core events.


classes

private static List<String> classes
A list with the name attribute of all classes found in the xml file.


allProperties

private static Map<String,List<ExtendedProperty>> allProperties
A map from class name --> a list of extended properties of for that class. The list holds ExtendedProperty objects.


dtdFile

private static final URL dtdFile
The DTD which is used to validate the XML file.


isInitialised

private static boolean isInitialised
Constructor Detail

ExtendedProperties

public ExtendedProperties()
Method Detail

init

static void init()
          throws BaseException
Initialize the class.

Throws:
BaseException - This exception is thrown if there is an error

unload

static void unload()
Unload all settings.


loadExtendedPropertiesFile

private static void loadExtendedPropertiesFile()
                                        throws BaseException
Load and parse the file with predefined queries. This method will populate the classes and allProperties variables.

Throws:
BaseException

getClasses

public static List<String> getClasses()
Get a list with the name of all classes. The names do not include a package name.

Returns:
A List containing the names of the classes.

isExtendable

public static boolean isExtendable(String className)
Check if extended properties has been defined for the specified class.

Parameters:
className - The name of the class with or without the package name
Returns:
TRUE if the class is extendable, FALSE otherwise

getProperties

public static List<ExtendedProperty> getProperties(String className)
Get a list of extended properties for the specified class.

Parameters:
className - The name of the class with or without the package name
Returns:
A List object containing ExtendedProperty objects, or null if the specified class is not extendable or no extended properties has been defined

getProperty

public static ExtendedProperty getProperty(String className,
                                           String property)
Find an extended property in a given class.

Parameters:
className - The name of an extendable class with or without the package name
property - The name of the property
Returns:
The extended property or null if not found
Since:
2.15

loadClasses

private static void loadClasses(Set<String> usedNames,
                                Document dom,
                                String xmlFile)
Load the classes and put their names in the classes variable.


loadProperties

private static void loadProperties(Set<String> usedNames,
                                   Element classElement,
                                   String xmlFile)
Load the properties for the specified class node and put the list in the allProperties variable.


2.17.2: 2011-06-17