org.opennms.web.map.config
Class MapPropertiesFactory

java.lang.Object
  extended by org.opennms.web.map.config.MapPropertiesFactory

public class MapPropertiesFactory
extends java.lang.Object


Field Summary
protected static java.util.Map<java.lang.String,Avail> availsMap
           
protected static java.util.Map<java.lang.String,java.lang.String> bgImagesMap
           
protected static java.lang.String defaultFactory
           
protected static int defaultLink
           
protected static java.util.Map<java.lang.String,MapsFactory> factoriesMap
           
protected static java.lang.String home
           
protected static java.util.Map<java.lang.String,java.lang.String> iconsMap
           
protected static java.lang.String info
          Descriptive information about this factory.
protected static java.util.Map<java.lang.Integer,java.util.Set<Link>> linksBySnmpTypeMap
           
protected static java.util.Map<java.lang.Integer,Link> linksMap
           
protected static java.util.Map<java.lang.String,LinkStatus> linkStatusesMap
           
protected static org.apache.log4j.Category log
          The Log4J category for logging web authentication messages.
protected static java.io.File mapPropertiesFile
          The map.properties file that is read for the list of severities and statuses settings for map view.
static java.lang.String MULTILINK_BEST_STATUS
           
static java.lang.String MULTILINK_WORST_STATUS
           
protected static java.lang.String multilinkStatus
           
protected static java.lang.String name
          Descriptive information about this factory.
protected static java.util.Map nodesPerSource
           
protected static Avail[] orderedAvails
           
protected static Severity[] orderedSeverities
           
protected static Status[] orderedStatuses
           
protected static java.util.Map[] propertiesMaps
           
protected static java.util.Map<java.lang.String,Severity> severitiesMap
           
protected static java.lang.String severityMapAs
           
protected static java.util.Map<java.lang.String,DataSource> sourcesMap
           
protected static java.util.Map<java.lang.String,Status> statusesMap
           
 
Method Summary
 boolean enableAvail()
           
 Avail getAvail(double avail)
           
 java.util.Map getAvailabilitiesMap()
          Gets the java.util.Map with key = availability label and value the Avail corresponding to the label
 java.util.Map getBackgroundImagesMap()
           
 DataSource getDataSource(java.lang.String dataSourceLabel)
           
 java.lang.Class getDataSourceClass(int nodeid)
          return the Class of the first dataSource (of map.properties file) matching with the nodeid in input
 MapsFactory getDefaultFactory()
          gets the default MapsFactory
 Link getDefaultLink()
           
 java.lang.String getDefaultMapIcon()
           
 java.lang.String getDefaultNodeIcon()
           
 Severity getDefaultSeverity()
          Gets the 'normal' severity in map.properties.
 Status getDefaultStatus()
          Gets the 'nodeup' status in map.properties.
 Avail getDisabledAvail()
           
 java.util.Map getFactoriesMap()
           
 java.util.Map getIconsMap()
           
 Severity getIndeterminateSeverity()
          Gets the 'indeterminate' severity in map.properties.
 java.lang.String getInfo()
           
static MapPropertiesFactory getInstance()
          Return the singleton instance of this factory.
 Link getLink(int id)
           
 java.util.Set<Link> getLinkBySnmpType(int linkTypologyId)
          gets the config Link by snmpType defined in the map properties config file
 java.util.Map getLinksMap()
           
 LinkStatus getLinkStatus(java.lang.String linkStatusLabel)
          gets the config LinkStatus by label defined in the map properties config file
 java.util.Map getLinkStatusesMap()
           
 int getLinkTypeId(int snmpiftype, long snmpifspeed)
          gets the id corresponding to the link defined in configuration file.
 java.util.Map[] getMapProperties()
          gets an Array of java.util.Map: -severitiesMap: severity label (String) to Severity -statusesMap: status (String) uei to Status -availsMap: min (String) of avail to Avail -iconsMap: icon (String) label to String (icon filename) -bgImagesMap: background (String) image label to String (background image filename) -sourcesMap: source label (String) to DataSource -factoriesMap: factory label (String) to MapsFactory
 MapsFactory getMapsFactory(java.lang.String factoryLabel)
          gets the MapsFactory by the factoryLabel in input
