org.opennms.netmgt.config
Class PollOutagesConfigManager

java.lang.Object
  extended by org.opennms.netmgt.dao.castor.AbstractCastorConfigDao<Outages,Outages>
      extended by org.opennms.netmgt.config.PollOutagesConfigManager
All Implemented Interfaces:
PollOutagesConfig, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
PollOutagesConfigFactory

public abstract class PollOutagesConfigManager
extends AbstractCastorConfigDao<Outages,Outages>
implements PollOutagesConfig

Represents a PollOutagesConfigManager

Version:
$Id: $
Author:
brozow

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opennms.netmgt.dao.castor.AbstractCastorConfigDao
AbstractCastorConfigDao.CastorReloadCallback
 
Constructor Summary
PollOutagesConfigManager()
           
 
Method Summary
 void addOutage(Outage newOutage)
          addOutage
 void afterPropertiesSet()
          afterPropertiesSet
protected  String createLoadedLogMessage(Outages config, long diffTime)
          createLoadedLogMessage
protected  Outages getConfig()
          getConfig
static Calendar getEndOfOutage(Outage out)
          Return a calendar representing the end time of this outage, assuming it's currently active (i.e.
 Calendar getEndOfOutage(String outName)
          getEndOfOutage
 Interface[] getInterfaces(String name)
          Return the interfaces for specified outage.
 Node[] getNodeIds(String name)
          getNodeIds
 Outage getOutage(String name)
          Return the specified outage.
 Outage[] getOutages()
          Return the outages configured.
 Time[] getOutageTimes(String name)
          Return the outage times for specified outage.
 String getOutageType(String name)
          Return the type for specified outage.
 Lock getReadLock()
           
 Lock getWriteLock()
           
 boolean isCurTimeInOutage(Outage out)
          Return if current time is part of specified outage.
 boolean isCurTimeInOutage(String outName)
          Return if current time is part of specified outage.
 boolean isInterfaceInOutage(String linterface, Outage out)
          Return if interfaces is part of specified outage.
 boolean isInterfaceInOutage(String linterface, String outName)
          Return if interfaces is part of specified outage.
 boolean isNodeIdInOutage(long lnodeid, Outage out)
           Return if nodeid is part of specified outage
 boolean isNodeIdInOutage(long lnodeid, String outName)
          Return if the node represented by the nodeid is part of specified outage.
 boolean isTimeInOutage(Calendar cal, Outage outage)
          Return if time is part of specified outage.
 boolean isTimeInOutage(Calendar cal, String outName)
           Return if time is part of specified outage.
 boolean isTimeInOutage(long time, String outName)
          Return if time is part of specified outage.
 void removeOutage(Outage outageToRemove)
          removeOutage
 void removeOutage(String outageName)
          removeOutage
 void replaceOutage(Outage oldOutage, Outage newOutage)
          replaceOutage
 Outages translateConfig(Outages outages)
          translateConfig
 
Methods inherited from class org.opennms.netmgt.dao.castor.AbstractCastorConfigDao
getConfigResource, getContainer, getDescription, getReloadCheckInterval, loadConfig, log, setConfigResource, setReloadCheckInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opennms.netmgt.config.PollOutagesConfig
update
 

Constructor Detail

PollOutagesConfigManager

public PollOutagesConfigManager()
Method Detail

getReadLock

public Lock getReadLock()

getWriteLock

public Lock getWriteLock()

createLoadedLogMessage

protected String createLoadedLogMessage(Outages config,
                                        long diffTime)

createLoadedLogMessage

Overrides:
createLoadedLogMessage in class AbstractCastorConfigDao<Outages,Outages>
Parameters:
config - a V object.
diffTime - a long.
Returns:
a String object.

afterPropertiesSet

public void afterPropertiesSet()
                        throws org.springframework.dao.DataAccessException

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class AbstractCastorConfigDao<Outages,Outages>
Throws:
org.springframework.dao.DataAccessException

translateConfig

public Outages translateConfig(Outages outages)
Description copied from class: AbstractCastorConfigDao

translateConfig

Specified by:
translateConfig in class AbstractCastorConfigDao<Outages,Outages>
Parameters:
outages - a K object.
Returns:
a V object.

getConfig

protected Outages getConfig()

getConfig

Returns:
Returns the config.

getOutages

public Outage[] getOutages()
Return the outages configured.

