feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,396 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp;
import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
import com.sun.jmx.snmp.InetAddressAcl;
import com.sun.jmx.snmp.IPAcl.SnmpAcl;
import sun.management.snmp.jvmmib.JVM_MANAGEMENT_MIB;
import sun.management.snmp.jvminstr.JVM_MANAGEMENT_MIB_IMPL;
import sun.management.snmp.jvminstr.NotificationTarget;
import sun.management.snmp.jvminstr.NotificationTargetImpl;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
import sun.management.Agent;
import sun.management.AgentConfigurationError;
import static sun.management.AgentConfigurationError.*;
import sun.management.FileSystem;
import java.util.List;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* This class initializes and starts the SNMP Adaptor for JSR 163 SNMP
* Monitoring.
**/
public final class AdaptorBootstrap {
private static final MibLogger log = new MibLogger(AdaptorBootstrap.class);
/**
* Default values for SNMP configuration properties.
**/
public static interface DefaultValues {
public static final String PORT="161";
public static final String CONFIG_FILE_NAME="management.properties";
public static final String TRAP_PORT="162";
public static final String USE_ACL="true";
public static final String ACL_FILE_NAME="snmp.acl";
public static final String BIND_ADDRESS="localhost";
}
/**
* Names of SNMP configuration properties.
**/
public static interface PropertyNames {
public static final String PORT="com.sun.management.snmp.port";
public static final String CONFIG_FILE_NAME=
"com.sun.management.config.file";
public static final String TRAP_PORT=
"com.sun.management.snmp.trap";
public static final String USE_ACL=
"com.sun.management.snmp.acl";
public static final String ACL_FILE_NAME=
"com.sun.management.snmp.acl.file";
public static final String BIND_ADDRESS=
"com.sun.management.snmp.interface";
}
/**
* We keep a reference - so that we can possibly call
* terminate(). As of now, terminate() is only called by unit tests
* (makes it possible to run several testcases sequentially in the
* same JVM).
**/
private SnmpAdaptorServer adaptor;
private JVM_MANAGEMENT_MIB_IMPL jvmmib;
private AdaptorBootstrap(SnmpAdaptorServer snmpas,
JVM_MANAGEMENT_MIB_IMPL mib) {
jvmmib = mib;
adaptor = snmpas;
}
/**
* Compute the full path name for a default file.
* @param basename basename (with extension) of the default file.
* @return ${JRE}/lib/management/${basename}
**/
private static String getDefaultFileName(String basename) {
final String fileSeparator = File.separator;
return System.getProperty("java.home") + fileSeparator + "lib" +
fileSeparator + "management" + fileSeparator + basename;
}
/**
* Retrieve the Trap Target List from the ACL file.
**/
@SuppressWarnings("unchecked")
private static List<NotificationTarget> getTargetList(InetAddressAcl acl,
int defaultTrapPort) {
final ArrayList<NotificationTarget> result =
new ArrayList<>();
if (acl != null) {
if (log.isDebugOn())
log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing"));
final Enumeration<InetAddress> td = acl.getTrapDestinations();
for (; td.hasMoreElements() ;) {
final InetAddress targetAddr = td.nextElement();
final Enumeration<String> tc =
acl.getTrapCommunities(targetAddr);
for (;tc.hasMoreElements() ;) {
final String community = tc.nextElement();
final NotificationTarget target =
new NotificationTargetImpl(targetAddr,
defaultTrapPort,
community);
if (log.isDebugOn())
log.debug("getTargetList",
Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.adding",
target.toString()));
result.add(target);
}
}
}
return result;
}
/**
* Initializes and starts the SNMP Adaptor Server.
* If the com.sun.management.snmp.port property is not defined,
* simply return. Otherwise, attempts to load the config file, and
* then calls {@link #initialize(java.lang.String, java.util.Properties)}.
*
**/
public static synchronized AdaptorBootstrap initialize() {
// Load a new properties
final Properties props = Agent.loadManagementProperties();
if (props == null) return null;
final String portStr = props.getProperty(PropertyNames.PORT);
return initialize(portStr,props);
}
/**
* Initializes and starts the SNMP Adaptor Server.
**/
public static synchronized
AdaptorBootstrap initialize(String portStr, Properties props) {
// Get port number
if (portStr.length()==0) portStr=DefaultValues.PORT;
final int port;
try {
port = Integer.parseInt(portStr);
} catch (NumberFormatException x) {
throw new AgentConfigurationError(INVALID_SNMP_PORT, x, portStr);
}
if (port < 0) {
throw new AgentConfigurationError(INVALID_SNMP_PORT, portStr);
}
// Get trap port number
final String trapPortStr =
props.getProperty(PropertyNames.TRAP_PORT,
DefaultValues.TRAP_PORT);
final int trapPort;
try {
trapPort = Integer.parseInt(trapPortStr);
} catch (NumberFormatException x) {
throw new AgentConfigurationError(INVALID_SNMP_TRAP_PORT, x, trapPortStr);
}
if (trapPort < 0) {
throw new AgentConfigurationError(INVALID_SNMP_TRAP_PORT, trapPortStr);
}
// Get bind address
final String addrStr =
props.getProperty(PropertyNames.BIND_ADDRESS,
DefaultValues.BIND_ADDRESS);
// Get ACL File
final String defaultAclFileName =
getDefaultFileName(DefaultValues.ACL_FILE_NAME);
final String aclFileName =
props.getProperty(PropertyNames.ACL_FILE_NAME,
defaultAclFileName);
final String useAclStr =
props.getProperty(PropertyNames.USE_ACL,DefaultValues.USE_ACL);
final boolean useAcl =
Boolean.valueOf(useAclStr).booleanValue();
if (useAcl) checkAclFile(aclFileName);
AdaptorBootstrap adaptor = null;
try {
adaptor = getAdaptorBootstrap(port, trapPort, addrStr,
useAcl, aclFileName);
} catch (Exception e) {
throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.getMessage());
}
return adaptor;
}
private static AdaptorBootstrap getAdaptorBootstrap
(int port, int trapPort, String bindAddress, boolean useAcl,
String aclFileName) {
final InetAddress address;
try {
address = InetAddress.getByName(bindAddress);
} catch (UnknownHostException e) {
throw new AgentConfigurationError(UNKNOWN_SNMP_INTERFACE, e, bindAddress);
}
if (log.isDebugOn()) {
log.debug("initialize",
Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.starting" +
"\n\t" + PropertyNames.PORT + "=" + port +
"\n\t" + PropertyNames.TRAP_PORT + "=" + trapPort +
"\n\t" + PropertyNames.BIND_ADDRESS + "=" + address +
(useAcl?("\n\t" + PropertyNames.ACL_FILE_NAME + "="
+ aclFileName):"\n\tNo ACL")+
""));
}
final InetAddressAcl acl;
try {
acl = useAcl ? new SnmpAcl(System.getProperty("user.name"),aclFileName)
: null;
} catch (UnknownHostException e) {
throw new AgentConfigurationError(UNKNOWN_SNMP_INTERFACE, e, e.getMessage());
}
// Create adaptor
final SnmpAdaptorServer adaptor =
new SnmpAdaptorServer(acl, port, address);
adaptor.setUserDataFactory(new JvmContextFactory());
adaptor.setTrapPort(trapPort);
// Create MIB
//
final JVM_MANAGEMENT_MIB_IMPL mib = new JVM_MANAGEMENT_MIB_IMPL();
try {
mib.init();
} catch (IllegalAccessException x) {
throw new AgentConfigurationError(SNMP_MIB_INIT_FAILED, x, x.getMessage());
}
// Configure the trap destinations.
//
mib.addTargets(getTargetList(acl,trapPort));
// Start Adaptor
//
try {
// Will wait until the adaptor starts or fails to start.
// If the adaptor fails to start, a CommunicationException or
// an InterruptedException is thrown.
//
adaptor.start(Long.MAX_VALUE);
} catch (Exception x) {
Throwable t=x;
if (x instanceof com.sun.jmx.snmp.daemon.CommunicationException) {
final Throwable next = t.getCause();
if (next != null) t = next;
}
throw new AgentConfigurationError(SNMP_ADAPTOR_START_FAILED, t,
address + ":" + port,
"(" + t.getMessage() + ")");
}
// double check that adaptor is actually started (should always
// be active, so that exception should never be thrown from here)
//
if (!adaptor.isActive()) {
throw new AgentConfigurationError(SNMP_ADAPTOR_START_FAILED,
address + ":" + port);
}
try {
// Add MIB to adaptor
//
adaptor.addMib(mib);
// Add Adaptor to the MIB
//
mib.setSnmpAdaptor(adaptor);
} catch (RuntimeException x) {
new AdaptorBootstrap(adaptor,mib).terminate();
throw x;
}
log.debug("initialize",
Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.initialize1"));
log.config("initialize",
Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.initialize2",
address.toString(), java.lang.Integer.toString(adaptor.getPort())));
return new AdaptorBootstrap(adaptor,mib);
}
private static void checkAclFile(String aclFileName) {
if (aclFileName == null || aclFileName.length()==0) {
throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
}
final File file = new File(aclFileName);
if (!file.exists()) {
throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
}
if (!file.canRead()) {
throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
}
FileSystem fs = FileSystem.open();
try {
if (fs.supportsFileSecurity(file)) {
if (!fs.isAccessUserOnly(file)) {
throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
aclFileName);
}
}
} catch (IOException e) {
throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);
}
}
/**
* Get the port on which the adaptor is bound.
* Returns 0 if the adaptor is already terminated.
*
**/
public synchronized int getPort() {
if (adaptor != null) return adaptor.getPort();
return 0;
}
/**
* Stops the adaptor server.
**/
public synchronized void terminate() {
if (adaptor == null) return;
// Terminate the MIB (deregister NotificationListener from
// MemoryMBean)
//
try {
jvmmib.terminate();
} catch (Exception x) {
// Must not prevent to stop...
//
log.debug("jmxremote.AdaptorBootstrap.getTargetList.terminate",
x.toString());
} finally {
jvmmib=null;
}
// Stop the adaptor
//
try {
adaptor.stop();
} finally {
adaptor = null;
}
}
}

View File

@@ -0,0 +1,694 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.util.Hashtable;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.lang.ref.WeakReference;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.InstanceAlreadyExistsException;
import javax.management.NotificationEmitter;
import javax.management.NotificationListener;
import javax.management.Notification;
import javax.management.ListenerNotFoundException;
import javax.management.openmbean.CompositeData;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
import com.sun.jmx.snmp.SnmpPeer;
import com.sun.jmx.snmp.SnmpParameters;
import com.sun.jmx.snmp.SnmpOidTable;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpVarBindList;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.Enumerated;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import sun.management.snmp.jvmmib.JVM_MANAGEMENT_MIBOidTable;
import sun.management.snmp.jvmmib.JVM_MANAGEMENT_MIB;
import sun.management.snmp.jvmmib.JvmMemoryMeta;
import sun.management.snmp.jvmmib.JvmThreadingMeta;
import sun.management.snmp.jvmmib.JvmRuntimeMeta;
import sun.management.snmp.jvmmib.JvmClassLoadingMeta;
import sun.management.snmp.jvmmib.JvmCompilationMeta;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableHandler;
//java management imports
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryNotificationInfo;
import java.lang.management.MemoryType;
public class JVM_MANAGEMENT_MIB_IMPL extends JVM_MANAGEMENT_MIB {
private static final long serialVersionUID = -8104825586888859831L;
private static final MibLogger log =
new MibLogger(JVM_MANAGEMENT_MIB_IMPL.class);
private static WeakReference<SnmpOidTable> tableRef;
public static SnmpOidTable getOidTable() {
SnmpOidTable table = null;
if(tableRef == null) {
table = new JVM_MANAGEMENT_MIBOidTable();
tableRef = new WeakReference<>(table);
return table;
}
table = tableRef.get();
if(table == null) {
table = new JVM_MANAGEMENT_MIBOidTable();
tableRef = new WeakReference<>(table);
}
return table;
}
/**
* Handler waiting for memory <CODE>Notification</CODE>.
* Translate each JMX notification in SNMP trap.
*/
private class NotificationHandler implements NotificationListener {
public void handleNotification(Notification notification,
Object handback) {
log.debug("handleNotification", "Received notification [ " +
notification.getType() + "]");
String type = notification.getType();
if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
type.equals(MemoryNotificationInfo.
MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {
MemoryNotificationInfo minfo = MemoryNotificationInfo.
from((CompositeData) notification.getUserData());
SnmpCounter64 count = new SnmpCounter64(minfo.getCount());
SnmpCounter64 used =
new SnmpCounter64(minfo.getUsage().getUsed());
SnmpString poolName = new SnmpString(minfo.getPoolName());
SnmpOid entryIndex =
getJvmMemPoolEntryIndex(minfo.getPoolName());
if (entryIndex == null) {
log.error("handleNotification",
"Error: Can't find entry index for Memory Pool: "
+ minfo.getPoolName() +": " +
"No trap emitted for " + type);
return;
}
SnmpOid trap = null;
final SnmpOidTable mibTable = getOidTable();
try {
SnmpOid usedOid = null;
SnmpOid countOid = null;
if (type.equals(MemoryNotificationInfo.
MEMORY_THRESHOLD_EXCEEDED)) {
trap = new SnmpOid(mibTable.
resolveVarName("jvmLowMemoryPoolUsageNotif").getOid());
usedOid =
new SnmpOid(mibTable.
resolveVarName("jvmMemPoolUsed").getOid() +
"." + entryIndex);
countOid =
new SnmpOid(mibTable.
resolveVarName("jvmMemPoolThreshdCount").getOid()
+ "." + entryIndex);
} else if (type.equals(MemoryNotificationInfo.
MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {
trap = new SnmpOid(mibTable.
resolveVarName("jvmLowMemoryPoolCollectNotif").
getOid());
usedOid =
new SnmpOid(mibTable.
resolveVarName("jvmMemPoolCollectUsed").getOid() +
"." + entryIndex);
countOid =
new SnmpOid(mibTable.
resolveVarName("jvmMemPoolCollectThreshdCount").
getOid() +
"." + entryIndex);
}
//Datas
SnmpVarBindList list = new SnmpVarBindList();
SnmpOid poolNameOid =
new SnmpOid(mibTable.
resolveVarName("jvmMemPoolName").getOid() +
"." + entryIndex);
SnmpVarBind varCount = new SnmpVarBind(countOid, count);
SnmpVarBind varUsed = new SnmpVarBind(usedOid, used);
SnmpVarBind varPoolName = new SnmpVarBind(poolNameOid,
poolName);
list.add(varPoolName);
list.add(varCount);
list.add(varUsed);
sendTrap(trap, list);
}catch(Exception e) {
log.error("handleNotification",
"Exception occurred : " + e);
}
}
}
}
/**
* List of notification targets.
*/
private ArrayList<NotificationTarget> notificationTargets =
new ArrayList<>();
private final NotificationEmitter emitter;
private final NotificationHandler handler;
/**
* Instantiate a JVM MIB intrusmentation.
* A <CODE>NotificationListener</CODE> is added to the <CODE>MemoryMXBean</CODE>
* <CODE>NotificationEmitter</CODE>
*/
public JVM_MANAGEMENT_MIB_IMPL() {
handler = new NotificationHandler();
emitter = (NotificationEmitter) ManagementFactory.getMemoryMXBean();
emitter.addNotificationListener(handler, null, null);
}
private synchronized void sendTrap(SnmpOid trap, SnmpVarBindList list) {
final Iterator<NotificationTarget> iterator = notificationTargets.iterator();
final SnmpAdaptorServer adaptor =
(SnmpAdaptorServer) getSnmpAdaptor();
if (adaptor == null) {
log.error("sendTrap", "Cannot send trap: adaptor is null.");
return;
}
if (!adaptor.isActive()) {
log.config("sendTrap", "Adaptor is not active: trap not sent.");
return;
}
while(iterator.hasNext()) {
NotificationTarget target = null;
try {
target = iterator.next();
SnmpPeer peer =
new SnmpPeer(target.getAddress(), target.getPort());
SnmpParameters p = new SnmpParameters();
p.setRdCommunity(target.getCommunity());
peer.setParams(p);
log.debug("handleNotification", "Sending trap to " +
target.getAddress() + ":" + target.getPort());
adaptor.snmpV2Trap(peer, trap, list, null);
}catch(Exception e) {
log.error("sendTrap",
"Exception occurred while sending trap to [" +
target + "]. Exception : " + e);
log.debug("sendTrap",e);
}
}
}
/**
* Add a notification target.
* @param target The target to add
* @throws IllegalArgumentException If target parameter is null.
*/
public synchronized void addTarget(NotificationTarget target)
throws IllegalArgumentException {
if(target == null)
throw new IllegalArgumentException("Target is null");
notificationTargets.add(target);
}
/**
* Remove notification listener.
*/
public void terminate() {
try {
emitter.removeNotificationListener(handler);
}catch(ListenerNotFoundException e) {
log.error("terminate", "Listener Not found : " + e);
}
}
/**
* Add notification targets.
* @param targets A list of
* <CODE>sun.management.snmp.jvminstr.NotificationTarget</CODE>
* @throws IllegalArgumentException If targets parameter is null.
*/
public synchronized void addTargets(List<NotificationTarget> targets)
throws IllegalArgumentException {
if(targets == null)
throw new IllegalArgumentException("Target list is null");
notificationTargets.addAll(targets);
}
/**
* Factory method for "JvmMemory" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmMemory")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmMemory" group (JvmMemory)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmMemoryMBean"
* interface.
**/
protected Object createJvmMemoryMBean(String groupName,
String groupOid, ObjectName groupObjname,
MBeanServer server) {
// Note that when using standard metadata,
// the returned object must implement the "JvmMemoryMBean"
// interface.
//
if (server != null)
return new JvmMemoryImpl(this,server);
else
return new JvmMemoryImpl(this);
}
/**
* Factory method for "JvmMemory" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmMemory")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemory" group (JvmMemoryMeta)
*
**/
protected JvmMemoryMeta createJvmMemoryMetaNode(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
return new JvmMemoryMetaImpl(this, objectserver);
}
/**
* Factory method for "JvmThreading" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmThreading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmThreading" group (JvmThreadingMeta)
*
**/
protected JvmThreadingMeta createJvmThreadingMetaNode(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
return new JvmThreadingMetaImpl(this, objectserver);
}
/**
* Factory method for "JvmThreading" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmThreading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmThreading" group (JvmThreading)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmThreadingMBean"
* interface.
**/
protected Object createJvmThreadingMBean(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
// Note that when using standard metadata,
// the returned object must implement the "JvmThreadingMBean"
// interface.
//
if (server != null)
return new JvmThreadingImpl(this,server);
else
return new JvmThreadingImpl(this);
}
/**
* Factory method for "JvmRuntime" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmRuntime")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRuntime" group (JvmRuntimeMeta)
*
**/
protected JvmRuntimeMeta createJvmRuntimeMetaNode(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
return new JvmRuntimeMetaImpl(this, objectserver);
}
/**
* Factory method for "JvmRuntime" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmRuntime")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmRuntime" group (JvmRuntime)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmRuntimeMBean"
* interface.
**/
protected Object createJvmRuntimeMBean(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
// Note that when using standard metadata,
// the returned object must implement the "JvmRuntimeMBean"
// interface.
//
if (server != null)
return new JvmRuntimeImpl(this,server);
else
return new JvmRuntimeImpl(this);
}
/**
* Factory method for "JvmCompilation" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmCompilation")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmCompilation" group (JvmCompilationMeta)
*
**/
protected JvmCompilationMeta
createJvmCompilationMetaNode(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
// If there is no compilation system, the jvmCompilation will not
// be instantiated.
//
if (ManagementFactory.getCompilationMXBean() == null) return null;
return super.createJvmCompilationMetaNode(groupName,groupOid,
groupObjname,server);
}
/**
* Factory method for "JvmCompilation" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmCompilation")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmCompilation" group (JvmCompilation)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmCompilationMBean"
* interface.
**/
protected Object createJvmCompilationMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
// Note that when using standard metadata,
// the returned object must implement the "JvmCompilationMBean"
// interface.
//
if (server != null)
return new JvmCompilationImpl(this,server);
else
return new JvmCompilationImpl(this);
}
/**
* Factory method for "JvmOS" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmOS")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmOS" group (JvmOS)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmOSMBean"
* interface.
**/
protected Object createJvmOSMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
// Note that when using standard metadata,
// the returned object must implement the "JvmOSMBean"
// interface.
//
if (server != null)
return new JvmOSImpl(this,server);
else
return new JvmOSImpl(this);
}
/**
* Factory method for "JvmClassLoading" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmClassLoading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmClassLoading" group (JvmClassLoading)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmClassLoadingMBean"
* interface.
**/
protected Object createJvmClassLoadingMBean(String groupName,
String groupOid,
ObjectName groupObjname,
MBeanServer server) {
// Note that when using standard metadata,
// the returned object must implement the "JvmClassLoadingMBean"
// interface.
//
if (server != null)
return new JvmClassLoadingImpl(this,server);
else
return new JvmClassLoadingImpl(this);
}
static String validDisplayStringTC(String str) {
if(str == null) return "";
if(str.length() > DISPLAY_STRING_MAX_LENGTH) {
return str.substring(0, DISPLAY_STRING_MAX_LENGTH);
}
else
return str;
}
static String validJavaObjectNameTC(String str) {
if(str == null) return "";
if(str.length() > JAVA_OBJECT_NAME_MAX_LENGTH) {
return str.substring(0, JAVA_OBJECT_NAME_MAX_LENGTH);
}
else
return str;
}
static String validPathElementTC(String str) {
if(str == null) return "";
if(str.length() > PATH_ELEMENT_MAX_LENGTH) {
return str.substring(0, PATH_ELEMENT_MAX_LENGTH);
}
else
return str;
}
static String validArgValueTC(String str) {
if(str == null) return "";
if(str.length() > ARG_VALUE_MAX_LENGTH) {
return str.substring(0, ARG_VALUE_MAX_LENGTH);
}
else
return str;
}
/**
* WARNING: This should probably be moved to JvmMemPoolTableMetaImpl
**/
private SnmpTableHandler getJvmMemPoolTableHandler(Object userData) {
final SnmpMibTable meta =
getRegisteredTableMeta("JvmMemPoolTable");
if (! (meta instanceof JvmMemPoolTableMetaImpl)) {
final String err = ((meta==null)?"No metadata for JvmMemPoolTable":
"Bad metadata class for JvmMemPoolTable: " +
meta.getClass().getName());
log.error("getJvmMemPoolTableHandler", err);
return null;
}
final JvmMemPoolTableMetaImpl memPoolTable =
(JvmMemPoolTableMetaImpl) meta;
return memPoolTable.getHandler(userData);
}
/**
* WARNING: This should probably be moved to JvmMemPoolTableMetaImpl
**/
private int findInCache(SnmpTableHandler handler,
String poolName) {
if (!(handler instanceof SnmpCachedData)) {
if (handler != null) {
final String err = "Bad class for JvmMemPoolTable datas: " +
handler.getClass().getName();
log.error("getJvmMemPoolEntry", err);
}
return -1;
}
final SnmpCachedData data = (SnmpCachedData)handler;
final int len = data.datas.length;
for (int i=0; i < data.datas.length ; i++) {
final MemoryPoolMXBean pool = (MemoryPoolMXBean) data.datas[i];
if (poolName.equals(pool.getName())) return i;
}
return -1;
}
/**
* WARNING: This should probably be moved to JvmMemPoolTableMetaImpl
**/
private SnmpOid getJvmMemPoolEntryIndex(SnmpTableHandler handler,
String poolName) {
final int index = findInCache(handler,poolName);
if (index < 0) return null;
return ((SnmpCachedData)handler).indexes[index];
}
private SnmpOid getJvmMemPoolEntryIndex(String poolName) {
return getJvmMemPoolEntryIndex(getJvmMemPoolTableHandler(null),
poolName);
}
// cache validity
//
// Should we define a property for this? Should we have different
// cache validity periods depending on which table we cache?
//
public long validity() {
return DEFAULT_CACHE_VALIDITY_PERIOD;
}
// Defined in RFC 2579
private final static int DISPLAY_STRING_MAX_LENGTH=255;
private final static int JAVA_OBJECT_NAME_MAX_LENGTH=1023;
private final static int PATH_ELEMENT_MAX_LENGTH=1023;
private final static int ARG_VALUE_MAX_LENGTH=1023;
private final static int DEFAULT_CACHE_VALIDITY_PERIOD=1000;
}

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
import java.lang.management.ClassLoadingMXBean;
import java.lang.management.ManagementFactory;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmClassLoadingMBean;
import sun.management.snmp.jvmmib.EnumJvmClassesVerboseLevel;
import sun.management.snmp.util.MibLogger;
/**
* The class is used for implementing the "JvmClassLoading" group.
*/
public class JvmClassLoadingImpl implements JvmClassLoadingMBean {
/**
* Variable for storing the value of "JvmClassesVerboseLevel".
*
* "verbose: if the -verbose:class flag is set.
* silent: otherwise.
*
* See java.management.ClassLoadingMXBean.isVerbose(),
* java.management.ClassLoadingMXBean.setVerbose()
* "
*
*/
static final EnumJvmClassesVerboseLevel JvmClassesVerboseLevelVerbose =
new EnumJvmClassesVerboseLevel("verbose");
static final EnumJvmClassesVerboseLevel JvmClassesVerboseLevelSilent =
new EnumJvmClassesVerboseLevel("silent");
/**
* Constructor for the "JvmClassLoading" group.
* If the group contains a table, the entries created through an
* SNMP SET will not be registered in Java DMK.
*/
public JvmClassLoadingImpl(SnmpMib myMib) {
}
/**
* Constructor for the "JvmClassLoading" group.
* If the group contains a table, the entries created through an SNMP SET
* will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmClassLoadingImpl(SnmpMib myMib, MBeanServer server) {
}
static ClassLoadingMXBean getClassLoadingMXBean() {
return ManagementFactory.getClassLoadingMXBean();
}
/**
* Getter for the "JvmClassesVerboseLevel" variable.
*/
public EnumJvmClassesVerboseLevel getJvmClassesVerboseLevel()
throws SnmpStatusException {
if(getClassLoadingMXBean().isVerbose())
return JvmClassesVerboseLevelVerbose;
else
return JvmClassesVerboseLevelSilent;
}
/**
* Setter for the "JvmClassesVerboseLevel" variable.
*/
public void setJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x)
throws SnmpStatusException {
final boolean verbose;
if (JvmClassesVerboseLevelVerbose.equals(x)) verbose=true;
else if (JvmClassesVerboseLevelSilent.equals(x)) verbose=false;
// Should never happen, this case is handled by
// checkJvmClassesVerboseLevel();
else throw new
SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
getClassLoadingMXBean().setVerbose(verbose);
}
/**
* Checker for the "JvmClassesVerboseLevel" variable.
*/
public void checkJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x)
throws SnmpStatusException {
//
// Add your own checking policy.
//
if (JvmClassesVerboseLevelVerbose.equals(x)) return;
if (JvmClassesVerboseLevelSilent.equals(x)) return;
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
/**
* Getter for the "JvmClassesUnloadedCount" variable.
*/
public Long getJvmClassesUnloadedCount() throws SnmpStatusException {
return new Long(getClassLoadingMXBean().getUnloadedClassCount());
}
/**
* Getter for the "JvmClassesTotalLoadedCount" variable.
*/
public Long getJvmClassesTotalLoadedCount() throws SnmpStatusException {
return new Long(getClassLoadingMXBean().getTotalLoadedClassCount());
}
/**
* Getter for the "JvmClassesLoadedCount" variable.
*/
public Long getJvmClassesLoadedCount() throws SnmpStatusException {
return new Long(getClassLoadingMXBean().getLoadedClassCount());
}
}

View File

