de.novanic.eventservice.config.loader
Class PropertyConfigurationLoader

java.lang.Object
  extended by de.novanic.eventservice.config.loader.PropertyConfigurationLoader
All Implemented Interfaces:
ConfigurationLoader

public class PropertyConfigurationLoader
extends java.lang.Object
implements ConfigurationLoader

PropertyConfigurationLoader is used by EventServiceConfigurationFactory to load the EventServiceConfiguration with a properties file. The default name of the properties is "eventservice.properties". For that file will be searched if not other defined.

Author:
sstrohschein
Date: 23.10.2008
Time: 14:37:13

Constructor Summary
PropertyConfigurationLoader()
          Creates a PropertyConfigurationLoader with the default properties ("eventservice.properties").
PropertyConfigurationLoader(java.lang.String aPropertyName)
          Creates a PropertyConfigurationLoader with a properties file.
 
Method Summary
 boolean equals(java.lang.Object anObject)
           
 int hashCode()
           
 boolean isAvailable()
          Checks if the configuration is available and can be loaded.
 EventServiceConfiguration load()
          Loads the configuration with the loader.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyConfigurationLoader

public PropertyConfigurationLoader()
Creates a PropertyConfigurationLoader with the default properties ("eventservice.properties").


PropertyConfigurationLoader

public PropertyConfigurationLoader(java.lang.String aPropertyName)
Creates a PropertyConfigurationLoader with a properties file.

Parameters:
aPropertyName - properties file to load (the location must be attached to the classpath)
Method Detail

isAvailable

public boolean isAvailable()
Checks if the configuration is available and can be loaded. If no configuration is available, the load method ConfigurationLoader.load() shouldn't called. In the case of PropertyConfigurationLoader the method returns true when the location of the properties file is attached to the classpath.

Specified by:
isAvailable in interface ConfigurationLoader
Returns:
true when available, otherwise false

load

public EventServiceConfiguration load()
Loads the configuration with the loader.

Specified by:
load in interface ConfigurationLoader
Returns:
EventServiceConfiguration the loaded configuration or NULL if the properties file couldn't found with the classpath.
Throws:
ConfigurationException - occurs when the configuration can't be loaded or if it contains unreadable values.

equals

public boolean equals(java.lang.Object anObject)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object