net.sf.snmpadaptor4j.core.mapping
Class XmlMappingParser

java.lang.Object
  extended by net.sf.snmpadaptor4j.core.mapping.XmlMappingParser

public final class XmlMappingParser
extends Object

Parser of SNMP mapping file (XML).

Author:
Jean-Philippe MINETTI

Method Summary
 String findBaseOid(ObjectName mBeanName, Map<String,String> rootOidMap, String defaultRootOid, String mainDefaultRootOid)
          Finds a base OID of a MBean instance in the mapping.
static XmlMappingParser newInstance(URL url)
          Creates and returns a new instance of XmlMappingParser.
 List<MBeanAttributeMapping> newMBeanAttributeMappingList(Map<String,MBeanAttributeInfo> mBeanAttributeInfoMap, ClassLoader classLoader, String baseOid)
          Creates and returns the list of mapping for access to each attribute of an MBean.
 Map<String,SnmpTrapMapping> newSnmpTrapMappingMap(String baseOid)
          Creates and returns the map of mapping to build SNMP traps from JMX notifications for each notification type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newInstance

public static XmlMappingParser newInstance(URL url)
                                    throws Exception
Creates and returns a new instance of XmlMappingParser.

Parameters:
url - URL to the SNMP mapping file.
Returns:
New instance of XmlMappingParser.
Throws:
Exception - Exception if an error occurred.

findBaseOid

public String findBaseOid(ObjectName mBeanName,
                          Map<String,String> rootOidMap,
                          String defaultRootOid,
                          String mainDefaultRootOid)
Finds a base OID of a MBean instance in the mapping.

Parameters:
mBeanName - MBean name.
rootOidMap - Map of root OIDs where the attributes of the application will stay.
defaultRootOid - Default root OID containing the attributes of the current application.
mainDefaultRootOid - Default root OID containing the attributes of the main application (must not be NULL).
Returns:
Base OID found (can be NULL).

newMBeanAttributeMappingList

public List<MBeanAttributeMapping> newMBeanAttributeMappingList(Map<String,MBeanAttributeInfo> mBeanAttributeInfoMap,
                                                                ClassLoader classLoader,
                                                                String baseOid)
                                                         throws Exception
Creates and returns the list of mapping for access to each attribute of an MBean.

Parameters:
mBeanAttributeInfoMap - Map of informations on each MBean attribute.
classLoader - ClassLoader where the MBean has been created.
baseOid - Base OID of MBean instance.
Returns:
List of mapping for access to each attribute of an MBean (never NULL).
Throws:
Exception - Exception if an error occurred.

newSnmpTrapMappingMap

public Map<String,SnmpTrapMapping> newSnmpTrapMappingMap(String baseOid)
Creates and returns the map of mapping to build SNMP traps from JMX notifications for each notification type.

Parameters:
baseOid - Base OID of MBean instance.
Returns:
Map of mapping to build SNMP traps from the JMX notifications for each notification type (never NULL).

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012-2013 snmpAdaptor4j. All Rights Reserved.