static java.lang.String getMultilinkStatus()
           
 java.util.Set getNodeIdsBySource(java.lang.String sourceLabel)
           
 Avail[] getOrderedAvails()
          Gets the array of ordered Avail by min.
 Severity[] getOrderedSeverities()
          Gets the array of ordered Severity by id.
 Status[] getOrderedStatuses()
          Gets the array of ordered Status by id.
static java.lang.String getProperty(java.lang.String key)
           
 java.util.Map getSeveritiesMap()
          Gets the java.util.Map with key = severity label and value the Severity corresponding to the label
 int getSeverity(java.lang.String severityLabel)
           
 java.lang.String getSeverityMapAs()
           
 java.util.Map getSourcesMap()
           
 int getStatus(java.lang.String uei)
           
 java.util.Map getStatusesMap()
          Gets the java.util.Map with key = uei and value the status corresponding to the uei
 Avail getUndefinedAvail()
          Gets the 'undefined' Avilability in map.properties.
 Status getUnknownUeiStatus()
          Gets the 'undefined' status in map.properties.
static void init()
           
protected static java.util.Map[] parseMapProperties()
          Parses the map.properties file into some mappings: -severitiesMap: severity label (String) to Severity -statusesMap: status (String) uei to Status -availsMap: min (String) of avail to Avail -iconsMap: icon (String) label to String (icon filename) -bgImagesMap: background (String) image label to String (background image filename) -sourcesMap: source label (String) to DataSource -factoriesMap: factory label (String) to MapsFactory
static void reload(boolean reloadPropertiesFile)
          Every time called, reload the properties file and the nodes per data source defined in the properties file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

info

protected static final java.lang.String info
Descriptive information about this factory.

See Also:
Constant Field Values

name

protected static final java.lang.String name
Descriptive information about this factory.

See Also:
Constant Field Values

mapPropertiesFile

protected static java.io.File mapPropertiesFile
The map.properties file that is read for the list of severities and statuses settings for map view.


home

protected static java.lang.String home

log

protected static org.apache.log4j.Category log
The Log4J category for logging web authentication messages.


propertiesMaps

protected static java.util.Map[] propertiesMaps

statusesMap

protected static java.util.Map<java.lang.String,Status> statusesMap

orderedStatuses

protected static Status[] orderedStatuses

severitiesMap

protected static java.util.Map<java.lang.String,Severity> severitiesMap

orderedSeverities

protected static Severity[] orderedSeverities

availsMap

protected static java.util.Map<java.lang.String,Avail> availsMap

orderedAvails

protected static Avail[] orderedAvails

iconsMap

protected static java.util.Map<java.lang.String,java.lang.String> iconsMap

bgImagesMap

protected static java.util.Map<java.lang.String,java.lang.String> bgImagesMap

sourcesMap

protected static java.util.Map<java.lang.String,DataSource> sourcesMap

nodesPerSource

protected static java.util.Map nodesPerSource

factoriesMap

protected static java.util.Map<java.lang.String,MapsFactory> factoriesMap

linksMap

protected static java.util.Map<java.lang.Integer,Link> linksMap

linksBySnmpTypeMap

protected static java.util.Map<java.lang.Integer,java.util.Set<Link>> linksBySnmpTypeMap

linkStatusesMap

protected static java.util.Map<java.lang.String,LinkStatus> linkStatusesMap

defaultFactory

protected static java.lang.String defaultFactory

severityMapAs

protected static java.lang.String severityMapAs

MULTILINK_BEST_STATUS

public static final java.lang.String MULTILINK_BEST_STATUS
See Also:
Constant Field Values

MULTILINK_WORST_STATUS

public static final java.lang.String MULTILINK_WORST_STATUS
See Also:
Constant Field Values

