public final class ServiceConfigFactory extends Object
This factory class is designed to be the main interface between the service
configuration information and the users of the information. When initialized
the factory loads the configuration from the file system, allowing access to
the information by others. The init
method may be called by more
than one thread, but MUST be called by at least one thread before
the factory can be used.
The factory supports the singleton design pattern, and thus the configuration
is loaded only once. All callers get the same reference unless a call to
reload
is made. After than any saved instances of the factory can still
be referenced. Old references will not reflect any changes in the file if the
factory is reloaded.
Modifier and Type | Method and Description |
---|---|
static ServiceConfigFactory |
getInstance()
Returns the currently defined singleton instance of the factory.
|
Service[] |
getServices()
Returns an array of all the defined configuration information for the
Services.
|
static void |
init()
Load the config from the default config file and create the singleton
instance of this factory.
|
static void |
reload()
Reload the config from the default config file
|
static void |
setInstance(ServiceConfigFactory instance)
setInstance
|
public static void init() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
IOException
- Thrown if the specified config file cannot be readorg.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public static void reload() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
IOException
- Thrown if the specified config file cannot be read/loadedorg.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public static ServiceConfigFactory getInstance()
reload
method is called.IllegalStateException
- Thrown if the factory has not yet been initialized.public static void setInstance(ServiceConfigFactory instance)
setInstance
instance
- a ServiceConfigFactory
object.public Service[] getServices()
Copyright © 2015. All Rights Reserved.