org.opennms.netmgt.config
Class PollOutagesConfigManager

java.lang.Object
  extended by org.opennms.netmgt.config.PollOutagesConfigManager
All Implemented Interfaces:
PollOutagesConfig
Direct Known Subclasses:
PollOutagesConfigFactory

public abstract class PollOutagesConfigManager
extends Object
implements PollOutagesConfig

Represents a PollOutagesConfigManager

Author:
brozow

Constructor Summary
PollOutagesConfigManager()
           
 
Method Summary
 void addOutage(Outage newOutage)
           
protected  Outages 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)
           
 Interface[] getInterfaces(String name)
          Return the interfaces for specified outage.
 Node[] getNodeIds(String name)
           
 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.
 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 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)
           
 void removeOutage(String outageName)
           
 void replaceOutage(Outage oldOutage, Outage newOutage)
           
 void saveCurrent()
          Saves the current in-memory configuration to disk and reloads
protected abstract  void saveXML(String xmlString)
           
protected  void setConfig(Outages config)
           
abstract  void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollOutagesConfigManager

public PollOutagesConfigManager()
Method Detail

setConfig

protected void setConfig(Outages config)
Parameters:
config - The config to set.

getConfig

protected Outages 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.

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.

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

isTimeInOutage

public boolean isTimeInOutage(long time,
                              String outName)
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.

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)

removeOutage

public void removeOutage(String outageName)

removeOutage

public void removeOutage(Outage outageToRemove)

replaceOutage

public void replaceOutage(Outage oldOutage,
                          Outage newOutage)

getNodeIds

public Node[] getNodeIds(String name)

isNodeIdInOutage

public boolean isNodeIdInOutage(long lnodeid,
                                String outName)

Return if nodeid is part of specified outage

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

getEndOfOutage

public Calendar getEndOfOutage(String outName)

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


isNodeIdInOutage

public boolean isNodeIdInOutage(long lnodeid,
                                Outage out)

Return if nodeid is part of specified outage

Parameters:
lnodeid - the nodeid to be looked up
outName - the outage
Returns:
the node iis part of the specified outage

saveCurrent

public void saveCurrent()
                 throws org.exolab.castor.xml.MarshalException,
                        IOException,
                        org.exolab.castor.xml.ValidationException
Saves the current in-memory configuration to disk and reloads

Throws:
org.exolab.castor.xml.MarshalException
IOException
org.exolab.castor.xml.ValidationException

saveXML

protected abstract void saveXML(String xmlString)
                         throws IOException,
                                org.exolab.castor.xml.MarshalException,
                                org.exolab.castor.xml.ValidationException
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException

update

public abstract void update()
                     throws IOException,
                            org.exolab.castor.xml.MarshalException,
                            org.exolab.castor.xml.ValidationException
Specified by:
update in interface PollOutagesConfig
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException


Copyright © 2009. All Rights Reserved.