@@ -0,0 +1,129 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.lang.management.CompilationMXBean;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmCompilationMBean;
import sun.management.snmp.jvmmib.EnumJvmJITCompilerTimeMonitoring;
import sun.management.snmp.util.MibLogger;
/**
* The class is used for implementing the "JvmCompilation" group.
*/
public class JvmCompilationImpl implements JvmCompilationMBean {
/**
* Variable for storing the value of "JvmJITCompilerTimeMonitoring".
*
* "Indicates whether the Java virtual machine supports
* compilation time monitoring.
*
* See java.management.CompilationMXBean.
* isCompilationTimeMonitoringSupported()
* "
*
*/
static final EnumJvmJITCompilerTimeMonitoring
JvmJITCompilerTimeMonitoringSupported =
new EnumJvmJITCompilerTimeMonitoring("supported");
static final EnumJvmJITCompilerTimeMonitoring
JvmJITCompilerTimeMonitoringUnsupported =
new EnumJvmJITCompilerTimeMonitoring("unsupported");
/**
* Constructor for the "JvmCompilation" group.
* If the group contains a table, the entries created through an SNMP SET
* will not be registered in Java DMK.
*/
public JvmCompilationImpl(SnmpMib myMib) {
}
/**
* Constructor for the "JvmCompilation" group.
* If the group contains a table, the entries created through an SNMP
* SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmCompilationImpl(SnmpMib myMib, MBeanServer server) {
}
private static CompilationMXBean getCompilationMXBean() {
return ManagementFactory.getCompilationMXBean();
}
/**
* Getter for the "JvmJITCompilerTimeMonitoring" variable.
*/
public EnumJvmJITCompilerTimeMonitoring getJvmJITCompilerTimeMonitoring()
throws SnmpStatusException {
// If we reach this point, then we can safely assume that
// getCompilationMXBean() will not return null, because this
// object will not be instantiated when there is no compilation
// system (see JVM_MANAGEMENT_MIB_IMPL).
//
if(getCompilationMXBean().isCompilationTimeMonitoringSupported())
return JvmJITCompilerTimeMonitoringSupported;
else
return JvmJITCompilerTimeMonitoringUnsupported;
}
/**
* Getter for the "JvmJITCompilerTimeMs" variable.
*/
public Long getJvmJITCompilerTimeMs() throws SnmpStatusException {
final long t;
if(getCompilationMXBean().isCompilationTimeMonitoringSupported())
t = getCompilationMXBean().getTotalCompilationTime();
else
t = 0;
return new Long(t);
}
/**
* Getter for the "JvmJITCompilerName" variable.
*/
public String getJvmJITCompilerName() throws SnmpStatusException {
return JVM_MANAGEMENT_MIB_IMPL.
validJavaObjectNameTC(getCompilationMXBean().getName());
}
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import java.lang.management.GarbageCollectorMXBean;
import sun.management.snmp.jvmmib.JvmMemGCEntryMBean;
import sun.management.snmp.util.MibLogger;
/**
* The class is used for implementing the "JvmMemGCEntry" group.
*/
public class JvmMemGCEntryImpl implements JvmMemGCEntryMBean {
/**
* Variable for storing the value of "JvmMemManagerIndex".
*
* "An index opaquely computed by the agent and which uniquely
* identifies a Memory Manager."
*
*/
protected final int JvmMemManagerIndex;
protected final GarbageCollectorMXBean gcm;
/**
* Constructor for the "JvmMemGCEntry" group.
*/
public JvmMemGCEntryImpl(GarbageCollectorMXBean gcm, int index) {
this.gcm=gcm;
this.JvmMemManagerIndex = index;
}
/**
* Getter for the "JvmMemGCTimeMs" variable.
*/
// Don't bother to uses the request contextual cache for this.
public Long getJvmMemGCTimeMs() throws SnmpStatusException {
return new Long(gcm.getCollectionTime());
}
/**
* Getter for the "JvmMemGCCount" variable.
*/
// Don't bother to uses the request contextual cache for this.
public Long getJvmMemGCCount() throws SnmpStatusException {
return new Long(gcm.getCollectionCount());
}
/**
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException {
return new Integer(JvmMemManagerIndex);
}
}

View File

@@ -0,0 +1,362 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import java.lang.management.MemoryManagerMXBean;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import sun.management.snmp.jvmmib.JvmMemGCTableMeta;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemGCTable" table.
*/
public class JvmMemGCTableMetaImpl extends JvmMemGCTableMeta {
static final long serialVersionUID = 8250461197108867607L;
/**
* This class acts as a filter over the SnmpTableHandler
* used for the JvmMemoryManagerTable. It filters out
* (skip) all MemoryManagerMXBean that are not instances of
* GarbageCollectorMXBean so that only Garbage Collectors are
* seen. This is a better solution than relying on
* ManagementFactory.getGarbageCollectorMXBeans() because it makes it
* possible to guarantee the consistency betwen the MemoryManager table
* and the GCTable since both will be sharing the same cache.
**/
protected static class GCTableFilter {
/**
* Returns the index that immediately follows the given
* <var>index</var>. The returned index is strictly greater
* than the given <var>index</var>, and is contained in the table.
* <br>If the given <var>index</var> is null, returns the first
* index in the table.
* <br>If there are no index after the given <var>index</var>,
* returns null.
* This method is an optimization for the case where the
* SnmpTableHandler is in fact an instance of SnmpCachedData.
**/
public SnmpOid getNext(SnmpCachedData datas, SnmpOid index) {
final boolean dbg = log.isDebugOn();
// We're going to loop until we find an instance of
// GarbageCollectorMXBean. First we attempt to find
// the next element whose OID follows the given index.
// If `index' is null, the insertion point is -1
// (the next is 0 = -insertion - 1)
//
final int insertion = (index==null)?-1:datas.find(index);
if (dbg) log.debug("GCTableFilter","oid="+index+
" at insertion="+insertion);
int next;
if (insertion > -1) next = insertion+1;
else next = -insertion -1;
// Now `next' points to the element that imediately
// follows the given `index'. We're going to loop
// through the table, starting at `next' (included),
// and return the first element which is an instance
// of GarbageCollectorMXBean.
//
for (;next<datas.indexes.length;next++) {
if (dbg) log.debug("GCTableFilter","next="+next);
final Object value = datas.datas[next];
if (dbg) log.debug("GCTableFilter","value["+next+"]=" +
((MemoryManagerMXBean)value).getName());
if (value instanceof GarbageCollectorMXBean) {
// That's the next: return it.
if (dbg) log.debug("GCTableFilter",
((MemoryManagerMXBean)value).getName() +
" is a GarbageCollectorMXBean.");
return datas.indexes[next];
}
if (dbg) log.debug("GCTableFilter",
((MemoryManagerMXBean)value).getName() +
" is not a GarbageCollectorMXBean: " +
value.getClass().getName());
// skip to next index...
}
return null;
}
/**
* Returns the index that immediately follows the given
* <var>index</var>. The returned index is strictly greater
* than the given <var>index</var>, and is contained in the table.
* <br>If the given <var>index</var> is null, returns the first
* index in the table.
* <br>If there are no index after the given <var>index</var>,
* returns null.
**/
public SnmpOid getNext(SnmpTableHandler handler, SnmpOid index) {
// try to call the optimized method
if (handler instanceof SnmpCachedData)
return getNext((SnmpCachedData)handler, index);
// too bad - revert to non-optimized generic algorithm
SnmpOid next = index;
do {
next = handler.getNext(next);
final Object value = handler.getData(next);
if (value instanceof GarbageCollectorMXBean)
// That's the next! return it
return next;
// skip to next index...
} while (next != null);
return null;
}
/**
* Returns the data associated with the given index.
* If the given index is not found, null is returned.
* Note that returning null does not necessarily means that
* the index was not found.
**/
public Object getData(SnmpTableHandler handler, SnmpOid index) {
final Object value = handler.getData(index);
if (value instanceof GarbageCollectorMXBean) return value;
// Behaves as if there was nothing at this index...
//
return null;
}
/**
* Returns true if the given <var>index</var> is present.
**/
public boolean contains(SnmpTableHandler handler, SnmpOid index) {
if (handler.getData(index) instanceof GarbageCollectorMXBean)
return true;
// Behaves as if there was nothing at this index...
//
return false;
}
}
private transient JvmMemManagerTableMetaImpl managers = null;
private static GCTableFilter filter = new GCTableFilter();
/**
* Constructor for the table. Initialize metadata for "JvmMemGCTableMeta".
*/
public JvmMemGCTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib,objserv);
}
// Returns a pointer to the JvmMemManager meta node - we're going
// to reuse its SnmpTableHandler by filtering out all that is
// not a GarbageCollectorMXBean.
private final JvmMemManagerTableMetaImpl getManagers(SnmpMib mib) {
if (managers == null) {
managers = (JvmMemManagerTableMetaImpl)
mib.getRegisteredTableMeta("JvmMemManagerTable");
}
return managers;
}
/**
* Returns the JvmMemManagerTable SnmpTableHandler
**/
protected SnmpTableHandler getHandler(Object userData) {
JvmMemManagerTableMetaImpl managerTable= getManagers(theMib);
return managerTable.getHandler(userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
try {
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new
SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid, using the GC filter.
//
final SnmpOid next = filter.getNext(handler,oid);
if (dbg) log.debug("getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new
SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
} catch (RuntimeException x) {
// debug. This should never happen.
//
if (dbg) log.debug("getNextOid",x);
throw x;
}
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return filter.contains(handler,oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
if (oid == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// First look in the request contextual cache: maybe we've already
// created this entry...
//
// We know in the case of this table that the index is an integer,
// it is thus the first OID arc of the index OID.
//
final long index = oid.getOidArc(0);
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:("JvmMemGCTable.entry." +
index));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) return entry;
}
// Entry was not in request cache. Make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Use the filter to retrieve only GarabageCollectorMBean data.
//
final Object data = filter.getData(handler,oid);
// data may be null if the OID we were given is not valid.
// (e.g. it identifies a MemoryManager which is not a
// GarbageCollector)
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Make a new entryy (transient object that will be kept only
// for the duration of the request.
//
final Object entry =
new JvmMemGCEntryImpl((GarbageCollectorMXBean)data,(int)index);
// Put the entry in the request cache in case we need it later
// in the processing of the request. Note that we could have
// optimized this by making JvmMemGCEntryImpl extend
// JvmMemManagerEntryImpl, and then make sure that
// JvmMemManagerTableMetaImpl creates an instance of JvmMemGCEntryImpl
// instead of JvmMemManagerEntryImpl when the associated data is
// an instance of GarbageCollectorMXBean. This would have made it
// possible to share the transient entry object.
// As it is, we may have two transient objects that points to
// the same underlying MemoryManagerMXBean (which is definitely
// not a problem - but is only a small dysatisfaction)
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
static final MibLogger log = new MibLogger(JvmMemGCTableMetaImpl.class);
}

View File

@@ -0,0 +1,101 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import java.lang.management.MemoryManagerMXBean;
import sun.management.snmp.jvmmib.JvmMemManagerEntryMBean;
import sun.management.snmp.jvmmib.EnumJvmMemManagerState;
/**
* The class is used for implementing the "JvmMemManagerEntry" group.
* The group is defined with the following
*/
public class JvmMemManagerEntryImpl implements JvmMemManagerEntryMBean {
/**
* Variable for storing the value of "JvmMemManagerIndex".
*
* "An index opaquely computed by the agent and which uniquely
* identifies a Memory Manager."
*
*/
protected final int JvmMemManagerIndex;
protected MemoryManagerMXBean manager;
/**
* Constructor for the "JvmMemManagerEntry" group.
*/
public JvmMemManagerEntryImpl(MemoryManagerMXBean m, int myindex) {
manager = m;
JvmMemManagerIndex = myindex;
}
/**
* Getter for the "JvmMemManagerName" variable.
*/
public String getJvmMemManagerName() throws SnmpStatusException {
return JVM_MANAGEMENT_MIB_IMPL.
validJavaObjectNameTC(manager.getName());
}
/**
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException {
return new Integer(JvmMemManagerIndex);
}
/**
* Getter for the "JvmMemManagerState" variable.
*/
public EnumJvmMemManagerState getJvmMemManagerState()
throws SnmpStatusException {
if (manager.isValid())
return JvmMemManagerStateValid;
else
return JvmMemManagerStateInvalid;
}
private final static EnumJvmMemManagerState JvmMemManagerStateValid =
new EnumJvmMemManagerState("valid");
private final static EnumJvmMemManagerState JvmMemManagerStateInvalid =
new EnumJvmMemManagerState("invalid");
}

View File

@@ -0,0 +1,303 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import java.lang.management.MemoryManagerMXBean;
import java.lang.management.ManagementFactory;
import sun.management.snmp.jvmmib.JvmMemManagerTableMeta;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpNamedListTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemManagerTable" table.
*
* This custom implementation show how to implement an SNMP table
* over a weak cache, recomputing the cahed data when needed.
*/
public class JvmMemManagerTableMetaImpl extends JvmMemManagerTableMeta {
static final long serialVersionUID = 36176771566817592L;
/**
* A concrete implementation of {@link SnmpNamedListTableCache}, for the
* jvmMemManagerTable.
**/
private static class JvmMemManagerTableCache
extends SnmpNamedListTableCache {
static final long serialVersionUID = 6564294074653009240L;
/**
* Create a weak cache for the jvmMemManagerTable.
* @param validity validity of the cached data, in ms.
**/
JvmMemManagerTableCache(long validity) {
this.validity = validity;
}
/**
* Use the MemoryManagerMXBean name as key.
* @param context A {@link TreeMap} as allocated by the parent
* {@link SnmpNamedListTableCache} class.
* @param rawDatas List of {@link MemoryManagerMXBean}, as
* returned by
* <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
* @param rank The <var>rank</var> of <var>item</var> in the list.
* @param item The <var>rank</var><super>th</super>
* <code>MemoryManagerMXBean</code> in the list.
* @return <code>((MemoryManagerMXBean)item).getName()</code>
**/
protected String getKey(Object context, List<?> rawDatas,
int rank, Object item) {
if (item == null) return null;
final String name = ((MemoryManagerMXBean)item).getName();
log.debug("getKey", "key=" + name);
return name;
}
/**
* Call <code>getTableHandler(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return the key used to cache the raw data of this table.
**/
protected String getRawDatasKey() {
return "JvmMemManagerTable.getMemoryManagers";
}
/**
* Call ManagementFactory.getMemoryManagerMXBeans() to
* load the raw data of this table.
**/
protected List<MemoryManagerMXBean> loadRawDatas(Map<Object, Object> userData) {
return ManagementFactory.getMemoryManagerMXBeans();
}
}
// The weak cache for this table.
protected SnmpTableCache cache;
/**
* Constructor for the table. Initialize metadata for
* "JvmMemManagerTableMeta".
* The reference on the MBean server is updated so the entries
* created through an SNMP SET will be AUTOMATICALLY REGISTERED
* in Java DMK.
*/
public JvmMemManagerTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib,objserv);
this.cache = new
JvmMemManagerTableCache(((JVM_MANAGEMENT_MIB_IMPL)myMib).
validity());
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
if (oid == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// We know in the case of this table that the index is an integer,
// it is thus the first OID arc of the index OID.
//
final long index = oid.getOidArc(0);
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:("JvmMemManagerTable.entry." +
index));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) return entry;
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
final Object entry =
new JvmMemManagerEntryImpl((MemoryManagerMXBean)data,(int)index);
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmMemManagerTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmMemManagerTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmMemManagerTable.handler",handler);
return handler;
}
static final MibLogger log =
new MibLogger(JvmMemManagerTableMetaImpl.class);
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import sun.management.snmp.jvmmib.JvmMemMgrPoolRelEntryMBean;
/**
* The class is used for implementing the "JvmMemMgrPoolRelEntry" group.
*/
public class JvmMemMgrPoolRelEntryImpl
implements JvmMemMgrPoolRelEntryMBean {
/**
* Variable for storing the value of "JvmMemManagerIndex".
*
* "An index opaquely computed by the agent and which uniquely
* identifies a Memory Manager."
*
*/
final protected int JvmMemManagerIndex;
/**
* Variable for storing the value of "JvmMemPoolIndex".
*
* "An index value opaquely computed by the agent which uniquely
* identifies a row in the jvmMemPoolTable.
* "
*
*/
final protected int JvmMemPoolIndex;
final protected String mmmName;
final protected String mpmName;
/**
* Constructor for the "JvmMemMgrPoolRelEntry" group.
*/
public JvmMemMgrPoolRelEntryImpl(String mmmName,
String mpmName,
int mmarc, int mparc) {
JvmMemManagerIndex = mmarc;
JvmMemPoolIndex = mparc;
this.mmmName = mmmName;
this.mpmName = mpmName;
}
/**
* Getter for the "JvmMemMgrRelPoolName" variable.
*/
public String getJvmMemMgrRelPoolName() throws SnmpStatusException {
return JVM_MANAGEMENT_MIB_IMPL.validJavaObjectNameTC(mpmName);
}
/**
* Getter for the "JvmMemMgrRelManagerName" variable.
*/
public String getJvmMemMgrRelManagerName() throws SnmpStatusException {
return JVM_MANAGEMENT_MIB_IMPL.validJavaObjectNameTC(mmmName);
}
/**
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException {
return new Integer(JvmMemManagerIndex);
}
/**
* Getter for the "JvmMemPoolIndex" variable.
*/
public Integer getJvmMemPoolIndex() throws SnmpStatusException {
return new Integer(JvmMemPoolIndex);
}
}

View File

@@ -0,0 +1,523 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.util.List;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.Collections;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import java.lang.management.MemoryManagerMXBean;
import java.lang.management.MemoryPoolMXBean;
import sun.management.snmp.jvmmib.JvmMemMgrPoolRelTableMeta;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemMgrPoolRelTable" group.
*/
public class JvmMemMgrPoolRelTableMetaImpl extends JvmMemMgrPoolRelTableMeta
implements Serializable {
static final long serialVersionUID = 1896509775012355443L;
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* jvmMemMgrPoolRelTable.
**/
private static class JvmMemMgrPoolRelTableCache
extends SnmpTableCache {
static final long serialVersionUID = 6059937161990659184L;
final private JvmMemMgrPoolRelTableMetaImpl meta;
/**
* Create a weak cache for the jvmMemMgrPoolRelTable.
* @param validity validity of the cached data, in ms.
**/
JvmMemMgrPoolRelTableCache(JvmMemMgrPoolRelTableMetaImpl meta,
long validity) {
this.validity = validity;
this.meta = meta;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Builds a map pool-name => pool-index from the SnmpTableHandler
* of the JvmMemPoolTable.
**/
private static Map<String, SnmpOid> buildPoolIndexMap(SnmpTableHandler handler) {
// optimization...
if (handler instanceof SnmpCachedData)
return buildPoolIndexMap((SnmpCachedData)handler);
// not optimizable... too bad.
final Map<String, SnmpOid> m = new HashMap<>();
SnmpOid index=null;
while ((index = handler.getNext(index))!=null) {
final MemoryPoolMXBean mpm =
(MemoryPoolMXBean)handler.getData(index);
if (mpm == null) continue;
final String name = mpm.getName();
if (name == null) continue;
m.put(name,index);
}
return m;
}
/**
* Builds a map pool-name => pool-index from the SnmpTableHandler
* of the JvmMemPoolTable.
* Optimized algorithm.
**/
private static Map<String, SnmpOid> buildPoolIndexMap(SnmpCachedData cached) {
if (cached == null) return Collections.emptyMap();
final SnmpOid[] indexes = cached.indexes;
final Object[] datas = cached.datas;
final int len = indexes.length;
final Map<String, SnmpOid> m = new HashMap<>(len);
for (int i=0; i<len; i++) {
final SnmpOid index = indexes[i];
if (index == null) continue;
final MemoryPoolMXBean mpm =
(MemoryPoolMXBean)datas[i];
if (mpm == null) continue;
final String name = mpm.getName();
if (name == null) continue;
m.put(name,index);
}
return m;
}
/**
* Return a table handler that holds the jvmMemManagerTable table data.
* This method return the cached table data if it is still
* valid, recompute it and cache the new value if it's not.
* If it needs to recompute the cached data, it first
* try to obtain the list of memory managers from the request
* contextual cache, and if it is not found, it calls
* <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
* and caches the value.
* This ensures that
* <code>ManagementFactory.getMemoryMBean().getMemoryManagers()</code>
* is not called more than once per request, thus ensuring a
* consistent view of the table.
**/
protected SnmpCachedData updateCachedDatas(Object userData) {
// Get the MemoryManager table
final SnmpTableHandler mmHandler =
meta.getManagerHandler(userData);
// Get the MemoryPool table
final SnmpTableHandler mpHandler =
meta.getPoolHandler(userData);
// Time stamp for the cache
final long time = System.currentTimeMillis();
// Build a Map poolname -> index
final Map<String,SnmpOid> poolIndexMap = buildPoolIndexMap(mpHandler);
// For each memory manager, get the list of memory pools
// For each memory pool, find its index in the memory pool table
// Create a row in the relation table.
final TreeMap<SnmpOid, Object> table =
new TreeMap<>(SnmpCachedData.oidComparator);
updateTreeMap(table,userData,mmHandler,mpHandler,poolIndexMap);
return new SnmpCachedData(time,table);
}
/**
* Get the list of memory pool associated with the
* given MemoryManagerMXBean.
**/
protected String[] getMemoryPools(Object userData,
MemoryManagerMXBean mmm, long mmarc) {
final String listTag =
"JvmMemManager." + mmarc + ".getMemoryPools";
String[] result=null;
if (userData instanceof Map) {
result = (String[])((Map)userData).get(listTag);
if (result != null) return result;
}
if (mmm!=null) {
result = mmm.getMemoryPoolNames();
}
if ((result!=null)&&(userData instanceof Map)) {
Map<Object, Object> map = Util.cast(userData);
map.put(listTag,result);
}
return result;
}
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
MemoryManagerMXBean mmm,
SnmpOid mmIndex,
Map<String, SnmpOid> poolIndexMap) {
// The MemoryManager index is an int, so it's the first
// and only subidentifier.
final long mmarc;
try {
mmarc = mmIndex.getOidArc(0);
} catch (SnmpStatusException x) {
log.debug("updateTreeMap",
"Bad MemoryManager OID index: "+mmIndex);
log.debug("updateTreeMap",x);
return;
}
// Cache this in userData + get it from cache?
final String[] mpList = getMemoryPools(userData,mmm,mmarc);
if (mpList == null || mpList.length < 1) return;
final String mmmName = mmm.getName();
for (int i = 0; i < mpList.length; i++) {
final String mpmName = mpList[i];
if (mpmName == null) continue;
final SnmpOid mpIndex = poolIndexMap.get(mpmName);
if (mpIndex == null) continue;
// The MemoryPool index is an int, so it's the first
// and only subidentifier.
final long mparc;
try {
mparc = mpIndex.getOidArc(0);
} catch (SnmpStatusException x) {
log.debug("updateTreeMap","Bad MemoryPool OID index: " +
mpIndex);
log.debug("updateTreeMap",x);
continue;
}
// The MemoryMgrPoolRel table indexed is composed
// of the MemoryManager index, to which the MemoryPool
// index is appended.
final long[] arcs = { mmarc, mparc };
final SnmpOid index = new SnmpOid(arcs);
table.put(index, new JvmMemMgrPoolRelEntryImpl(mmmName,
mpmName,
(int)mmarc,
(int)mparc));
}
}
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
SnmpTableHandler mmHandler,
SnmpTableHandler mpHandler,
Map<String, SnmpOid> poolIndexMap) {
if (mmHandler instanceof SnmpCachedData) {
updateTreeMap(table,userData,(SnmpCachedData)mmHandler,
mpHandler,poolIndexMap);
return;
}
SnmpOid mmIndex=null;
while ((mmIndex = mmHandler.getNext(mmIndex))!=null) {
final MemoryManagerMXBean mmm =
(MemoryManagerMXBean)mmHandler.getData(mmIndex);
if (mmm == null) continue;
updateTreeMap(table,userData,mmm,mmIndex,poolIndexMap);
}
}
protected void updateTreeMap(TreeMap<SnmpOid, Object> table, Object userData,
SnmpCachedData mmHandler,
SnmpTableHandler mpHandler,
Map<String, SnmpOid> poolIndexMap) {
final SnmpOid[] indexes = mmHandler.indexes;
final Object[] datas = mmHandler.datas;
final int size = indexes.length;
for (int i=size-1; i>-1; i--) {
final MemoryManagerMXBean mmm =
(MemoryManagerMXBean)datas[i];
if (mmm == null) continue;
updateTreeMap(table,userData,mmm,indexes[i],poolIndexMap);
}
}
}
// The weak cache for this table.
protected SnmpTableCache cache;
private transient JvmMemManagerTableMetaImpl managers = null;
private transient JvmMemPoolTableMetaImpl pools = null;
/**
* Constructor for the table. Initialize metadata for
* "JvmMemMgrPoolRelTableMeta".
* The reference on the MBean server is updated so the entries
* created through an SNMP SET will be AUTOMATICALLY REGISTERED
* in Java DMK.
*/
public JvmMemMgrPoolRelTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib,objserv);
this.cache = new
JvmMemMgrPoolRelTableCache(this,((JVM_MANAGEMENT_MIB_IMPL)myMib).
validity());
}
// Returns a pointer to the JvmMemManager meta node - we're going
// to reuse its SnmpTableHandler in order to implement the
// relation table.
private final JvmMemManagerTableMetaImpl getManagers(SnmpMib mib) {
if (managers == null) {
managers = (JvmMemManagerTableMetaImpl)
mib.getRegisteredTableMeta("JvmMemManagerTable");
}
return managers;
}
// Returns a pointer to the JvmMemPool meta node - we're going
// to reuse its SnmpTableHandler in order to implement the
// relation table.
private final JvmMemPoolTableMetaImpl getPools(SnmpMib mib) {
if (pools == null) {
pools = (JvmMemPoolTableMetaImpl)
mib.getRegisteredTableMeta("JvmMemPoolTable");
}
return pools;
}
/**
* Returns the JvmMemManagerTable SnmpTableHandler
**/
protected SnmpTableHandler getManagerHandler(Object userData) {
final JvmMemManagerTableMetaImpl managerTable = getManagers(theMib);
return managerTable.getHandler(userData);
}
/**
* Returns the JvmMemPoolTable SnmpTableHandler
**/
protected SnmpTableHandler getPoolHandler(Object userData) {
final JvmMemPoolTableMetaImpl poolTable = getPools(theMib);
return poolTable.getHandler(userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
if (oid == null || oid.getLength() < 2)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// We know in the case of this table that the index is composed
// of two integers,
// o The MemoryManager is the first OID arc of the index OID.
// o The MemoryPool is the second OID arc of the index OID.
//
final long mgrIndex = oid.getOidArc(0);
final long poolIndex = oid.getOidArc(1);
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:
("JvmMemMgrPoolRelTable.entry." +
mgrIndex + "." + poolIndex));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) return entry;
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (!(data instanceof JvmMemMgrPoolRelEntryImpl))
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
final Object entry = (JvmMemMgrPoolRelEntryImpl)data;
// XXXXX Revisit
// new JvmMemMgrPoolRelEntryImpl((MemoryManagerMXBean)data,
// (int)mgrIndex,(int)poolIndex);
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmMemManagerTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmMemMgrPoolRelTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmMemMgrPoolRelTable.handler",handler);
return handler;
}
static final MibLogger log =
new MibLogger(JvmMemMgrPoolRelTableMetaImpl.class);
}

View File

