OpenNMS API 1.2.3

org.opennms.netmgt.config
Class PollOutagesConfigManager

java.lang.Object
  extended byorg.opennms.netmgt.config.PollOutagesConfigManager
All Implemented Interfaces:
PollOutagesConfig
Direct Known Subclasses:
MockPollerConfig, PollOutagesConfigFactory

public abstract class PollOutagesConfigManager
extends java.lang.Object
implements PollOutagesConfig

Represents a PollOutagesConfigManager

Author:
brozow

Field Summary
static java.lang.String FORMAT1
           
static java.lang.String FORMAT2
           
private  Outages m_config
          The config class loaded from the config file
protected static java.util.Map m_dayOfWeekMap
          The day of the week values to name mapping
 
Constructor Summary
PollOutagesConfigManager()
           
 
Method Summary
 void addOutage(Outage newOutage)
           
protected static void createDayOfWeekMapping()
          Create the day of week mapping
protected  Outages getConfig()
           
 java.util.Calendar getEndOfOutage(Outage out)
          Return a calendar representing the end time of this outage, assuming it's currently active (i.e.
 java.util.Calendar getEndOfOutage(java.lang.String outName)
           
 Interface[] getInterfaces(java.lang.String name)
          Return the interfaces for specified outage.
 Node[] getNodeIds(java.lang.String name)
           
 Outage getOutage(java.lang.String name)
          Return the specified outage.
 Outage[] getOutages()
          Return the outages configured.
 Time[] getOutageTimes(java.lang.String name)
          Return the outage times for specified outage.
 java.lang.String getOutageType(java.lang.String name)
          Return the type for specified outage.
 boolean isCurTimeInOutage(Outage out)
          Return if current time is part of specified outage.
 boolean isCurTimeInOutage(java.lang.String outName)
          Return if current time is part of specified outage.
 boolean isInterfaceInOutage(java.lang.String linterface, Outage out)
          Return if interfaces is part of specified outage.
 boolean isInterfaceInOutage(java.lang.String linterface, java.lang.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, java.lang.String outName)
           Return if nodeid is part of specified outage
 boolean isTimeInOutage(java.util.Calendar cal, Outage out)
          Return if time is part of specified outage.
 boolean isTimeInOutage(java.util.Calendar cal, java.lang.String outName)
          Return if time is part of specified outage.
 boolean isTimeInOutage(long time, java.lang.String outName)
          Return if time is part of specified outage.
 void removeOutage(Outage outageToRemove)
           
 void removeOutage(java.lang.String outageName)
           
 void replaceOutage(Outage oldOutage, Outage newOutage)
           
 void saveCurrent()
          Saves the current in-memory configuration to disk and reloads
protected abstract  void saveXML(java.lang.String xmlString)
           
protected  void setConfig(Outages config)
           
private  void setOutCalTime(java.util.Calendar outCal, java.lang.String timeStr)
          Set the time in outCal from timeStr.
abstract  void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_config

private Outages m_config
The config class loaded from the config file


m_dayOfWeekMap

protected static java.util.Map m_dayOfWeekMap
The day of the week values to name mapping


FORMAT1

public static java.lang.String FORMAT1

FORMAT2

public static java.lang.String FORMAT2
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.

createDayOfWeekMapping

protected static void createDayOfWeekMapping()
Create the day of week mapping


setOutCalTime

private void setOutCalTime(java.util.Calendar outCal,
                           java.lang.String timeStr)
Set the time in outCal from timeStr. 'timeStr'is in either the 'dd-MMM-yyyy HH:mm:ss' or the 'HH:mm:ss' formats

Parameters:
outCal - the calendar in which time is to be set
timeStr - the time string

getOutages

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

Returns:
the outages configured

getOutage

public Outage getOutage(java.lang.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 java.lang.String getOutageType(java.lang.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(java.lang.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(java.lang.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(java.lang.String linterface,
                                   java.lang.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(java.lang.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(java.util.Calendar cal,
                              java.lang.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,
                              java.lang.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(java.util.Calendar cal,
                              Outage out)
Return if time is part of specified outage.

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

isCurTimeInOutage

public boolean isCurTimeInOutage(java.lang.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(java.lang.String outageName)

removeOutage

public void removeOutage(Outage outageToRemove)

replaceOutage

public void replaceOutage(Outage oldOutage,
                          Outage newOutage)

getNodeIds

public Node[] getNodeIds(java.lang.String name)

isNodeIdInOutage

public boolean isNodeIdInOutage(long lnodeid,
                                java.lang.String outName)

Return if nodeid is part of specified outage

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

getEndOfOutage

public java.util.Calendar getEndOfOutage(java.lang.String outName)

getEndOfOutage

public java.util.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
Returns:
the node iis part of the specified outage

saveCurrent

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

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

saveXML

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

update

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

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.