Top Description Fields Constructors Methods
com.rometools.rome.io.impl

public Class PropertiesLoader

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.net.URL, java.util.ArrayList, .Enumeration, .List, .Map, .Properties, .StringTokenizer, .WeakHashMap, com.rometools.rome.feed.impl.ConfigurableClassLoader

Properties loader that aggregates a master properties file and several extra properties files, all from the current classpath.

The master properties file has to be in a distinct location than the extra properties files. First the master properties file is loaded, then all the extra properties files in their order of appearance in the classpath.

Current use cases (plugin manager for parsers/converters/generators for feeds and modules and date formats) assume properties are list of tokens, that why the only method to get property values is the getTokenizedProperty().

Field Summary

Modifier and TypeField and Description
private static Map<ClassLoader, PropertiesLoader>
private static final String
private static final String
private final Properties[]

Constructor Summary

AccessConstructor and Description
private
PropertiesLoader(final String
master file location, there must be only one.
masterFileLocation
,
final String
extra file location, there may be many.
extraFileLocation
)

Creates a PropertiesLoader.

Method Summary

Modifier and TypeMethod and Description
public static PropertiesLoader

Returns:

PropertiesLoader singleton.
getPropertiesLoader
()

Returns the PropertiesLoader singleton used by ROME to load plugin components.

public String[]

Returns:

all the values for the given property key from all the properties files.
getProperty
(final String
property key to retrieve values
key
)

Returns an array of values stored under a property key in all properties files.

public String[]

Returns:

all the tokens for the given property key from all the properties files.
getTokenizedProperty
(final String
property key to retrieve values
key
,
final String
String with all separator characters to tokenize from the values in all properties files.
separator
)

Returns an array of tokenized values stored under a property key in all properties files.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clMapback to summary
private static Map<ClassLoader, PropertiesLoader> clMap
EXTRA_PLUGIN_FILEback to summary
private static final String EXTRA_PLUGIN_FILE
MASTER_PLUGIN_FILEback to summary
private static final String MASTER_PLUGIN_FILE
propertiesback to summary
private final Properties[] properties

Constructor Detail

PropertiesLoaderback to summary
private PropertiesLoader(final String masterFileLocation, final String extraFileLocation) throws IOException

Creates a PropertiesLoader.

Parameters
masterFileLocation:String

master file location, there must be only one.

extraFileLocation:String

extra file location, there may be many.

Exceptions
IOException:
thrown if one of the properties file could not be read.

Method Detail

getPropertiesLoaderback to summary
public static PropertiesLoader getPropertiesLoader()

Returns the PropertiesLoader singleton used by ROME to load plugin components.

Returns:PropertiesLoader

PropertiesLoader singleton.

getPropertyback to summary
public String[] getProperty(final String key)

Returns an array of values stored under a property key in all properties files. If the master file has this property it will be the first ones in the array.

Parameters
key:String

property key to retrieve values

Returns:String[]

all the values for the given property key from all the properties files.

getTokenizedPropertyback to summary
public String[] getTokenizedProperty(final String key, final String separator)

Returns an array of tokenized values stored under a property key in all properties files. If the master file has this property its tokens will be the first ones in the array.

Parameters
key:String

property key to retrieve values

separator:String

String with all separator characters to tokenize from the values in all properties files.

Returns:String[]

all the tokens for the given property key from all the properties files.