org.opennms.bb.dp.poller.parsers
Class ModelsParser

java.lang.Object
  |
  +--org.opennms.bb.common.utils.BBParser
        |
        +--org.opennms.bb.dp.poller.parsers.ModelsParser

public final class ModelsParser
extends BBParser

This class is used to parse the packages.xml and load the information into classes to be used programatically.

Version:
$Revision: 1.2 $
Author:
Jason Johns, OpenNMS

Inner classes inherited from class org.opennms.bb.common.utils.BBParser
BBParser.BBErrorHandler
 
Field Summary
private static String BEGIN
           
private static String CREATED
           
private static String END
           
private static String HEADER
           
private static String INTERVAL
           
private static String INTERVALS
           
private  List m_modelList
          The list of models to parse from the xml file.
private  List m_models
          The list of Model objects that are created by parsing from the list of models.
private  PollerModel m_pollerModel
          As each model is parsed this object will be built and then placed into the m_models list when complete
private  boolean m_readModel
          Indicates if a certain model should be read or ignored
private static String MODEL
           
private static String MODEL_DESCR
           
private static String MODEL_NAME
           
private static String MODELS
           
private static String MSTATION
           
private static String SERVICE_MODELS
           
private static String VALUE
           
private static String VER
           
 
Fields inherited from class org.opennms.bb.common.utils.BBParser
ATTRIB_VALUE_PAIR_ERR, ATTRIB_VALUE_PAIR_ERR_STR, EXCEPTION, m_curElement, m_errNum, m_exceptionMsg, m_inpSource, m_parser, NULL_VALUE_ERR, NULL_VALUE_ERR_STR
 
Constructor Summary
ModelsParser(List aModelList)
          Creates the new parser that can be used to disassemble an XML file corresponding to the models.dtd as defined by the OpenNMS specifications.
 
Method Summary
 List getModels()
          This method returns the list of models that was created by parsing.
 Map getModelsAsMap()
          This method returns the list of models as a Map object, indexed by the model name.
protected  boolean processElement(org.w3c.dom.Element el, boolean isRoot)
          This method override the method in the base class that is the default target for processing elements in the DOM tree.
private  boolean processIntervalElement(org.w3c.dom.Element intervalElement, PollerModel aPollerModel)
          This method is used to process the tags
 
Methods inherited from class org.opennms.bb.common.utils.BBParser
getErrorMessage, getErrorNumber, parse, parse, parse, parse, processDocument, processNode, processParmValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_modelList

private List m_modelList
The list of models to parse from the xml file. If a model name is not in this list it will not be parsed.

m_models

private List m_models
The list of Model objects that are created by parsing from the list of models.

m_readModel

private boolean m_readModel
Indicates if a certain model should be read or ignored

m_pollerModel

private PollerModel m_pollerModel
As each model is parsed this object will be built and then placed into the m_models list when complete

SERVICE_MODELS

private static final String SERVICE_MODELS

HEADER

private static final String HEADER

VER

private static final String VER

MSTATION

private static final String MSTATION

CREATED

private static final String CREATED

MODELS

private static final String MODELS

MODEL

private static final String MODEL

MODEL_NAME

private static final String MODEL_NAME

MODEL_DESCR

private static final String MODEL_DESCR

INTERVALS

private static final String INTERVALS

INTERVAL

private static final String INTERVAL

BEGIN

private static final String BEGIN

END

private static final String END

VALUE

private static final String VALUE
Constructor Detail

ModelsParser

public ModelsParser(List aModelList)

Creates the new parser that can be used to disassemble an XML file corresponding to the models.dtd as defined by the OpenNMS specifications. A new instance of a DOM parser is created to parse the passed file. The list of models that should be read by the parser are passed to the object on construction.

Parameters:
List - aPackageList, The list of m_packages to be read.
Method Detail

processElement

protected boolean processElement(org.w3c.dom.Element el,
                                 boolean isRoot)

This method override the method in the base class that is the default target for processing elements in the DOM tree. The method is invoked by the DOM parser to handle each element.

Overrides:
processElement in class BBParser
Parameters:
el - The DOM element to be processed.
isRoot - True if the element is a root element.
Returns:
True if the element was successfully handled.

processIntervalElement

private boolean processIntervalElement(org.w3c.dom.Element intervalElement,
                                       PollerModel aPollerModel)

This method is used to process the tags

Parameters:
Element - serviceElement, the DOM element to handle.
PollerPackage - m_pollerPackage, the package object we are building
Returns:
Returns true if successful, false otherwise.

getModels

public List getModels()

This method returns the list of models that was created by parsing.

Returns:
List, the list of Models

getModelsAsMap

public Map getModelsAsMap()

This method returns the list of models as a Map object, indexed by the model name.

Returns:
Map, the map of models