org.opennms.web.map.config
Class MapPropertiesFactory

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

public class MapPropertiesFactory
extends Object

MapPropertiesFactory class.

Since:
1.8.1

Field Summary
protected  boolean availEnabled
           
protected  Map<String,Avail> availsMap
           
protected  Map<String,String> bgImagesMap
           
protected  ContextMenu cmenu
           
protected  boolean contextMenuEnabled
           
protected  int defaultLink
           
protected  int defaultMapElementDimension
           
protected  String defaultMapIcon
           
protected  String defaultNodeIcon
           
protected  Severity defaultSeverity
           
protected  Status defaultStatus
           
protected  Avail disabledAvail
           
protected  boolean doubleClickEnabled
           
protected  Map<String,String> iconsBySysoidMap
           
protected  Map<String,String> iconsMap
           
protected  Severity indeterminateSeverity
           
protected static String info
          Descriptive information about this factory.
protected  Map<Integer,Set<Link>> linksBySnmpTypeMap
           
protected  Map<Integer,Link> linksMap
           
protected  Map<String,LinkStatus> linkStatusesMap
           
protected  ThreadCategory log
          The Log4J category for logging web authentication messages.
protected  File mapPropertiesFile
          The map.properties file that is read for the list of severities and statuses settings for map view.
protected  String mapPropertiesFileString
           
protected  int maxLinks
           
static String MULTILINK_BEST_STATUS
          Constant MULTILINK_BEST_STATUS="best"
static String MULTILINK_IGNORE_STATUS
          Constant MULTILINK_IGNORE_STATUS="ignore"
static String MULTILINK_WORST_STATUS
          Constant MULTILINK_WORST_STATUS="worst"
protected  String multilinkIgnoreColor
           
protected  String multilinkStatus
           
protected static String name
          Descriptive information about this factory.
protected  Avail[] orderedAvails
           
protected  Severity[] orderedSeverities
           
protected  Status[] orderedStatuses
           
protected  boolean reload
           
protected  Map<String,Severity> severitiesMap
           
protected  String severityMapAs
           
protected  Map<String,Status> statusesMap
           
protected  int summaryLink
           
protected  String summaryLinkColor
           
protected  Avail undefinedAvail
           
protected  Status unknownStatus
           
protected  boolean useSemaphore
           
 
Constructor Summary
MapPropertiesFactory()
          Create a new instance.
MapPropertiesFactory(String mapPropertiesFileString)
          Constructor for MapPropertiesFactory.
 
