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 boolean availEnabled
           
protected static java.util.Map<java.lang.String,Avail> availsMap
           
protected static java.util.Map<java.lang.String,java.lang.String> bgImagesMap
           
protected static ContextMenu cmenu
           
protected static boolean contextMenuEnabled
           
protected static int defaultLink
           
protected static java.lang.String defaultMapIcon
           
protected static java.lang.String defaultNodeIcon
           
protected static Severity defaultSeverity
           
protected static Status defaultStatus
           
protected static Avail disabledAvail
           
protected static boolean doubleClickEnabled
           
protected static java.util.Map<java.lang.String,java.lang.String> iconsMap
           
protected static Severity indeterminateSeverity
           
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.
protected  java.lang.String mapPropertiesFileString
           
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 Avail[] orderedAvails
           
protected static Severity[] orderedSeverities
           
protected static Status[] orderedStatuses
           
protected static java.util.Map[] propertiesMaps
           
protected static boolean reload
           
protected static java.util.Map<java.lang.String,Severity> severitiesMap
           
protected static java.lang.String severityMapAs
           
protected static java.util.Map<java.lang.String,Status> statusesMap
           
protected static Avail undefinedAvail
           
protected static Status unknownStatus
           
 
Constructor Summary
MapPropertiesFactory()
          Create a new instance.
MapPropertiesFactory(java.lang.String mapPropertiesFileString)
           
 
Method Summary
 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.List<Avail> getAvails()
           
 java.util.Map<java.lang.String,java.lang.String> getBackgroundImages()
           
 java.util.Map<java.lang.String,java.lang.String> getBackgroundImagesMap()
           
 ContextMenu getContextMenu()
           
 java.lang.String getDefaultBackgroundColor()
           
 Link getDefaultLink()
           
 int getDefaultMapElementDimension()
           
 java.lang.String getDefaultMapIcon()
           
 java.lang.String getDefaultNodeIcon()
           
 java.lang.String getDefaultSemaphoreColorBy()
           
 Severity getDefaultSeverity()
          Gets the default severity in map.properties.
 Status getDefaultStatus()
          Gets the default status in map.properties.
 int getDefaultStatusId()
           
 Avail getDisabledAvail()
           
 java.util.Map<java.lang.String,java.lang.String> getIcons()
           
 java.util.Map<java.lang.String,java.lang.String> getIconsMap()
           
 Severity getIndeterminateSeverity()
          Gets the indeterminate severity in map.properties.
 java.lang.String getInfo()
           
 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.List<Link> getLinks()
           
 java.util.Map<java.lang.Integer,Link> getLinksMap()
           
 LinkStatus getLinkStatus(java.lang.String linkStatusLabel)
          gets the config LinkStatus by label defined in the map properties config file
 java.util.List<LinkStatus> getLinkStatuses()
           
 java.util.Map<java.lang.String,LinkStatus> getLinkStatusesMap()
           
 int getLinkTypeId(int snmpiftype, long snmpifspeed)
          gets the id corresponding to the link defined in configuration file.
 java.util.Map<java.lang.Integer,java.lang.String> getMapElementDimensions()
           
 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
 java.lang.String getMapPropertiesFileString()
           
 java.lang.String getMultilinkStatus()
           
 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.List<Severity> getSeverities()
           
 java.util.Map<java.lang.String,Severity> 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()
           
 int getStatus(java.lang.String uei)
           
 java.util.List<Status> getStatuses()
           
 java.util.Map<java.lang.String,Status> 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 getUnknownStatus()
          Gets the unknown status in map.properties.
 void init()
           
 boolean isAvailEnabled()
           
 boolean isContextMenuEnabled()
           
 boolean isDoubleClickEnabled()
           
 boolean isReload()
           
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
 void reload(boolean reloadPropertiesFile)
          Every time called, reload the properties file and the nodes per data source defined in the properties file.
 void setContextMenu(ContextMenu cmenu)
           
 void setMapPropertiesFileString(java.lang.String mapPropertiesFileString)
           
 
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.


mapPropertiesFileString

protected java.lang.String mapPropertiesFileString

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

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

defaultNodeIcon

protected static java.lang.String defaultNodeIcon

defaultMapIcon

protected static java.lang.String defaultMapIcon

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

defaultSeverity

protected static Severity defaultSeverity

indeterminateSeverity