Returns:
the outages configured

getOutage

public Outage getOutage(String name)
Return the specified outage.

Parameters:
name - the outage that is to be looked up
Returns:
the specified outage, null if not found

getOutageType

public String getOutageType(String name)
Return the type for specified outage.

Parameters:
name - the outage that is to be looked up
Returns:
the type for the specified outage, null if not found

getOutageTimes

public Time[] getOutageTimes(String name)
Return the outage times for specified outage.

Parameters:
name - the outage that is to be looked up
Returns:
the outage times for the specified outage, null if not found

getInterfaces

public Interface[] getInterfaces(String name)
Return the interfaces for specified outage.

Parameters:
name - the outage that is to be looked up
Returns:
the interfaces for the specified outage, null if not found

isInterfaceInOutage

public boolean isInterfaceInOutage(String linterface,
                                   String outName)
Return if interfaces is part of specified outage. Return if interfaces is part of specified outage.

Specified by:
isInterfaceInOutage in interface PollOutagesConfig
Parameters:
linterface - the interface to be looked up
outName - the outage name
Returns:
the interface is part of the specified outage

isInterfaceInOutage

public boolean isInterfaceInOutage(String linterface,
                                   Outage out)
Return if interfaces is part of specified outage.

Parameters:
linterface - the interface to be looked up
out - the outage
Returns:
the interface is part of the specified outage

isTimeInOutage

public boolean isTimeInOutage(Calendar cal,
                              String outName)
Return if time is part of specified outage.


isTimeInOutage

public boolean isTimeInOutage(long time,
                              String outName)
Return if time is part of specified outage. Return if time is part of specified outage.

Specified by:
isTimeInOutage in interface PollOutagesConfig
Parameters:
time - the time in millis to look up
outName - the outage name
Returns:
true if time is in outage

isTimeInOutage

public boolean isTimeInOutage(Calendar cal,
                              Outage outage)
Return if time is part of specified outage.

Parameters:
cal - the calendar to lookup
outage - the outage
Returns:
true if time is in outage

isCurTimeInOutage

public boolean isCurTimeInOutage(String outName)
Return if current time is part of specified outage. Return if current time is part of specified outage.

Specified by:
isCurTimeInOutage in interface PollOutagesConfig
Parameters:
outName - the outage name
Returns:
true if current time is in outage

isCurTimeInOutage

public boolean isCurTimeInOutage(Outage out)
Return if current time is part of specified outage.

Parameters:
out - the outage
Returns:
true if current time is in outage

addOutage

public void addOutage(Outage newOutage)

addOutage

Parameters:
newOutage - a Outage object.

removeOutage

public void removeOutage(String outageName)

removeOutage

Parameters:
outageName - a String object.

removeOutage

public void removeOutage(Outage outageToRemove)

removeOutage

Parameters:
outageToRemove - a Outage object.

replaceOutage

public void replaceOutage(Outage oldOutage,
                          Outage newOutage)

replaceOutage

Parameters:
oldOutage - a Outage object.
newOutage - a Outage object.

getNodeIds

public Node[] getNodeIds(String name)

getNodeIds

Parameters:
name - a String object.
Returns:
an array of Node objects.

isNodeIdInOutage

public boolean isNodeIdInOutage(long lnodeid,
                                String outName)
Return if the node represented by the nodeid is part of specified outage.

Return if nodeid is part of specified outage

Specified by:
isNodeIdInOutage in interface PollOutagesConfig
Parameters:
lnodeid - the nodeid to be checked
outName - the outage name
Returns:
the node is part of the specified outage

getEndOfOutage

public Calendar getEndOfOutage(String outName)

getEndOfOutage

Parameters:
outName - a String object.
Returns:
a Calendar object.

getEndOfOutage

public static Calendar getEndOfOutage(Outage out)
Return a calendar representing the end time of this outage, assuming it's currently active (i.e. right now is within one of the time periods) FIXME: This code is almost identical to isTimeInOutage... We need to fix it

Parameters:
out - a Outage object.
Returns:
a Calendar object.

isNodeIdInOutage

public boolean isNodeIdInOutage(long lnodeid,
                                Outage out)

Return if nodeid is part of specified outage

Parameters:
lnodeid - the nodeid to be looked up
out - a Outage object.
Returns:
the node iis part of the specified outage


Copyright © 2011. All Rights Reserved.