Method Summary
 Avail getAvail(double avail)
          getAvail
 Map<String,Avail> getAvailabilitiesMap()
          Gets the java.util.Map with key = availability label and value the Avail corresponding to the label
 List<Avail> getAvails()
          getAvails
 Map<String,String> getBackgroundImages()
          getBackgroundImages
 Map<String,String> getBackgroundImagesMap()
          getBackgroundImagesMap
 ContextMenu getContextMenu()
          getContextMenu
 String getDefaultBackgroundColor()
          getDefaultBackgroundColor
 Link getDefaultLink()
          Getter for the field defaultLink.
 int getDefaultMapElementDimension()
          Getter for the field defaultMapElementDimension.
 String getDefaultMapIcon()
          Getter for the field defaultMapIcon.
 String getDefaultNodeIcon()
          Getter for the field defaultNodeIcon.
 Severity getDefaultSeverity()
          Gets the default severity in map.properties.
 Status getDefaultStatus()
          Gets the default status in map.properties.
 int getDefaultStatusId()
          getDefaultStatusId
 Avail getDisabledAvail()
          Getter for the field disabledAvail.
 Map<String,String> getIcons()
          getIcons
 Map<String,String> getIconsBySysoid()
          getIconsBySysoid
 Map<String,String> getIconsBySysoidMap()
          Getter for the field iconsBySysoidMap.
 Severity getIndeterminateSeverity()
          Gets the indeterminate severity in map.properties.
 String getInfo()
          Getter for the field info.
 Link getLink(int id)
          getLink
 Set<Link> getLinkBySnmpType(int linkTypologyId)
          gets the config Link by snmpType defined in the map properties config file
 List<Link> getLinks()
          getLinks
 Map<Integer,Link> getLinksMap()
          Getter for the field linksMap.
 LinkStatus getLinkStatus(String linkStatusLabel)
          gets the config LinkStatus by label defined in the map properties config file
 List<LinkStatus> getLinkStatuses()
          getLinkStatuses
 Map<String,LinkStatus> getLinkStatusesMap()
          Getter for the field linkStatusesMap.
 int getLinkTypeId(int snmpiftype, long snmpifspeed)
          gets the id corresponding to the link defined in configuration file.
 Map<String,String> getMapElementDimensions()
          getMapElementDimensions
 String getMapPropertiesFileString()
          Getter for the field mapPropertiesFileString.
 int getMaxLinks()
          Getter for the field maxLinks.
 String getMultilinkIgnoreColor()
          Getter for the field multilinkIgnoreColor.
 String getMultilinkStatus()
          Getter for the field multilinkStatus.
 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.
 String getProperty(String key)
          getProperty
 List<Severity> getSeverities()
          getSeverities
 Map<String,Severity> getSeveritiesMap()
          Gets the java.util.Map with key = severity label and value the Severity corresponding to the label
 int getSeverity(String severityLabel)
          getSeverity
 String getSeverityMapAs()
          Getter for the field severityMapAs.
 int getStatus(String uei)
          getStatus
 List<Status> getStatuses()
          getStatuses
 Map<String,Status> getStatusesMap()
          Gets the java.util.Map with key = uei and value the status corresponding to the uei
 int getSummaryLink()
          Getter for the field summaryLink.
 String getSummaryLinkColor()
          Getter for the field summaryLinkColor.
 Avail getUndefinedAvail()
          Gets the undefined Avilability in map.properties.
 Status getUnknownStatus()
          Gets the unknown status in map.properties.
 int getUnknownStatusId()
          getUnknownStatusId
 void init()
          init
 boolean isAvailEnabled()
          isAvailEnabled
 boolean isContextMenuEnabled()
          isContextMenuEnabled
 boolean isDoubleClickEnabled()
          isDoubleClickEnabled
 boolean isReload()
          isReload
 boolean isUseSemaphore()
          isUseSemaphore
protected  void 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) -iconsBySysoidMap: sysoid (String) to icon label (String) -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)
          setContextMenu
 void setMapPropertiesFileString(String mapPropertiesFileString)
          Setter for the field 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 String info
Descriptive information about this factory.

See Also:
Constant Field Values

name

protected static final String name
Descriptive information about this factory.

See Also:
Constant Field Values

mapPropertiesFile

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


mapPropertiesFileString

protected String mapPropertiesFileString

log

protected ThreadCategory log
The Log4J category for logging web authentication messages.


statusesMap

protected Map<String,Status> statusesMap

orderedStatuses

protected Status[] orderedStatuses

severitiesMap

protected Map<String,Severity> severitiesMap

orderedSeverities

protected Severity[] orderedSeverities

availsMap

protected Map<String,Avail> availsMap

orderedAvails

protected Avail[] orderedAvails

iconsMap

protected Map<String,String> iconsMap

iconsBySysoidMap

protected Map<String,String> iconsBySysoidMap

bgImagesMap

protected Map<String,String> bgImagesMap

linksMap

protected Map<Integer,Link> linksMap

linksBySnmpTypeMap

protected Map<Integer,Set<Link>> linksBySnmpTypeMap

linkStatusesMap

protected Map<String,LinkStatus> linkStatusesMap

defaultNodeIcon

protected String defaultNodeIcon

defaultMapIcon

protected String defaultMapIcon

defaultMapElementDimension

protected int defaultMapElementDimension

maxLinks

protected int maxLinks

summaryLink

protected int summaryLink

summaryLinkColor

protected String summaryLinkColor

MULTILINK_BEST_STATUS

public static final String MULTILINK_BEST_STATUS
Constant MULTILINK_BEST_STATUS="best"

See Also:
Constant Field Values

MULTILINK_WORST_STATUS

public static final String MULTILINK_WORST_STATUS
Constant MULTILINK_WORST_STATUS="worst"

See Also:
Constant Field Values

MULTILINK_IGNORE_STATUS

public static final String MULTILINK_IGNORE_STATUS
Constant MULTILINK_IGNORE_STATUS="ignore"

