// Home | Go Back //
package agent.mib2jni;
import java.io.*;
import java.util.*;
import com.ireasoning.util.*;
import com.ireasoning.protocol.snmp.*;
import javax.management.*;
public class AgentMib
{
private static MBeanServer _server;
private static OIDTreeNode _root;
public static void registerMBeans(MBeanServer server, OIDTreeNode root)
{
_server = server;
_root = root;
try
{
registerIcmpGroup();
registerSnmpGroup();
registerInterfacesGroup();
registerUdpGroup();
registerTcpGroup();
registerSystemGroup();
registerIpGroup();
registerIfTable();
registerAtTable();
registerIpAddrTable();
registerIpRouteTable();
registerIpNetToMediaTable();
registerTcpConnTable();
registerUdpTable();
}
catch(Exception e)
{
Logger.error(e);
throw new SnmpException(e.toString());
}
}
public static void unregisterMBeans()
{
try
{
unregisterIcmpGroup();
unregisterSnmpGroup();
unregisterInterfacesGroup();
unregisterUdpGroup();
unregisterTcpGroup();
unregisterSystemGroup();
unregisterIpGroup();
unregisterIfTable();
unregisterAtTable();
unregisterIpAddrTable();
unregisterIpRouteTable();
unregisterIpNetToMediaTable();
unregisterTcpConnTable();
unregisterUdpTable();
}
catch(Exception e)
{
Logger.error(e);
throw new SnmpException(e.toString());
}
}
public static void registerIcmpGroup() throws Exception
{
if ( _icmpGroup == null )
{
_icmpGroup = new IcmpGroup(_root, ".1.3.6.1.2.1.5", null);
}
ObjectName objName = new ObjectName("iReasoning:name=IcmpGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_icmpGroup, objName);
}
}
public static void unregisterIcmpGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=IcmpGroup,noPdu=true"));
_icmpGroup = null;
}
public static void registerSnmpGroup() throws Exception
{
if ( _snmpGroup == null )
{
_snmpGroup = new SnmpGroup(_root, ".1.3.6.1.2.1.11", null);
}
ObjectName objName = new ObjectName("iReasoning:name=SnmpGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_snmpGroup, objName);
}
}
public static void unregisterSnmpGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=SnmpGroup,noPdu=true"));
_snmpGroup = null;
}
public static void registerInterfacesGroup() throws Exception
{
if ( _interfacesGroup == null )
{
_interfacesGroup = new InterfacesGroup(_root, ".1.3.6.1.2.1.2", null);
}
ObjectName objName = new ObjectName("iReasoning:name=InterfacesGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_interfacesGroup, objName);
}
}
public static void unregisterInterfacesGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=InterfacesGroup,noPdu=true"));
_interfacesGroup = null;
}
public static void registerUdpGroup() throws Exception
{
if ( _udpGroup == null )
{
_udpGroup = new UdpGroup(_root, ".1.3.6.1.2.1.7", null);
}
ObjectName objName = new ObjectName("iReasoning:name=UdpGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_udpGroup, objName);
}
}
public static void unregisterUdpGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=UdpGroup,noPdu=true"));
_udpGroup = null;
}
public static void registerTcpGroup() throws Exception
{
if ( _tcpGroup == null )
{
_tcpGroup = new TcpGroup(_root, ".1.3.6.1.2.1.6", null);
}
ObjectName objName = new ObjectName("iReasoning:name=TcpGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_tcpGroup, objName);
}
}
public static void unregisterTcpGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=TcpGroup,noPdu=true"));
_tcpGroup = null;
}
public static void registerSystemGroup() throws Exception
{
if ( _systemGroup == null )
{
_systemGroup = new SystemGroup(_root, ".1.3.6.1.2.1.1", null);
}
ObjectName objName = new ObjectName("iReasoning:name=SystemGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_systemGroup, objName);
}
}
public static void unregisterSystemGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=SystemGroup,noPdu=true"));
_systemGroup = null;
}
public static void registerIpGroup() throws Exception
{
if ( _ipGroup == null )
{
_ipGroup = new IpGroup(_root, ".1.3.6.1.2.1.4", null);
}
ObjectName objName = new ObjectName("iReasoning:name=IpGroup,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_ipGroup, objName);
}
}
public static void unregisterIpGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=IpGroup,noPdu=true"));
_ipGroup = null;
}
public static void registerIfTable() throws Exception
{
if ( _ifTable == null )
{
_ifTable = new IfTable(_root, ".1.3.6.1.2.1.2.2", null);
}
ObjectName objName = new ObjectName("iReasoning:name=IfTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_ifTable, objName);
}
}
public static void unregisterIfTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=IfTable,noPdu=true"));
_ifTable = null;
}
public static void registerAtTable() throws Exception
{
if ( _atTable == null )
{
_atTable = new AtTable(_root, ".1.3.6.1.2.1.3.1", null);
}
ObjectName objName = new ObjectName("iReasoning:name=AtTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_atTable, objName);
}
}
public static void unregisterAtTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=AtTable,noPdu=true"));
_atTable = null;
}
public static void registerIpAddrTable() throws Exception
{
if ( _ipAddrTable == null )
{
_ipAddrTable = new IpAddrTable(_root, ".1.3.6.1.2.1.4.20", null);
}
ObjectName objName = new ObjectName("iReasoning:name=IpAddrTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_ipAddrTable, objName);
}
}
public static void unregisterIpAddrTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=IpAddrTable,noPdu=true"));
_ipAddrTable = null;
}
public static void registerIpRouteTable() throws Exception
{
if ( _ipRouteTable == null )
{
_ipRouteTable = new IpRouteTable(_root, ".1.3.6.1.2.1.4.21", null);
}
ObjectName objName = new ObjectName("iReasoning:name=IpRouteTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_ipRouteTable, objName);
}
}
public static void unregisterIpRouteTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=IpRouteTable,noPdu=true"));
_ipRouteTable = null;
}
public static void registerIpNetToMediaTable() throws Exception
{
if ( _ipNetToMediaTable == null )
{
_ipNetToMediaTable = new IpNetToMediaTable(_root, ".1.3.6.1.2.1.4.22", null);
}
ObjectName objName = new ObjectName("iReasoning:name=IpNetToMediaTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_ipNetToMediaTable, objName);
}
}
public static void unregisterIpNetToMediaTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=IpNetToMediaTable,noPdu=true"));
_ipNetToMediaTable = null;
}
public static void registerTcpConnTable() throws Exception
{
if ( _tcpConnTable == null )
{
_tcpConnTable = new TcpConnTable(_root, ".1.3.6.1.2.1.6.13", null);
}
ObjectName objName = new ObjectName("iReasoning:name=TcpConnTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_tcpConnTable, objName);
}
}
public static void unregisterTcpConnTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=TcpConnTable,noPdu=true"));
_tcpConnTable = null;
}
public static void registerUdpTable() throws Exception
{
if ( _udpTable == null )
{
_udpTable = new UdpTable(_root, ".1.3.6.1.2.1.7.5", null);
}
ObjectName objName = new ObjectName("iReasoning:name=UdpTable,noPdu=true");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_udpTable, objName);
}
}
public static void unregisterUdpTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=UdpTable,noPdu=true"));
_udpTable = null;
}
public static IcmpGroup getIcmpGroup( )
{
if( _icmpGroup == null )
{
try
{
registerIcmpGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _icmpGroup;
}
public static SnmpGroup getSnmpGroup( )
{
if( _snmpGroup == null )
{
try
{
registerSnmpGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _snmpGroup;
}
public static InterfacesGroup getInterfacesGroup( )
{
if( _interfacesGroup == null )
{
try
{
registerInterfacesGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _interfacesGroup;
}
public static UdpGroup getUdpGroup( )
{
if( _udpGroup == null )
{
try
{
registerUdpGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _udpGroup;
}
public static TcpGroup getTcpGroup( )
{
if( _tcpGroup == null )
{
try
{
registerTcpGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _tcpGroup;
}
public static SystemGroup getSystemGroup( )
{
if( _systemGroup == null )
{
try
{
registerSystemGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _systemGroup;
}
public static IpGroup getIpGroup( )
{
if( _ipGroup == null )
{
try
{
registerIpGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _ipGroup;
}
public static IfTable getIfTable( )
{
if( _ifTable == null )
{
try
{
registerIfTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _ifTable;
}
public static AtTable getAtTable( )
{
if( _atTable == null )
{
try
{
registerAtTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _atTable;
}
public static IpAddrTable getIpAddrTable( )
{
if( _ipAddrTable == null )
{
try
{
registerIpAddrTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _ipAddrTable;
}
public static IpRouteTable getIpRouteTable( )
{
if( _ipRouteTable == null )
{
try
{
registerIpRouteTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _ipRouteTable;
}
public static IpNetToMediaTable getIpNetToMediaTable( )
{
if( _ipNetToMediaTable == null )
{
try
{
registerIpNetToMediaTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _ipNetToMediaTable;
}
public static TcpConnTable getTcpConnTable( )
{
if( _tcpConnTable == null )
{
try
{
registerTcpConnTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _tcpConnTable;
}
public static UdpTable getUdpTable( )
{
if( _udpTable == null )
{
try
{
registerUdpTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _udpTable;
}
static IcmpGroup _icmpGroup;
static SnmpGroup _snmpGroup;
static InterfacesGroup _interfacesGroup;
static UdpGroup _udpGroup;
static TcpGroup _tcpGroup;
static SystemGroup _systemGroup;
static IpGroup _ipGroup;
static IfTable _ifTable;
static AtTable _atTable;
static IpAddrTable _ipAddrTable;
static IpRouteTable _ipRouteTable;
static IpNetToMediaTable _ipNetToMediaTable;
static TcpConnTable _tcpConnTable;
static UdpTable _udpTable;
}