org.opennms.web.map.config
Class MapPropertiesFactory

java.lang.Object
  extended by org.opennms.web.map.config.MapPropertiesFactory
Direct Known Subclasses:
InitializationObj

public class MapPropertiesFactory
extends Object


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> 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  Category 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
           
static String MULTILINK_BEST_STATUS
           
static String MULTILINK_WORST_STATUS
           
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  Avail undefinedAvail
           
protected  Status unknownStatus
           
 
Constructor Summary
MapPropertiesFactory()
          Create a new instance.
MapPropertiesFactory(String mapPropertiesFileString)
           
 
Method Summary
 Avail getAvail(double avail)
           
 Map<String,Avail> getAvailabilitiesMap()
          Gets the java.util.Map with key = availability label and value the Avail corresponding to the label
 List<Avail> getAvails()
           
 Map<String,String> getBackgroundImages()
           
 Map<String,String> getBackgroundImagesMap()
           
 ContextMenu getContextMenu()
           
 String getDefaultBackgroundColor()
           
 Link getDefaultLink()
           
 int getDefaultMapElementDimension()
           
 String getDefaultMapIcon()
           
 String getDefaultNodeIcon()
           
 String getDefaultSemaphoreColorBy()
           
 Severity getDefaultSeverity()
          Gets the default severity in map.properties.
 Status getDefaultStatus()
          Gets the default status in map.properties.
 int getDefaultStatusId()
           
 Avail getDisabledAvail()
           
 Map<String,String> getIcons()
           
 Map<String,String> getIconsMap()
           
 Severity getIndeterminateSeverity()
          Gets the indeterminate severity in map.properties.
 String getInfo()
           
 Link getLink(int id)
           
 Set<Link> getLinkBySnmpType(int linkTypologyId)
          gets the config Link by snmpType defined in the map properties config file
 List<Link> getLinks()
           
 Map<Integer,Link> getLinksMap()
           
 LinkStatus getLinkStatus(String linkStatusLabel)
          gets the config LinkStatus by label defined in the map properties config file
 List<LinkStatus> getLinkStatuses()
           
 Map<String,LinkStatus> getLinkStatusesMap()
           
 int getLinkTypeId(int snmpiftype, long snmpifspeed)
          gets the id corresponding to the link defined in configuration file.
 Map<String,String> getMapElementDimensions()
           
 String getMapPropertiesFileString()
           
 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.
 String getProperty(String key)
           
 List<Severity> 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)
           
 String getSeverityMapAs()
           
 int getStatus(String uei)
           
 List<Status> getStatuses()
           
 Map<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  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) -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(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 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 Category 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

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

MULTILINK_BEST_STATUS

public static final String MULTILINK_BEST_STATUS
See Also:
Constant Field Values

MULTILINK_WORST_STATUS

public static final String MULTILINK_WORST_STATUS
See Also:
Constant Field Values

multilinkStatus

protected String multilinkStatus

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

reload

protected boolean reload

severityMapAs

protected String severityMapAs

cmenu

protected ContextMenu cmenu
Constructor Detail

MapPropertiesFactory

public MapPropertiesFactory(String mapPropertiesFileString)

MapPropertiesFactory

public MapPropertiesFactory()
Create a new instance.

Method Detail

getMapPropertiesFileString

public String getMapPropertiesFileString()

setMapPropertiesFileString

public void setMapPropertiesFileString(String mapPropertiesFileString)

getSeverityMapAs

public 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 FileNotFoundException,
                 IOException
Throws:
FileNotFoundException
IOException

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.

Throws:
FileNotFoundException
IOException

getSeveritiesMap

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

Returns:
Throws:
IOException
FileNotFoundException

getAvailabilitiesMap

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

Returns:
Throws:
IOException
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 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
FileNotFoundException

getInfo

public String getInfo()

getProperty

public String getProperty(String key)
                   throws FileNotFoundException,
                          IOException
Throws:
FileNotFoundException
IOException

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) -bgImagesMap: background (String) image label to String (background image filename) -sourcesMap: source label (String) to DataSource -factoriesMap: factory label (String) to MapsFactory

Throws:
FileNotFoundException
IOException

getIconsMap

public Map<String,String> getIconsMap()

getBackgroundImagesMap

public Map<String,String> getBackgroundImagesMap()

getDefaultMapIcon

public String getDefaultMapIcon()

getDefaultNodeIcon

public 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(String severityLabel)

getStatus

public int getStatus(String uei)

getLinkBySnmpType

public 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(String linkStatusLabel)
gets the config LinkStatus by label defined in the map properties config file

Parameters:
linkStatusLabel -
Returns:

getDefaultLink

public Link getDefaultLink()

getLinksMap

public Map<Integer,Link> getLinksMap()

getLinkStatusesMap

public Map<String,LinkStatus> getLinkStatusesMap()

getMultilinkStatus

public String getMultilinkStatus()

getAvails

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

getLinks

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

getLinkStatuses

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

getStatuses

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

getSeverities

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

getIcons

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

getBackgroundImages

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

getDefaultBackgroundColor

public String getDefaultBackgroundColor()

getDefaultStatusId

public int getDefaultStatusId()

getDefaultSemaphoreColorBy

public String getDefaultSemaphoreColorBy()

getMapElementDimensions

public Map<String,String> getMapElementDimensions()

getDefaultMapElementDimension

public int getDefaultMapElementDimension()


Copyright © 2009. All Rights Reserved.