See Also:
Constant Field Values

multilinkStatus

protected String multilinkStatus

multilinkIgnoreColor

protected String multilinkIgnoreColor

defaultLink

protected int defaultLink

defaultSeverity

protected Severity defaultSeverity

indeterminateSeverity

protected Severity indeterminateSeverity

unknownStatus

protected Status unknownStatus

defaultStatus

protected Status defaultStatus

undefinedAvail

protected Avail undefinedAvail

disabledAvail

protected Avail disabledAvail

availEnabled

protected boolean availEnabled

doubleClickEnabled

protected boolean doubleClickEnabled

contextMenuEnabled

protected boolean contextMenuEnabled

useSemaphore

protected boolean useSemaphore

reload

protected boolean reload

severityMapAs

protected String severityMapAs

cmenu

protected ContextMenu cmenu
Constructor Detail

MapPropertiesFactory

public MapPropertiesFactory(String mapPropertiesFileString)

Constructor for MapPropertiesFactory.

Parameters:
mapPropertiesFileString - a String object.

MapPropertiesFactory

public MapPropertiesFactory()
Create a new instance.

Method Detail

getMapPropertiesFileString

public String getMapPropertiesFileString()

Getter for the field mapPropertiesFileString.

Returns:
a String object.

setMapPropertiesFileString

public void setMapPropertiesFileString(String mapPropertiesFileString)

Setter for the field mapPropertiesFileString.

Parameters:
mapPropertiesFileString - a String object.

getSeverityMapAs

public String getSeverityMapAs()

Getter for the field severityMapAs.

Returns:
a String object.

getContextMenu

public ContextMenu getContextMenu()

getContextMenu

Returns:
a ContextMenu object.

setContextMenu

public void setContextMenu(ContextMenu cmenu)

setContextMenu

Parameters:
cmenu - a ContextMenu object.

isContextMenuEnabled

public boolean isContextMenuEnabled()

isContextMenuEnabled

Returns:
a boolean.

isDoubleClickEnabled

public boolean isDoubleClickEnabled()

isDoubleClickEnabled

Returns:
a boolean.

isReload

public boolean isReload()

isReload

Returns:
a boolean.

init

public void init()
          throws FileNotFoundException,
                 IOException

init

Throws:
FileNotFoundException - if any.
IOException - if any.

reload

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

Parameters:
reloadPropertiesFile - a boolean.
Throws:
FileNotFoundException - if any.
IOException - if any.

getSeveritiesMap

public Map<String,Severity> getSeveritiesMap()
Gets the java.util.Map with key = severity label and value the Severity corresponding to the label

Returns:
a Map object.
Throws:
IOException - if any.
FileNotFoundException - if any.

getAvailabilitiesMap

public Map<String,Avail> getAvailabilitiesMap()
Gets the java.util.Map with key = availability label and value the Avail corresponding to the label

Returns:
a Map object.
Throws:
IOException - if any.
FileNotFoundException - if any.

getAvail

public Avail getAvail(double avail)

getAvail

Parameters:
avail - a double.
Returns:
a Avail object.

getDisabledAvail

public Avail getDisabledAvail()

Getter for the field disabledAvail.

Returns:
a Avail object.

isAvailEnabled

public boolean isAvailEnabled()

isAvailEnabled

Returns:
a boolean.

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 Map<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:
IOException - if any.
FileNotFoundException - if any.

getInfo

public String getInfo()

Getter for the field info.

Returns:
a String object.

getProperty

public String getProperty(String key)
                   throws FileNotFoundException,
                          IOException

getProperty

Parameters:
key - a String object.
Returns:
a String object.
Throws:
FileNotFoundException - if any.
IOException - if any.

parseMapProperties

protected void parseMapProperties()
                           throws FileNotFoundException,
                                  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) -iconsBySysoidMap: sysoid (String) to icon label (String) -bgImagesMap: background (String) image label to String (background image filename) -sourcesMap: source label (String) to DataSource -factoriesMap: factory label (String) to MapsFactory

Throws:
FileNotFoundException - if any.
IOException - if any.

getSummaryLinkColor

public String getSummaryLinkColor()

Getter for the field summaryLinkColor.

Returns:
a String object.

getIconsBySysoidMap