@@ -0,0 +1,506 @@
/*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.util.Map;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
import com.sun.jmx.snmp.SnmpDefinitions;
// jdmk imports
//
import java.lang.management.MemoryUsage;
import java.lang.management.MemoryType;
import java.lang.management.MemoryPoolMXBean;
import sun.management.snmp.jvmmib.JvmMemPoolEntryMBean;
import sun.management.snmp.jvmmib.EnumJvmMemPoolState;
import sun.management.snmp.jvmmib.EnumJvmMemPoolType;
import sun.management.snmp.jvmmib.EnumJvmMemPoolThreshdSupport;
import sun.management.snmp.jvmmib.EnumJvmMemPoolCollectThreshdSupport;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemPoolEntry" group.
*/
public class JvmMemPoolEntryImpl implements JvmMemPoolEntryMBean {
/**
* Variable for storing the value of "JvmMemPoolIndex".
*
* "An index value opaquely computed by the agent which uniquely
* identifies a row in the jvmMemPoolTable.
* "
*
*/
final protected int jvmMemPoolIndex;
final static String memoryTag = "jvmMemPoolEntry.getUsage";
final static String peakMemoryTag = "jvmMemPoolEntry.getPeakUsage";
final static String collectMemoryTag =
"jvmMemPoolEntry.getCollectionUsage";
final static MemoryUsage ZEROS = new MemoryUsage(0,0,0,0);
final String entryMemoryTag;
final String entryPeakMemoryTag;
final String entryCollectMemoryTag;
MemoryUsage getMemoryUsage() {
try {
final Map<Object, Object> m = JvmContextFactory.getUserData();
if (m != null) {
final MemoryUsage cached = (MemoryUsage)
m.get(entryMemoryTag);
if (cached != null) {
log.debug("getMemoryUsage",entryMemoryTag+
" found in cache.");
return cached;
}
MemoryUsage u = pool.getUsage();
if (u == null) u = ZEROS;
m.put(entryMemoryTag,u);
return u;
}
// Should never come here.
// Log error!
log.trace("getMemoryUsage", "ERROR: should never come here!");
return pool.getUsage();
} catch (RuntimeException x) {
log.trace("getMemoryUsage",
"Failed to get MemoryUsage: " + x);
log.debug("getMemoryUsage",x);
throw x;
}
}
MemoryUsage getPeakMemoryUsage() {
try {
final Map<Object, Object> m = JvmContextFactory.getUserData();
if (m != null) {
final MemoryUsage cached = (MemoryUsage)
m.get(entryPeakMemoryTag);
if (cached != null) {
if (log.isDebugOn())
log.debug("getPeakMemoryUsage",
entryPeakMemoryTag + " found in cache.");
return cached;
}
MemoryUsage u = pool.getPeakUsage();
if (u == null) u = ZEROS;
m.put(entryPeakMemoryTag,u);
return u;
}
// Should never come here.
// Log error!
log.trace("getPeakMemoryUsage", "ERROR: should never come here!");
return ZEROS;
} catch (RuntimeException x) {
log.trace("getPeakMemoryUsage",
"Failed to get MemoryUsage: " + x);
log.debug("getPeakMemoryUsage",x);
throw x;
}
}
MemoryUsage getCollectMemoryUsage() {
try {
final Map<Object, Object> m = JvmContextFactory.getUserData();
if (m != null) {
final MemoryUsage cached = (MemoryUsage)
m.get(entryCollectMemoryTag);
if (cached != null) {
if (log.isDebugOn())
log.debug("getCollectMemoryUsage",
entryCollectMemoryTag + " found in cache.");
return cached;
}
MemoryUsage u = pool.getCollectionUsage();
if (u == null) u = ZEROS;
m.put(entryCollectMemoryTag,u);
return u;
}
// Should never come here.
// Log error!
log.trace("getCollectMemoryUsage",
"ERROR: should never come here!");
return ZEROS;
} catch (RuntimeException x) {
log.trace("getPeakMemoryUsage",
"Failed to get MemoryUsage: " + x);
log.debug("getPeakMemoryUsage",x);
throw x;
}
}
final MemoryPoolMXBean pool;
/**
* Constructor for the "JvmMemPoolEntry" group.
*/
public JvmMemPoolEntryImpl(MemoryPoolMXBean mp, final int index) {
this.pool=mp;
this.jvmMemPoolIndex = index;
this.entryMemoryTag = memoryTag + "." + index;
this.entryPeakMemoryTag = peakMemoryTag + "." + index;
this.entryCollectMemoryTag = collectMemoryTag + "." + index;
}
/**
* Getter for the "JvmMemPoolMaxSize" variable.
*/
public Long getJvmMemPoolMaxSize() throws SnmpStatusException {
final long val = getMemoryUsage().getMax();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolUsed" variable.
*/
public Long getJvmMemPoolUsed() throws SnmpStatusException {
final long val = getMemoryUsage().getUsed();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolInitSize" variable.
*/
public Long getJvmMemPoolInitSize() throws SnmpStatusException {
final long val = getMemoryUsage().getInit();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolCommitted" variable.
*/
public Long getJvmMemPoolCommitted() throws SnmpStatusException {
final long val = getMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolPeakMaxSize" variable.
*/
public Long getJvmMemPoolPeakMaxSize() throws SnmpStatusException {
final long val = getPeakMemoryUsage().getMax();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolPeakUsed" variable.
*/
public Long getJvmMemPoolPeakUsed() throws SnmpStatusException {
final long val = getPeakMemoryUsage().getUsed();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolPeakCommitted" variable.
*/
public Long getJvmMemPoolPeakCommitted() throws SnmpStatusException {
final long val = getPeakMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolCollectMaxSize" variable.
*/
public Long getJvmMemPoolCollectMaxSize() throws SnmpStatusException {
final long val = getCollectMemoryUsage().getMax();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolCollectUsed" variable.
*/
public Long getJvmMemPoolCollectUsed() throws SnmpStatusException {
final long val = getCollectMemoryUsage().getUsed();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolCollectCommitted" variable.
*/
public Long getJvmMemPoolCollectCommitted() throws SnmpStatusException {
final long val = getCollectMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolThreshold" variable.
*/
public Long getJvmMemPoolThreshold() throws SnmpStatusException {
if (!pool.isUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getUsageThreshold();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Setter for the "JvmMemPoolThreshold" variable.
*/
public void setJvmMemPoolThreshold(Long x) throws SnmpStatusException {
final long val = x.longValue();
if (val < 0 )
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
// This should never throw an exception has the checks have
// already been performed in checkJvmMemPoolThreshold().
//
pool.setUsageThreshold(val);
}
/**
* Checker for the "JvmMemPoolThreshold" variable.
*/
public void checkJvmMemPoolThreshold(Long x) throws SnmpStatusException {
// if threshold is -1, it means that low memory detection is not
// supported.
if (!pool.isUsageThresholdSupported())
throw new
SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
final long val = x.longValue();
if (val < 0 )
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
/**
* Getter for the "JvmMemPoolThreshdSupport" variable.
*/
public EnumJvmMemPoolThreshdSupport getJvmMemPoolThreshdSupport()
throws SnmpStatusException {
if (pool.isUsageThresholdSupported())
return EnumJvmMemPoolThreshdSupported;
else
return EnumJvmMemPoolThreshdUnsupported;
}
/**
* Getter for the "JvmMemPoolThreshdCount" variable.
*/
public Long getJvmMemPoolThreshdCount()
throws SnmpStatusException {
if (!pool.isUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getUsageThresholdCount();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Getter for the "JvmMemPoolCollectThreshold" variable.
*/
public Long getJvmMemPoolCollectThreshold() throws SnmpStatusException {
if (!pool.isCollectionUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getCollectionUsageThreshold();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
/**
* Setter for the "JvmMemPoolCollectThreshold" variable.
*/
public void setJvmMemPoolCollectThreshold(Long x)
throws SnmpStatusException {
final long val = x.longValue();
if (val < 0 )
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
// This should never throw an exception has the checks have
// already been performed in checkJvmMemPoolCollectThreshold().
//
pool.setCollectionUsageThreshold(val);
}
/**
* Checker for the "JvmMemPoolCollectThreshold" variable.
*/
public void checkJvmMemPoolCollectThreshold(Long x)
throws SnmpStatusException {
// if threshold is -1, it means that low memory detection is not
// supported.
if (!pool.isCollectionUsageThresholdSupported())
throw new
SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
final long val = x.longValue();
if (val < 0 )
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
/**
* Getter for the "JvmMemPoolThreshdSupport" variable.
*/
public EnumJvmMemPoolCollectThreshdSupport
getJvmMemPoolCollectThreshdSupport()
throws SnmpStatusException {
if (pool.isCollectionUsageThresholdSupported())
return EnumJvmMemPoolCollectThreshdSupported;
else
return EnumJvmMemPoolCollectThreshdUnsupported;
}
/**
* Getter for the "JvmMemPoolCollectThreshdCount" variable.
*/
public Long getJvmMemPoolCollectThreshdCount()
throws SnmpStatusException {
if (!pool.isCollectionUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getCollectionUsageThresholdCount();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
public static EnumJvmMemPoolType jvmMemPoolType(MemoryType type)
throws SnmpStatusException {
if (type.equals(MemoryType.HEAP))
return EnumJvmMemPoolTypeHeap;
else if (type.equals(MemoryType.NON_HEAP))
return EnumJvmMemPoolTypeNonHeap;
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
/**
* Getter for the "JvmMemPoolType" variable.
*/
public EnumJvmMemPoolType getJvmMemPoolType() throws SnmpStatusException {
return jvmMemPoolType(pool.getType());
}
/**
* Getter for the "JvmMemPoolName" variable.
*/
public String getJvmMemPoolName() throws SnmpStatusException {
return JVM_MANAGEMENT_MIB_IMPL.validJavaObjectNameTC(pool.getName());
}
/**
* Getter for the "JvmMemPoolIndex" variable.
*/
public Integer getJvmMemPoolIndex() throws SnmpStatusException {
return new Integer(jvmMemPoolIndex);
}
/**
* Getter for the "JvmMemPoolState" variable.
*/
public EnumJvmMemPoolState getJvmMemPoolState()
throws SnmpStatusException {
if (pool.isValid())
return JvmMemPoolStateValid;
else
return JvmMemPoolStateInvalid;
}
/**
* Getter for the "JvmMemPoolPeakReset" variable.
*/
public synchronized Long getJvmMemPoolPeakReset()
throws SnmpStatusException {
return new Long(jvmMemPoolPeakReset);
}
/**
* Setter for the "JvmMemPoolPeakReset" variable.
*/
public synchronized void setJvmMemPoolPeakReset(Long x)
throws SnmpStatusException {
final long l = x.longValue();
if (l > jvmMemPoolPeakReset) {
final long stamp = System.currentTimeMillis();
pool.resetPeakUsage();
jvmMemPoolPeakReset = stamp;
log.debug("setJvmMemPoolPeakReset",
"jvmMemPoolPeakReset="+stamp);
}
}
/**
* Checker for the "JvmMemPoolPeakReset" variable.
*/
public void checkJvmMemPoolPeakReset(Long x) throws SnmpStatusException {
}
/* Last time peak usage was reset */
private long jvmMemPoolPeakReset = 0;
private final static EnumJvmMemPoolState JvmMemPoolStateValid =
new EnumJvmMemPoolState("valid");
private final static EnumJvmMemPoolState JvmMemPoolStateInvalid =
new EnumJvmMemPoolState("invalid");
private static final EnumJvmMemPoolType EnumJvmMemPoolTypeHeap =
new EnumJvmMemPoolType("heap");
private static final EnumJvmMemPoolType EnumJvmMemPoolTypeNonHeap =
new EnumJvmMemPoolType("nonheap");
private static final EnumJvmMemPoolThreshdSupport
EnumJvmMemPoolThreshdSupported =
new EnumJvmMemPoolThreshdSupport("supported");
private static final EnumJvmMemPoolThreshdSupport
EnumJvmMemPoolThreshdUnsupported =
new EnumJvmMemPoolThreshdSupport("unsupported");
private static final EnumJvmMemPoolCollectThreshdSupport
EnumJvmMemPoolCollectThreshdSupported =
new EnumJvmMemPoolCollectThreshdSupport("supported");
private static final EnumJvmMemPoolCollectThreshdSupport
EnumJvmMemPoolCollectThreshdUnsupported=
new EnumJvmMemPoolCollectThreshdSupport("unsupported");
static final MibLogger log = new MibLogger(JvmMemPoolEntryImpl.class);
}

View File

@@ -0,0 +1,311 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.ManagementFactory;
import sun.management.snmp.jvmmib.JvmMemPoolTableMeta;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpNamedListTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemPoolTable" group.
*/
public class JvmMemPoolTableMetaImpl extends JvmMemPoolTableMeta {
static final long serialVersionUID = -2525820976094284957L;
/**
* A concrete implementation of {@link SnmpNamedListTableCache}, for the
* jvmMemPoolTable.
**/
private static class JvmMemPoolTableCache extends SnmpNamedListTableCache {
static final long serialVersionUID = -1755520683086760574L;
/**
* Create a weak cache for the jvmMemPoolTable.
* @param validity validity of the cached data, in ms.
**/
JvmMemPoolTableCache(long validity) {
this.validity = validity;
}
/**
* Use the MemoryPoolMXBean name as key.
* @param context A {@link TreeMap} as allocated by the parent
* {@link SnmpNamedListTableCache} class.
* @param rawDatas List of {@link MemoryPoolMXBean}, as
* returned by
* <code>ManagementFactory.getMemoryPoolMXBeans()</code>
* @param rank The <var>rank</var> of <var>item</var> in the list.
* @param item The <var>rank</var><super>th</super>
* <code>MemoryPoolMXBean</code> in the list.
* @return <code>((MemoryPoolMXBean)item).getName()</code>
**/
protected String getKey(Object context, List<?> rawDatas,
int rank, Object item) {
if (item == null) return null;
final String name = ((MemoryPoolMXBean)item).getName();
log.debug("getKey", "key=" + name);
return name;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return the key used to cache the raw data of this table.
**/
protected String getRawDatasKey() {
return "JvmMemManagerTable.getMemoryPools";
}
/**
* Call ManagementFactory.getMemoryPoolMXBeans() to
* load the raw data of this table.
**/
protected List<MemoryPoolMXBean> loadRawDatas(Map<Object, Object> userData) {
return ManagementFactory.getMemoryPoolMXBeans();
}
}
// The weak cache for this table.
protected SnmpTableCache cache;
/**
* Constructor for the table.
* Initialize metadata for "JvmMemPoolTableMeta".
*/
public JvmMemPoolTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib,objserv);
this.cache = new
JvmMemPoolTableCache(((JVM_MANAGEMENT_MIB_IMPL)myMib).
validity()*30);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
try {
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new
SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new
SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
} catch (SnmpStatusException x) {
if (dbg) log.debug("getNextOid", "End of MIB View: " + x);
throw x;
} catch (RuntimeException r) {
if (dbg) log.debug("getNextOid", "Unexpected exception: " + r);
if (dbg) log.debug("getNextOid",r);
throw r;
}
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
if (oid == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = Util.cast(JvmContextFactory.getUserData());
// We know in the case of this table that the index is an integer,
// it is thus the first OID arc of the index OID.
//
final long index = oid.getOidArc(0);
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:("JvmMemPoolTable.entry." +
index));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) return entry;
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
if (log.isDebugOn())
log.debug("getEntry","data is a: " + data.getClass().getName());
final Object entry =
new JvmMemPoolEntryImpl((MemoryPoolMXBean)data,(int)index);
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmMemPoolTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m = Util.cast(userData);
else m = null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmMemPoolTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmMemPoolTable.handler",handler);
return handler;
}
static final MibLogger log = new MibLogger(JvmMemPoolTableMetaImpl.class);
}

View File

@@ -0,0 +1,391 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpStatusException;
import com.sun.jmx.snmp.SnmpDefinitions;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import java.util.Map;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
import java.lang.management.MemoryType;
import java.lang.management.MemoryMXBean;
import javax.management.openmbean.CompositeData;
import sun.management.snmp.jvmmib.JvmMemoryMBean;
import sun.management.snmp.jvmmib.EnumJvmMemoryGCCall;
import sun.management.snmp.jvmmib.EnumJvmMemoryGCVerboseLevel;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmMemory" group.
*/
public class JvmMemoryImpl implements JvmMemoryMBean {
/**
* Variable for storing the value of "JvmMemoryGCCall".
*
* "This object makes it possible to remotelly trigger the
* Garbage Collector in the JVM.
*
* This object's syntax is an enumeration which defines:
*
* * Two state values, that can be returned from a GET request:
*
* unsupported(1): means that remote invocation of gc() is not
* supported by the SNMP agent.
* supported(2) : means that remote invocation of gc() is supported
* by the SNMP agent.
*
* * One action value, that can be provided in a SET request to
* trigger the garbage collector:
*
* start(3) : means that a manager wishes to trigger
* garbage collection.
*
* * Two result value, that will be returned as a result of a
* SET request when remote invocation of gc is supported
* by the SNMP agent:
*
* started(4) : means that garbage collection was
* successfully triggered. It does not mean
* however that the action was successfullly
* completed: gc might still be running when
* this value is returned.
* failed(5) : means that garbage collection couldn't be
* triggered.
*
* * If remote invocation is not supported by the SNMP agent, then
* unsupported(1) will always be returned as a result of either
* a GET request, or a SET request with start(3) as input value.
*
* * If a SET request with anything but start(3) is received, then
* the agent will return a wrongValue error.
*
* See java.management.MemoryMXBean.gc()
* "
*
*/
final static EnumJvmMemoryGCCall JvmMemoryGCCallSupported
= new EnumJvmMemoryGCCall("supported");
final static EnumJvmMemoryGCCall JvmMemoryGCCallStart
= new EnumJvmMemoryGCCall("start");
final static EnumJvmMemoryGCCall JvmMemoryGCCallFailed
= new EnumJvmMemoryGCCall("failed");
final static EnumJvmMemoryGCCall JvmMemoryGCCallStarted
= new EnumJvmMemoryGCCall("started");
/**
* Variable for storing the value of "JvmMemoryGCVerboseLevel".
*
* "State of the -verbose:gc state.
*
* verbose: if the -verbose:gc flag is on,
* silent: otherwise.
*
* See java.management.MemoryMXBean.isVerbose(),
* java.management.MemoryMXBean.setVerbose()
* "
*
*/
final static EnumJvmMemoryGCVerboseLevel JvmMemoryGCVerboseLevelVerbose =
new EnumJvmMemoryGCVerboseLevel("verbose");
final static EnumJvmMemoryGCVerboseLevel JvmMemoryGCVerboseLevelSilent =
new EnumJvmMemoryGCVerboseLevel("silent");
/**
* Constructor for the "JvmMemory" group.
* If the group contains a table, the entries created through an
* SNMP SET will not be registered in Java DMK.
*/
public JvmMemoryImpl(SnmpMib myMib) {
}
/**
* Constructor for the "JvmMemory" group.
* If the group contains a table, the entries created through an
* SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmMemoryImpl(SnmpMib myMib, MBeanServer server) {
// no entry will be registered since the table is virtual.
}
final static String heapMemoryTag = "jvmMemory.getHeapMemoryUsage";
final static String nonHeapMemoryTag = "jvmMemory.getNonHeapMemoryUsage";
private MemoryUsage getMemoryUsage(MemoryType type) {
if (type == MemoryType.HEAP) {
return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
} else {
return ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
}
}
MemoryUsage getNonHeapMemoryUsage() {
try {
final Map<Object, Object> m = JvmContextFactory.getUserData();
if (m != null) {
final MemoryUsage cached = (MemoryUsage)
m.get(nonHeapMemoryTag);
if (cached != null) {
log.debug("getNonHeapMemoryUsage",
"jvmMemory.getNonHeapMemoryUsage found in cache.");
return cached;
}
final MemoryUsage u = getMemoryUsage(MemoryType.NON_HEAP);
// getNonHeapMemoryUsage() never returns null.
//
// if (u == null) u=MemoryUsage.INVALID;
m.put(nonHeapMemoryTag,u);
return u;
}
// Should never come here.
// Log error!
log.trace("getNonHeapMemoryUsage",
"ERROR: should never come here!");
return getMemoryUsage(MemoryType.NON_HEAP);
} catch (RuntimeException x) {
log.trace("getNonHeapMemoryUsage",
"Failed to get NonHeapMemoryUsage: " + x);
log.debug("getNonHeapMemoryUsage",x);
throw x;
}
}
MemoryUsage getHeapMemoryUsage() {
try {
final Map<Object, Object> m = JvmContextFactory.getUserData();
if (m != null) {
final MemoryUsage cached = (MemoryUsage)m.get(heapMemoryTag);
if (cached != null) {
log.debug("getHeapMemoryUsage",
"jvmMemory.getHeapMemoryUsage found in cache.");
return cached;
}
final MemoryUsage u = getMemoryUsage(MemoryType.HEAP);
// getHeapMemoryUsage() never returns null.
//
// if (u == null) u=MemoryUsage.INVALID;
m.put(heapMemoryTag,u);
return u;
}
// Should never come here.
// Log error!
log.trace("getHeapMemoryUsage", "ERROR: should never come here!");
return getMemoryUsage(MemoryType.HEAP);
} catch (RuntimeException x) {
log.trace("getHeapMemoryUsage",
"Failed to get HeapMemoryUsage: " + x);
log.debug("getHeapMemoryUsage",x);
throw x;
}
}
static final Long Long0 = new Long(0);
/**
* Getter for the "JvmMemoryNonHeapMaxSize" variable.
*/
public Long getJvmMemoryNonHeapMaxSize()
throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getMax();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryNonHeapCommitted" variable.
*/
public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryNonHeapUsed" variable.
*/
public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getUsed();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryNonHeapInitSize" variable.
*/
public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException {
final long val = getNonHeapMemoryUsage().getInit();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryHeapMaxSize" variable.
*/
public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getMax();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryGCCall" variable.
*/
public EnumJvmMemoryGCCall getJvmMemoryGCCall()
throws SnmpStatusException {
final Map<Object,Object> m = JvmContextFactory.getUserData();
if (m != null) {
final EnumJvmMemoryGCCall cached
= (EnumJvmMemoryGCCall) m.get("jvmMemory.getJvmMemoryGCCall");
if (cached != null) return cached;
}
return JvmMemoryGCCallSupported;
}
/**
* Setter for the "JvmMemoryGCCall" variable.
*/
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x)
throws SnmpStatusException {
if (x.intValue() == JvmMemoryGCCallStart.intValue()) {
final Map<Object, Object> m = JvmContextFactory.getUserData();
try {
ManagementFactory.getMemoryMXBean().gc();
if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
JvmMemoryGCCallStarted);
} catch (Exception ex) {
if (m != null) m.put("jvmMemory.getJvmMemoryGCCall",
JvmMemoryGCCallFailed);
}
return;
}
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
/**
* Checker for the "JvmMemoryGCCall" variable.
*/
public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x)
throws SnmpStatusException {
if (x.intValue() != JvmMemoryGCCallStart.intValue())
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
/**
* Getter for the "JvmMemoryHeapCommitted" variable.
*/
public Long getJvmMemoryHeapCommitted() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getCommitted();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryGCVerboseLevel" variable.
*/
public EnumJvmMemoryGCVerboseLevel getJvmMemoryGCVerboseLevel()
throws SnmpStatusException {
if (ManagementFactory.getMemoryMXBean().isVerbose())
return JvmMemoryGCVerboseLevelVerbose;
else
return JvmMemoryGCVerboseLevelSilent;
}
/**
* Setter for the "JvmMemoryGCVerboseLevel" variable.
*/
public void setJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
throws SnmpStatusException {
if (JvmMemoryGCVerboseLevelVerbose.intValue() == x.intValue())
ManagementFactory.getMemoryMXBean().setVerbose(true);
else
ManagementFactory.getMemoryMXBean().setVerbose(false);
}
/**
* Checker for the "JvmMemoryGCVerboseLevel" variable.
*/
public void checkJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
throws SnmpStatusException {
// Nothing to check...
}
/**
* Getter for the "JvmMemoryHeapUsed" variable.
*/
public Long getJvmMemoryHeapUsed() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getUsed();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryHeapInitSize" variable.
*/
public Long getJvmMemoryHeapInitSize() throws SnmpStatusException {
final long val = getHeapMemoryUsage().getInit();
if (val > -1) return new Long(val);
else return Long0;
}
/**
* Getter for the "JvmMemoryPendingFinalCount" variable.
*/
public Long getJvmMemoryPendingFinalCount()
throws SnmpStatusException {
final long val = ManagementFactory.getMemoryMXBean().
getObjectPendingFinalizationCount();
if (val > -1) return new Long((int)val);
// Should never happen... but stay safe all the same.
//
else return new Long(0);
}
static final MibLogger log = new MibLogger(JvmMemoryImpl.class);
}

View File

@@ -0,0 +1,151 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import sun.management.snmp.jvmmib.JvmMemoryMeta;
import sun.management.snmp.jvmmib.JvmMemManagerTableMeta;
import sun.management.snmp.jvmmib.JvmMemGCTableMeta;
import sun.management.snmp.jvmmib.JvmMemPoolTableMeta;
import sun.management.snmp.jvmmib.JvmMemMgrPoolRelTableMeta;
import sun.management.snmp.util.MibLogger;
/**
* The class is used for representing SNMP metadata for the "JvmMemory" group.
*/
public class JvmMemoryMetaImpl extends JvmMemoryMeta {
static final long serialVersionUID = -6500448253825893071L;
/**
* Constructor for the metadata associated to "JvmMemory".
*/
public JvmMemoryMetaImpl(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib,objserv);
}
/**
* Factory method for "JvmMemManagerTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemManagerTable")
* @param groupName Name of the group to which this table belong
* ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemManagerTable" table (JvmMemManagerTableMeta)
*
**/
protected JvmMemManagerTableMeta createJvmMemManagerTableMetaNode(
String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmMemManagerTableMetaImpl(mib, objectserver);
}
/**
* Factory method for "JvmMemGCTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemGCTable")
* @param groupName Name of the group to which this table belong
* ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemGCTable" table (JvmMemGCTableMeta)
*
**/
protected JvmMemGCTableMeta createJvmMemGCTableMetaNode(String tableName,
String groupName, SnmpMib mib, MBeanServer server) {
return new JvmMemGCTableMetaImpl(mib, objectserver);
}
/**
* Factory method for "JvmMemPoolTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemPoolTable")
* @param groupName Name of the group to which this table belong
* ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemPoolTable" table (JvmMemPoolTableMeta)
*
**/
protected JvmMemPoolTableMeta
createJvmMemPoolTableMetaNode(String tableName, String groupName,
SnmpMib mib, MBeanServer server) {
return new JvmMemPoolTableMetaImpl(mib, objectserver);
}
/**
* Factory method for "JvmMemMgrPoolRelTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemMgrPoolRelTable")
* @param groupName Name of the group to which this table belong
* ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemMgrPoolRelTable" table (JvmMemMgrPoolRelTableMeta)
*
**/
protected JvmMemMgrPoolRelTableMeta
createJvmMemMgrPoolRelTableMetaNode(String tableName,
String groupName,
SnmpMib mib, MBeanServer server) {
return new JvmMemMgrPoolRelTableMetaImpl(mib, objectserver);
}
}

View File

@@ -0,0 +1,110 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmOSMBean;
/**
* The class is used for implementing the "JvmOS" group.
*/
public class JvmOSImpl implements JvmOSMBean, Serializable {
static final long serialVersionUID = 1839834731763310809L;
/**
* Constructor for the "JvmOS" group.
* If the group contains a table, the entries created through an
* SNMP SET will not be registered in Java DMK.
*/
public JvmOSImpl(SnmpMib myMib) {
}
/**
* Constructor for the "JvmOS" group.
* If the group contains a table, the entries created through an
* SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmOSImpl(SnmpMib myMib, MBeanServer server) {
}
static OperatingSystemMXBean getOSMBean() {
return ManagementFactory.getOperatingSystemMXBean();
}
private static String validDisplayStringTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validDisplayStringTC(str);
}
private static String validJavaObjectNameTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validJavaObjectNameTC(str);
}
/**
* Getter for the "JvmRTProcessorCount" variable.
*/
public Integer getJvmOSProcessorCount() throws SnmpStatusException {
return new Integer(getOSMBean().getAvailableProcessors());
}
/**
* Getter for the "JvmOSVersion" variable.
*/
public String getJvmOSVersion() throws SnmpStatusException {
return validDisplayStringTC(getOSMBean().getVersion());
}
/**
* Getter for the "JvmOSArch" variable.
*/
public String getJvmOSArch() throws SnmpStatusException {
return validDisplayStringTC(getOSMBean().getArch());
}
/**
* Getter for the "JvmOSName" variable.
*/
public String getJvmOSName() throws SnmpStatusException {
return validJavaObjectNameTC(getOSMBean().getName());
}
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmRTBootClassPathEntryMBean;
/**
* The class is used for implementing the "JvmRTBootClassPathEntry" group.
*/
public class JvmRTBootClassPathEntryImpl
implements JvmRTBootClassPathEntryMBean, Serializable {
static final long serialVersionUID = -2282652055235913013L;
private final String item;
private final int index;
/**
* Constructor for the "JvmRTBootClassPathEntry" group.
*/
public JvmRTBootClassPathEntryImpl(String item, int index) {
this.item = validPathElementTC(item);
this.index = index;
}
private String validPathElementTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validPathElementTC(str);
}
/**
* Getter for the "JvmRTBootClassPathItem" variable.
*/
public String getJvmRTBootClassPathItem() throws SnmpStatusException {
return item;
}
/**
* Getter for the "JvmRTBootClassPathIndex" variable.
*/
public Integer getJvmRTBootClassPathIndex() throws SnmpStatusException {
return new Integer(index);
}
}

View File

@@ -0,0 +1,303 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.util.List;
import java.util.Map;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import sun.management.snmp.jvmmib.JvmRTBootClassPathTableMeta;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmRTBootClassPathTable".
*/
public class JvmRTBootClassPathTableMetaImpl
extends JvmRTBootClassPathTableMeta {
static final long serialVersionUID = -8659886610487538299L;
private SnmpTableCache cache;
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* JvmRTBootClassPathTable.
**/
private static class JvmRTBootClassPathTableCache extends SnmpTableCache {
static final long serialVersionUID = -2637458695413646098L;
private JvmRTBootClassPathTableMetaImpl meta;
JvmRTBootClassPathTableCache(JvmRTBootClassPathTableMetaImpl meta,
long validity) {
this.meta = meta;
this.validity = validity;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return a table handler containing the Thread indexes.
* Indexes are computed from the ThreadId.
**/
protected SnmpCachedData updateCachedDatas(Object userData) {
// We are getting all the input args
final String[] path =
JvmRuntimeImpl.getBootClassPath(userData);
// Time stamp for the cache
final long time = System.currentTimeMillis();
final int len = path.length;
SnmpOid indexes[] = new SnmpOid[len];
for(int i = 0; i < len; i++) {
indexes[i] = new SnmpOid(i + 1);
}
return new SnmpCachedData(time, indexes, path);
}
}
/**
* Constructor for the table. Initialize metadata for
* "JvmRTBootClassPathTableMeta".
* The reference on the MBean server is updated so the entries
* created through an SNMP SET will be AUTOMATICALLY REGISTERED
* in Java DMK.
*/
public JvmRTBootClassPathTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
cache = new JvmRTBootClassPathTableCache(this, -1);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getEntry", "oid [" + oid + "]");
if (oid == null || oid.getLength() != 1) {
if (dbg) log.debug("getEntry", "Invalid oid [" + oid + "]");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:
("JvmRTBootClassPathTable.entry." +
oid.toString()));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) {
if (dbg)
log.debug("getEntry", "Entry is already in the cache");
return entry;
} else
if (dbg) log.debug("getEntry", "Entry is not in the cache");
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
if (dbg)
log.debug("getEntry","data is a: " + data.getClass().getName());
final Object entry =
new JvmRTBootClassPathEntryImpl((String) data,
(int) oid.getOidArc(0));
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmThreadInstanceTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmRTBootClassPathTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmRTBootClassPathTable.handler",handler);
return handler;
}
static final MibLogger log =
new MibLogger(JvmRTBootClassPathTableMetaImpl.class);
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmRTClassPathEntryMBean;
/**
* The class is used for implementing the "JvmRTClassPathEntry" group.
*/
public class JvmRTClassPathEntryImpl implements JvmRTClassPathEntryMBean,
Serializable {
static final long serialVersionUID = 8524792845083365742L;
private final String item;
private final int index;
/**
* Constructor for the "JvmRTClassPathEntry" group.
*/
public JvmRTClassPathEntryImpl(String item, int index) {
this.item = validPathElementTC(item);
this.index = index;
}
private String validPathElementTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validPathElementTC(str);
}
/**
* Getter for the "JvmRTClassPathItem" variable.
*/
public String getJvmRTClassPathItem() throws SnmpStatusException {
return item;
}
/**
* Getter for the "JvmRTClassPathIndex" variable.
*/
public Integer getJvmRTClassPathIndex() throws SnmpStatusException {
return new Integer(index);
}
}

View File

@@ -0,0 +1,301 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.util.List;
import java.util.Map;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import sun.management.snmp.jvmmib.JvmRTClassPathTableMeta;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmRTClassPathTable".
*/
public class JvmRTClassPathTableMetaImpl extends JvmRTClassPathTableMeta {
static final long serialVersionUID = -6914494148818455166L;
private SnmpTableCache cache;
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* JvmRTClassPathTable.
**/
private static class JvmRTClassPathTableCache extends SnmpTableCache {
static final long serialVersionUID = 3805032372592117315L;
private JvmRTClassPathTableMetaImpl meta;
JvmRTClassPathTableCache(JvmRTClassPathTableMetaImpl meta,
long validity) {
this.meta = meta;
this.validity = validity;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return a table handler containing the Thread indexes.
* Indexes are computed from the ThreadId.
**/
protected SnmpCachedData updateCachedDatas(Object userData) {
// We are getting all the input args
final String[] path =
JvmRuntimeImpl.getClassPath(userData);
// Time stamp for the cache
final long time = System.currentTimeMillis();
final int len = path.length;
SnmpOid indexes[] = new SnmpOid[len];
for(int i = 0; i < len; i++) {
indexes[i] = new SnmpOid(i + 1);
}
return new SnmpCachedData(time, indexes, path);
}
}
/**
* Constructor for the table. Initialize metadata for
* "JvmRTClassPathTableMeta".
* The reference on the MBean server is updated so the entries
* created through an SNMP SET will be AUTOMATICALLY REGISTERED
* in Java DMK.
*/
public JvmRTClassPathTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
cache = new JvmRTClassPathTableCache(this, -1);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getEntry", "oid [" + oid + "]");
if (oid == null || oid.getLength() != 1) {
if (dbg) log.debug("getEntry", "Invalid oid [" + oid + "]");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:
("JvmRTClassPathTable.entry." +
oid.toString()));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) {
if (dbg)
log.debug("getEntry", "Entry is already in the cache");
return entry;
} else
if (dbg) log.debug("getEntry", "Entry is not in the cache");
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
if (dbg)
log.debug("getEntry","data is a: " + data.getClass().getName());
final Object entry =
new JvmRTClassPathEntryImpl((String) data, (int) oid.getOidArc(0));
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmThreadInstanceTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmRTClassPathTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmRTClassPathTable.handler",handler);
return handler;
}
static final MibLogger log =
new MibLogger(JvmRTClassPathTableMetaImpl.class);
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmRTInputArgsEntryMBean;
/**
* The class is used for implementing the "JvmRTInputArgsEntry" group.
*/
public class JvmRTInputArgsEntryImpl implements JvmRTInputArgsEntryMBean,
Serializable {
static final long serialVersionUID = 1000306518436503395L;
private final String item;
private final int index;
/**
* Constructor for the "JvmRTInputArgsEntry" group.
*/
public JvmRTInputArgsEntryImpl(String item, int index) {
this.item = validArgValueTC(item);
this.index = index;
}
private String validArgValueTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validArgValueTC(str);
}
/**
* Getter for the "JvmRTInputArgsItem" variable.
*/
public String getJvmRTInputArgsItem() throws SnmpStatusException {
return item;
}
/**
* Getter for the "JvmRTInputArgsIndex" variable.
*/
public Integer getJvmRTInputArgsIndex() throws SnmpStatusException {
return new Integer(index);
}
}

View File

@@ -0,0 +1,297 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.util.List;
import java.util.Map;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import sun.management.snmp.jvmmib.JvmRTInputArgsTableMeta;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmRTInputArgsTable" group.
*/
public class JvmRTInputArgsTableMetaImpl extends JvmRTInputArgsTableMeta {
static final long serialVersionUID = -2083438094888099238L;
private SnmpTableCache cache;
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* JvmRTInputArgsTable.
**/
private static class JvmRTInputArgsTableCache extends SnmpTableCache {
static final long serialVersionUID = 1693751105464785192L;
private JvmRTInputArgsTableMetaImpl meta;
JvmRTInputArgsTableCache(JvmRTInputArgsTableMetaImpl meta,
long validity) {
this.meta = meta;
this.validity = validity;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return a table handler containing the Thread indexes.
* Indexes are computed from the ThreadId.
**/
protected SnmpCachedData updateCachedDatas(Object userData) {
// We are getting all the input args
final String[] args = JvmRuntimeImpl.getInputArguments(userData);
// Time stamp for the cache
final long time = System.currentTimeMillis();
SnmpOid indexes[] = new SnmpOid[args.length];
for(int i = 0; i < args.length; i++) {
indexes[i] = new SnmpOid(i + 1);
}
return new SnmpCachedData(time, indexes, args);
}
}
/**
* Constructor for the table. Initialize metadata for
* "JvmRTInputArgsTableMeta".
* The reference on the MBean server is updated so the entries
* created through an SNMP SET will be AUTOMATICALLY REGISTERED
* in Java DMK.
*/
public JvmRTInputArgsTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
cache = new JvmRTInputArgsTableCache(this, -1);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getEntry", "oid [" + oid + "]");
if (oid == null || oid.getLength() != 1) {
if (dbg) log.debug("getEntry", "Invalid oid [" + oid + "]");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:
("JvmRTInputArgsTable.entry." +
oid.toString()));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) {
if (dbg)
log.debug("getEntry", "Entry is already in the cache");
return entry;
} else if (dbg) log.debug("getEntry", "Entry is not in the cache");
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
if (dbg) log.debug("getEntry","data is a: " +
data.getClass().getName());
final Object entry =
new JvmRTInputArgsEntryImpl((String) data, (int) oid.getOidArc(0));
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmThreadInstanceTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmRTInputArgsTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmRTInputArgsTable.handler",handler);
return handler;
}
static final MibLogger log =
new MibLogger(JvmRTInputArgsTableMetaImpl.class);
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmRTLibraryPathEntryMBean;
/**
* The class is used for implementing the "JvmRTLibraryPathEntry" group.
*/
public class JvmRTLibraryPathEntryImpl implements JvmRTLibraryPathEntryMBean,
Serializable {
static final long serialVersionUID = -3322438153507369765L;
private final String item;
private final int index;
/**
* Constructor for the "JvmRTLibraryPathEntry" group.
*/
public JvmRTLibraryPathEntryImpl(String item, int index) {
this.item = validPathElementTC(item);
this.index = index;
}
private String validPathElementTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validPathElementTC(str);
}
/**
* Getter for the "JvmRTLibraryPathItem" variable.
*/
public String getJvmRTLibraryPathItem() throws SnmpStatusException {
return item;
}
/**
* Getter for the "JvmRTLibraryPathIndex" variable.
*/
public Integer getJvmRTLibraryPathIndex() throws SnmpStatusException {
return new Integer(index);
}
}

View File

@@ -0,0 +1,300 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.util.List;
import java.util.Map;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import sun.management.snmp.jvmmib.JvmRTLibraryPathTableMeta;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmRTLibraryPathTable".
*/
public class JvmRTLibraryPathTableMetaImpl extends JvmRTLibraryPathTableMeta {
static final long serialVersionUID = 6713252710712502068L;
private SnmpTableCache cache;
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* JvmRTLibraryPathTable.
**/
private static class JvmRTLibraryPathTableCache extends SnmpTableCache {
static final long serialVersionUID = 2035304445719393195L;
private JvmRTLibraryPathTableMetaImpl meta;
JvmRTLibraryPathTableCache(JvmRTLibraryPathTableMetaImpl meta,
long validity) {
this.meta = meta;
this.validity = validity;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object,Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return a table handler containing the Thread indexes.
* Indexes are computed from the ThreadId.
**/
protected SnmpCachedData updateCachedDatas(Object userData) {
// We are getting all the input args
final String[] path =
JvmRuntimeImpl.getLibraryPath(userData);
// Time stamp for the cache
final long time = System.currentTimeMillis();
final int len = path.length;
SnmpOid indexes[] = new SnmpOid[len];
for(int i = 0; i < len; i++) {
indexes[i] = new SnmpOid(i + 1);
}
return new SnmpCachedData(time, indexes, path);
}
}
/**
* Constructor for the table. Initialize metadata for
* "JvmRTLibraryPathTableMeta".
* The reference on the MBean server is updated so the entries
* created through an SNMP SET will be AUTOMATICALLY REGISTERED
* in Java DMK.
*/
public JvmRTLibraryPathTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
cache = new JvmRTLibraryPathTableCache(this, -1);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
if (dbg) log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
final SnmpOid next = handler.getNext(oid);
if (dbg) log.debug("*** **** **** **** getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
return handler.contains(oid);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
final boolean dbg = log.isDebugOn();
if (dbg) log.debug("getEntry", "oid [" + oid + "]");
if (oid == null || oid.getLength() != 1) {
if (dbg) log.debug("getEntry", "Invalid oid [" + oid + "]");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the request contextual cache (userData).
//
final Map<Object, Object> m = JvmContextFactory.getUserData();
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
final String entryTag = ((m==null)?null:
("JvmRTLibraryPathTable.entry." +
oid.toString()));
// If the entry is in the cache, simply return it.
//
if (m != null) {
final Object entry = m.get(entryTag);
if (entry != null) {
if (dbg)
log.debug("getEntry", "Entry is already in the cache");
return entry;
} else if (dbg) log.debug("getEntry", "Entry is not in the cache");
}
// The entry was not in the cache, make a new one.
//
// Get the data hanler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// Get the data associated with our entry.
//
final Object data = handler.getData(oid);
// data may be null if the OID we were given is not valid.
//
if (data == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
// make the new entry (transient object that will be kept only
// for the duration of the request.
//
if (dbg) log.debug("getEntry","data is a: "+
data.getClass().getName());
final Object entry =
new JvmRTLibraryPathEntryImpl((String) data,(int)oid.getOidArc(0));
// Put the entry in the cache in case we need it later while processing
// the request.
//
if (m != null && entry != null) {
m.put(entryTag,entry);
}
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmThreadInstanceTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmRTLibraryPathTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmRTLibraryPathTable.handler",handler);
return handler;
}
static final MibLogger log =
new MibLogger(JvmRTLibraryPathTableMetaImpl.class);
}

View File

@@ -0,0 +1,286 @@
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.lang.management.RuntimeMXBean;
import java.lang.management.ManagementFactory;
import java.util.List;
import java.util.Map;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import sun.management.snmp.jvmmib.JvmRuntimeMBean;
import sun.management.snmp.jvmmib.EnumJvmRTBootClassPathSupport;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmRuntime" group.
*/
public class JvmRuntimeImpl implements JvmRuntimeMBean {
/**
* Variable for storing the value of "JvmRTBootClassPathSupport".
*
* "Indicates whether the Java virtual machine supports the
* boot class path mechanism used by the system class loader
* to search for class files.
*
* See java.management.RuntimeMXBean.isBootClassPathSupported()
* "
*
*/
static final EnumJvmRTBootClassPathSupport
JvmRTBootClassPathSupportSupported =
new EnumJvmRTBootClassPathSupport("supported");
static final EnumJvmRTBootClassPathSupport
JvmRTBootClassPathSupportUnSupported =
new EnumJvmRTBootClassPathSupport("unsupported");
/**
* Constructor for the "JvmRuntime" group.
* If the group contains a table, the entries created through an SNMP SET
* will not be registered in Java DMK.
*/
public JvmRuntimeImpl(SnmpMib myMib) {
}
/**
* Constructor for the "JvmRuntime" group.
* If the group contains a table, the entries created through an SNMP SET
* will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmRuntimeImpl(SnmpMib myMib, MBeanServer server) {
}
static RuntimeMXBean getRuntimeMXBean() {
return ManagementFactory.getRuntimeMXBean();
}
private static String validDisplayStringTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validDisplayStringTC(str);
}
private static String validPathElementTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validPathElementTC(str);
}
private static String validJavaObjectNameTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validJavaObjectNameTC(str);
}
static String[] splitPath(String path) {
final String[] items = path.split(java.io.File.pathSeparator);
// for (int i=0;i<items.length;i++) {
// items[i]=validPathElementTC(items[i]);
// }
return items;
}
static String[] getClassPath(Object userData) {
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getClassPath";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final String[] args = splitPath(getRuntimeMXBean().getClassPath());
if (m != null) m.put(tag,args);
return args;
}
static String[] getBootClassPath(Object userData) {
if (!getRuntimeMXBean().isBootClassPathSupported())
return new String[0];
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getBootClassPath";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final String[] args = splitPath(getRuntimeMXBean().getBootClassPath());
if (m != null) m.put(tag,args);
return args;
}
static String[] getLibraryPath(Object userData) {
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getLibraryPath";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final String[] args = splitPath(getRuntimeMXBean().getLibraryPath());
if (m != null) m.put(tag,args);
return args;
}
static String[] getInputArguments(Object userData) {
final Map<Object, Object> m =
Util.cast((userData instanceof Map)?userData:null);
final String tag = "JvmRuntime.getInputArguments";
// If the list is in the cache, simply return it.
//
if (m != null) {
final String[] cached = (String[])m.get(tag);
if (cached != null) return cached;
}
final List<String> l = getRuntimeMXBean().getInputArguments();
final String[] args = l.toArray(new String[0]);
if (m != null) m.put(tag,args);
return args;
}
/**
* Getter for the "JvmRTSpecVendor" variable.
*/
public String getJvmRTSpecVendor() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().getSpecVendor());
}
/**
* Getter for the "JvmRTSpecName" variable.
*/
public String getJvmRTSpecName() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().getSpecName());
}
/**
* Getter for the "JvmRTVersion" variable.
*/
public String getJvmRTVMVersion() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().getVmVersion());
}
/**
* Getter for the "JvmRTVendor" variable.
*/
public String getJvmRTVMVendor() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().getVmVendor());
}
/**
* Getter for the "JvmRTManagementSpecVersion" variable.
*/
public String getJvmRTManagementSpecVersion() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().
getManagementSpecVersion());
}
/**
* Getter for the "JvmRTVMName" variable.
*/
public String getJvmRTVMName() throws SnmpStatusException {
return validJavaObjectNameTC(getRuntimeMXBean().getVmName());
}
/**
* Getter for the "JvmRTInputArgsCount" variable.
*/
public Integer getJvmRTInputArgsCount() throws SnmpStatusException {
final String[] args = getInputArguments(JvmContextFactory.
getUserData());
return new Integer(args.length);
}
/**
* Getter for the "JvmRTBootClassPathSupport" variable.
*/
public EnumJvmRTBootClassPathSupport getJvmRTBootClassPathSupport()
throws SnmpStatusException {
if(getRuntimeMXBean().isBootClassPathSupported())
return JvmRTBootClassPathSupportSupported;
else
return JvmRTBootClassPathSupportUnSupported;
}
/**
* Getter for the "JvmRTUptimeMs" variable.
*/
public Long getJvmRTUptimeMs() throws SnmpStatusException {
return new Long(getRuntimeMXBean().getUptime());
}
/**
* Getter for the "JvmRTStartTimeMs" variable.
*/
public Long getJvmRTStartTimeMs() throws SnmpStatusException {
return new Long(getRuntimeMXBean().getStartTime());
}
/**
* Getter for the "JvmRTSpecVersion" variable.
*/
public String getJvmRTSpecVersion() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().getSpecVersion());
}
/**
* Getter for the "JvmRTName" variable.
*/
public String getJvmRTName() throws SnmpStatusException {
return validDisplayStringTC(getRuntimeMXBean().getName());
}
}

View File

@@ -0,0 +1,175 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import sun.management.snmp.jvmmib.JvmRuntimeMeta;
import sun.management.snmp.jvmmib.JvmRTInputArgsTableMeta;
import sun.management.snmp.jvmmib.JvmRTClassPathTableMeta;
import sun.management.snmp.jvmmib.JvmRTBootClassPathTableMeta;
import sun.management.snmp.jvmmib.JvmRTLibraryPathTableMeta;
/**
* The class is used for representing SNMP metadata for the "JvmRuntime" group.
*/
public class JvmRuntimeMetaImpl extends JvmRuntimeMeta {
static final long serialVersionUID = -6570428414857608618L;
/**
* Constructor for the metadata associated to "JvmRuntime".
*/
public JvmRuntimeMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
}
/**
* Factory method for "JvmRTInputArgsTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTInputArgsTable")
* @param groupName Name of the group to which this table belong
* ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTInputArgsTable" table (JvmRTInputArgsTableMeta)
*
**/
protected JvmRTInputArgsTableMeta
createJvmRTInputArgsTableMetaNode(String tableName, String groupName,
SnmpMib mib, MBeanServer server) {
return new JvmRTInputArgsTableMetaImpl(mib, objectserver);
}
/**
* Factory method for "JvmRTLibraryPathTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTLibraryPathTable")
* @param groupName Name of the group to which this table belong
* ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTLibraryPathTable" table (JvmRTLibraryPathTableMeta)
*
**/
protected JvmRTLibraryPathTableMeta
createJvmRTLibraryPathTableMetaNode(String tableName,
String groupName,
SnmpMib mib,
MBeanServer server) {
return new JvmRTLibraryPathTableMetaImpl(mib, objectserver);
}
/**
* Factory method for "JvmRTClassPathTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTClassPathTable")
* @param groupName Name of the group to which this table belong
* ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTClassPathTable" table (JvmRTClassPathTableMeta)
*
**/
protected JvmRTClassPathTableMeta
createJvmRTClassPathTableMetaNode(String tableName, String groupName,
SnmpMib mib, MBeanServer server) {
return new JvmRTClassPathTableMetaImpl(mib, objectserver);
}
/**
* Factory method for "JvmRTBootClassPathTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTBootClassPathTable")
* @param groupName Name of the group to which this table belong
* ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTBootClassPathTable" table (JvmRTBootClassPathTableMeta)
*
**/
protected JvmRTBootClassPathTableMeta
createJvmRTBootClassPathTableMetaNode(String tableName,
String groupName,
SnmpMib mib,
MBeanServer server) {
return new JvmRTBootClassPathTableMetaImpl(mib, objectserver);
}
}

View File

@@ -0,0 +1,330 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
import java.lang.management.ThreadInfo;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpDefinitions;
import com.sun.jmx.snmp.SnmpOidTable;
import com.sun.jmx.snmp.SnmpOidRecord;
import sun.management.snmp.jvmmib.JvmThreadInstanceEntryMBean;
import sun.management.snmp.jvmmib.JVM_MANAGEMENT_MIBOidTable;
import sun.management.snmp.util.MibLogger;
/**
* The class is used for implementing the "JvmThreadInstanceEntry" group.
*/
public class JvmThreadInstanceEntryImpl
implements JvmThreadInstanceEntryMBean, Serializable {
static final long serialVersionUID = 910173589985461347L;
public final static class ThreadStateMap {
public final static class Byte0 {
public final static byte inNative = (byte)0x80; // bit 1
public final static byte suspended = (byte)0x40; // bit 2
public final static byte newThread = (byte)0x20; // bit 3
public final static byte runnable = (byte)0x10; // bit 4
public final static byte blocked = (byte)0x08; // bit 5
public final static byte terminated = (byte)0x04; // bit 6
public final static byte waiting = (byte)0x02; // bit 7
public final static byte timedWaiting = (byte)0x01; // bit 8
}
public final static class Byte1 {
public final static byte other = (byte)0x80; // bit 9
public final static byte reserved10 = (byte)0x40; // bit 10
public final static byte reserved11 = (byte)0x20; // bit 11
public final static byte reserved12 = (byte)0x10; // bit 12
public final static byte reserved13 = (byte)0x08; // bit 13
public final static byte reserved14 = (byte)0x04; // bit 14
public final static byte reserved15 = (byte)0x02; // bit 15
public final static byte reserved16 = (byte)0x01; // bit 16
}
public final static byte mask0 = (byte)0x3F;
public final static byte mask1 = (byte)0x80;
private static void setBit(byte[] bitmap, int index, byte state) {
bitmap[index] = (byte) (bitmap[index] | state);
}
public static void setNative(byte[] bitmap) {
setBit(bitmap,0,Byte0.inNative);
}
public static void setSuspended(byte[] bitmap) {
setBit(bitmap,0,Byte0.suspended);
}
public static void setState(byte[] bitmap, Thread.State state) {
switch(state) {
case BLOCKED:
setBit(bitmap,0,Byte0.blocked);
return;
case NEW:
setBit(bitmap,0,Byte0.newThread);
return;
case RUNNABLE:
setBit(bitmap,0,Byte0.runnable);
return;
case TERMINATED:
setBit(bitmap,0,Byte0.terminated);
return;
case TIMED_WAITING:
setBit(bitmap,0,Byte0.timedWaiting);
return;
case WAITING:
setBit(bitmap,0,Byte0.waiting);
return;
}
}
public static void checkOther(byte[] bitmap) {
if (((bitmap[0]&mask0)==(byte)0x00) &&
((bitmap[1]&mask1)==(byte)0x00))
setBit(bitmap,1,Byte1.other);
}
public static Byte[] getState(ThreadInfo info) {
byte[] bitmap = new byte[] {(byte)0x00, (byte)0x00};
try {
final Thread.State state = info.getThreadState();
final boolean inNative = info.isInNative();
final boolean suspended = info.isSuspended();
log.debug("getJvmThreadInstState",
"[State=" + state +
",isInNative=" + inNative +
",isSuspended=" + suspended + "]");
setState(bitmap,state);
if (inNative) setNative(bitmap);
if (suspended) setSuspended(bitmap);
checkOther(bitmap);
} catch (RuntimeException r) {
bitmap[0]=(byte)0x00;
bitmap[1]=Byte1.other;
log.trace("getJvmThreadInstState",
"Unexpected exception: " + r);
log.debug("getJvmThreadInstState",r);
}
Byte[] result = { new Byte(bitmap[0]), new Byte(bitmap[1]) };
return result;
}
}
private final ThreadInfo info;
private final Byte[] index;
/**
* Constructor for the "JvmThreadInstanceEntry" group.
*/
public JvmThreadInstanceEntryImpl(ThreadInfo info,
Byte[] index) {
this.info = info;
this.index = index;
}
private static String jvmThreadInstIndexOid = null;
public static String getJvmThreadInstIndexOid()
throws SnmpStatusException {
if (jvmThreadInstIndexOid == null) {
final SnmpOidTable table = new JVM_MANAGEMENT_MIBOidTable();
final SnmpOidRecord record =
table.resolveVarName("jvmThreadInstIndex");
jvmThreadInstIndexOid = record.getOid();
}
return jvmThreadInstIndexOid;
}
/**
* Getter for the "JvmThreadInstLockedOwnerId" variable.
*/
public String getJvmThreadInstLockOwnerPtr() throws SnmpStatusException {
long id = info.getLockOwnerId();
if(id == -1)
return new String("0.0");
SnmpOid oid = JvmThreadInstanceTableMetaImpl.makeOid(id);
return getJvmThreadInstIndexOid() + "." + oid.toString();
}
private String validDisplayStringTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validDisplayStringTC(str);
}
private String validJavaObjectNameTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validJavaObjectNameTC(str);
}
private String validPathElementTC(String str) {
return JVM_MANAGEMENT_MIB_IMPL.validPathElementTC(str);
}
/**
* Getter for the "JvmThreadInstLockName" variable.
*/
public String getJvmThreadInstLockName() throws SnmpStatusException {
return validJavaObjectNameTC(info.getLockName());
}
/**
* Getter for the "JvmThreadInstName" variable.
*/
public String getJvmThreadInstName() throws SnmpStatusException {
return validJavaObjectNameTC(info.getThreadName());
}
/**
* Getter for the "JvmThreadInstCpuTimeNs" variable.
*/
public Long getJvmThreadInstCpuTimeNs() throws SnmpStatusException {
long l = 0;
final ThreadMXBean tmb = JvmThreadingImpl.getThreadMXBean();
try {
if (tmb.isThreadCpuTimeSupported()) {
l = tmb.getThreadCpuTime(info.getThreadId());
log.debug("getJvmThreadInstCpuTimeNs", "Cpu time ns : " + l);
//Cpu time measurement is disabled or the id is not valid.
if(l == -1) l = 0;
}
} catch (UnsatisfiedLinkError e) {
// XXX Revisit: catch TO BE EVENTUALLY REMOVED
log.debug("getJvmThreadInstCpuTimeNs",
"Operation not supported: " + e);
}
return new Long(l);
}
/**
* Getter for the "JvmThreadInstBlockTimeMs" variable.
*/
public Long getJvmThreadInstBlockTimeMs() throws SnmpStatusException {
long l = 0;
final ThreadMXBean tmb = JvmThreadingImpl.getThreadMXBean();
if (tmb.isThreadContentionMonitoringSupported()) {
l = info.getBlockedTime();
//Monitoring is disabled
if(l == -1) l = 0;
}
return new Long(l);
}
/**
* Getter for the "JvmThreadInstBlockCount" variable.
*/
public Long getJvmThreadInstBlockCount() throws SnmpStatusException {
return new Long(info.getBlockedCount());
}
/**
* Getter for the "JvmThreadInstWaitTimeMs" variable.
*/
public Long getJvmThreadInstWaitTimeMs() throws SnmpStatusException {
long l = 0;
final ThreadMXBean tmb = JvmThreadingImpl.getThreadMXBean();
if (tmb.isThreadContentionMonitoringSupported()) {
l = info.getWaitedTime();
//Monitoring is disabled
if(l == -1) l = 0;
}
return new Long(l);
}
/**
* Getter for the "JvmThreadInstWaitCount" variable.
*/
public Long getJvmThreadInstWaitCount() throws SnmpStatusException {
return new Long(info.getWaitedCount());
}
/**
* Getter for the "JvmThreadInstState" variable.
*/
public Byte[] getJvmThreadInstState()
throws SnmpStatusException {
return ThreadStateMap.getState(info);
}
/**
* Getter for the "JvmThreadInstId" variable.
*/
public Long getJvmThreadInstId() throws SnmpStatusException {
return new Long(info.getThreadId());
}
/**
* Getter for the "JvmThreadInstIndex" variable.
*/
public Byte[] getJvmThreadInstIndex() throws SnmpStatusException {
return index;
}
/**
* Getter for the "JvmThreadInstStackTrace" variable.
*/
private String getJvmThreadInstStackTrace() throws SnmpStatusException {
StackTraceElement[] stackTrace = info.getStackTrace();
//We append the stack trace in a buffer
// XXX Revisit: should check isDebugOn()
StringBuffer b = new StringBuffer();
final int stackSize = stackTrace.length;
log.debug("getJvmThreadInstStackTrace", "Stack size : " + stackSize);
for(int i = 0; i < stackSize; i++) {
log.debug("getJvmThreadInstStackTrace", "Append " +
stackTrace[i].toString());
b.append(stackTrace[i].toString());
//Append \n at the end of each line except the last one
if(i < stackSize)
b.append("\n");
}
//The stack trace is truncated if its size exceeds 255.
return validPathElementTC(b.toString());
}
static final MibLogger log =
new MibLogger(JvmThreadInstanceEntryImpl.class);
}

View File

@@ -0,0 +1,404 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.util.Vector;
import java.util.Map;
import java.util.TreeMap;
import java.util.Enumeration;
import java.lang.management.ThreadInfo;
import java.lang.management.ManagementFactory;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import sun.management.snmp.jvmmib.JvmThreadInstanceEntryMBean;
import sun.management.snmp.jvmmib.JvmThreadInstanceTableMeta;
import sun.management.snmp.util.SnmpTableCache;
import sun.management.snmp.util.SnmpCachedData;
import sun.management.snmp.util.SnmpTableHandler;
import sun.management.snmp.util.MibLogger;
import sun.management.snmp.util.JvmContextFactory;
/**
* The class is used for implementing the "JvmThreadInstanceTable" group.
*/
public class JvmThreadInstanceTableMetaImpl
extends JvmThreadInstanceTableMeta {
static final long serialVersionUID = -8432271929226397492L;
/**
* Maximum depth of the stacktrace that might be returned through
* SNMP.
*
* Since we do not export the stack trace through SNMP, we set
* MAX_STACK_TRACE_DEPTH=0 so that ThreadMXBean.getThreadInfo(long) does
* not compute the stack trace.
*
**/
public static final int MAX_STACK_TRACE_DEPTH=0;
/**
* Translate from a long to a Oid. Arc follow the long big-endian order.
* @param l The long to make the index from
* @return The arc array.
*/
static SnmpOid makeOid(long l) {
long[] x = new long [8];
x[0] = (l >> 56) & 0xFF;
x[1] = (l >> 48) & 0x00FF;
x[2] = (l >> 40) & 0x0000FF;
x[3] = (l >> 32) & 0x000000FF;
x[4] = (l >> 24) & 0x00000000FF;
x[5] = (l >> 16) & 0x0000000000FF;
x[6] = (l >> 8) & 0x000000000000FF;
x[7] = l & 0x00000000000000FF;
return new SnmpOid(x);
}
/**
* Translate an Oid to a thread id. Arc follow the long big-endian order.
* @param oid The oid to make the id from
* @return The thread id.
*/
static long makeId(SnmpOid oid) {
long id = 0;
long[] arcs = oid.longValue(false);
id |= arcs[0] << 56;
id |= arcs[1] << 48;
id |= arcs[2] << 40;
id |= arcs[3] << 32;
id |= arcs[4] << 24;
id |= arcs[5] << 16;
id |= arcs[6] << 8;
id |= arcs[7];
return id;
}
/**
* A concrete implementation of {@link SnmpTableCache}, for the
* JvmThreadInstanceTable.
**/
private static class JvmThreadInstanceTableCache
extends SnmpTableCache {
static final long serialVersionUID = 4947330124563406878L;
final private JvmThreadInstanceTableMetaImpl meta;
/**
* Create a weak cache for the JvmThreadInstanceTable.
* @param validity validity of the cached data, in ms.
**/
JvmThreadInstanceTableCache(JvmThreadInstanceTableMetaImpl meta,
long validity) {
this.validity = validity;
this.meta = meta;
}
/**
* Call <code>getTableDatas(JvmContextFactory.getUserData())</code>.
**/
public SnmpTableHandler getTableHandler() {
final Map<Object, Object> userData = JvmContextFactory.getUserData();
return getTableDatas(userData);
}
/**
* Return a table handler containing the Thread indexes.
* Indexes are computed from the ThreadId.
**/
protected SnmpCachedData updateCachedDatas(Object userData) {
// We are getting all the thread ids. WARNING.
// Some of them will be not valid when accessed for data...
// See getEntry
long[] id = JvmThreadingImpl.getThreadMXBean().getAllThreadIds();
// Time stamp for the cache
final long time = System.currentTimeMillis();
SnmpOid indexes[] = new SnmpOid[id.length];
final TreeMap<SnmpOid, Object> table =
new TreeMap<>(SnmpCachedData.oidComparator);
for(int i = 0; i < id.length; i++) {
log.debug("", "Making index for thread id [" + id[i] +"]");
//indexes[i] = makeOid(id[i]);
SnmpOid oid = makeOid(id[i]);
table.put(oid, oid);
}
return new SnmpCachedData(time, table);
}
}
// The weak cache for this table.
protected SnmpTableCache cache;
/**
* Constructor for the table. Initialize metadata for
* "JvmThreadInstanceTableMeta".
* The reference on the MBean server is updated so the entries created
* through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmThreadInstanceTableMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
cache = new JvmThreadInstanceTableCache(this,
((JVM_MANAGEMENT_MIB_IMPL)myMib).validity());
log.debug("JvmThreadInstanceTableMetaImpl", "Create Thread meta");
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(Object userData)
throws SnmpStatusException {
log.debug("JvmThreadInstanceTableMetaImpl", "getNextOid");
// null means get the first OID.
return getNextOid(null,userData);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
throws SnmpStatusException {
log.debug("getNextOid", "previous=" + oid);
// Get the data handler.
//
SnmpTableHandler handler = getHandler(userData);
if (handler == null) {
// This should never happen.
// If we get here it's a bug.
//
log.debug("getNextOid", "handler is null!");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the next oid
//
SnmpOid next = oid;
while(true) {
next = handler.getNext(next);
if (next == null) break;
if (getJvmThreadInstance(userData,next) != null) break;
}
log.debug("*** **** **** **** getNextOid", "next=" + next);
// if next is null: we reached the end of the table.
//
if (next == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return next;
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
protected boolean contains(SnmpOid oid, Object userData) {
// Get the handler.
//
SnmpTableHandler handler = getHandler(userData);
// handler should never be null.
//
if (handler == null)
return false;
if(!handler.contains(oid))
return false;
JvmThreadInstanceEntryImpl inst = getJvmThreadInstance(userData, oid);
return (inst != null);
}
// See com.sun.jmx.snmp.agent.SnmpMibTable
public Object getEntry(SnmpOid oid)
throws SnmpStatusException {
log.debug("*** **** **** **** getEntry", "oid [" + oid + "]");
if (oid == null || oid.getLength() != 8) {
log.debug("getEntry", "Invalid oid [" + oid + "]");
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
// Get the request contextual cache (userData).
//
final Map<Object,Object> m = JvmContextFactory.getUserData();
// Get the handler.
//
SnmpTableHandler handler = getHandler(m);
// handler should never be null.
//
if (handler == null || !handler.contains(oid))
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
final JvmThreadInstanceEntryImpl entry = getJvmThreadInstance(m,oid);
if (entry == null)
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
return entry;
}
/**
* Get the SnmpTableHandler that holds the jvmThreadInstanceTable data.
* First look it up in the request contextual cache, and if it is
* not found, obtain it from the weak cache.
* <br>The request contextual cache will be released at the end of the
* current requests, and is used only to process this request.
* <br>The weak cache is shared by all requests, and is only
* recomputed when it is found to be obsolete.
* <br>Note that the data put in the request contextual cache is
* never considered to be obsolete, in order to preserve data
* coherency.
**/
protected SnmpTableHandler getHandler(Object userData) {
final Map<Object, Object> m;
if (userData instanceof Map) m=Util.cast(userData);
else m=null;
// Look in the contextual cache.
if (m != null) {
final SnmpTableHandler handler =
(SnmpTableHandler)m.get("JvmThreadInstanceTable.handler");
if (handler != null) return handler;
}
// No handler in contextual cache, make a new one.
final SnmpTableHandler handler = cache.getTableHandler();
if (m != null && handler != null )
m.put("JvmThreadInstanceTable.handler",handler);
return handler;
}
private ThreadInfo getThreadInfo(long id) {
return JvmThreadingImpl.getThreadMXBean().
getThreadInfo(id,MAX_STACK_TRACE_DEPTH);
}
private ThreadInfo getThreadInfo(SnmpOid oid) {
return getThreadInfo(makeId(oid));
}
private JvmThreadInstanceEntryImpl getJvmThreadInstance(Object userData,
SnmpOid oid) {
JvmThreadInstanceEntryImpl cached = null;
String entryTag = null;
Map<Object, Object> map = null;
final boolean dbg = log.isDebugOn();
if (userData instanceof Map) {
map = Util.cast(userData);
// We're going to use this name to store/retrieve the entry in
// the request contextual cache.
//
// Revisit: Probably better programming to put all these strings
// in some interface.
//
entryTag = "JvmThreadInstanceTable.entry." + oid.toString();
cached = (JvmThreadInstanceEntryImpl) map.get(entryTag);
}
// If the entry is in the cache, simply return it.
//
if (cached != null) {
if (dbg) log.debug("*** getJvmThreadInstance",
"Entry found in cache: " + entryTag);
return cached;
}
if (dbg) log.debug("*** getJvmThreadInstance", "Entry [" +
oid + "] is not in cache");
// Entry not in cache. We will create one if needed.
//
ThreadInfo info = null;
try {
info = getThreadInfo(oid);
} catch (RuntimeException r) {
log.trace("*** getJvmThreadInstance",
"Failed to get thread info for rowOid: " + oid);
log.debug("*** getJvmThreadInstance",r);
}
// No thread by that id => no entry.
//
if(info == null) {
if (dbg) log.debug("*** getJvmThreadInstance",
"No entry by that oid [" + oid + "]");
return null;
}
cached = new JvmThreadInstanceEntryImpl(info, oid.toByte());
if (map != null) map.put(entryTag, cached);
if (dbg) log.debug("*** getJvmThreadInstance",
"Entry created for Thread OID [" + oid + "]");
return cached;
}
static final MibLogger log =
new MibLogger(JvmThreadInstanceTableMetaImpl.class);
}

View File

@@ -0,0 +1,364 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
import java.lang.management.ThreadMXBean;
import java.lang.management.ManagementFactory;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.SnmpDefinitions;
import sun.management.snmp.jvmmib.JvmThreadingMBean;
import sun.management.snmp.jvmmib.EnumJvmThreadCpuTimeMonitoring;
import sun.management.snmp.jvmmib.EnumJvmThreadContentionMonitoring;
import sun.management.snmp.util.MibLogger;
/**
* The class is used for implementing the "JvmThreading" group.
*/
public class JvmThreadingImpl implements JvmThreadingMBean {
/**
* Variable for storing the value of "JvmThreadCpuTimeMonitoring".
*
* "The state of the Thread CPU Time Monitoring feature.
* This feature can be:
*
* unsupported: The JVM does not support Thread CPU Time Monitoring.
* enabled : The JVM supports Thread CPU Time Monitoring, and it
* is enabled.
* disabled : The JVM supports Thread CPU Time Monitoring, and it
* is disabled.
*
* Only enabled(3) and disabled(4) may be supplied as values to a
* SET request. unsupported(1) can only be set internally by the
* agent.
*
* See java.lang.management.ThreadMXBean.isThreadCpuTimeSupported(),
* java.lang.management.ThreadMXBean.isThreadCpuTimeEnabled(),
* java.lang.management.ThreadMXBean.setThreadCpuTimeEnabled()
* "
*
*/
final static EnumJvmThreadCpuTimeMonitoring
JvmThreadCpuTimeMonitoringUnsupported =
new EnumJvmThreadCpuTimeMonitoring("unsupported");
final static EnumJvmThreadCpuTimeMonitoring
JvmThreadCpuTimeMonitoringEnabled =
new EnumJvmThreadCpuTimeMonitoring("enabled");
final static EnumJvmThreadCpuTimeMonitoring
JvmThreadCpuTimeMonitoringDisabled =
new EnumJvmThreadCpuTimeMonitoring("disabled");
/**
* Variable for storing the value of "JvmThreadContentionMonitoring".
*
* "The state of the Thread Contention Monitoring feature.
* This feature can be:
*
* unsupported: The JVM does not support Thread Contention Monitoring.
* enabled : The JVM supports Thread Contention Monitoring, and it
* is enabled.
* disabled : The JVM supports Thread Contention Monitoring, and it
* is disabled.
*
* Only enabled(3) and disabled(4) may be supplied as values to a
* SET request. unsupported(1) can only be set internally by the
* agent.
*
* See java.lang.management.ThreadMXBean.isThreadContentionMonitoringSupported(),
* java.lang.management.ThreadMXBean.isThreadContentionMonitoringEnabled(),
* java.lang.management.ThreadMXBean.setThreadContentionMonitoringEnabled()
* "
*
*/
static final EnumJvmThreadContentionMonitoring
JvmThreadContentionMonitoringUnsupported =
new EnumJvmThreadContentionMonitoring("unsupported");
static final EnumJvmThreadContentionMonitoring
JvmThreadContentionMonitoringEnabled =
new EnumJvmThreadContentionMonitoring("enabled");
static final EnumJvmThreadContentionMonitoring
JvmThreadContentionMonitoringDisabled =
new EnumJvmThreadContentionMonitoring("disabled");
/**
* Constructor for the "JvmThreading" group.
* If the group contains a table, the entries created through an SNMP SET
* will not be registered in Java DMK.
*/
public JvmThreadingImpl(SnmpMib myMib) {
log.debug("JvmThreadingImpl","Constructor");
}
/**
* Constructor for the "JvmThreading" group.
* If the group contains a table, the entries created through an SNMP SET
* will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmThreadingImpl(SnmpMib myMib, MBeanServer server) {
log.debug("JvmThreadingImpl","Constructor with server");
}
/**
* ThreadMXBean accessor. It is acquired from the
* java.lang.management.ManagementFactory
* @return The local ThreadMXBean.
*/
static ThreadMXBean getThreadMXBean() {
return ManagementFactory.getThreadMXBean();
}
/**
* Getter for the "JvmThreadCpuTimeMonitoring" variable.
*/
public EnumJvmThreadCpuTimeMonitoring getJvmThreadCpuTimeMonitoring()
throws SnmpStatusException {
ThreadMXBean mbean = getThreadMXBean();
if(!mbean.isThreadCpuTimeSupported()) {
log.debug("getJvmThreadCpuTimeMonitoring",
"Unsupported ThreadCpuTimeMonitoring");
return JvmThreadCpuTimeMonitoringUnsupported;
}
try {
if(mbean.isThreadCpuTimeEnabled()) {
log.debug("getJvmThreadCpuTimeMonitoring",
"Enabled ThreadCpuTimeMonitoring");
return JvmThreadCpuTimeMonitoringEnabled;
} else {
log.debug("getJvmThreadCpuTimeMonitoring",
"Disabled ThreadCpuTimeMonitoring");
return JvmThreadCpuTimeMonitoringDisabled;
}
}catch(UnsupportedOperationException e) {
log.debug("getJvmThreadCpuTimeMonitoring",
"Newly unsupported ThreadCpuTimeMonitoring");
return JvmThreadCpuTimeMonitoringUnsupported;
}
}
/**
* Setter for the "JvmThreadCpuTimeMonitoring" variable.
*/
public void setJvmThreadCpuTimeMonitoring(EnumJvmThreadCpuTimeMonitoring x)
throws SnmpStatusException {
ThreadMXBean mbean = getThreadMXBean();
// We can trust the received value, it has been checked in
// checkJvmThreadCpuTimeMonitoring
if(JvmThreadCpuTimeMonitoringEnabled.intValue() == x.intValue())
mbean.setThreadCpuTimeEnabled(true);
else
mbean.setThreadCpuTimeEnabled(false);
}
/**
* Checker for the "JvmThreadCpuTimeMonitoring" variable.
*/
public void checkJvmThreadCpuTimeMonitoring(EnumJvmThreadCpuTimeMonitoring
x)
throws SnmpStatusException {
//Can't be set externaly to unsupported state.
if(JvmThreadCpuTimeMonitoringUnsupported.intValue() == x.intValue()) {
log.debug("checkJvmThreadCpuTimeMonitoring",
"Try to set to illegal unsupported value");
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
if ((JvmThreadCpuTimeMonitoringEnabled.intValue() == x.intValue()) ||
(JvmThreadCpuTimeMonitoringDisabled.intValue() == x.intValue())) {
// The value is a valid value. But is the feature supported?
ThreadMXBean mbean = getThreadMXBean();
if(mbean.isThreadCpuTimeSupported()) return;
// Not supported.
log.debug("checkJvmThreadCpuTimeMonitoring",
"Unsupported operation, can't set state");
throw new
SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
}
// Unknown value.
log.debug("checkJvmThreadCpuTimeMonitoring",
"unknown enum value ");
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
/**
* Getter for the "JvmThreadContentionMonitoring" variable.
*/
public EnumJvmThreadContentionMonitoring getJvmThreadContentionMonitoring()
throws SnmpStatusException {
ThreadMXBean mbean = getThreadMXBean();
if(!mbean.isThreadContentionMonitoringSupported()) {
log.debug("getJvmThreadContentionMonitoring",
"Unsupported ThreadContentionMonitoring");
return JvmThreadContentionMonitoringUnsupported;
}
if(mbean.isThreadContentionMonitoringEnabled()) {
log.debug("getJvmThreadContentionMonitoring",
"Enabled ThreadContentionMonitoring");
return JvmThreadContentionMonitoringEnabled;
} else {
log.debug("getJvmThreadContentionMonitoring",
"Disabled ThreadContentionMonitoring");
return JvmThreadContentionMonitoringDisabled;
}
}
/**
* Setter for the "JvmThreadContentionMonitoring" variable.
*/
public void setJvmThreadContentionMonitoring(
EnumJvmThreadContentionMonitoring x)
throws SnmpStatusException {
ThreadMXBean mbean = getThreadMXBean();
// We can trust the received value, it has been checked in
// checkJvmThreadContentionMonitoring
if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue())
mbean.setThreadContentionMonitoringEnabled(true);
else
mbean.setThreadContentionMonitoringEnabled(false);
}
/**
* Checker for the "JvmThreadContentionMonitoring" variable.
*/
public void checkJvmThreadContentionMonitoring(
EnumJvmThreadContentionMonitoring x)
throws SnmpStatusException {
//Can't be set externaly to unsupported state.
if(JvmThreadContentionMonitoringUnsupported.intValue()==x.intValue()) {
log.debug("checkJvmThreadContentionMonitoring",
"Try to set to illegal unsupported value");
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
if ((JvmThreadContentionMonitoringEnabled.intValue()==x.intValue()) ||
(JvmThreadContentionMonitoringDisabled.intValue()==x.intValue())) {
// The value is valid, but is the feature supported ?
ThreadMXBean mbean = getThreadMXBean();
if(mbean.isThreadContentionMonitoringSupported()) return;
log.debug("checkJvmThreadContentionMonitoring",
"Unsupported operation, can't set state");
throw new
SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
}
log.debug("checkJvmThreadContentionMonitoring",
"Try to set to unknown value");
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
/**
* Getter for the "JvmThreadTotalStartedCount" variable.
*/
public Long getJvmThreadTotalStartedCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getTotalStartedThreadCount());
}
/**
* Getter for the "JvmThreadPeakCount" variable.
*/
public Long getJvmThreadPeakCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getPeakThreadCount());
}
/**
* Getter for the "JvmThreadDaemonCount" variable.
*/
public Long getJvmThreadDaemonCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getDaemonThreadCount());
}
/**
* Getter for the "JvmThreadCount" variable.
*/
public Long getJvmThreadCount() throws SnmpStatusException {
return new Long(getThreadMXBean().getThreadCount());
}
/**
* Getter for the "JvmThreadPeakCountReset" variable.
*/
public synchronized Long getJvmThreadPeakCountReset()
throws SnmpStatusException {
return new Long(jvmThreadPeakCountReset);
}
/**
* Setter for the "JvmThreadPeakCountReset" variable.
*/
public synchronized void setJvmThreadPeakCountReset(Long x)
throws SnmpStatusException {
final long l = x.longValue();
if (l > jvmThreadPeakCountReset) {
final long stamp = System.currentTimeMillis();
getThreadMXBean().resetPeakThreadCount();
jvmThreadPeakCountReset = stamp;
log.debug("setJvmThreadPeakCountReset",
"jvmThreadPeakCountReset="+stamp);
}
}
/**
* Checker for the "JvmThreadPeakCountReset" variable.
*/
public void checkJvmThreadPeakCountReset(Long x)
throws SnmpStatusException {
}
/* Last time thread peak count was reset */
private long jvmThreadPeakCountReset=0;
static final MibLogger log = new MibLogger(JvmThreadingImpl.class);
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import sun.management.snmp.jvmmib.JvmThreadingMeta;
import sun.management.snmp.jvmmib.JvmThreadInstanceTableMeta;
/**
* The class is used for representing SNMP metadata for the "JvmThreading"
* group.
*/
public class JvmThreadingMetaImpl extends JvmThreadingMeta {
static final long serialVersionUID = -2104788458393251457L;
/**
* Constructor for the metadata associated to "JvmThreading".
*/
public JvmThreadingMetaImpl(SnmpMib myMib,
SnmpStandardObjectServer objserv) {
super(myMib, objserv);
}
/**
* Factory method for "JvmThreadInstanceTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmThreadInstanceTable")
* @param groupName Name of the group to which this table belong
* ("JvmThreading")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmThreadInstanceTable" table (JvmThreadInstanceTableMeta)
*
**/
protected JvmThreadInstanceTableMeta
createJvmThreadInstanceTableMetaNode(String tableName,
String groupName,
SnmpMib mib,
MBeanServer server) {
return new JvmThreadInstanceTableMetaImpl(mib, objectserver);
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
import java.net.InetAddress;
/**
* Target notification.
*/
public interface NotificationTarget {
public InetAddress getAddress();
public int getPort();
public String getCommunity();
}

View File

@@ -0,0 +1,131 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvminstr;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* Notification Target data.
*/
public class NotificationTargetImpl implements NotificationTarget {
private InetAddress address;
private int port;
private String community;
/**
* Target parameter is a <CODE>java.lang.String</CODE>
* target synctax is <host>:<port>:community. Eg: "localhost:163:private".
* <p>The <code><em>host</em></code> is a host name, an IPv4 numeric
* host address, or an IPv6 numeric address enclosed in square
* brackets.</p>
* @throws IllegalArgumentException In case the target is malformed
*/
public NotificationTargetImpl(String target)
throws IllegalArgumentException, UnknownHostException {
parseTarget(target);
}
public NotificationTargetImpl(String address, int port,
String community)
throws UnknownHostException {
this(InetAddress.getByName(address),port,community);
}
public NotificationTargetImpl(InetAddress address, int port,
String community) {
this.address = address;
this.port = port;
this.community = community;
}
private void parseTarget(String target)
throws IllegalArgumentException, UnknownHostException {
if(target == null ||
target.length() == 0) throw new
IllegalArgumentException("Invalid target [" + target + "]");
String addrStr;
if (target.startsWith("[")) {
final int index = target.indexOf("]");
final int index2 = target.lastIndexOf(":");
if(index == -1)
throw new IllegalArgumentException("Host starts with [ but " +
"does not end with ]");
addrStr = target.substring(1, index);
port = Integer.parseInt(target.substring(index + 2,
index2));
if (!isNumericIPv6Address(addrStr)) {
throw new IllegalArgumentException("Address inside [...] must " +
"be numeric IPv6 address");
}
if (addrStr.startsWith("["))
throw new IllegalArgumentException("More than one [[...]]");
} else {
final int index = target.indexOf(":");
final int index2 = target.lastIndexOf(":");
if(index == -1) throw new
IllegalArgumentException("Missing port separator \":\"");
addrStr = target.substring(0, index);
port = Integer.parseInt(target.substring(index + 1,
index2));
}
address = InetAddress.getByName(addrStr);
//THE CHECK SHOULD BE STRONGER!!!
final int index = target.lastIndexOf(":");
community = target.substring(index + 1, target.length());
}
/* True if this string, assumed to be a valid argument to
* InetAddress.getByName, is a numeric IPv6 address.
*/
private static boolean isNumericIPv6Address(String s) {
// address contains colon iff it's a numeric IPv6 address
return (s.indexOf(':') >= 0);
}
public String getCommunity() {
return community;
}
public InetAddress getAddress() {
return address;
}
public int getPort() {
return port;
}
public String toString() {
return "address : " + address + " port : " + port +
" community : " + community;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmClassesVerboseLevel".
*/
public class EnumJvmClassesVerboseLevel extends Enumerated implements Serializable {
static final long serialVersionUID = -620710366914810374L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "verbose");
intTable.put(new Integer(1), "silent");
stringTable.put("verbose", new Integer(2));
stringTable.put("silent", new Integer(1));
}
public EnumJvmClassesVerboseLevel(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmClassesVerboseLevel(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmClassesVerboseLevel() throws IllegalArgumentException {
super();
}
public EnumJvmClassesVerboseLevel(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmJITCompilerTimeMonitoring".
*/
public class EnumJvmJITCompilerTimeMonitoring extends Enumerated implements Serializable {
static final long serialVersionUID = 3953565918146461236L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported");
stringTable.put("supported", new Integer(2));
stringTable.put("unsupported", new Integer(1));
}
public EnumJvmJITCompilerTimeMonitoring(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmJITCompilerTimeMonitoring(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmJITCompilerTimeMonitoring() throws IllegalArgumentException {
super();
}
public EnumJvmJITCompilerTimeMonitoring(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer, String> getIntTable() {
return intTable ;
}
protected Hashtable<String, Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemManagerState".
*/
public class EnumJvmMemManagerState extends Enumerated implements Serializable {
static final long serialVersionUID = 8249515157795166343L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "valid");
intTable.put(new Integer(1), "invalid");
stringTable.put("valid", new Integer(2));
stringTable.put("invalid", new Integer(1));
}
public EnumJvmMemManagerState(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemManagerState(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemManagerState() throws IllegalArgumentException {
super();
}
public EnumJvmMemManagerState(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer, String> getIntTable() {
return intTable ;
}
protected Hashtable<String, Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemPoolCollectThreshdSupport".
*/
public class EnumJvmMemPoolCollectThreshdSupport extends Enumerated implements Serializable {
static final long serialVersionUID = 8610091819732806282L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported");
stringTable.put("supported", new Integer(2));
stringTable.put("unsupported", new Integer(1));
}
public EnumJvmMemPoolCollectThreshdSupport(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolCollectThreshdSupport(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolCollectThreshdSupport() throws IllegalArgumentException {
super();
}
public EnumJvmMemPoolCollectThreshdSupport(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer, String> getIntTable() {
return intTable ;
}
protected Hashtable<String, Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemPoolState".
*/
public class EnumJvmMemPoolState extends Enumerated implements Serializable {
static final long serialVersionUID = 3038175407527743027L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "valid");
intTable.put(new Integer(1), "invalid");
stringTable.put("valid", new Integer(2));
stringTable.put("invalid", new Integer(1));
}
public EnumJvmMemPoolState(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolState(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolState() throws IllegalArgumentException {
super();
}
public EnumJvmMemPoolState(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemPoolThreshdSupport".
*/
public class EnumJvmMemPoolThreshdSupport extends Enumerated implements Serializable {
static final long serialVersionUID = 7014693561120661029L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported");
stringTable.put("supported", new Integer(2));
stringTable.put("unsupported", new Integer(1));
}
public EnumJvmMemPoolThreshdSupport(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolThreshdSupport(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolThreshdSupport() throws IllegalArgumentException {
super();
}
public EnumJvmMemPoolThreshdSupport(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemPoolType".
*/
public class EnumJvmMemPoolType extends Enumerated implements Serializable {
static final long serialVersionUID = -7214498472962396555L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "heap");
intTable.put(new Integer(1), "nonheap");
stringTable.put("heap", new Integer(2));
stringTable.put("nonheap", new Integer(1));
}
public EnumJvmMemPoolType(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolType(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemPoolType() throws IllegalArgumentException {
super();
}
public EnumJvmMemPoolType(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemoryGCCall".
*/
public class EnumJvmMemoryGCCall extends Enumerated implements Serializable {
static final long serialVersionUID = -2869147994287351375L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "supported");
intTable.put(new Integer(5), "failed");
intTable.put(new Integer(4), "started");
intTable.put(new Integer(1), "unsupported");
intTable.put(new Integer(3), "start");
stringTable.put("supported", new Integer(2));
stringTable.put("failed", new Integer(5));
stringTable.put("started", new Integer(4));
stringTable.put("unsupported", new Integer(1));
stringTable.put("start", new Integer(3));
}
public EnumJvmMemoryGCCall(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemoryGCCall(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemoryGCCall() throws IllegalArgumentException {
super();
}
public EnumJvmMemoryGCCall(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer, String> getIntTable() {
return intTable ;
}
protected Hashtable<String, Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmMemoryGCVerboseLevel".
*/
public class EnumJvmMemoryGCVerboseLevel extends Enumerated implements Serializable {
static final long serialVersionUID = 1362427628755978190L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "verbose");
intTable.put(new Integer(1), "silent");
stringTable.put("verbose", new Integer(2));
stringTable.put("silent", new Integer(1));
}
public EnumJvmMemoryGCVerboseLevel(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemoryGCVerboseLevel(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmMemoryGCVerboseLevel() throws IllegalArgumentException {
super();
}
public EnumJvmMemoryGCVerboseLevel(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmRTBootClassPathSupport".
*/
public class EnumJvmRTBootClassPathSupport extends Enumerated implements Serializable {
static final long serialVersionUID = -5957542680437939894L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(2), "supported");
intTable.put(new Integer(1), "unsupported");
stringTable.put("supported", new Integer(2));
stringTable.put("unsupported", new Integer(1));
}
public EnumJvmRTBootClassPathSupport(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmRTBootClassPathSupport(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmRTBootClassPathSupport() throws IllegalArgumentException {
super();
}
public EnumJvmRTBootClassPathSupport(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer, String> getIntTable() {
return intTable ;
}
protected Hashtable<String, Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmThreadContentionMonitoring".
*/
public class EnumJvmThreadContentionMonitoring extends Enumerated implements Serializable {
static final long serialVersionUID = -6411827583604137210L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(3), "enabled");
intTable.put(new Integer(4), "disabled");
intTable.put(new Integer(1), "unsupported");
stringTable.put("enabled", new Integer(3));
stringTable.put("disabled", new Integer(4));
stringTable.put("unsupported", new Integer(1));
}
public EnumJvmThreadContentionMonitoring(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmThreadContentionMonitoring(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmThreadContentionMonitoring() throws IllegalArgumentException {
super();
}
public EnumJvmThreadContentionMonitoring(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// RI imports
//
import com.sun.jmx.snmp.Enumerated;
/**
* The class is used for representing "JvmThreadCpuTimeMonitoring".
*/
public class EnumJvmThreadCpuTimeMonitoring extends Enumerated implements Serializable {
static final long serialVersionUID = -532837824105215699L;
protected static Hashtable<Integer, String> intTable =
new Hashtable<>();
protected static Hashtable<String, Integer> stringTable =
new Hashtable<>();
static {
intTable.put(new Integer(3), "enabled");
intTable.put(new Integer(4), "disabled");
intTable.put(new Integer(1), "unsupported");
stringTable.put("enabled", new Integer(3));
stringTable.put("disabled", new Integer(4));
stringTable.put("unsupported", new Integer(1));
}
public EnumJvmThreadCpuTimeMonitoring(int valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmThreadCpuTimeMonitoring(Integer valueIndex) throws IllegalArgumentException {
super(valueIndex);
}
public EnumJvmThreadCpuTimeMonitoring() throws IllegalArgumentException {
super();
}
public EnumJvmThreadCpuTimeMonitoring(String x) throws IllegalArgumentException {
super(x);
}
protected Hashtable<Integer,String> getIntTable() {
return intTable ;
}
protected Hashtable<String,Integer> getStringTable() {
return stringTable ;
}
}

View File

@@ -0,0 +1,687 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Hashtable;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.InstanceAlreadyExistsException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for representing "JVM-MANAGEMENT-MIB".
* You can edit the file if you want to modify the behaviour of the MIB.
*/
public abstract class JVM_MANAGEMENT_MIB extends SnmpMib implements Serializable {
static final long serialVersionUID = 6895037919735816732L;
/**
* Default constructor. Initialize the Mib tree.
*/
public JVM_MANAGEMENT_MIB() {
mibName = "JVM_MANAGEMENT_MIB";
}
/**
* Initialization of the MIB with no registration in Java DMK.
*/
public void init() throws IllegalAccessException {
// Allow only one initialization of the MIB.
//
if (isInitialized == true) {
return ;
}
try {
populate(null, null);
} catch(IllegalAccessException x) {
throw x;
} catch(RuntimeException x) {
throw x;
} catch(Exception x) {
throw new Error(x.getMessage());
}
isInitialized = true;
}
/**
* Initialization of the MIB with AUTOMATIC REGISTRATION in Java DMK.
*/
public ObjectName preRegister(MBeanServer server, ObjectName name)
throws Exception {
// Allow only one initialization of the MIB.
//
if (isInitialized == true) {
throw new InstanceAlreadyExistsException();
}
// Initialize MBeanServer information.
//
this.server = server;
populate(server, name);
isInitialized = true;
return name;
}
/**
* Initialization of the MIB with no registration in Java DMK.
*/
public void populate(MBeanServer server, ObjectName name)
throws Exception {
// Allow only one initialization of the MIB.
//
if (isInitialized == true) {
return ;
}
if (objectserver == null)
objectserver = new SnmpStandardObjectServer();
// Initialization of the "JvmOS" group.
// To disable support of this group, redefine the
// "createJvmOSMetaNode()" factory method, and make it return "null"
//
initJvmOS(server);
// Initialization of the "JvmCompilation" group.
// To disable support of this group, redefine the
// "createJvmCompilationMetaNode()" factory method, and make it return "null"
//
initJvmCompilation(server);
// Initialization of the "JvmRuntime" group.
// To disable support of this group, redefine the
// "createJvmRuntimeMetaNode()" factory method, and make it return "null"
//
initJvmRuntime(server);
// Initialization of the "JvmThreading" group.
// To disable support of this group, redefine the
// "createJvmThreadingMetaNode()" factory method, and make it return "null"
//
initJvmThreading(server);
// Initialization of the "JvmMemory" group.
// To disable support of this group, redefine the
// "createJvmMemoryMetaNode()" factory method, and make it return "null"
//
initJvmMemory(server);
// Initialization of the "JvmClassLoading" group.
// To disable support of this group, redefine the
// "createJvmClassLoadingMetaNode()" factory method, and make it return "null"
//
initJvmClassLoading(server);
isInitialized = true;
}
// ------------------------------------------------------------
//
// Initialization of the "JvmOS" group.
//
// ------------------------------------------------------------
/**
* Initialization of the "JvmOS" group.
*
* To disable support of this group, redefine the
* "createJvmOSMetaNode()" factory method, and make it return "null"
*
* @param server MBeanServer for this group (may be null)
*
**/
protected void initJvmOS(MBeanServer server)
throws Exception {
final String oid = getGroupOid("JvmOS", "1.3.6.1.4.1.42.2.145.3.163.1.1.6");
ObjectName objname = null;
if (server != null) {
objname = getGroupObjectName("JvmOS", oid, mibName + ":name=sun.management.snmp.jvmmib.JvmOS");
}
final JvmOSMeta meta = createJvmOSMetaNode("JvmOS", oid, objname, server);
if (meta != null) {
meta.registerTableNodes( this, server );
// Note that when using standard metadata,
// the returned object must implement the "JvmOSMBean"
// interface.
//
final JvmOSMBean group = (JvmOSMBean) createJvmOSMBean("JvmOS", oid, objname, server);
meta.setInstance( group );
registerGroupNode("JvmOS", oid, objname, meta, group, server);
}
}
/**
* Factory method for "JvmOS" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmOS")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmOS" group (JvmOSMeta)
*
**/
protected JvmOSMeta createJvmOSMetaNode(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
return new JvmOSMeta(this, objectserver);
}
/**
* Factory method for "JvmOS" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmOS")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmOS" group (JvmOS)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmOSMBean"
* interface.
**/
protected abstract Object createJvmOSMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server);
// ------------------------------------------------------------
//
// Initialization of the "JvmCompilation" group.
//
// ------------------------------------------------------------
/**
* Initialization of the "JvmCompilation" group.
*
* To disable support of this group, redefine the
* "createJvmCompilationMetaNode()" factory method, and make it return "null"
*
* @param server MBeanServer for this group (may be null)
*
**/
protected void initJvmCompilation(MBeanServer server)
throws Exception {
final String oid = getGroupOid("JvmCompilation", "1.3.6.1.4.1.42.2.145.3.163.1.1.5");
ObjectName objname = null;
if (server != null) {
objname = getGroupObjectName("JvmCompilation", oid, mibName + ":name=sun.management.snmp.jvmmib.JvmCompilation");
}
final JvmCompilationMeta meta = createJvmCompilationMetaNode("JvmCompilation", oid, objname, server);
if (meta != null) {
meta.registerTableNodes( this, server );
// Note that when using standard metadata,
// the returned object must implement the "JvmCompilationMBean"
// interface.
//
final JvmCompilationMBean group = (JvmCompilationMBean) createJvmCompilationMBean("JvmCompilation", oid, objname, server);
meta.setInstance( group );
registerGroupNode("JvmCompilation", oid, objname, meta, group, server);
}
}
/**
* Factory method for "JvmCompilation" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmCompilation")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmCompilation" group (JvmCompilationMeta)
*
**/
protected JvmCompilationMeta createJvmCompilationMetaNode(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
return new JvmCompilationMeta(this, objectserver);
}
/**
* Factory method for "JvmCompilation" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmCompilation")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmCompilation" group (JvmCompilation)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmCompilationMBean"
* interface.
**/
protected abstract Object createJvmCompilationMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server);
// ------------------------------------------------------------
//
// Initialization of the "JvmRuntime" group.
//
// ------------------------------------------------------------
/**
* Initialization of the "JvmRuntime" group.
*
* To disable support of this group, redefine the
* "createJvmRuntimeMetaNode()" factory method, and make it return "null"
*
* @param server MBeanServer for this group (may be null)
*
**/
protected void initJvmRuntime(MBeanServer server)
throws Exception {
final String oid = getGroupOid("JvmRuntime", "1.3.6.1.4.1.42.2.145.3.163.1.1.4");
ObjectName objname = null;
if (server != null) {
objname = getGroupObjectName("JvmRuntime", oid, mibName + ":name=sun.management.snmp.jvmmib.JvmRuntime");
}
final JvmRuntimeMeta meta = createJvmRuntimeMetaNode("JvmRuntime", oid, objname, server);
if (meta != null) {
meta.registerTableNodes( this, server );
// Note that when using standard metadata,
// the returned object must implement the "JvmRuntimeMBean"
// interface.
//
final JvmRuntimeMBean group = (JvmRuntimeMBean) createJvmRuntimeMBean("JvmRuntime", oid, objname, server);
meta.setInstance( group );
registerGroupNode("JvmRuntime", oid, objname, meta, group, server);
}
}
/**
* Factory method for "JvmRuntime" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmRuntime")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRuntime" group (JvmRuntimeMeta)
*
**/
protected JvmRuntimeMeta createJvmRuntimeMetaNode(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
return new JvmRuntimeMeta(this, objectserver);
}
/**
* Factory method for "JvmRuntime" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmRuntime")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmRuntime" group (JvmRuntime)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmRuntimeMBean"
* interface.
**/
protected abstract Object createJvmRuntimeMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server);
// ------------------------------------------------------------
//
// Initialization of the "JvmThreading" group.
//
// ------------------------------------------------------------
/**
* Initialization of the "JvmThreading" group.
*
* To disable support of this group, redefine the
* "createJvmThreadingMetaNode()" factory method, and make it return "null"
*
* @param server MBeanServer for this group (may be null)
*
**/
protected void initJvmThreading(MBeanServer server)
throws Exception {
final String oid = getGroupOid("JvmThreading", "1.3.6.1.4.1.42.2.145.3.163.1.1.3");
ObjectName objname = null;
if (server != null) {
objname = getGroupObjectName("JvmThreading", oid, mibName + ":name=sun.management.snmp.jvmmib.JvmThreading");
}
final JvmThreadingMeta meta = createJvmThreadingMetaNode("JvmThreading", oid, objname, server);
if (meta != null) {
meta.registerTableNodes( this, server );
// Note that when using standard metadata,
// the returned object must implement the "JvmThreadingMBean"
// interface.
//
final JvmThreadingMBean group = (JvmThreadingMBean) createJvmThreadingMBean("JvmThreading", oid, objname, server);
meta.setInstance( group );
registerGroupNode("JvmThreading", oid, objname, meta, group, server);
}
}
/**
* Factory method for "JvmThreading" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmThreading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmThreading" group (JvmThreadingMeta)
*
**/
protected JvmThreadingMeta createJvmThreadingMetaNode(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
return new JvmThreadingMeta(this, objectserver);
}
/**
* Factory method for "JvmThreading" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmThreading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmThreading" group (JvmThreading)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmThreadingMBean"
* interface.
**/
protected abstract Object createJvmThreadingMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server);
// ------------------------------------------------------------
//
// Initialization of the "JvmMemory" group.
//
// ------------------------------------------------------------
/**
* Initialization of the "JvmMemory" group.
*
* To disable support of this group, redefine the
* "createJvmMemoryMetaNode()" factory method, and make it return "null"
*
* @param server MBeanServer for this group (may be null)
*
**/
protected void initJvmMemory(MBeanServer server)
throws Exception {
final String oid = getGroupOid("JvmMemory", "1.3.6.1.4.1.42.2.145.3.163.1.1.2");
ObjectName objname = null;
if (server != null) {
objname = getGroupObjectName("JvmMemory", oid, mibName + ":name=sun.management.snmp.jvmmib.JvmMemory");
}
final JvmMemoryMeta meta = createJvmMemoryMetaNode("JvmMemory", oid, objname, server);
if (meta != null) {
meta.registerTableNodes( this, server );
// Note that when using standard metadata,
// the returned object must implement the "JvmMemoryMBean"
// interface.
//
final JvmMemoryMBean group = (JvmMemoryMBean) createJvmMemoryMBean("JvmMemory", oid, objname, server);
meta.setInstance( group );
registerGroupNode("JvmMemory", oid, objname, meta, group, server);
}
}
/**
* Factory method for "JvmMemory" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmMemory")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemory" group (JvmMemoryMeta)
*
**/
protected JvmMemoryMeta createJvmMemoryMetaNode(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
return new JvmMemoryMeta(this, objectserver);
}
/**
* Factory method for "JvmMemory" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmMemory")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmMemory" group (JvmMemory)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmMemoryMBean"
* interface.
**/
protected abstract Object createJvmMemoryMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server);
// ------------------------------------------------------------
//
// Initialization of the "JvmClassLoading" group.
//
// ------------------------------------------------------------
/**
* Initialization of the "JvmClassLoading" group.
*
* To disable support of this group, redefine the
* "createJvmClassLoadingMetaNode()" factory method, and make it return "null"
*
* @param server MBeanServer for this group (may be null)
*
**/
protected void initJvmClassLoading(MBeanServer server)
throws Exception {
final String oid = getGroupOid("JvmClassLoading", "1.3.6.1.4.1.42.2.145.3.163.1.1.1");
ObjectName objname = null;
if (server != null) {
objname = getGroupObjectName("JvmClassLoading", oid, mibName + ":name=sun.management.snmp.jvmmib.JvmClassLoading");
}
final JvmClassLoadingMeta meta = createJvmClassLoadingMetaNode("JvmClassLoading", oid, objname, server);
if (meta != null) {
meta.registerTableNodes( this, server );
// Note that when using standard metadata,
// the returned object must implement the "JvmClassLoadingMBean"
// interface.
//
final JvmClassLoadingMBean group = (JvmClassLoadingMBean) createJvmClassLoadingMBean("JvmClassLoading", oid, objname, server);
meta.setInstance( group );
registerGroupNode("JvmClassLoading", oid, objname, meta, group, server);
}
}
/**
* Factory method for "JvmClassLoading" group metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param groupName Name of the group ("JvmClassLoading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmClassLoading" group (JvmClassLoadingMeta)
*
**/
protected JvmClassLoadingMeta createJvmClassLoadingMetaNode(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server) {
return new JvmClassLoadingMeta(this, objectserver);
}
/**
* Factory method for "JvmClassLoading" group MBean.
*
* You can redefine this method if you need to replace the default
* generated MBean class with your own customized class.
*
* @param groupName Name of the group ("JvmClassLoading")
* @param groupOid OID of this group
* @param groupObjname ObjectName for this group (may be null)
* @param server MBeanServer for this group (may be null)
*
* @return An instance of the MBean class generated for the
* "JvmClassLoading" group (JvmClassLoading)
*
* Note that when using standard metadata,
* the returned object must implement the "JvmClassLoadingMBean"
* interface.
**/
protected abstract Object createJvmClassLoadingMBean(String groupName,
String groupOid, ObjectName groupObjname, MBeanServer server);
// ------------------------------------------------------------
//
// Implements the "registerTableMeta" method defined in "SnmpMib".
// See the "SnmpMib" Javadoc API for more details.
//
// ------------------------------------------------------------
public void registerTableMeta( String name, SnmpMibTable meta) {
if (metadatas == null) return;
if (name == null) return;
metadatas.put(name,meta);
}
// ------------------------------------------------------------
//
// Implements the "getRegisteredTableMeta" method defined in "SnmpMib".
// See the "SnmpMib" Javadoc API for more details.
//
// ------------------------------------------------------------
public SnmpMibTable getRegisteredTableMeta( String name ) {
if (metadatas == null) return null;
if (name == null) return null;
return metadatas.get(name);
}
public SnmpStandardObjectServer getStandardObjectServer() {
if (objectserver == null)
objectserver = new SnmpStandardObjectServer();
return objectserver;
}
private boolean isInitialized = false;
protected SnmpStandardObjectServer objectserver;
protected final Hashtable<String, SnmpMibTable> metadatas =
new Hashtable<String, SnmpMibTable>();
}

View File

@@ -0,0 +1,168 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import com.sun.jmx.snmp.SnmpOidRecord;
// jdmk imports
//
import com.sun.jmx.snmp.SnmpOidTableSupport;
/**
* The class contains metadata definitions for "JVM-MANAGEMENT-MIB".
* Call SnmpOid.setSnmpOidTable(new JVM_MANAGEMENT_MIBOidTable()) to load the metadata in the SnmpOidTable.
*/
public class JVM_MANAGEMENT_MIBOidTable extends SnmpOidTableSupport implements Serializable {
static final long serialVersionUID = -5010870014488732061L;
/**
* Default constructor. Initialize the Mib tree.
*/
public JVM_MANAGEMENT_MIBOidTable() {
super("JVM_MANAGEMENT_MIB");
loadMib(varList);
}
static SnmpOidRecord varList [] = {
new SnmpOidRecord("jvmOSProcessorCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.6.4", "I"),
new SnmpOidRecord("jvmOSVersion", "1.3.6.1.4.1.42.2.145.3.163.1.1.6.3", "S"),
new SnmpOidRecord("jvmOSArch", "1.3.6.1.4.1.42.2.145.3.163.1.1.6.2", "S"),
new SnmpOidRecord("jvmOSName", "1.3.6.1.4.1.42.2.145.3.163.1.1.6.1", "S"),
new SnmpOidRecord("jvmJITCompilerTimeMonitoring", "1.3.6.1.4.1.42.2.145.3.163.1.1.5.3", "I"),
new SnmpOidRecord("jvmJITCompilerTimeMs", "1.3.6.1.4.1.42.2.145.3.163.1.1.5.2", "C64"),
new SnmpOidRecord("jvmJITCompilerName", "1.3.6.1.4.1.42.2.145.3.163.1.1.5.1", "S"),
new SnmpOidRecord("jvmRTLibraryPathTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.23", "TA"),
new SnmpOidRecord("jvmRTLibraryPathEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.23.1", "EN"),
new SnmpOidRecord("jvmRTLibraryPathItem", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.23.1.2", "S"),
new SnmpOidRecord("jvmRTLibraryPathIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.23.1.1", "I"),
new SnmpOidRecord("jvmRTClassPathTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.22", "TA"),
new SnmpOidRecord("jvmRTClassPathEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.22.1", "EN"),
new SnmpOidRecord("jvmRTClassPathItem", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.22.1.2", "S"),
new SnmpOidRecord("jvmRTClassPathIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.22.1.1", "I"),
new SnmpOidRecord("jvmRTBootClassPathTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.21", "TA"),
new SnmpOidRecord("jvmRTBootClassPathEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.21.1", "EN"),
new SnmpOidRecord("jvmRTBootClassPathItem", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.21.1.2", "S"),
new SnmpOidRecord("jvmRTBootClassPathIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.21.1.1", "I"),
new SnmpOidRecord("jvmRTBootClassPathSupport", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.9", "I"),
new SnmpOidRecord("jvmRTInputArgsTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.20", "TA"),
new SnmpOidRecord("jvmRTInputArgsEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.1", "EN"),
new SnmpOidRecord("jvmRTInputArgsItem", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.1.2", "S"),
new SnmpOidRecord("jvmRTInputArgsIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.1.1", "I"),
new SnmpOidRecord("jvmRTManagementSpecVersion", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.8", "S"),
new SnmpOidRecord("jvmRTSpecVersion", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.7", "S"),
new SnmpOidRecord("jvmRTSpecVendor", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.6", "S"),
new SnmpOidRecord("jvmRTSpecName", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.5", "S"),
new SnmpOidRecord("jvmRTVMVersion", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.4", "S"),
new SnmpOidRecord("jvmRTVMVendor", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.3", "S"),
new SnmpOidRecord("jvmRTStartTimeMs", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.12", "C64"),
new SnmpOidRecord("jvmRTUptimeMs", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.11", "C64"),
new SnmpOidRecord("jvmRTVMName", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.2", "S"),
new SnmpOidRecord("jvmRTName", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.1", "S"),
new SnmpOidRecord("jvmRTInputArgsCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.4.10", "I"),
new SnmpOidRecord("jvmThreadCpuTimeMonitoring", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.6", "I"),
new SnmpOidRecord("jvmThreadContentionMonitoring", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.5", "I"),
new SnmpOidRecord("jvmThreadTotalStartedCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.4", "C64"),
new SnmpOidRecord("jvmThreadPeakCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.3", "C"),
new SnmpOidRecord("jvmThreadDaemonCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.2", "G"),
new SnmpOidRecord("jvmThreadCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.1", "G"),
new SnmpOidRecord("jvmThreadInstanceTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10", "TA"),
new SnmpOidRecord("jvmThreadInstanceEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1", "EN"),
new SnmpOidRecord("jvmThreadInstName", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.9", "S"),
new SnmpOidRecord("jvmThreadInstCpuTimeNs", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.8", "C64"),
new SnmpOidRecord("jvmThreadInstWaitTimeMs", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.7", "C64"),
new SnmpOidRecord("jvmThreadInstWaitCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.6", "C64"),
new SnmpOidRecord("jvmThreadInstBlockTimeMs", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.5", "C64"),
new SnmpOidRecord("jvmThreadInstBlockCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.4", "C64"),
new SnmpOidRecord("jvmThreadInstState", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.3", "S"),
new SnmpOidRecord("jvmThreadInstLockOwnerPtr", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.11", "OI"),
new SnmpOidRecord("jvmThreadInstId", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.2", "C64"),
new SnmpOidRecord("jvmThreadInstLockName", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.10", "S"),
new SnmpOidRecord("jvmThreadInstIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.1", "S"),
new SnmpOidRecord("jvmThreadPeakCountReset", "1.3.6.1.4.1.42.2.145.3.163.1.1.3.7", "C64"),
new SnmpOidRecord("jvmMemMgrPoolRelTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.120", "TA"),
new SnmpOidRecord("jvmMemMgrPoolRelEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.120.1", "EN"),
new SnmpOidRecord("jvmMemMgrRelPoolName", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.120.1.3", "S"),
new SnmpOidRecord("jvmMemMgrRelManagerName", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.120.1.2", "S"),
new SnmpOidRecord("jvmMemoryNonHeapMaxSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.23", "C64"),
new SnmpOidRecord("jvmMemoryNonHeapCommitted", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.22", "C64"),
new SnmpOidRecord("jvmMemoryNonHeapUsed", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.21", "C64"),
new SnmpOidRecord("jvmMemPoolTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110", "TA"),
new SnmpOidRecord("jvmMemPoolEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1", "EN"),
new SnmpOidRecord("jvmMemPoolCollectMaxSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.33", "C64"),
new SnmpOidRecord("jvmMemPoolCollectCommitted", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.32", "C64"),
new SnmpOidRecord("jvmMemPoolCollectUsed", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.31", "C64"),
new SnmpOidRecord("jvmMemPoolCollectThreshdSupport", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.133", "I"),
new SnmpOidRecord("jvmMemPoolCollectThreshdCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.132", "C64"),
new SnmpOidRecord("jvmMemPoolCollectThreshold", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.131", "C64"),
new SnmpOidRecord("jvmMemPoolMaxSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.13", "C64"),
new SnmpOidRecord("jvmMemPoolCommitted", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.12", "C64"),
new SnmpOidRecord("jvmMemPoolUsed", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.11", "C64"),
new SnmpOidRecord("jvmMemPoolInitSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.10", "C64"),
new SnmpOidRecord("jvmMemPoolThreshdSupport", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.112", "I"),
new SnmpOidRecord("jvmMemPoolThreshdCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.111", "C64"),
new SnmpOidRecord("jvmMemPoolThreshold", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.110", "C64"),
new SnmpOidRecord("jvmMemPoolPeakReset", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.5", "C64"),
new SnmpOidRecord("jvmMemPoolState", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.4", "I"),
new SnmpOidRecord("jvmMemPoolType", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.3", "I"),
new SnmpOidRecord("jvmMemPoolName", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.2", "S"),
new SnmpOidRecord("jvmMemPoolPeakMaxSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.23", "C64"),
new SnmpOidRecord("jvmMemPoolIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.1", "I"),
new SnmpOidRecord("jvmMemPoolPeakCommitted", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.22", "C64"),
new SnmpOidRecord("jvmMemPoolPeakUsed", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.21", "C64"),
new SnmpOidRecord("jvmMemoryNonHeapInitSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.20", "C64"),
new SnmpOidRecord("jvmMemoryHeapMaxSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.13", "C64"),
new SnmpOidRecord("jvmMemoryHeapCommitted", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.12", "C64"),
new SnmpOidRecord("jvmMemoryGCCall", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.3", "I"),
new SnmpOidRecord("jvmMemoryHeapUsed", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.11", "C64"),
new SnmpOidRecord("jvmMemoryGCVerboseLevel", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.2", "I"),
new SnmpOidRecord("jvmMemGCTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.101", "TA"),
new SnmpOidRecord("jvmMemGCEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.101.1", "EN"),
new SnmpOidRecord("jvmMemGCTimeMs", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.101.1.3", "C64"),
new SnmpOidRecord("jvmMemGCCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.101.1.2", "C64"),
new SnmpOidRecord("jvmMemoryHeapInitSize", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.10", "C64"),
new SnmpOidRecord("jvmMemoryPendingFinalCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.1", "G"),
new SnmpOidRecord("jvmMemManagerTable", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.100", "TA"),
new SnmpOidRecord("jvmMemManagerEntry", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.100.1", "EN"),
new SnmpOidRecord("jvmMemManagerState", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.100.1.3", "I"),
new SnmpOidRecord("jvmMemManagerName", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.100.1.2", "S"),
new SnmpOidRecord("jvmMemManagerIndex", "1.3.6.1.4.1.42.2.145.3.163.1.1.2.100.1.1", "I"),
new SnmpOidRecord("jvmClassesVerboseLevel", "1.3.6.1.4.1.42.2.145.3.163.1.1.1.4", "I"),
new SnmpOidRecord("jvmClassesUnloadedCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.1.3", "C64"),
new SnmpOidRecord("jvmClassesTotalLoadedCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.1.2", "C64"),
new SnmpOidRecord("jvmClassesLoadedCount", "1.3.6.1.4.1.42.2.145.3.163.1.1.1.1", "G"),
new SnmpOidRecord("jvmLowMemoryPoolUsageNotif", "1.3.6.1.4.1.42.2.145.3.163.1.2.2.1.0.1", "NT"),
new SnmpOidRecord("jvmLowMemoryPoolCollectNotif", "1.3.6.1.4.1.42.2.145.3.163.1.2.2.1.0.2", "NT") };
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmClassLoading" MBean.
*/
public interface JvmClassLoadingMBean {
/**
* Getter for the "JvmClassesVerboseLevel" variable.
*/
public EnumJvmClassesVerboseLevel getJvmClassesVerboseLevel() throws SnmpStatusException;
/**
* Setter for the "JvmClassesVerboseLevel" variable.
*/
public void setJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException;
/**
* Checker for the "JvmClassesVerboseLevel" variable.
*/
public void checkJvmClassesVerboseLevel(EnumJvmClassesVerboseLevel x) throws SnmpStatusException;
/**
* Getter for the "JvmClassesUnloadedCount" variable.
*/
public Long getJvmClassesUnloadedCount() throws SnmpStatusException;
/**
* Getter for the "JvmClassesTotalLoadedCount" variable.
*/
public Long getJvmClassesTotalLoadedCount() throws SnmpStatusException;
/**
* Getter for the "JvmClassesLoadedCount" variable.
*/
public Long getJvmClassesLoadedCount() throws SnmpStatusException;
}

View File

@@ -0,0 +1,329 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmClassLoading" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.1.
*/
public class JvmClassLoadingMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 5722857476941218568L;
/**
* Constructor for the metadata associated to "JvmClassLoading".
*/
public JvmClassLoadingMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
try {
registerObject(4);
registerObject(3);
registerObject(2);
registerObject(1);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 4:
return new SnmpInt(node.getJvmClassesVerboseLevel());
case 3:
return new SnmpCounter64(node.getJvmClassesUnloadedCount());
case 2:
return new SnmpCounter64(node.getJvmClassesTotalLoadedCount());
case 1:
return new SnmpGauge(node.getJvmClassesLoadedCount());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 4:
if (x instanceof SnmpInt) {
try {
node.setJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
return new SnmpInt(node.getJvmClassesVerboseLevel());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 4:
if (x instanceof SnmpInt) {
try {
node.checkJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmClassLoadingMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 4:
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 4:
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 3:
case 2:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 4:
return "JvmClassesVerboseLevel";
case 3:
return "JvmClassesUnloadedCount";
case 2:
return "JvmClassesTotalLoadedCount";
case 1:
return "JvmClassesLoadedCount";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Returns true if "arc" identifies a table object.
*/
public boolean isTable(long arc) {
switch((int)arc) {
default:
break;
}
return false;
}
/**
* Returns the table object identified by "arc".
*/
public SnmpMibTable getTable(long arc) {
return null;
}
/**
* Register the group's SnmpMibTable objects with the meta-data.
*/
public void registerTableNodes(SnmpMib mib, MBeanServer server) {
}
protected JvmClassLoadingMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmCompilation" MBean.
*/
public interface JvmCompilationMBean {
/**
* Getter for the "JvmJITCompilerTimeMonitoring" variable.
*/
public EnumJvmJITCompilerTimeMonitoring getJvmJITCompilerTimeMonitoring() throws SnmpStatusException;
/**
* Getter for the "JvmJITCompilerTimeMs" variable.
*/
public Long getJvmJITCompilerTimeMs() throws SnmpStatusException;
/**
* Getter for the "JvmJITCompilerName" variable.
*/
public String getJvmJITCompilerName() throws SnmpStatusException;
}

View File

@@ -0,0 +1,295 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmCompilation" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.5.
*/
public class JvmCompilationMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -95492874115033638L;
/**
* Constructor for the metadata associated to "JvmCompilation".
*/
public JvmCompilationMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
try {
registerObject(3);
registerObject(2);
registerObject(1);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
return new SnmpInt(node.getJvmJITCompilerTimeMonitoring());
case 2:
return new SnmpCounter64(node.getJvmJITCompilerTimeMs());
case 1:
return new SnmpString(node.getJvmJITCompilerName());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmCompilationMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 2:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 3:
return "JvmJITCompilerTimeMonitoring";
case 2:
return "JvmJITCompilerTimeMs";
case 1:
return "JvmJITCompilerName";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Returns true if "arc" identifies a table object.
*/
public boolean isTable(long arc) {
switch((int)arc) {
default:
break;
}
return false;
}
/**
* Returns the table object identified by "arc".
*/
public SnmpMibTable getTable(long arc) {
return null;
}
/**
* Register the group's SnmpMibTable objects with the meta-data.
*/
public void registerTableNodes(SnmpMib mib, MBeanServer server) {
}
protected JvmCompilationMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmMemGCEntry" MBean.
*/
public interface JvmMemGCEntryMBean {
/**
* Getter for the "JvmMemGCTimeMs" variable.
*/
public Long getJvmMemGCTimeMs() throws SnmpStatusException;
/**
* Getter for the "JvmMemGCCount" variable.
*/
public Long getJvmMemGCCount() throws SnmpStatusException;
/**
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,255 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmMemGCEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.101.1.
*/
public class JvmMemGCEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 6082082529298387063L;
/**
* Constructor for the metadata associated to "JvmMemGCEntry".
*/
public JvmMemGCEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[2];
varList[0] = 3;
varList[1] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
return new SnmpCounter64(node.getJvmMemGCTimeMs());
case 2:
return new SnmpCounter64(node.getJvmMemGCCount());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmMemGCEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 3:
case 2:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 3:
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 3:
case 2:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 3:
return "JvmMemGCTimeMs";
case 2:
return "JvmMemGCCount";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmMemGCEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmMemGCTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.101.
*/
public class JvmMemGCTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -8843296871149264612L;
/**
* Constructor for the table. Initialize metadata for "JvmMemGCTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmMemGCTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmMemGCEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmMemGCEntry")
* @param tableName Name of the table in which the entries are registered ("JvmMemGCTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemGCEntry" conceptual row (JvmMemGCEntryMeta)
*
**/
protected JvmMemGCEntryMeta createJvmMemGCEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmMemGCEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmMemGCEntryMetaNode("JvmMemGCEntry", "JvmMemGCTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmMemGCEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmMemGCTable" + "\" must implement the \"" +
"JvmMemGCEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmMemGCEntryMBean entry = (JvmMemGCEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmMemGCEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmMemManagerEntry" MBean.
*/
public interface JvmMemManagerEntryMBean {
/**
* Getter for the "JvmMemManagerState" variable.
*/
public EnumJvmMemManagerState getJvmMemManagerState() throws SnmpStatusException;
/**
* Getter for the "JvmMemManagerName" variable.
*/
public String getJvmMemManagerName() throws SnmpStatusException;
/**
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmMemManagerEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.100.1.
*/
public class JvmMemManagerEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 8166956416408970453L;
/**
* Constructor for the metadata associated to "JvmMemManagerEntry".
*/
public JvmMemManagerEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[2];
varList[0] = 3;
varList[1] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
return new SnmpInt(node.getJvmMemManagerState());
case 2:
return new SnmpString(node.getJvmMemManagerName());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmMemManagerEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 3:
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 3:
return "JvmMemManagerState";
case 2:
return "JvmMemManagerName";
case 1:
return "JvmMemManagerIndex";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmMemManagerEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmMemManagerTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.100.
*/
public class JvmMemManagerTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 5026520607518015233L;
/**
* Constructor for the table. Initialize metadata for "JvmMemManagerTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmMemManagerTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmMemManagerEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmMemManagerEntry")
* @param tableName Name of the table in which the entries are registered ("JvmMemManagerTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemManagerEntry" conceptual row (JvmMemManagerEntryMeta)
*
**/
protected JvmMemManagerEntryMeta createJvmMemManagerEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmMemManagerEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmMemManagerEntryMetaNode("JvmMemManagerEntry", "JvmMemManagerTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmMemManagerEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmMemManagerTable" + "\" must implement the \"" +
"JvmMemManagerEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmMemManagerEntryMBean entry = (JvmMemManagerEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemManagerEntryMBean entry = (JvmMemManagerEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemManagerEntryMBean entry = (JvmMemManagerEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmMemManagerEntryMBean entry = (JvmMemManagerEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmMemManagerEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmMemMgrPoolRelEntry" MBean.
*/
public interface JvmMemMgrPoolRelEntryMBean {
/**
* Getter for the "JvmMemMgrRelPoolName" variable.
*/
public String getJvmMemMgrRelPoolName() throws SnmpStatusException;
/**
* Getter for the "JvmMemMgrRelManagerName" variable.
*/
public String getJvmMemMgrRelManagerName() throws SnmpStatusException;
/**
* Getter for the "JvmMemManagerIndex" variable.
*/
public Integer getJvmMemManagerIndex() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolIndex" variable.
*/
public Integer getJvmMemPoolIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,247 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmMemMgrPoolRelEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.120.1.
*/
public class JvmMemMgrPoolRelEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 7414270971113459798L;
/**
* Constructor for the metadata associated to "JvmMemMgrPoolRelEntry".
*/
public JvmMemMgrPoolRelEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[2];
varList[0] = 3;
varList[1] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
return new SnmpString(node.getJvmMemMgrRelPoolName());
case 2:
return new SnmpString(node.getJvmMemMgrRelManagerName());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmMemMgrPoolRelEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 3:
case 2:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 3:
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 3:
return "JvmMemMgrRelPoolName";
case 2:
return "JvmMemMgrRelManagerName";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmMemMgrPoolRelEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmMemMgrPoolRelTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.120.
*/
public class JvmMemMgrPoolRelTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -310733366542788998L;
/**
* Constructor for the table. Initialize metadata for "JvmMemMgrPoolRelTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmMemMgrPoolRelTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmMemMgrPoolRelEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmMemMgrPoolRelEntry")
* @param tableName Name of the table in which the entries are registered ("JvmMemMgrPoolRelTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemMgrPoolRelEntry" conceptual row (JvmMemMgrPoolRelEntryMeta)
*
**/
protected JvmMemMgrPoolRelEntryMeta createJvmMemMgrPoolRelEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmMemMgrPoolRelEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmMemMgrPoolRelEntryMetaNode("JvmMemMgrPoolRelEntry", "JvmMemMgrPoolRelTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmMemMgrPoolRelEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmMemMgrPoolRelTable" + "\" must implement the \"" +
"JvmMemMgrPoolRelEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmMemMgrPoolRelEntryMBean entry = (JvmMemMgrPoolRelEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemMgrPoolRelEntryMBean entry = (JvmMemMgrPoolRelEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemMgrPoolRelEntryMBean entry = (JvmMemMgrPoolRelEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmMemMgrPoolRelEntryMBean entry = (JvmMemMgrPoolRelEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmMemMgrPoolRelEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,177 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmMemPoolEntry" MBean.
*/
public interface JvmMemPoolEntryMBean {
/**
* Getter for the "JvmMemPoolCollectMaxSize" variable.
*/
public Long getJvmMemPoolCollectMaxSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolCollectCommitted" variable.
*/
public Long getJvmMemPoolCollectCommitted() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolCollectUsed" variable.
*/
public Long getJvmMemPoolCollectUsed() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolCollectThreshdSupport" variable.
*/
public EnumJvmMemPoolCollectThreshdSupport getJvmMemPoolCollectThreshdSupport() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolCollectThreshdCount" variable.
*/
public Long getJvmMemPoolCollectThreshdCount() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolCollectThreshold" variable.
*/
public Long getJvmMemPoolCollectThreshold() throws SnmpStatusException;
/**
* Setter for the "JvmMemPoolCollectThreshold" variable.
*/
public void setJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException;
/**
* Checker for the "JvmMemPoolCollectThreshold" variable.
*/
public void checkJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolMaxSize" variable.
*/
public Long getJvmMemPoolMaxSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolCommitted" variable.
*/
public Long getJvmMemPoolCommitted() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolUsed" variable.
*/
public Long getJvmMemPoolUsed() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolInitSize" variable.
*/
public Long getJvmMemPoolInitSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolThreshdSupport" variable.
*/
public EnumJvmMemPoolThreshdSupport getJvmMemPoolThreshdSupport() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolThreshdCount" variable.
*/
public Long getJvmMemPoolThreshdCount() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolThreshold" variable.
*/
public Long getJvmMemPoolThreshold() throws SnmpStatusException;
/**
* Setter for the "JvmMemPoolThreshold" variable.
*/
public void setJvmMemPoolThreshold(Long x) throws SnmpStatusException;
/**
* Checker for the "JvmMemPoolThreshold" variable.
*/
public void checkJvmMemPoolThreshold(Long x) throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolPeakReset" variable.
*/
public Long getJvmMemPoolPeakReset() throws SnmpStatusException;
/**
* Setter for the "JvmMemPoolPeakReset" variable.
*/
public void setJvmMemPoolPeakReset(Long x) throws SnmpStatusException;
/**
* Checker for the "JvmMemPoolPeakReset" variable.
*/
public void checkJvmMemPoolPeakReset(Long x) throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolState" variable.
*/
public EnumJvmMemPoolState getJvmMemPoolState() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolType" variable.
*/
public EnumJvmMemPoolType getJvmMemPoolType() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolName" variable.
*/
public String getJvmMemPoolName() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolPeakMaxSize" variable.
*/
public Long getJvmMemPoolPeakMaxSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolIndex" variable.
*/
public Integer getJvmMemPoolIndex() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolPeakCommitted" variable.
*/
public Long getJvmMemPoolPeakCommitted() throws SnmpStatusException;
/**
* Getter for the "JvmMemPoolPeakUsed" variable.
*/
public Long getJvmMemPoolPeakUsed() throws SnmpStatusException;
}

View File

@@ -0,0 +1,584 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmMemPoolEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.1.
*/
public class JvmMemPoolEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 7220682779249102830L;
/**
* Constructor for the metadata associated to "JvmMemPoolEntry".
*/
public JvmMemPoolEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[20];
varList[0] = 33;
varList[1] = 32;
varList[2] = 31;
varList[3] = 133;
varList[4] = 132;
varList[5] = 131;
varList[6] = 13;
varList[7] = 12;
varList[8] = 11;
varList[9] = 10;
varList[10] = 112;
varList[11] = 111;
varList[12] = 110;
varList[13] = 5;
varList[14] = 4;
varList[15] = 3;
varList[16] = 2;
varList[17] = 23;
varList[18] = 22;
varList[19] = 21;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 33:
return new SnmpCounter64(node.getJvmMemPoolCollectMaxSize());
case 32:
return new SnmpCounter64(node.getJvmMemPoolCollectCommitted());
case 31:
return new SnmpCounter64(node.getJvmMemPoolCollectUsed());
case 133:
return new SnmpInt(node.getJvmMemPoolCollectThreshdSupport());
case 132:
return new SnmpCounter64(node.getJvmMemPoolCollectThreshdCount());
case 131:
return new SnmpCounter64(node.getJvmMemPoolCollectThreshold());
case 13:
return new SnmpCounter64(node.getJvmMemPoolMaxSize());
case 12:
return new SnmpCounter64(node.getJvmMemPoolCommitted());
case 11:
return new SnmpCounter64(node.getJvmMemPoolUsed());
case 10:
return new SnmpCounter64(node.getJvmMemPoolInitSize());
case 112:
return new SnmpInt(node.getJvmMemPoolThreshdSupport());
case 111:
return new SnmpCounter64(node.getJvmMemPoolThreshdCount());
case 110:
return new SnmpCounter64(node.getJvmMemPoolThreshold());
case 5:
return new SnmpCounter64(node.getJvmMemPoolPeakReset());
case 4:
return new SnmpInt(node.getJvmMemPoolState());
case 3:
return new SnmpInt(node.getJvmMemPoolType());
case 2:
return new SnmpString(node.getJvmMemPoolName());
case 23:
return new SnmpCounter64(node.getJvmMemPoolPeakMaxSize());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
case 22:
return new SnmpCounter64(node.getJvmMemPoolPeakCommitted());
case 21:
return new SnmpCounter64(node.getJvmMemPoolPeakUsed());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 33:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 32:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 31:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 133:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 132:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 131:
if (x instanceof SnmpCounter64) {
node.setJvmMemPoolCollectThreshold(((SnmpCounter64)x).toLong());
return new SnmpCounter64(node.getJvmMemPoolCollectThreshold());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 13:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 12:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 112:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 111:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 110:
if (x instanceof SnmpCounter64) {
node.setJvmMemPoolThreshold(((SnmpCounter64)x).toLong());
return new SnmpCounter64(node.getJvmMemPoolThreshold());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 5:
if (x instanceof SnmpCounter64) {
node.setJvmMemPoolPeakReset(((SnmpCounter64)x).toLong());
return new SnmpCounter64(node.getJvmMemPoolPeakReset());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 23:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 22:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 21:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 33:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 32:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 31:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 133:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 132:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 131:
if (x instanceof SnmpCounter64) {
node.checkJvmMemPoolCollectThreshold(((SnmpCounter64)x).toLong());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 13:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 12:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 112:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 111:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 110:
if (x instanceof SnmpCounter64) {
node.checkJvmMemPoolThreshold(((SnmpCounter64)x).toLong());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 5:
if (x instanceof SnmpCounter64) {
node.checkJvmMemPoolPeakReset(((SnmpCounter64)x).toLong());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 23:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 22:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 21:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmMemPoolEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 33:
case 32:
case 31:
case 133:
case 132:
case 131:
case 13:
case 12:
case 11:
case 10:
case 112:
case 111:
case 110:
case 5:
case 4:
case 3:
case 2:
case 23:
case 1:
case 22:
case 21:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 33:
case 32:
case 31:
case 133:
case 132:
case 131:
case 13:
case 12:
case 11:
case 10:
case 112:
case 111:
case 110:
case 5:
case 4:
case 3:
case 2:
case 23:
case 22:
case 21:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 33:
case 32:
case 31:
case 132:
case 131:
case 13:
case 12:
case 11:
case 10:
case 111:
case 110:
case 5:
case 23:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
case 1:
return true;
case 22:
case 21:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 33:
return "JvmMemPoolCollectMaxSize";
case 32:
return "JvmMemPoolCollectCommitted";
case 31:
return "JvmMemPoolCollectUsed";
case 133:
return "JvmMemPoolCollectThreshdSupport";
case 132:
return "JvmMemPoolCollectThreshdCount";
case 131:
return "JvmMemPoolCollectThreshold";
case 13:
return "JvmMemPoolMaxSize";
case 12:
return "JvmMemPoolCommitted";
case 11:
return "JvmMemPoolUsed";
case 10:
return "JvmMemPoolInitSize";
case 112:
return "JvmMemPoolThreshdSupport";
case 111:
return "JvmMemPoolThreshdCount";
case 110:
return "JvmMemPoolThreshold";
case 5:
return "JvmMemPoolPeakReset";
case 4:
return "JvmMemPoolState";
case 3:
return "JvmMemPoolType";
case 2:
return "JvmMemPoolName";
case 23:
return "JvmMemPoolPeakMaxSize";
case 1:
return "JvmMemPoolIndex";
case 22:
return "JvmMemPoolPeakCommitted";
case 21:
return "JvmMemPoolPeakUsed";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmMemPoolEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,266 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmMemPoolTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.110.
*/
public class JvmMemPoolTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -2799470815264898659L;
/**
* Constructor for the table. Initialize metadata for "JvmMemPoolTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmMemPoolTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmMemPoolEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmMemPoolEntry")
* @param tableName Name of the table in which the entries are registered ("JvmMemPoolTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemPoolEntry" conceptual row (JvmMemPoolEntryMeta)
*
**/
protected JvmMemPoolEntryMeta createJvmMemPoolEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmMemPoolEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmMemPoolEntryMetaNode("JvmMemPoolEntry", "JvmMemPoolTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmMemPoolEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmMemPoolTable" + "\" must implement the \"" +
"JvmMemPoolEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmMemPoolEntryMBean entry = (JvmMemPoolEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmMemPoolEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmMemory" MBean.
*/
public interface JvmMemoryMBean {
/**
* Getter for the "JvmMemoryNonHeapMaxSize" variable.
*/
public Long getJvmMemoryNonHeapMaxSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryNonHeapCommitted" variable.
*/
public Long getJvmMemoryNonHeapCommitted() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryNonHeapUsed" variable.
*/
public Long getJvmMemoryNonHeapUsed() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryNonHeapInitSize" variable.
*/
public Long getJvmMemoryNonHeapInitSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryHeapMaxSize" variable.
*/
public Long getJvmMemoryHeapMaxSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryHeapCommitted" variable.
*/
public Long getJvmMemoryHeapCommitted() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryGCCall" variable.
*/
public EnumJvmMemoryGCCall getJvmMemoryGCCall() throws SnmpStatusException;
/**
* Setter for the "JvmMemoryGCCall" variable.
*/
public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException;
/**
* Checker for the "JvmMemoryGCCall" variable.
*/
public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException;
/**
* Getter for the "JvmMemoryHeapUsed" variable.
*/
public Long getJvmMemoryHeapUsed() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryGCVerboseLevel" variable.
*/
public EnumJvmMemoryGCVerboseLevel getJvmMemoryGCVerboseLevel() throws SnmpStatusException;
/**
* Setter for the "JvmMemoryGCVerboseLevel" variable.
*/
public void setJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x) throws SnmpStatusException;
/**
* Checker for the "JvmMemoryGCVerboseLevel" variable.
*/
public void checkJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x) throws SnmpStatusException;
/**
* Getter for the "JvmMemoryHeapInitSize" variable.
*/
public Long getJvmMemoryHeapInitSize() throws SnmpStatusException;
/**
* Getter for the "JvmMemoryPendingFinalCount" variable.
*/
public Long getJvmMemoryPendingFinalCount() throws SnmpStatusException;
}

View File

@@ -0,0 +1,655 @@
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmMemory" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.2.
*/
public class JvmMemoryMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer {
private static final long serialVersionUID = 9047644262627149214L;
/**
* Constructor for the metadata associated to "JvmMemory".
*/
public JvmMemoryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
try {
registerObject(120);
registerObject(23);
registerObject(22);
registerObject(21);
registerObject(110);
registerObject(20);
registerObject(13);
registerObject(12);
registerObject(3);
registerObject(11);
registerObject(2);
registerObject(101);
registerObject(10);
registerObject(1);
registerObject(100);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 120: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 23:
return new SnmpCounter64(node.getJvmMemoryNonHeapMaxSize());
case 22:
return new SnmpCounter64(node.getJvmMemoryNonHeapCommitted());
case 21:
return new SnmpCounter64(node.getJvmMemoryNonHeapUsed());
case 110: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 20:
return new SnmpCounter64(node.getJvmMemoryNonHeapInitSize());
case 13:
return new SnmpCounter64(node.getJvmMemoryHeapMaxSize());
case 12:
return new SnmpCounter64(node.getJvmMemoryHeapCommitted());
case 3:
return new SnmpInt(node.getJvmMemoryGCCall());
case 11:
return new SnmpCounter64(node.getJvmMemoryHeapUsed());
case 2:
return new SnmpInt(node.getJvmMemoryGCVerboseLevel());
case 101: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 10:
return new SnmpCounter64(node.getJvmMemoryHeapInitSize());
case 1:
return new SnmpGauge(node.getJvmMemoryPendingFinalCount());
case 100: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 120: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 23:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 22:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 21:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 110: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 20:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 13:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 12:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
if (x instanceof SnmpInt) {
try {
node.setJvmMemoryGCCall( new EnumJvmMemoryGCCall (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
return new SnmpInt(node.getJvmMemoryGCCall());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
if (x instanceof SnmpInt) {
try {
node.setJvmMemoryGCVerboseLevel( new EnumJvmMemoryGCVerboseLevel (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
return new SnmpInt(node.getJvmMemoryGCVerboseLevel());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 101: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 100: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 120: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 23:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 22:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 21:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 110: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 20:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 13:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 12:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
if (x instanceof SnmpInt) {
try {
node.checkJvmMemoryGCCall( new EnumJvmMemoryGCCall (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
if (x instanceof SnmpInt) {
try {
node.checkJvmMemoryGCVerboseLevel( new EnumJvmMemoryGCVerboseLevel (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 101: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 100: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmMemoryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 23:
case 22:
case 21:
case 20:
case 13:
case 12:
case 3:
case 11:
case 2:
case 10:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 23:
case 22:
case 21:
case 20:
case 13:
case 12:
case 3:
case 11:
case 2:
case 10:
case 1:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 23:
case 22:
case 21:
case 20:
case 13:
case 12:
case 11:
case 10:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 120: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 23:
return "JvmMemoryNonHeapMaxSize";
case 22:
return "JvmMemoryNonHeapCommitted";
case 21:
return "JvmMemoryNonHeapUsed";
case 110: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 20:
return "JvmMemoryNonHeapInitSize";
case 13:
return "JvmMemoryHeapMaxSize";
case 12:
return "JvmMemoryHeapCommitted";
case 3:
return "JvmMemoryGCCall";
case 11:
return "JvmMemoryHeapUsed";
case 2:
return "JvmMemoryGCVerboseLevel";
case 101: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 10:
return "JvmMemoryHeapInitSize";
case 1:
return "JvmMemoryPendingFinalCount";
case 100: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Returns true if "arc" identifies a table object.
*/
public boolean isTable(long arc) {
switch((int)arc) {
case 120:
return true;
case 110:
return true;
case 101:
return true;
case 100:
return true;
default:
break;
}
return false;
}
/**
* Returns the table object identified by "arc".
*/
public SnmpMibTable getTable(long arc) {
switch((int)arc) {
case 120:
return tableJvmMemMgrPoolRelTable;
case 110:
return tableJvmMemPoolTable;
case 101:
return tableJvmMemGCTable;
case 100:
return tableJvmMemManagerTable;
default:
break;
}
return null;
}
/**
* Register the group's SnmpMibTable objects with the meta-data.
*/
public void registerTableNodes(SnmpMib mib, MBeanServer server) {
tableJvmMemMgrPoolRelTable = createJvmMemMgrPoolRelTableMetaNode("JvmMemMgrPoolRelTable", "JvmMemory", mib, server);
if ( tableJvmMemMgrPoolRelTable != null) {
tableJvmMemMgrPoolRelTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmMemMgrPoolRelTable", tableJvmMemMgrPoolRelTable);
}
tableJvmMemPoolTable = createJvmMemPoolTableMetaNode("JvmMemPoolTable", "JvmMemory", mib, server);
if ( tableJvmMemPoolTable != null) {
tableJvmMemPoolTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmMemPoolTable", tableJvmMemPoolTable);
}
tableJvmMemGCTable = createJvmMemGCTableMetaNode("JvmMemGCTable", "JvmMemory", mib, server);
if ( tableJvmMemGCTable != null) {
tableJvmMemGCTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmMemGCTable", tableJvmMemGCTable);
}
tableJvmMemManagerTable = createJvmMemManagerTableMetaNode("JvmMemManagerTable", "JvmMemory", mib, server);
if ( tableJvmMemManagerTable != null) {
tableJvmMemManagerTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmMemManagerTable", tableJvmMemManagerTable);
}
}
/**
* Factory method for "JvmMemMgrPoolRelTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemMgrPoolRelTable")
* @param groupName Name of the group to which this table belong ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemMgrPoolRelTable" table (JvmMemMgrPoolRelTableMeta)
*
**/
protected JvmMemMgrPoolRelTableMeta createJvmMemMgrPoolRelTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmMemMgrPoolRelTableMeta(mib, objectserver);
}
/**
* Factory method for "JvmMemPoolTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemPoolTable")
* @param groupName Name of the group to which this table belong ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemPoolTable" table (JvmMemPoolTableMeta)
*
**/
protected JvmMemPoolTableMeta createJvmMemPoolTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmMemPoolTableMeta(mib, objectserver);
}
/**
* Factory method for "JvmMemGCTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemGCTable")
* @param groupName Name of the group to which this table belong ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemGCTable" table (JvmMemGCTableMeta)
*
**/
protected JvmMemGCTableMeta createJvmMemGCTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmMemGCTableMeta(mib, objectserver);
}
/**
* Factory method for "JvmMemManagerTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmMemManagerTable")
* @param groupName Name of the group to which this table belong ("JvmMemory")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmMemManagerTable" table (JvmMemManagerTableMeta)
*
**/
protected JvmMemManagerTableMeta createJvmMemManagerTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmMemManagerTableMeta(mib, objectserver);
}
protected JvmMemoryMBean node;
protected SnmpStandardObjectServer objectserver = null;
protected JvmMemMgrPoolRelTableMeta tableJvmMemMgrPoolRelTable = null;
protected JvmMemPoolTableMeta tableJvmMemPoolTable = null;
protected JvmMemGCTableMeta tableJvmMemGCTable = null;
protected JvmMemManagerTableMeta tableJvmMemManagerTable = null;
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmOS" MBean.
*/
public interface JvmOSMBean {
/**
* Getter for the "JvmOSProcessorCount" variable.
*/
public Integer getJvmOSProcessorCount() throws SnmpStatusException;
/**
* Getter for the "JvmOSVersion" variable.
*/
public String getJvmOSVersion() throws SnmpStatusException;
/**
* Getter for the "JvmOSArch" variable.
*/
public String getJvmOSArch() throws SnmpStatusException;
/**
* Getter for the "JvmOSName" variable.
*/
public String getJvmOSName() throws SnmpStatusException;
}

View File

@@ -0,0 +1,304 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmOS" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.6.
*/
public class JvmOSMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -2024138733580127133L;
/**
* Constructor for the metadata associated to "JvmOS".
*/
public JvmOSMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
try {
registerObject(4);
registerObject(3);
registerObject(2);
registerObject(1);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 4:
return new SnmpInt(node.getJvmOSProcessorCount());
case 3:
return new SnmpString(node.getJvmOSVersion());
case 2:
return new SnmpString(node.getJvmOSArch());
case 1:
return new SnmpString(node.getJvmOSName());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmOSMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 4:
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 4:
case 3:
case 2:
case 1:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 4:
return "JvmOSProcessorCount";
case 3:
return "JvmOSVersion";
case 2:
return "JvmOSArch";
case 1:
return "JvmOSName";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Returns true if "arc" identifies a table object.
*/
public boolean isTable(long arc) {
switch((int)arc) {
default:
break;
}
return false;
}
/**
* Returns the table object identified by "arc".
*/
public SnmpMibTable getTable(long arc) {
return null;
}
/**
* Register the group's SnmpMibTable objects with the meta-data.
*/
public void registerTableNodes(SnmpMib mib, MBeanServer server) {
}
protected JvmOSMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmRTBootClassPathEntry" MBean.
*/
public interface JvmRTBootClassPathEntryMBean {
/**
* Getter for the "JvmRTBootClassPathItem" variable.
*/
public String getJvmRTBootClassPathItem() throws SnmpStatusException;
/**
* Getter for the "JvmRTBootClassPathIndex" variable.
*/
public Integer getJvmRTBootClassPathIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,250 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmRTBootClassPathEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.21.1.
*/
public class JvmRTBootClassPathEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 7703840715080588941L;
/**
* Constructor for the metadata associated to "JvmRTBootClassPathEntry".
*/
public JvmRTBootClassPathEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[1];
varList[0] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
return new SnmpString(node.getJvmRTBootClassPathItem());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmRTBootClassPathEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 2:
return "JvmRTBootClassPathItem";
case 1:
return "JvmRTBootClassPathIndex";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmRTBootClassPathEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmRTBootClassPathTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.21.
*/
public class JvmRTBootClassPathTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 42471379600792135L;
/**
* Constructor for the table. Initialize metadata for "JvmRTBootClassPathTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmRTBootClassPathTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmRTBootClassPathEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmRTBootClassPathEntry")
* @param tableName Name of the table in which the entries are registered ("JvmRTBootClassPathTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTBootClassPathEntry" conceptual row (JvmRTBootClassPathEntryMeta)
*
**/
protected JvmRTBootClassPathEntryMeta createJvmRTBootClassPathEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmRTBootClassPathEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmRTBootClassPathEntryMetaNode("JvmRTBootClassPathEntry", "JvmRTBootClassPathTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmRTBootClassPathEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmRTBootClassPathTable" + "\" must implement the \"" +
"JvmRTBootClassPathEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmRTBootClassPathEntryMBean entry = (JvmRTBootClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTBootClassPathEntryMBean entry = (JvmRTBootClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTBootClassPathEntryMBean entry = (JvmRTBootClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmRTBootClassPathEntryMBean entry = (JvmRTBootClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmRTBootClassPathEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmRTClassPathEntry" MBean.
*/
public interface JvmRTClassPathEntryMBean {
/**
* Getter for the "JvmRTClassPathItem" variable.
*/
public String getJvmRTClassPathItem() throws SnmpStatusException;
/**
* Getter for the "JvmRTClassPathIndex" variable.
*/
public Integer getJvmRTClassPathIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,250 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmRTClassPathEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.22.1.
*/
public class JvmRTClassPathEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 3388703998226830801L;
/**
* Constructor for the metadata associated to "JvmRTClassPathEntry".
*/
public JvmRTClassPathEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[1];
varList[0] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
return new SnmpString(node.getJvmRTClassPathItem());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmRTClassPathEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 2:
return "JvmRTClassPathItem";
case 1:
return "JvmRTClassPathIndex";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmRTClassPathEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmRTClassPathTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.22.
*/
public class JvmRTClassPathTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -1518727175345404443L;
/**
* Constructor for the table. Initialize metadata for "JvmRTClassPathTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmRTClassPathTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmRTClassPathEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmRTClassPathEntry")
* @param tableName Name of the table in which the entries are registered ("JvmRTClassPathTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTClassPathEntry" conceptual row (JvmRTClassPathEntryMeta)
*
**/
protected JvmRTClassPathEntryMeta createJvmRTClassPathEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmRTClassPathEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmRTClassPathEntryMetaNode("JvmRTClassPathEntry", "JvmRTClassPathTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmRTClassPathEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmRTClassPathTable" + "\" must implement the \"" +
"JvmRTClassPathEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmRTClassPathEntryMBean entry = (JvmRTClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTClassPathEntryMBean entry = (JvmRTClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTClassPathEntryMBean entry = (JvmRTClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmRTClassPathEntryMBean entry = (JvmRTClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmRTClassPathEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmRTInputArgsEntry" MBean.
*/
public interface JvmRTInputArgsEntryMBean {
/**
* Getter for the "JvmRTInputArgsItem" variable.
*/
public String getJvmRTInputArgsItem() throws SnmpStatusException;
/**
* Getter for the "JvmRTInputArgsIndex" variable.
*/
public Integer getJvmRTInputArgsIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,250 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmRTInputArgsEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.1.
*/
public class JvmRTInputArgsEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -7729576810347358025L;
/**
* Constructor for the metadata associated to "JvmRTInputArgsEntry".
*/
public JvmRTInputArgsEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[1];
varList[0] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
return new SnmpString(node.getJvmRTInputArgsItem());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmRTInputArgsEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 2:
return "JvmRTInputArgsItem";
case 1:
return "JvmRTInputArgsIndex";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmRTInputArgsEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmRTInputArgsTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.20.
*/
public class JvmRTInputArgsTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 5395531763015738645L;
/**
* Constructor for the table. Initialize metadata for "JvmRTInputArgsTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmRTInputArgsTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmRTInputArgsEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmRTInputArgsEntry")
* @param tableName Name of the table in which the entries are registered ("JvmRTInputArgsTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTInputArgsEntry" conceptual row (JvmRTInputArgsEntryMeta)
*
**/
protected JvmRTInputArgsEntryMeta createJvmRTInputArgsEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmRTInputArgsEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmRTInputArgsEntryMetaNode("JvmRTInputArgsEntry", "JvmRTInputArgsTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmRTInputArgsEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmRTInputArgsTable" + "\" must implement the \"" +
"JvmRTInputArgsEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmRTInputArgsEntryMBean entry = (JvmRTInputArgsEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmRTInputArgsEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmRTLibraryPathEntry" MBean.
*/
public interface JvmRTLibraryPathEntryMBean {
/**
* Getter for the "JvmRTLibraryPathItem" variable.
*/
public String getJvmRTLibraryPathItem() throws SnmpStatusException;
/**
* Getter for the "JvmRTLibraryPathIndex" variable.
*/
public Integer getJvmRTLibraryPathIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,250 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmRTLibraryPathEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.23.1.
*/
public class JvmRTLibraryPathEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -5851555586263475792L;
/**
* Constructor for the metadata associated to "JvmRTLibraryPathEntry".
*/
public JvmRTLibraryPathEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[1];
varList[0] = 2;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
return new SnmpString(node.getJvmRTLibraryPathItem());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmRTLibraryPathEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 2:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 2:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 2:
return "JvmRTLibraryPathItem";
case 1:
return "JvmRTLibraryPathIndex";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmRTLibraryPathEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmRTLibraryPathTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.23.
*/
public class JvmRTLibraryPathTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = -632403620113109468L;
/**
* Constructor for the table. Initialize metadata for "JvmRTLibraryPathTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmRTLibraryPathTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmRTLibraryPathEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmRTLibraryPathEntry")
* @param tableName Name of the table in which the entries are registered ("JvmRTLibraryPathTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTLibraryPathEntry" conceptual row (JvmRTLibraryPathEntryMeta)
*
**/
protected JvmRTLibraryPathEntryMeta createJvmRTLibraryPathEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmRTLibraryPathEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmRTLibraryPathEntryMetaNode("JvmRTLibraryPathEntry", "JvmRTLibraryPathTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmRTLibraryPathEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmRTLibraryPathTable" + "\" must implement the \"" +
"JvmRTLibraryPathEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmRTLibraryPathEntryMBean entry = (JvmRTLibraryPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmRTLibraryPathEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmRuntime" MBean.
*/
public interface JvmRuntimeMBean {
/**
* Getter for the "JvmRTBootClassPathSupport" variable.
*/
public EnumJvmRTBootClassPathSupport getJvmRTBootClassPathSupport() throws SnmpStatusException;
/**
* Getter for the "JvmRTManagementSpecVersion" variable.
*/
public String getJvmRTManagementSpecVersion() throws SnmpStatusException;
/**
* Getter for the "JvmRTSpecVersion" variable.
*/
public String getJvmRTSpecVersion() throws SnmpStatusException;
/**
* Getter for the "JvmRTSpecVendor" variable.
*/
public String getJvmRTSpecVendor() throws SnmpStatusException;
/**
* Getter for the "JvmRTSpecName" variable.
*/
public String getJvmRTSpecName() throws SnmpStatusException;
/**
* Getter for the "JvmRTVMVersion" variable.
*/
public String getJvmRTVMVersion() throws SnmpStatusException;
/**
* Getter for the "JvmRTVMVendor" variable.
*/
public String getJvmRTVMVendor() throws SnmpStatusException;
/**
* Getter for the "JvmRTStartTimeMs" variable.
*/
public Long getJvmRTStartTimeMs() throws SnmpStatusException;
/**
* Getter for the "JvmRTUptimeMs" variable.
*/
public Long getJvmRTUptimeMs() throws SnmpStatusException;
/**
* Getter for the "JvmRTVMName" variable.
*/
public String getJvmRTVMName() throws SnmpStatusException;
/**
* Getter for the "JvmRTName" variable.
*/
public String getJvmRTName() throws SnmpStatusException;
/**
* Getter for the "JvmRTInputArgsCount" variable.
*/
public Integer getJvmRTInputArgsCount() throws SnmpStatusException;
}

View File

@@ -0,0 +1,628 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmRuntime" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.4.
*/
public class JvmRuntimeMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 1994595220765880109L;
/**
* Constructor for the metadata associated to "JvmRuntime".
*/
public JvmRuntimeMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
try {
registerObject(23);
registerObject(22);
registerObject(21);
registerObject(9);
registerObject(20);
registerObject(8);
registerObject(7);
registerObject(6);
registerObject(5);
registerObject(4);
registerObject(3);
registerObject(12);
registerObject(11);
registerObject(2);
registerObject(1);
registerObject(10);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 23: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 22: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 21: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 9:
return new SnmpInt(node.getJvmRTBootClassPathSupport());
case 20: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 8:
return new SnmpString(node.getJvmRTManagementSpecVersion());
case 7:
return new SnmpString(node.getJvmRTSpecVersion());
case 6:
return new SnmpString(node.getJvmRTSpecVendor());
case 5:
return new SnmpString(node.getJvmRTSpecName());
case 4:
return new SnmpString(node.getJvmRTVMVersion());
case 3:
return new SnmpString(node.getJvmRTVMVendor());
case 12:
return new SnmpCounter64(node.getJvmRTStartTimeMs());
case 11:
return new SnmpCounter64(node.getJvmRTUptimeMs());
case 2:
return new SnmpString(node.getJvmRTVMName());
case 1:
return new SnmpString(node.getJvmRTName());
case 10:
return new SnmpInt(node.getJvmRTInputArgsCount());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 23: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 22: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 21: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 9:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 20: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 8:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 7:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 6:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 5:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 12:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 23: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 22: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 21: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 9:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 20: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 8:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 7:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 6:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 5:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 12:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmRuntimeMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 12:
case 11:
case 2:
case 1:
case 10:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 12:
case 11:
case 2:
case 1:
case 10:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 12:
case 11:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 23: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 22: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 21: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 9:
return "JvmRTBootClassPathSupport";
case 20: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 8:
return "JvmRTManagementSpecVersion";
case 7:
return "JvmRTSpecVersion";
case 6:
return "JvmRTSpecVendor";
case 5:
return "JvmRTSpecName";
case 4:
return "JvmRTVMVersion";
case 3:
return "JvmRTVMVendor";
case 12:
return "JvmRTStartTimeMs";
case 11:
return "JvmRTUptimeMs";
case 2:
return "JvmRTVMName";
case 1:
return "JvmRTName";
case 10:
return "JvmRTInputArgsCount";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Returns true if "arc" identifies a table object.
*/
public boolean isTable(long arc) {
switch((int)arc) {
case 23:
return true;
case 22:
return true;
case 21:
return true;
case 20:
return true;
default:
break;
}
return false;
}
/**
* Returns the table object identified by "arc".
*/
public SnmpMibTable getTable(long arc) {
switch((int)arc) {
case 23:
return tableJvmRTLibraryPathTable;
case 22:
return tableJvmRTClassPathTable;
case 21:
return tableJvmRTBootClassPathTable;
case 20:
return tableJvmRTInputArgsTable;
default:
break;
}
return null;
}
/**
* Register the group's SnmpMibTable objects with the meta-data.
*/
public void registerTableNodes(SnmpMib mib, MBeanServer server) {
tableJvmRTLibraryPathTable = createJvmRTLibraryPathTableMetaNode("JvmRTLibraryPathTable", "JvmRuntime", mib, server);
if ( tableJvmRTLibraryPathTable != null) {
tableJvmRTLibraryPathTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmRTLibraryPathTable", tableJvmRTLibraryPathTable);
}
tableJvmRTClassPathTable = createJvmRTClassPathTableMetaNode("JvmRTClassPathTable", "JvmRuntime", mib, server);
if ( tableJvmRTClassPathTable != null) {
tableJvmRTClassPathTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmRTClassPathTable", tableJvmRTClassPathTable);
}
tableJvmRTBootClassPathTable = createJvmRTBootClassPathTableMetaNode("JvmRTBootClassPathTable", "JvmRuntime", mib, server);
if ( tableJvmRTBootClassPathTable != null) {
tableJvmRTBootClassPathTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmRTBootClassPathTable", tableJvmRTBootClassPathTable);
}
tableJvmRTInputArgsTable = createJvmRTInputArgsTableMetaNode("JvmRTInputArgsTable", "JvmRuntime", mib, server);
if ( tableJvmRTInputArgsTable != null) {
tableJvmRTInputArgsTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmRTInputArgsTable", tableJvmRTInputArgsTable);
}
}
/**
* Factory method for "JvmRTLibraryPathTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTLibraryPathTable")
* @param groupName Name of the group to which this table belong ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTLibraryPathTable" table (JvmRTLibraryPathTableMeta)
*
**/
protected JvmRTLibraryPathTableMeta createJvmRTLibraryPathTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmRTLibraryPathTableMeta(mib, objectserver);
}
/**
* Factory method for "JvmRTClassPathTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTClassPathTable")
* @param groupName Name of the group to which this table belong ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTClassPathTable" table (JvmRTClassPathTableMeta)
*
**/
protected JvmRTClassPathTableMeta createJvmRTClassPathTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmRTClassPathTableMeta(mib, objectserver);
}
/**
* Factory method for "JvmRTBootClassPathTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTBootClassPathTable")
* @param groupName Name of the group to which this table belong ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTBootClassPathTable" table (JvmRTBootClassPathTableMeta)
*
**/
protected JvmRTBootClassPathTableMeta createJvmRTBootClassPathTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmRTBootClassPathTableMeta(mib, objectserver);
}
/**
* Factory method for "JvmRTInputArgsTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmRTInputArgsTable")
* @param groupName Name of the group to which this table belong ("JvmRuntime")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmRTInputArgsTable" table (JvmRTInputArgsTableMeta)
*
**/
protected JvmRTInputArgsTableMeta createJvmRTInputArgsTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmRTInputArgsTableMeta(mib, objectserver);
}
protected JvmRuntimeMBean node;
protected SnmpStandardObjectServer objectserver = null;
protected JvmRTLibraryPathTableMeta tableJvmRTLibraryPathTable = null;
protected JvmRTClassPathTableMeta tableJvmRTClassPathTable = null;
protected JvmRTBootClassPathTableMeta tableJvmRTBootClassPathTable = null;
protected JvmRTInputArgsTableMeta tableJvmRTInputArgsTable = null;
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmThreadInstanceEntry" MBean.
*/
public interface JvmThreadInstanceEntryMBean {
/**
* Getter for the "JvmThreadInstName" variable.
*/
public String getJvmThreadInstName() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstCpuTimeNs" variable.
*/
public Long getJvmThreadInstCpuTimeNs() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstWaitTimeMs" variable.
*/
public Long getJvmThreadInstWaitTimeMs() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstWaitCount" variable.
*/
public Long getJvmThreadInstWaitCount() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstBlockTimeMs" variable.
*/
public Long getJvmThreadInstBlockTimeMs() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstBlockCount" variable.
*/
public Long getJvmThreadInstBlockCount() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstState" variable.
*/
public Byte[] getJvmThreadInstState() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstLockOwnerPtr" variable.
*/
public String getJvmThreadInstLockOwnerPtr() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstId" variable.
*/
public Long getJvmThreadInstId() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstLockName" variable.
*/
public String getJvmThreadInstLockName() throws SnmpStatusException;
/**
* Getter for the "JvmThreadInstIndex" variable.
*/
public Byte[] getJvmThreadInstIndex() throws SnmpStatusException;
}

View File

@@ -0,0 +1,393 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMibNode;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibEntry;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmThreadInstanceEntry" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.
*/
public class JvmThreadInstanceEntryMeta extends SnmpMibEntry
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = -2015330111801477399L;
/**
* Constructor for the metadata associated to "JvmThreadInstanceEntry".
*/
public JvmThreadInstanceEntryMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
varList = new int[10];
varList[0] = 9;
varList[1] = 8;
varList[2] = 7;
varList[3] = 6;
varList[4] = 5;
varList[5] = 4;
varList[6] = 3;
varList[7] = 11;
varList[8] = 2;
varList[9] = 10;
SnmpMibNode.sort(varList);
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 9:
return new SnmpString(node.getJvmThreadInstName());
case 8:
return new SnmpCounter64(node.getJvmThreadInstCpuTimeNs());
case 7:
return new SnmpCounter64(node.getJvmThreadInstWaitTimeMs());
case 6:
return new SnmpCounter64(node.getJvmThreadInstWaitCount());
case 5:
return new SnmpCounter64(node.getJvmThreadInstBlockTimeMs());
case 4:
return new SnmpCounter64(node.getJvmThreadInstBlockCount());
case 3:
return new SnmpString(node.getJvmThreadInstState());
case 11:
return new SnmpOid(node.getJvmThreadInstLockOwnerPtr());
case 2:
return new SnmpCounter64(node.getJvmThreadInstId());
case 10:
return new SnmpString(node.getJvmThreadInstLockName());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 9:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 8:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 7:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 6:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 5:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 9:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 8:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 7:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 6:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 5:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 11:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmThreadInstanceEntryMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 11:
case 2:
case 10:
case 1:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 11:
case 2:
case 10:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibEntry".
// See the "SnmpMibEntry" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 8:
case 7:
case 6:
case 5:
case 4:
case 2:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
case 1:
return true;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 9:
return "JvmThreadInstName";
case 8:
return "JvmThreadInstCpuTimeNs";
case 7:
return "JvmThreadInstWaitTimeMs";
case 6:
return "JvmThreadInstWaitCount";
case 5:
return "JvmThreadInstBlockTimeMs";
case 4:
return "JvmThreadInstBlockCount";
case 3:
return "JvmThreadInstState";
case 11:
return "JvmThreadInstLockOwnerPtr";
case 2:
return "JvmThreadInstId";
case 10:
return "JvmThreadInstLockName";
case 1:
return "JvmThreadInstIndex";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
protected JvmThreadInstanceEntryMBean node;
protected SnmpStandardObjectServer objectserver = null;
}

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
import java.util.Vector;
// jmx imports
//
import javax.management.MBeanServer;
import javax.management.ObjectName;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpIndex;
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
/**
* The class is used for implementing the "JvmThreadInstanceTable" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.
*/
public class JvmThreadInstanceTableMeta extends SnmpMibTable implements Serializable {
static final long serialVersionUID = 2519514732589115954L;
/**
* Constructor for the table. Initialize metadata for "JvmThreadInstanceTableMeta".
* The reference on the MBean server is updated so the entries created through an SNMP SET will be AUTOMATICALLY REGISTERED in Java DMK.
*/
public JvmThreadInstanceTableMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
super(myMib);
objectserver = objserv;
}
/**
* Factory method for "JvmThreadInstanceEntry" entry metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param snmpEntryName Name of the SNMP Entry object (conceptual row) ("JvmThreadInstanceEntry")
* @param tableName Name of the table in which the entries are registered ("JvmThreadInstanceTable")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmThreadInstanceEntry" conceptual row (JvmThreadInstanceEntryMeta)
*
**/
protected JvmThreadInstanceEntryMeta createJvmThreadInstanceEntryMetaNode(String snmpEntryName, String tableName, SnmpMib mib, MBeanServer server) {
return new JvmThreadInstanceEntryMeta(mib, objectserver);
}
// ------------------------------------------------------------
//
// Implements the "createNewEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (factory != null)
factory.createNewEntry(req, rowOid, depth, this);
else
throw new SnmpStatusException(
SnmpStatusException.snmpRspNoAccess);
}
// ------------------------------------------------------------
//
// Implements the "isRegistrationRequired" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean isRegistrationRequired() {
return false;
}
public void registerEntryNode(SnmpMib mib, MBeanServer server) {
node = createJvmThreadInstanceEntryMetaNode("JvmThreadInstanceEntry", "JvmThreadInstanceTable", mib, server);
}
// ------------------------------------------------------------
//
// Implements the "addEntry" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
Object entry)
throws SnmpStatusException {
if (! (entry instanceof JvmThreadInstanceEntryMBean) )
throw new ClassCastException("Entries for Table \"" +
"JvmThreadInstanceTable" + "\" must implement the \"" +
"JvmThreadInstanceEntryMBean" + "\" interface.");
super.addEntry(rowOid, objname, entry);
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
JvmThreadInstanceEntryMBean entry = (JvmThreadInstanceEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.get(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmThreadInstanceEntryMBean entry = (JvmThreadInstanceEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.set(req,depth);
}
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
throws SnmpStatusException {
if (req.getSize() == 0) return;
JvmThreadInstanceEntryMBean entry = (JvmThreadInstanceEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
node.check(req,depth);
}
}
/**
* check that the given "var" identifies a columnar object.
*/
public void validateVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
node.validateVarId(var, data);
}
/**
* Returns true if "var" identifies a readable scalar object.
*/
public boolean isReadableEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
return node.isReadable(var);
}
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
// ------------------------------------------------------------
//
// Implements the "skipEntryVariable" method defined in "SnmpMibTable".
// See the "SnmpMibTable" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmThreadInstanceEntryMBean entry = (JvmThreadInstanceEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
/**
* Reference to the entry metadata.
*/
private JvmThreadInstanceEntryMeta node;
/**
* Reference to the object server.
*/
protected SnmpStandardObjectServer objectserver;
}

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// jmx imports
//
import com.sun.jmx.snmp.SnmpStatusException;
/**
* This interface is used for representing the remote management interface for the "JvmThreading" MBean.
*/
public interface JvmThreadingMBean {
/**
* Getter for the "JvmThreadCpuTimeMonitoring" variable.
*/
public EnumJvmThreadCpuTimeMonitoring getJvmThreadCpuTimeMonitoring() throws SnmpStatusException;
/**
* Setter for the "JvmThreadCpuTimeMonitoring" variable.
*/
public void setJvmThreadCpuTimeMonitoring(EnumJvmThreadCpuTimeMonitoring x) throws SnmpStatusException;
/**
* Checker for the "JvmThreadCpuTimeMonitoring" variable.
*/
public void checkJvmThreadCpuTimeMonitoring(EnumJvmThreadCpuTimeMonitoring x) throws SnmpStatusException;
/**
* Getter for the "JvmThreadContentionMonitoring" variable.
*/
public EnumJvmThreadContentionMonitoring getJvmThreadContentionMonitoring() throws SnmpStatusException;
/**
* Setter for the "JvmThreadContentionMonitoring" variable.
*/
public void setJvmThreadContentionMonitoring(EnumJvmThreadContentionMonitoring x) throws SnmpStatusException;
/**
* Checker for the "JvmThreadContentionMonitoring" variable.
*/
public void checkJvmThreadContentionMonitoring(EnumJvmThreadContentionMonitoring x) throws SnmpStatusException;
/**
* Getter for the "JvmThreadTotalStartedCount" variable.
*/
public Long getJvmThreadTotalStartedCount() throws SnmpStatusException;
/**
* Getter for the "JvmThreadPeakCount" variable.
*/
public Long getJvmThreadPeakCount() throws SnmpStatusException;
/**
* Getter for the "JvmThreadDaemonCount" variable.
*/
public Long getJvmThreadDaemonCount() throws SnmpStatusException;
/**
* Getter for the "JvmThreadCount" variable.
*/
public Long getJvmThreadCount() throws SnmpStatusException;
/**
* Getter for the "JvmThreadPeakCountReset" variable.
*/
public Long getJvmThreadPeakCountReset() throws SnmpStatusException;
/**
* Setter for the "JvmThreadPeakCountReset" variable.
*/
public void setJvmThreadPeakCountReset(Long x) throws SnmpStatusException;
/**
* Checker for the "JvmThreadPeakCountReset" variable.
*/
public void checkJvmThreadPeakCountReset(Long x) throws SnmpStatusException;
}

View File

@@ -0,0 +1,455 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.jvmmib;
//
// Generated by mibgen version 5.0 (06/02/03) when compiling JVM-MANAGEMENT-MIB in standard metadata mode.
//
// java imports
//
import java.io.Serializable;
// jmx imports
//
import javax.management.MBeanServer;
import com.sun.jmx.snmp.SnmpCounter;
import com.sun.jmx.snmp.SnmpCounter64;
import com.sun.jmx.snmp.SnmpGauge;
import com.sun.jmx.snmp.SnmpInt;
import com.sun.jmx.snmp.SnmpUnsignedInt;
import com.sun.jmx.snmp.SnmpIpAddress;
import com.sun.jmx.snmp.SnmpTimeticks;
import com.sun.jmx.snmp.SnmpOpaque;
import com.sun.jmx.snmp.SnmpString;
import com.sun.jmx.snmp.SnmpStringFixed;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpNull;
import com.sun.jmx.snmp.SnmpValue;
import com.sun.jmx.snmp.SnmpVarBind;
import com.sun.jmx.snmp.SnmpStatusException;
// jdmk imports
//
import com.sun.jmx.snmp.agent.SnmpMib;
import com.sun.jmx.snmp.agent.SnmpMibGroup;
import com.sun.jmx.snmp.agent.SnmpStandardObjectServer;
import com.sun.jmx.snmp.agent.SnmpStandardMetaServer;
import com.sun.jmx.snmp.agent.SnmpMibSubRequest;
import com.sun.jmx.snmp.agent.SnmpMibTable;
import com.sun.jmx.snmp.EnumRowStatus;
import com.sun.jmx.snmp.SnmpDefinitions;
/**
* The class is used for representing SNMP metadata for the "JvmThreading" group.
* The group is defined with the following oid: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.
*/
public class JvmThreadingMeta extends SnmpMibGroup
implements Serializable, SnmpStandardMetaServer {
static final long serialVersionUID = 5223833578005322854L;
/**
* Constructor for the metadata associated to "JvmThreading".
*/
public JvmThreadingMeta(SnmpMib myMib, SnmpStandardObjectServer objserv) {
objectserver = objserv;
try {
registerObject(6);
registerObject(5);
registerObject(4);
registerObject(3);
registerObject(2);
registerObject(1);
registerObject(10);
registerObject(7);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 6:
return new SnmpInt(node.getJvmThreadCpuTimeMonitoring());
case 5:
return new SnmpInt(node.getJvmThreadContentionMonitoring());
case 4:
return new SnmpCounter64(node.getJvmThreadTotalStartedCount());
case 3:
return new SnmpCounter(node.getJvmThreadPeakCount());
case 2:
return new SnmpGauge(node.getJvmThreadDaemonCount());
case 1:
return new SnmpGauge(node.getJvmThreadCount());
case 10: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 7:
return new SnmpCounter64(node.getJvmThreadPeakCountReset());
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Set the value of a scalar variable
*/
public SnmpValue set(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 6:
if (x instanceof SnmpInt) {
try {
node.setJvmThreadCpuTimeMonitoring( new EnumJvmThreadCpuTimeMonitoring (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
return new SnmpInt(node.getJvmThreadCpuTimeMonitoring());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 5:
if (x instanceof SnmpInt) {
try {
node.setJvmThreadContentionMonitoring( new EnumJvmThreadContentionMonitoring (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
return new SnmpInt(node.getJvmThreadContentionMonitoring());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 7:
if (x instanceof SnmpCounter64) {
node.setJvmThreadPeakCountReset(((SnmpCounter64)x).toLong());
return new SnmpCounter64(node.getJvmThreadPeakCountReset());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 6:
if (x instanceof SnmpInt) {
try {
node.checkJvmThreadCpuTimeMonitoring( new EnumJvmThreadCpuTimeMonitoring (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 5:
if (x instanceof SnmpInt) {
try {
node.checkJvmThreadContentionMonitoring( new EnumJvmThreadContentionMonitoring (((SnmpInt)x).toInteger()));
} catch(IllegalArgumentException e) {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
}
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
case 4:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 3:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 10: {
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
case 7:
if (x instanceof SnmpCounter64) {
node.checkJvmThreadPeakCountReset(((SnmpCounter64)x).toLong());
} else {
throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
}
break;
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
/**
* Allow to bind the metadata description to a specific object.
*/
protected void setInstance(JvmThreadingMBean var) {
node = var;
}
// ------------------------------------------------------------
//
// Implements the "get" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void get(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.get(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "set" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.set(this,req,depth);
}
// ------------------------------------------------------------
//
// Implements the "check" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public void check(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
objectserver.check(this,req,depth);
}
/**
* Returns true if "arc" identifies a scalar object.
*/
public boolean isVariable(long arc) {
switch((int)arc) {
case 6:
case 5:
case 4:
case 3:
case 2:
case 1:
case 7:
return true;
default:
break;
}
return false;
}
/**
* Returns true if "arc" identifies a readable scalar object.
*/
public boolean isReadable(long arc) {
switch((int)arc) {
case 6:
case 5:
case 4:
case 3:
case 2:
case 1:
case 7:
return true;
default:
break;
}
return false;
}
// ------------------------------------------------------------
//
// Implements the "skipVariable" method defined in "SnmpMibGroup".
// See the "SnmpMibGroup" Javadoc API for more details.
//
// ------------------------------------------------------------
public boolean skipVariable(long var, Object data, int pduVersion) {
switch((int)var) {
case 4:
case 7:
if (pduVersion==SnmpDefinitions.snmpVersionOne) return true;
break;
default:
break;
}
return super.skipVariable(var,data,pduVersion);
}
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 6:
return "JvmThreadCpuTimeMonitoring";
case 5:
return "JvmThreadContentionMonitoring";
case 4:
return "JvmThreadTotalStartedCount";
case 3:
return "JvmThreadPeakCount";
case 2:
return "JvmThreadDaemonCount";
case 1:
return "JvmThreadCount";
case 10: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 7:
return "JvmThreadPeakCountReset";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
/**
* Returns true if "arc" identifies a table object.
*/
public boolean isTable(long arc) {
switch((int)arc) {
case 10:
return true;
default:
break;
}
return false;
}
/**
* Returns the table object identified by "arc".
*/
public SnmpMibTable getTable(long arc) {
switch((int)arc) {
case 10:
return tableJvmThreadInstanceTable;
default:
break;
}
return null;
}
/**
* Register the group's SnmpMibTable objects with the meta-data.
*/
public void registerTableNodes(SnmpMib mib, MBeanServer server) {
tableJvmThreadInstanceTable = createJvmThreadInstanceTableMetaNode("JvmThreadInstanceTable", "JvmThreading", mib, server);
if ( tableJvmThreadInstanceTable != null) {
tableJvmThreadInstanceTable.registerEntryNode(mib,server);
mib.registerTableMeta("JvmThreadInstanceTable", tableJvmThreadInstanceTable);
}
}
/**
* Factory method for "JvmThreadInstanceTable" table metadata class.
*
* You can redefine this method if you need to replace the default
* generated metadata class with your own customized class.
*
* @param tableName Name of the table object ("JvmThreadInstanceTable")
* @param groupName Name of the group to which this table belong ("JvmThreading")
* @param mib The SnmpMib object in which this table is registered
* @param server MBeanServer for this table entries (may be null)
*
* @return An instance of the metadata class generated for the
* "JvmThreadInstanceTable" table (JvmThreadInstanceTableMeta)
*
**/
protected JvmThreadInstanceTableMeta createJvmThreadInstanceTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) {
return new JvmThreadInstanceTableMeta(mib, objectserver);
}
protected JvmThreadingMBean node;
protected SnmpStandardObjectServer objectserver = null;
protected JvmThreadInstanceTableMeta tableJvmThreadInstanceTable = null;
}

View File

@@ -0,0 +1,110 @@
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.mbeanserver.Util;
import com.sun.jmx.snmp.agent.SnmpUserDataFactory;
import com.sun.jmx.snmp.SnmpPdu;
import com.sun.jmx.snmp.SnmpStatusException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class JvmContextFactory implements SnmpUserDataFactory {
/**
* Called by the <CODE>SnmpAdaptorServer</CODE> adaptor.
* Allocate a contextual object containing some user data. This method
* is called once for each incoming SNMP request. The scope
* of this object will be the whole request. Since the request can be
* handled in several threads, the user should make sure that this
* object can be accessed in a thread-safe manner. The SNMP framework
* will never access this object directly - it will simply pass
* it to the <code>SnmpMibAgent</code> within
* <code>SnmpMibRequest</code> objects - from where it can be retrieved
* through the {@link com.sun.jmx.snmp.agent.SnmpMibRequest#getUserData() getUserData()} accessor.
* <code>null</code> is considered to be a valid return value.
*
* This method is called just after the SnmpPduPacket has been
* decoded.
*
* @param requestPdu The SnmpPduPacket received from the SNMP manager.
* <b>This parameter is owned by the SNMP framework and must be
* considered as transient.</b> If you wish to keep some of its
* content after this method returns (by storing it in the
* returned object for instance) you should clone that
* information.
*
* @return A newly allocated user-data contextual object, or
* <code>null</code>
* @exception SnmpStatusException If an SnmpStatusException is thrown,
* the request will be aborted.
*
* @since Java DMK 5.0
**/
public Object allocateUserData(SnmpPdu requestPdu)
throws SnmpStatusException {
return Collections.synchronizedMap(new HashMap<Object, Object>());
}
/**
* Called by the <CODE>SnmpAdaptorServer</CODE> adaptor.
* Release a previously allocated contextual object containing user-data.
* This method is called just before the responsePdu is sent back to the
* manager. It gives the user a chance to alter the responsePdu packet
* before it is encoded, and to free any resources that might have
* been allocated when creating the contextual object.
*
* @param userData The contextual object being released.
* @param responsePdu The SnmpPduPacket that will be sent back to the
* SNMP manager.
* <b>This parameter is owned by the SNMP framework and must be
* considered as transient.</b> If you wish to keep some of its
* content after this method returns you should clone that
* information.
*
* @exception SnmpStatusException If an SnmpStatusException is thrown,
* the responsePdu is dropped and nothing is returned to
* to the manager.
*
* @since Java DMK 5.0
**/
public void releaseUserData(Object userData, SnmpPdu responsePdu)
throws SnmpStatusException {
((Map<?, ?>)userData).clear();
}
public static Map<Object, Object> getUserData() {
final Object userData =
com.sun.jmx.snmp.ThreadContext.get("SnmpUserData");
if (userData instanceof Map<?, ?>) return Util.cast(userData);
else return null;
}
}

View File

@@ -0,0 +1,203 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import java.util.logging.Logger;
import java.util.logging.Level;
public class MibLogger {
final Logger logger;
final String className;
static String getClassName(Class<?> clazz) {
if (clazz == null) return null;
if (clazz.isArray())
return getClassName(clazz.getComponentType()) + "[]";
final String fullname = clazz.getName();
final int lastpoint = fullname.lastIndexOf('.');
final int len = fullname.length();
if ((lastpoint < 0) || (lastpoint >= len))
return fullname;
else return fullname.substring(lastpoint+1,len);
}
static String getLoggerName(Class<?> clazz) {
if (clazz == null) return "sun.management.snmp.jvminstr";
Package p = clazz.getPackage();
if (p == null) return "sun.management.snmp.jvminstr";
final String pname = p.getName();
if (pname == null) return "sun.management.snmp.jvminstr";
else return pname;
}
public MibLogger(Class<?> clazz) {
this(getLoggerName(clazz),getClassName(clazz));
}
public MibLogger(Class<?> clazz, String postfix) {
this(getLoggerName(clazz)+((postfix==null)?"":"."+postfix),
getClassName(clazz));
}
public MibLogger(String className) {
this("sun.management.snmp.jvminstr",className);
}
public MibLogger(String loggerName, String className) {
Logger l = null;
try {
l = Logger.getLogger(loggerName);
} catch (Exception x) {
// OK. Should not happen
}
logger = l;
this.className=className;
}
protected Logger getLogger() {
return logger;
}
public boolean isTraceOn() {
final Logger l = getLogger();
if (l==null) return false;
return l.isLoggable(Level.FINE);
}
public boolean isDebugOn() {
final Logger l = getLogger();
if (l==null) return false;
return l.isLoggable(Level.FINEST);
}
public boolean isInfoOn() {
final Logger l = getLogger();
if (l==null) return false;
return l.isLoggable(Level.INFO);
}
public boolean isConfigOn() {
final Logger l = getLogger();
if (l==null) return false;
return l.isLoggable(Level.CONFIG);
}
public void config(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.CONFIG,className,
func,msg);
}
public void config(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.CONFIG,className,
func,t.toString(),t);
}
public void config(String func, String msg, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.CONFIG,className,
func,msg,t);
}
public void error(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.SEVERE,className,
func,msg);
}
public void info(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.INFO,className,
func,msg);
}
public void info(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.INFO,className,
func,t.toString(),t);
}
public void info(String func, String msg, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.INFO,className,
func,msg,t);
}
public void warning(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.WARNING,className,
func,msg);
}
public void warning(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.WARNING,className,
func,t.toString(),t);
}
public void warning(String func, String msg, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.WARNING,className,
func,msg,t);
}
public void trace(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINE,className,
func,msg);
}
public void trace(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINE,className,
func,t.toString(),t);
}
public void trace(String func, String msg, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINE,className,
func,msg,t);
}
public void debug(String func, String msg) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINEST,className,
func,msg);
}
public void debug(String func, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINEST,className,
func,t.toString(),t);
}
public void debug(String func, String msg, Throwable t) {
final Logger l = getLogger();
if (l!=null) l.logp(Level.FINEST,className,
func,msg,t);
}
}

View File

@@ -0,0 +1,168 @@
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.snmp.SnmpOid;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.List;
import java.util.Iterator;
import java.lang.ref.WeakReference;
/**
* This class is used to cache table data.
**/
public class SnmpCachedData implements SnmpTableHandler {
/**
* Compares two SnmpOid.
**/
public static final Comparator<SnmpOid> oidComparator =
new Comparator<SnmpOid>() {
public int compare(SnmpOid o1, SnmpOid o2) {
return o1.compareTo(o2);
}
public boolean equals(Object o1, Object o2) {
if (o1 == o2) return true;
else return o1.equals(o2);
}
};
/**
* Constructs a new instance of SnmpCachedData. Instances are
* immutable.
* @param lastUpdated Time stamp as returned by
* {@link System#currentTimeMillis System.currentTimeMillis()}
* @param indexes The table entry indexes, sorted in ascending order.
* @param datas The table datas, sorted according to the
* order in <code>indexes</code>: <code>datas[i]</code>
* is the data that corresponds to
* <code>indexes[i]</code>
**/
public SnmpCachedData(long lastUpdated, SnmpOid indexes[],
Object datas[]) {
this.lastUpdated = lastUpdated;
this.indexes = indexes;
this.datas = datas;
}
/**
* Constructs a new instance of SnmpCachedData. Instances are
* immutable.
* @param lastUpdated Time stamp as returned by
* {@link System#currentTimeMillis System.currentTimeMillis()}
* @param indexMap The table indexed table data, sorted in ascending
* order by {@link #oidComparator}. The keys must be
* instances of {@link SnmpOid}.
**/
public SnmpCachedData(long lastUpdated, TreeMap<SnmpOid, Object> indexMap) {
this(lastUpdated, indexMap, true);
}
/**
* Constructs a new instance of SnmpCachedData. Instances are
* immutable.
* @param lastUpdated Time stamp as returned by
* {@link System#currentTimeMillis System.currentTimeMillis()}
* @param indexMap The table indexed table data, sorted in ascending
* order by {@link #oidComparator}. The keys must be
* instances of {@link SnmpOid}.
**/
public SnmpCachedData(long lastUpdated, TreeMap<SnmpOid, Object> indexMap,
boolean b) {
final int size = indexMap.size();
this.lastUpdated = lastUpdated;
this.indexes = new SnmpOid[size];
this.datas = new Object[size];
if(b) {
indexMap.keySet().toArray(this.indexes);
indexMap.values().toArray(this.datas);
} else
indexMap.values().toArray(this.datas);
}
/**
* Time stamp as returned by
* {@link System#currentTimeMillis System.currentTimeMillis()}
**/
public final long lastUpdated;
/**
* The table entry indexes, sorted in ascending order.
**/
public final SnmpOid indexes[];
/**
* The table datas, sorted according to the
* order in <code>indexes</code>: <code>datas[i]</code>
* is the data that corresponds to <code>indexes[i]</code>
**/
public final Object datas[];
/**
* The position of the given <var>index</var>, as returned by
* <code>java.util.Arrays.binarySearch()</code>
**/
public final int find(SnmpOid index) {
return Arrays.binarySearch(indexes,index,oidComparator);
}
// SnmpTableHandler.getData()
public Object getData(SnmpOid index) {
final int pos = find(index);
if ((pos < 0)||(pos >= datas.length)) return null;
return datas[pos];
}
// SnmpTableHandler.getNext()
public SnmpOid getNext(SnmpOid index) {
if (index == null) {
if (indexes.length>0) return indexes[0];
else return null;
}
final int pos = find(index);
if (pos > -1) {
if (pos < (indexes.length -1) ) return indexes[pos+1];
else return null;
}
final int insertion = -pos -1;
if ((insertion > -1) && (insertion < indexes.length))
return indexes[insertion];
else return null;
}
// SnmpTableHandler.contains()
public boolean contains(SnmpOid index) {
final int pos = find(index);
return ((pos > -1)&&(pos < indexes.length));
}
}

View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.snmp.SnmpOid;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.List;
import java.util.Iterator;
import java.lang.ref.WeakReference;
/**
* This abstract class implements a weak cache for a table whose data
* is obtained from a {@link List}.
*
* <p><b>NOTE: This class is not synchronized, subclasses must implement
* the appropriate synchronization whwn needed.</b></p>
**/
public abstract class SnmpListTableCache extends SnmpTableCache {
/**
* The index of the entry corresponding to the given <var>item</var>.
* <br>This method is called by {@link #updateCachedDatas(Object,List)}.
* The given <var>item</var> is expected to be always associated with
* the same index.
* @param context The context passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rawDatas Raw table datas passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rank Rank of the given <var>item</var> in the
* <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined.
**/
protected abstract SnmpOid getIndex(Object context, List<?> rawDatas,
int rank, Object item);
/**
* The data for the entry corresponding to the given <var>item</var>.
* <br>This method is called by {@link #updateCachedDatas(Object,List)}.
* @param context The context passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rawDatas Raw table datas passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rank Rank of the given <var>item</var> in the
* <var>rawDatas</var> list iterator.
* @param item The raw data object from which the entry data must be
* extracted.
* @return By default <var>item</var> is returned.
**/
protected Object getData(Object context, List<?> rawDatas,
int rank, Object item) {
return item;
}
/**
* Recompute cached data.
* @param context A context object, valid during the duration of
* of the call to this method, and that will be passed to
* {@link #getIndex} and {@link #getData}. <br>
* This method is intended to be called by
* {@link #updateCachedDatas(Object)}. It is assumed that
* the context is be allocated by before this method is called,
* and released just after this method has returned.<br>
* This class does not use the context object: it is a simple
* hook for subclassed.
* @param rawDatas The table datas from which the cached data will be
* computed.
* @return the computed cached data.
**/
protected SnmpCachedData updateCachedDatas(Object context, List<?> rawDatas) {
final int size = ((rawDatas == null)?0:rawDatas.size());
if (size == 0) return null;
final long time = System.currentTimeMillis();
final Iterator<?> it = rawDatas.iterator();
final TreeMap<SnmpOid, Object> map =
new TreeMap<>(SnmpCachedData.oidComparator);
for (int rank=0; it.hasNext() ; rank++) {
final Object item = it.next();
final SnmpOid index = getIndex(context, rawDatas, rank, item);
final Object data = getData(context, rawDatas, rank, item);
if (index == null) continue;
map.put(index,data);
}
return new SnmpCachedData(time,map);
}
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.snmp.SnmpStatusException;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.List;
import java.util.Iterator;
import java.lang.ref.WeakReference;
/**
* This class is used to cache LoadedClass table data.
* WARNING : MUST IMPLEMENT THE SnmpTableHandler directly. Some changes in daniel classes.
**/
public final class SnmpLoadedClassData extends SnmpCachedData {
/**
* Constructs a new instance of SnmpLoadedClassData. Instances are
* immutable.
* @param lastUpdated Time stamp as returned by
* {@link System#currentTimeMillis System.currentTimeMillis()}
* @param indexMap The table indexed table data, sorted in ascending
* order by {@link #oidComparator}. The keys must be
* instances of {@link SnmpOid}.
**/
public SnmpLoadedClassData(long lastUpdated, TreeMap<SnmpOid, Object> indexMap) {
super(lastUpdated, indexMap, false);
}
// SnmpTableHandler.getData()
public final Object getData(SnmpOid index) {
int pos = 0;
try {
pos = (int) index.getOidArc(0);
}catch(SnmpStatusException e) {
return null;
}
if (pos >= datas.length) return null;
return datas[pos];
}
// SnmpTableHandler.getNext()
public final SnmpOid getNext(SnmpOid index) {
int pos = 0;
if (index == null) {
if( (datas!= null) && (datas.length >= 1) )
return new SnmpOid(0);
}
try {
pos = (int) index.getOidArc(0);
}catch(SnmpStatusException e) {
return null;
}
if(pos < (datas.length - 1))
return new SnmpOid(pos+1);
else
return null;
}
// SnmpTableHandler.contains()
public final boolean contains(SnmpOid index) {
int pos = 0;
try {
pos = (int) index.getOidArc(0);
}catch(SnmpStatusException e) {
return false;
}
return (pos < datas.length);
}
}

View File

@@ -0,0 +1,266 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.snmp.SnmpOid;
import com.sun.jmx.mbeanserver.Util;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;
import java.util.List;
import java.util.Iterator;
import java.lang.ref.WeakReference;
/**
* This abstract class implements a weak cache that holds table data, for
* a table whose data is obtained from a list where a name can be obtained
* for each item in the list.
* <p>This object maintains a map between an entry name and its associated
* SnmpOid index, so that a given entry is always associated to the same
* index.</p>
* <p><b>NOTE: This class is not synchronized, subclasses must implement
* the appropriate synchronization whwn needed.</b></p>
**/
public abstract class SnmpNamedListTableCache extends SnmpListTableCache {
/**
* This map associate an entry name with the SnmpOid index that's
* been allocated for it.
**/
protected TreeMap<String, SnmpOid> names = new TreeMap<>();
/**
* The last allocate index.
**/
protected long last = 0;
/**
* true if the index has wrapped.
**/
boolean wrapped = false;
/**
* Returns the key to use as name for the given <var>item</var>.
* <br>This method is called by {@link #getIndex(Object,List,int,Object)}.
* The given <var>item</var> is expected to be always associated with
* the same name.
* @param context The context passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rawDatas Raw table datas passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rank Rank of the given <var>item</var> in the
* <var>rawDatas</var> list iterator.
* @param item The raw data object for which a key name must be determined.
**/
protected abstract String getKey(Object context, List<?> rawDatas,
int rank, Object item);
/**
* Find a new index for the entry corresponding to the
* given <var>item</var>.
* <br>This method is called by {@link #getIndex(Object,List,int,Object)}
* when a new index needs to be allocated for an <var>item</var>. The
* index returned must not be already in used.
* @param context The context passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rawDatas Raw table datas passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rank Rank of the given <var>item</var> in the
* <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined.
**/
protected SnmpOid makeIndex(Object context, List<?> rawDatas,
int rank, Object item) {
// check we are in the limits of an unsigned32.
if (++last > 0x00000000FFFFFFFFL) {
// we just wrapped.
log.debug("makeIndex", "Index wrapping...");
last = 0;
wrapped=true;
}
// If we never wrapped, we can safely return last as new index.
if (!wrapped) return new SnmpOid(last);
// We wrapped. We must look for an unused index.
for (int i=1;i < 0x00000000FFFFFFFFL;i++) {
if (++last > 0x00000000FFFFFFFFL) last = 1;
final SnmpOid testOid = new SnmpOid(last);
// Was this index already in use?
if (names == null) return testOid;
if (names.containsValue(testOid)) continue;
// Have we just used it in a previous iteration?
if (context == null) return testOid;
if (((Map)context).containsValue(testOid)) continue;
// Ok, not in use.
return testOid;
}
// all indexes are in use! we're stuck.
// // throw new IndexOutOfBoundsException("No index available.");
// better to return null and log an error.
return null;
}
/**
* Call {@link #getKey(Object,List,int,Object)} in order to get
* the item name. Then check whether an index was already allocated
* for the entry by that name. If yes return it. Otherwise, call
* {@link #makeIndex(Object,List,int,Object)} to compute a new
* index for that entry.
* Finally store the association between
* the name and index in the context TreeMap.
* @param context The context passed to
* {@link #updateCachedDatas(Object,List)}.
* It is expected to
* be an instance of {@link TreeMap}.
* @param rawDatas Raw table datas passed to
* {@link #updateCachedDatas(Object,List)}.
* @param rank Rank of the given <var>item</var> in the
* <var>rawDatas</var> list iterator.
* @param item The raw data object for which an index must be determined.
**/
protected SnmpOid getIndex(Object context, List<?> rawDatas,
int rank, Object item) {
final String key = getKey(context,rawDatas,rank,item);
final Object index = (names==null||key==null)?null:names.get(key);
final SnmpOid result =
((index != null)?((SnmpOid)index):makeIndex(context,rawDatas,
rank,item));
if ((context != null) && (key != null) && (result != null)) {
Map<Object, Object> map = Util.cast(context);
map.put(key,result);
}
log.debug("getIndex","key="+key+", index="+result);
return result;
}
/**
* Allocate a new {@link TreeMap} to serve as context, then
* call {@link SnmpListTableCache#updateCachedDatas(Object,List)}, and
* finally replace the {@link #names} TreeMap by the new allocated
* TreeMap.
* @param rawDatas The table datas from which the cached data will be
* computed.
**/
protected SnmpCachedData updateCachedDatas(Object context, List<?> rawDatas) {
TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
final SnmpCachedData result =
super.updateCachedDatas(context,rawDatas);
names = ctxt;
return result;
}
/**
* Load a list of raw data from which to build the cached data.
* This method is called when nothing is found in the request
* contextual cache.
* @param userData The request contextual cache allocated by
* the {@link JvmContextFactory}.
*
**/
protected abstract List<?> loadRawDatas(Map<Object,Object> userData);
/**
*The name under which the raw data is to be found/put in
* the request contextual cache.
**/
protected abstract String getRawDatasKey();
/**
* Get a list of raw data from which to build the cached data.
* Obtains a list of raw data by first looking it up in the
* request contextual cache <var>userData</var> under the given
* <var>key</var>. If nothing is found in the cache, calls
* {@link #loadRawDatas(Map)} to obtain a new rawData list,
* and cache the result in <var>userData</var> under <var>key</var>.
* @param userData The request contextual cache allocated by
* the {@link JvmContextFactory}.
* @param key The name under which the raw data is to be found/put in
* the request contextual cache.
*
**/
protected List<?> getRawDatas(Map<Object, Object> userData, String key) {
List<?> rawDatas = null;
// Look for memory manager list in request contextual cache.
if (userData != null)
rawDatas = (List<?>)userData.get(key);
if (rawDatas == null) {
// No list in contextual cache, get it from API
rawDatas = loadRawDatas(userData);
// Put list in cache...
if (rawDatas != null && userData != null)
userData.put(key, rawDatas);
}
return rawDatas;
}
/**
* Update cahed datas.
* Obtains a {@link List} of raw datas by calling
* {@link #getRawDatas(Map,String) getRawDatas((Map)context,getRawDatasKey())}.<br>
* Then allocate a new {@link TreeMap} to serve as temporary map between
* names and indexes, and call {@link #updateCachedDatas(Object,List)}
* with that temporary map as context.<br>
* Finally replaces the {@link #names} TreeMap by the temporary
* TreeMap.
* @param context The request contextual cache allocated by the
* {@link JvmContextFactory}.
**/
protected SnmpCachedData updateCachedDatas(Object context) {
final Map<Object, Object> userData =
(context instanceof Map)?Util.<Map<Object, Object>>cast(context):null;
// Look for memory manager list in request contextual cache.
final List<?> rawDatas = getRawDatas(userData,getRawDatasKey());
log.debug("updateCachedDatas","rawDatas.size()=" +
((rawDatas==null)?"<no data>":""+rawDatas.size()));
TreeMap<String,SnmpOid> ctxt = new TreeMap<>();
final SnmpCachedData result =
super.updateCachedDatas(ctxt,rawDatas);
names = ctxt;
return result;
}
static final MibLogger log = new MibLogger(SnmpNamedListTableCache.class);
}

View File

@@ -0,0 +1,119 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.snmp.SnmpOid;
import java.io.Serializable;
import java.util.Comparator;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.List;
import java.util.Iterator;
import java.lang.ref.WeakReference;
/**
* This abstract class implements a weak cache that holds table data.
* <p>The table data is stored in an instance of
* {@link SnmpCachedData}, which is kept in a {@link WeakReference}.
* If the WeakReference is null or empty, the cached data is recomputed.</p>
*
* <p><b>NOTE: This class is not synchronized, subclasses must implement
* the appropriate synchronization when needed.</b></p>
**/
public abstract class SnmpTableCache implements Serializable {
/**
* Interval of time in ms during which the cached table data
* is considered valid.
**/
protected long validity;
/**
* A weak refernce holding cached table data.
**/
protected transient WeakReference<SnmpCachedData> datas;
/**
* true if the given cached table data is obsolete.
**/
protected boolean isObsolete(SnmpCachedData cached) {
if (cached == null) return true;
if (validity < 0) return false;
return ((System.currentTimeMillis() - cached.lastUpdated) > validity);
}
/**
* Returns the cached table data.
* Returns null if the cached data is obsolete, or if there is no
* cached data, or if the cached data was garbage collected.
* @return a still valid cached data or null.
**/
protected SnmpCachedData getCachedDatas() {
if (datas == null) return null;
final SnmpCachedData cached = datas.get();
if ((cached == null) || isObsolete(cached)) return null;
return cached;
}
/**
* Returns the cached table data, if it is still valid,
* or recompute it if it is obsolete.
* <p>
* When cache data is recomputed, store it in the weak reference,
* unless {@link #validity} is 0: then the data will not be stored
* at all.<br>
* This method calls {@link #isObsolete(SnmpCachedData)} to determine
* whether the cached data is obsolete, and {
* {@link #updateCachedDatas(Object)} to recompute it.
* </p>
* @param context A context object.
* @return the valid cached data, or the recomputed table data.
**/
protected synchronized SnmpCachedData getTableDatas(Object context) {
final SnmpCachedData cached = getCachedDatas();
if (cached != null) return cached;
final SnmpCachedData computedDatas = updateCachedDatas(context);
if (validity != 0) datas = new WeakReference<>(computedDatas);
return computedDatas;
}
/**
* Recompute cached data.
* @param context A context object, as passed to
* {@link #getTableDatas(Object)}
**/
protected abstract SnmpCachedData updateCachedDatas(Object context);
/**
* Return a table handler that holds the table data.
* This method should return the cached table data if it is still
* valid, recompute it and cache the new value if it's not.
**/
public abstract SnmpTableHandler getTableHandler();
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.management.snmp.util;
import com.sun.jmx.snmp.SnmpOid;
/**
* Defines the interface implemented by an object that holds
* table data.
**/
public interface SnmpTableHandler {
/**
* Returns the data associated with the given index.
* If the given index is not found, null is returned.
* Note that returning null does not necessarily means that
* the index was not found.
**/
public Object getData(SnmpOid index);
/**
* Returns the index that immediately follows the given
* <var>index</var>. The returned index is strictly greater
* than the given <var>index</var>, and is contained in the table.
* <br>If the given <var>index</var> is null, returns the first
* index in the table.
* <br>If there are no index after the given <var>index</var>,
* returns null.
**/
public SnmpOid getNext(SnmpOid index);
/**
* Returns true if the given <var>index</var> is present.
**/
public boolean contains(SnmpOid index);
}