// Home | Go Back //
package agent.subagent;
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
{
registerInfoGroup();
registerSubagentTable();
}
catch(Exception e)
{
Logger.error(e);
throw new SnmpException(e.toString());
}
}
public static void unregisterMBeans()
{
try
{
unregisterInfoGroup();
unregisterSubagentTable();
}
catch(Exception e)
{
Logger.error(e);
throw new SnmpException(e.toString());
}
}
public static void registerInfoGroup() throws Exception
{
if ( _infoGroup == null )
{
_infoGroup = new InfoGroup(_root, ".1.3.6.1.4.1.15145.1.1.1", null);
}
ObjectName objName = new ObjectName("iReasoning:name=InfoGroup");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_infoGroup, objName);
}
}
public static void unregisterInfoGroup() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=InfoGroup"));
}
public static void registerSubagentTable() throws Exception
{
if ( _subagentTable == null )
{
_subagentTable = new SubagentTable(_root, ".1.3.6.1.4.1.15145.1.1.2", null);
}
ObjectName objName = new ObjectName("iReasoning:name=SubagentTable");
if(!_server.isRegistered(objName))
{
_server.registerMBean(_subagentTable, objName);
}
}
public static void unregisterSubagentTable() throws Exception
{
_server.unregisterMBean(new ObjectName("iReasoning:name=SubagentTable"));
}
public static InfoGroup getInfoGroup( )
{
if( _infoGroup == null )
{
try
{
registerInfoGroup();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _infoGroup;
}
public static SubagentTable getSubagentTable( )
{
if( _subagentTable == null )
{
try
{
registerSubagentTable();
}
catch(Exception e)
{
Logger.error(e);
}
}
return _subagentTable;
}
static InfoGroup _infoGroup;
static SubagentTable _subagentTable;
}