protected static Severity indeterminateSeverity

unknownStatus

protected static Status unknownStatus

defaultStatus

protected static Status defaultStatus

undefinedAvail

protected static Avail undefinedAvail

disabledAvail

protected static Avail disabledAvail

availEnabled

protected static boolean availEnabled

doubleClickEnabled

protected static boolean doubleClickEnabled

contextMenuEnabled

protected static boolean contextMenuEnabled

reload

protected static boolean reload

severityMapAs

protected static java.lang.String severityMapAs

cmenu

protected static ContextMenu cmenu
Constructor Detail

MapPropertiesFactory

public MapPropertiesFactory(java.lang.String mapPropertiesFileString)

MapPropertiesFactory

public MapPropertiesFactory()
Create a new instance.

Method Detail

getMapPropertiesFileString

public java.lang.String getMapPropertiesFileString()

setMapPropertiesFileString

public void setMapPropertiesFileString(java.lang.String mapPropertiesFileString)

getSeverityMapAs

public java.lang.String getSeverityMapAs()

getContextMenu

public ContextMenu getContextMenu()

setContextMenu

public void setContextMenu(ContextMenu cmenu)

isContextMenuEnabled

public boolean isContextMenuEnabled()

isDoubleClickEnabled

public boolean isDoubleClickEnabled()

isReload

public boolean isReload()

init

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

reload

public 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

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<java.lang.String,Severity> getSeveritiesMap()
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()
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()

isAvailEnabled

public boolean isAvailEnabled()

getDefaultStatus

public Status getDefaultStatus()
Gets the default status in map.properties. default status is a required parameter.

Returns:
default status

getUnknownStatus

public Status getUnknownStatus()
Gets the unknown status in map.properties. unknown status is a required parameter.

Returns:
unknown status

getDefaultSeverity

public Severity getDefaultSeverity()
Gets the default severity in map.properties. default severity is a required parameter.

Returns:
default severity

getIndeterminateSeverity

public Severity getIndeterminateSeverity()
Gets the indeterminate severity in map.properties. Indeterminate severity is a required parameter.

Returns:
Indeterminate Severity

getUndefinedAvail

public Avail getUndefinedAvail()
Gets the undefined Avilability in map.properties. Undefined Availability is a required parameter.

Returns:
Undefined Availability

getStatusesMap

public java.util.Map<java.lang.String,Status> getStatusesMap()
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()

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

getIconsMap

public java.util.Map<java.lang.String,java.lang.String> getIconsMap()

getBackgroundImagesMap

public java.util.Map<java.lang.String,java.lang.String> getBackgroundImagesMap()

getDefaultMapIcon

public java.lang.String getDefaultMapIcon()

getDefaultNodeIcon

public java.lang.String getDefaultNodeIcon()

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:

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<java.lang.Integer,Link> getLinksMap()

getLinkStatusesMap

public java.util.Map<java.lang.String,LinkStatus> getLinkStatusesMap()

getMultilinkStatus

public java.lang.String getMultilinkStatus()

getAvails

public java.util.List<Avail> getAvails()
                                throws MapsException
Throws:
MapsException

getLinks

public java.util.List<Link> getLinks()
                              throws MapsException
Throws:
MapsException

getLinkStatuses

public java.util.List<LinkStatus> getLinkStatuses()
                                           throws MapsException
Throws:
MapsException

getStatuses

public java.util.List<Status> getStatuses()
                                   throws MapsException
Throws:
MapsException

getSeverities

public java.util.List<Severity> getSeverities()
                                       throws MapsException
Throws:
MapsException

getIcons

public java.util.Map<java.lang.String,java.lang.String> getIcons()
                                                          throws MapsException
Throws:
MapsException

getBackgroundImages

public java.util.Map<java.lang.String,java.lang.String> getBackgroundImages()
                                                                     throws MapsException
Throws:
MapsException

getDefaultBackgroundColor

public java.lang.String getDefaultBackgroundColor()

getDefaultStatusId

public int getDefaultStatusId()

getDefaultSemaphoreColorBy

public java.lang.String getDefaultSemaphoreColorBy()

getMapElementDimensions

public java.util.Map<java.lang.Integer,java.lang.String> getMapElementDimensions()

getDefaultMapElementDimension

public int getDefaultMapElementDimension()


Copyright © 2007. All Rights Reserved.