public Map<String,String> getIconsBySysoidMap()

Getter for the field iconsBySysoidMap.

Returns:
a Map object.

getBackgroundImagesMap

public Map<String,String> getBackgroundImagesMap()

getBackgroundImagesMap

Returns:
a Map object.

getDefaultMapIcon

public String getDefaultMapIcon()

Getter for the field defaultMapIcon.

Returns:
a String object.

getDefaultNodeIcon

public String getDefaultNodeIcon()

Getter for the field defaultNodeIcon.

Returns:
a String object.

getOrderedSeverities

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

Returns:
an array of Severity objects.

getOrderedAvails

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

Returns:
an array of Avail objects.

getOrderedStatuses

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

Returns:
an array of Status objects.

getSeverity

public int getSeverity(String severityLabel)

getSeverity

Parameters:
severityLabel - a String object.
Returns:
a int.

getStatus

public int getStatus(String uei)

getStatus

Parameters:
uei - a String object.
Returns:
a int.

getLinkBySnmpType

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

Parameters:
linkTypologyId - a int.
Returns:
a Set object.

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 - a int.
snmpifspeed - a long.
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)

getLink

Parameters:
id - a int.
Returns:
a Link object.

getLinkStatus

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

Parameters:
linkStatusLabel - a String object.
Returns:
a LinkStatus object.

getDefaultLink

public Link getDefaultLink()

Getter for the field defaultLink.

Returns:
a Link object.

getLinksMap

public Map<Integer,Link> getLinksMap()

Getter for the field linksMap.

Returns:
a Map object.

getLinkStatusesMap

public Map<String,LinkStatus> getLinkStatusesMap()

Getter for the field linkStatusesMap.

Returns:
a Map object.

getMultilinkStatus

public String getMultilinkStatus()

Getter for the field multilinkStatus.

Returns:
a String object.

getAvails

public List<Avail> getAvails()
                      throws MapsException

getAvails

Returns:
a List object.
Throws:
MapsException - if any.

getLinks

public List<Link> getLinks()
                    throws MapsException

getLinks

Returns:
a List object.
Throws:
MapsException - if any.

getLinkStatuses

public List<LinkStatus> getLinkStatuses()
                                 throws MapsException

getLinkStatuses

Returns:
a List object.
Throws:
MapsException - if any.

getStatuses

public List<Status> getStatuses()
                         throws MapsException

getStatuses

Returns:
a List object.
Throws:
MapsException - if any.

getSeverities

public List<Severity> getSeverities()
                             throws MapsException

getSeverities

Returns:
a List object.
Throws:
MapsException - if any.

getIcons

public Map<String,String> getIcons()
                            throws MapsException

getIcons

Returns:
a java$util$Map object.
Throws:
MapsException - if any.

getIconsBySysoid

public Map<String,String> getIconsBySysoid()
                                    throws MapsException

getIconsBySysoid

Returns:
a java$util$Map object.
Throws:
MapsException - if any.

getBackgroundImages

public Map<String,String> getBackgroundImages()
                                       throws MapsException

getBackgroundImages

Returns:
a java$util$Map object.
Throws:
MapsException - if any.

getDefaultBackgroundColor

public String getDefaultBackgroundColor()

getDefaultBackgroundColor

Returns:
a String object.

getDefaultStatusId

public int getDefaultStatusId()

getDefaultStatusId

Returns:
a int.

getUnknownStatusId

public int getUnknownStatusId()

getUnknownStatusId

Returns:
a int.

getMapElementDimensions

public Map<String,String> getMapElementDimensions()

getMapElementDimensions

Returns:
a java$util$Map object.

getDefaultMapElementDimension

public int getDefaultMapElementDimension()

Getter for the field defaultMapElementDimension.

Returns:
a int.

getMaxLinks

public int getMaxLinks()

Getter for the field maxLinks.

Returns:
a int.

getSummaryLink

public int getSummaryLink()

Getter for the field summaryLink.

Returns:
a int.

getMultilinkIgnoreColor

public String getMultilinkIgnoreColor()

Getter for the field multilinkIgnoreColor.

Returns:
a String object.

isUseSemaphore

public boolean isUseSemaphore()

isUseSemaphore

Returns:
a boolean.


Copyright © 2011. All Rights Reserved.