multilinkStatus

protected static java.lang.String multilinkStatus

defaultLink

protected static int defaultLink
Method Detail

init

public static void init()
                 throws java.io.FileNotFoundException,
                        java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

reload

public static void reload(boolean reloadPropertiesFile)
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Every time called, reload the properties file and the nodes per data source defined in the properties file.

Throws:
java.io.FileNotFoundException
java.io.IOException

getInstance

public static MapPropertiesFactory getInstance()
Return the singleton instance of this factory.

Returns:
The current factory instance.
Throws:
java.lang.IllegalStateException - Thrown if the factory has not yet been initialized.

getMapProperties

public java.util.Map[] getMapProperties()
                                 throws java.io.IOException,
                                        java.io.FileNotFoundException
gets an Array of java.util.Map: -severitiesMap: severity label (String) to Severity -statusesMap: status (String) uei to Status -availsMap: min (String) of avail to Avail -iconsMap: icon (String) label to String (icon filename) -bgImagesMap: background (String) image label to String (background image filename) -sourcesMap: source label (String) to DataSource -factoriesMap: factory label (String) to MapsFactory

Throws:
java.io.IOException
java.io.FileNotFoundException

getSeveritiesMap

public java.util.Map getSeveritiesMap()
                               throws java.io.IOException,
                                      java.io.FileNotFoundException
Gets the java.util.Map with key = severity label and value the Severity corresponding to the label

Returns:
Throws:
java.io.IOException
java.io.FileNotFoundException

getAvailabilitiesMap

public java.util.Map getAvailabilitiesMap()
                                   throws java.io.IOException,
                                          java.io.FileNotFoundException
Gets the java.util.Map with key = availability label and value the Avail corresponding to the label

Returns:
Throws:
java.io.IOException
java.io.FileNotFoundException

getAvail

public Avail getAvail(double avail)

getDisabledAvail

public Avail getDisabledAvail()
                       throws java.io.IOException,
                              java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

enableAvail

public boolean enableAvail()
                    throws java.io.IOException,
                           java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

getDefaultStatus

public Status getDefaultStatus()
                        throws java.io.IOException,
                               java.io.FileNotFoundException
Gets the 'nodeup' status in map.properties. nodeup status is a required parameter.

Returns:
nodeup status
Throws:
java.io.IOException
java.io.FileNotFoundException

getUnknownUeiStatus

public Status getUnknownUeiStatus()
                           throws java.io.IOException,
                                  java.io.FileNotFoundException
Gets the 'undefined' status in map.properties. nodeup status is a required parameter.

Returns:
nodeup status
Throws:
java.io.IOException
java.io.FileNotFoundException

getDefaultSeverity

public Severity getDefaultSeverity()
                            throws java.io.IOException,
                                   java.io.FileNotFoundException
Gets the 'normal' severity in map.properties. Normal severity is a required parameter.

Returns:
Normal severity
Throws:
java.io.IOException
java.io.FileNotFoundException

getIndeterminateSeverity

public Severity getIndeterminateSeverity()
                                  throws java.io.IOException,
                                         java.io.FileNotFoundException
Gets the 'indeterminate' severity in map.properties. Indeterminate severity is a required parameter.

Returns:
Indeterminate Severity
Throws:
java.io.IOException
java.io.FileNotFoundException

getUndefinedAvail

public Avail getUndefinedAvail()
                        throws java.io.IOException,
                               java.io.FileNotFoundException
Gets the 'undefined' Avilability in map.properties. Undefined Availability is a required parameter.

Returns:
Undefined Availability
Throws:
java.io.IOException
java.io.FileNotFoundException

getStatusesMap

public java.util.Map getStatusesMap()
                             throws java.io.IOException,
                                    java.io.FileNotFoundException
Gets the java.util.Map with key = uei and value the status corresponding to the uei

Returns:
java.util.Map with key = uei and value the status corresponding to the uei
Throws:
java.io.IOException
java.io.FileNotFoundException

getInfo

