org.opennms.netmgt.config
Class MonitoringLocationsFactory

java.lang.Object
  extended by org.opennms.netmgt.config.MonitoringLocationsFactory

public class MonitoringLocationsFactory
extends Object

MonitoringLocationsFactory class.

Version:
$Id: $
Author:
David Hustace

Field Summary
protected  boolean initialized
          Boolean indicating if the init() method has been called.
protected static Map<String,LocationDef> m_defsMap
          Constant m_defsMap
protected static long m_lastModified
          Timestamp of the config file, used to know when to reload from disk.
 
Constructor Summary
MonitoringLocationsFactory(InputStream stream)
          Constructor for MonitoringLocationsFactory.
MonitoringLocationsFactory(Reader rdr)
          Deprecated. 
MonitoringLocationsFactory(String configFile)
          Constructor for MonitoringLocationsFactory.
 
Method Summary
static MonitoringLocationsConfiguration getConfig()
          getConfig
 LocationDef getDef(String defName)
          Can't be null
static Map<String,LocationDef> getDefsMap()
          getDefsMap
static MonitoringLocationsFactory getInstance()
          Singleton static call to get the only instance that should exist for the MonioringLocationsFactory
static void init()
          Be sure to call this method before calling getInstance().
 void reload()
          reload
static void setConfig(MonitoringLocationsConfiguration m_config)
          setConfig
static void setDefsMap(Map<String,LocationDef> map)
          setDefsMap
static void setInstance(MonitoringLocationsFactory instance)
          setInstance
protected  void updateFromFile()
          Reload the config file if it has been changed since we last read it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialized

protected boolean initialized
Boolean indicating if the init() method has been called.


m_lastModified

protected static long m_lastModified
Timestamp of the config file, used to know when to reload from disk.


m_defsMap

protected static Map<String,LocationDef> m_defsMap
Constant m_defsMap

Constructor Detail

MonitoringLocationsFactory

public MonitoringLocationsFactory(String configFile)
                           throws org.exolab.castor.xml.MarshalException,
                                  org.exolab.castor.xml.ValidationException,
                                  IOException

Constructor for MonitoringLocationsFactory.

Parameters:
configFile - a String object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
IOException - if any.

MonitoringLocationsFactory

public MonitoringLocationsFactory(InputStream stream)
                           throws org.exolab.castor.xml.MarshalException,
                                  org.exolab.castor.xml.ValidationException

Constructor for MonitoringLocationsFactory.

Parameters:
stream - a InputStream object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

MonitoringLocationsFactory

@Deprecated
public MonitoringLocationsFactory(Reader rdr)
                           throws org.exolab.castor.xml.MarshalException,
                                  org.exolab.castor.xml.ValidationException
Deprecated. 

Constructor for MonitoringLocationsFactory.

Parameters:
rdr - a Reader object.
Throws:
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
Method Detail

init

public static void init()
                 throws IOException,
                        FileNotFoundException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException
Be sure to call this method before calling getInstance().

Throws:
IOException - if any.
FileNotFoundException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

getInstance

public static MonitoringLocationsFactory getInstance()
Singleton static call to get the only instance that should exist for the MonioringLocationsFactory

Returns:
the monitoring locations factory instance
Throws:
IllegalStateException - if init has not been called

setInstance

public static void setInstance(MonitoringLocationsFactory instance)

setInstance

Parameters:
instance - a MonitoringLocationsFactory object.

reload

public void reload()
            throws IOException,
                   FileNotFoundException,
                   org.exolab.castor.xml.MarshalException,
                   org.exolab.castor.xml.ValidationException

reload

Throws:
IOException - if any.
FileNotFoundException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

getDef

public LocationDef getDef(String defName)
                   throws IOException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException
Can't be null

Parameters:
defName - a String object.
Returns:
a LocationDef object.
Throws:
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

updateFromFile

protected void updateFromFile()
                       throws IOException,
                              org.exolab.castor.xml.MarshalException,
                              org.exolab.castor.xml.ValidationException
Reload the config file if it has been changed since we last read it.

Throws:
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.

getConfig

public static MonitoringLocationsConfiguration getConfig()

getConfig

Returns:
a MonitoringLocationsConfiguration object.

setConfig

public static void setConfig(MonitoringLocationsConfiguration m_config)

setConfig

Parameters:
m_config - a MonitoringLocationsConfiguration object.

getDefsMap

public static Map<String,LocationDef> getDefsMap()

getDefsMap

Returns:
a Map object.

setDefsMap

public static void setDefsMap(Map<String,LocationDef> map)

setDefsMap

Parameters:
map - a Map object.


Copyright © 2011. All Rights Reserved.