public java.lang.String getInfo()

getSeverityMapAs

public java.lang.String getSeverityMapAs()

getProperty

public static java.lang.String getProperty(java.lang.String key)
                                    throws java.io.FileNotFoundException,
                                           java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

parseMapProperties

protected static java.util.Map[] parseMapProperties()
                                             throws java.io.FileNotFoundException,
                                                    java.io.IOException
Parses the map.properties file into some mappings: -severitiesMap: severity label (String) to Severity -statusesMap: status (String) uei to Status -availsMap: min (String) of avail to Avail -iconsMap: icon (String) label to String (icon filename) -bgImagesMap: background (String) image label to String (background image filename) -sourcesMap: source label (String) to DataSource -factoriesMap: factory label (String) to MapsFactory

Throws:
java.io.FileNotFoundException
java.io.IOException

getSourcesMap

public java.util.Map getSourcesMap()

getFactoriesMap

public java.util.Map getFactoriesMap()

getIconsMap

public java.util.Map getIconsMap()

getBackgroundImagesMap

public java.util.Map getBackgroundImagesMap()

getDefaultMapIcon

public java.lang.String getDefaultMapIcon()
                                   throws java.io.IOException,
                                          java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

getDefaultNodeIcon

public java.lang.String getDefaultNodeIcon()
                                    throws java.io.IOException,
                                           java.io.FileNotFoundException
Throws:
java.io.IOException
java.io.FileNotFoundException

getOrderedSeverities

public Severity[] getOrderedSeverities()
Gets the array of ordered Severity by id.

Returns:

getOrderedAvails

public Avail[] getOrderedAvails()
Gets the array of ordered Avail by min.

Returns:

getOrderedStatuses

public Status[] getOrderedStatuses()
Gets the array of ordered Status by id.

Returns:

getDataSourceClass

public java.lang.Class getDataSourceClass(int nodeid)
return the Class of the first dataSource (of map.properties file) matching with the nodeid in input

Parameters:
nodeid -
Returns:
the Class of the first dataSource (of map.properties file) matching with the nodeid in input, null if there are no matches.

getDataSource

public DataSource getDataSource(java.lang.String dataSourceLabel)

getNodeIdsBySource

public java.util.Set getNodeIdsBySource(java.lang.String sourceLabel)
                                 throws MapsException
Throws:
MapsException

getMapsFactory

public MapsFactory getMapsFactory(java.lang.String factoryLabel)
gets the MapsFactory by the factoryLabel in input

Parameters:
factoryLabel -
Returns:
MapsFactory by the factoryLabel in input

getDefaultFactory

public MapsFactory getDefaultFactory()
gets the default MapsFactory

Returns:
the default MapsFactory

getSeverity

public int getSeverity(java.lang.String severityLabel)

getStatus

public int getStatus(java.lang.String uei)

getLinkBySnmpType

public java.util.Set<Link> getLinkBySnmpType(int linkTypologyId)
gets the config Link by snmpType defined in the map properties config file

Parameters:
linkTypologyId -
Returns:

getLinkTypeId

public int getLinkTypeId(int snmpiftype,
                         long snmpifspeed)
gets the id corresponding to the link defined in configuration file. The match is performed first by snmptype, then by speed (if more are defined). If there is no match, the default link id is returned.

Parameters:
snmpiftype -
snmpifspeed -
Returns:
the id corresponding to the link defined in configuration file. If there is no match, the default link id is returned.

getLink

public Link getLink(int id)

getLinkStatus

public LinkStatus getLinkStatus(java.lang.String linkStatusLabel)
gets the config LinkStatus by label defined in the map properties config file

Parameters:
linkStatusLabel -
Returns:

getDefaultLink

public Link getDefaultLink()

getLinksMap

public java.util.Map getLinksMap()

getLinkStatusesMap

public java.util.Map getLinkStatusesMap()

getMultilinkStatus

public static java.lang.String getMultilinkStatus()


Copyright © 2007. All Rights Reserved.