⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snmpadaptorserver.java

📁 Mobile 应用程序使用 Java Micro Edition (Java ME) 平台
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * Returns the <CODE>snmpOutGetResponses</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpOutGetResponses</CODE> value.     */    public Long getSnmpOutGetResponses() {        return new Long(snmpOutGetResponses);    }      /**     * Returns the <CODE>snmpOutGenErrs</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpOutGenErrs</CODE> value.     */    public Long getSnmpOutGenErrs() {        return new Long(snmpOutGenErrs);    }      /**     * Returns the <CODE>snmpOutBadValues</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpOutBadValues</CODE> value.     */    public Long getSnmpOutBadValues() {        return new Long(snmpOutBadValues);    }      /**     * Returns the <CODE>snmpOutNoSuchNames</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpOutNoSuchNames</CODE> value.     */    public Long getSnmpOutNoSuchNames() {        return new Long(snmpOutNoSuchNames);    }      /**     * Returns the <CODE>snmpOutTooBigs</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpOutTooBigs</CODE> value.     */    public Long getSnmpOutTooBigs() {        return new Long(snmpOutTooBigs);    }      /**     * Returns the <CODE>snmpInASNParseErrs</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInASNParseErrs</CODE> value.     */    public Long getSnmpInASNParseErrs() {        return new Long(snmpInASNParseErrs);    }      /**     * Returns the <CODE>snmpInBadCommunityUses</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInBadCommunityUses</CODE> value.     */    public Long getSnmpInBadCommunityUses() {        return new Long(snmpInBadCommunityUses);    }      /**     * Returns the <CODE>snmpInBadCommunityNames</CODE> value defined in      * MIB-II.     *      * @return The <CODE>snmpInBadCommunityNames</CODE> value.     */    public Long getSnmpInBadCommunityNames() {        return new Long(snmpInBadCommunityNames);    }      /**     * Returns the <CODE>snmpInBadVersions</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInBadVersions</CODE> value.     */    public Long getSnmpInBadVersions() {        return new Long(snmpInBadVersions);    }      /**     * Returns the <CODE>snmpOutPkts</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpOutPkts</CODE> value.     */    public Long getSnmpOutPkts() {        return new Long(snmpOutPkts);    }      /**     * Returns the <CODE>snmpInPkts</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInPkts</CODE> value.     */    public Long getSnmpInPkts() {        return new Long(snmpInPkts);    }      /**     * Returns the <CODE>snmpInGetRequests</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInGetRequests</CODE> value.     */    public Long getSnmpInGetRequests() {        return new Long(snmpInGetRequests);    }      /**     * Returns the <CODE>snmpInGetNexts</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInGetNexts</CODE> value.     */    public Long getSnmpInGetNexts() {        return new Long(snmpInGetNexts);    }      /**     * Returns the <CODE>snmpInSetRequests</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInSetRequests</CODE> value.     */    public Long getSnmpInSetRequests() {        return new Long(snmpInSetRequests);    }      /**     * Returns the <CODE>snmpInTotalSetVars</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInTotalSetVars</CODE> value.     */    public Long getSnmpInTotalSetVars() {        return new Long(snmpInTotalSetVars);    }      /**     * Returns the <CODE>snmpInTotalReqVars</CODE> value defined in MIB-II.     *      * @return The <CODE>snmpInTotalReqVars</CODE> value.     */    public Long getSnmpInTotalReqVars() {        return new Long(snmpInTotalReqVars);    }        /**     * Returns the <CODE>snmpSilentDrops</CODE> value defined in RFC     * 1907 NMPv2-MIB .     *      * @return The <CODE>snmpSilentDrops</CODE> value.     *     * @since 1.5     */    public Long getSnmpSilentDrops() {        return new Long(snmpSilentDrops);    }    /**     * Returns the <CODE>snmpProxyDrops</CODE> value defined in RFC     * 1907 NMPv2-MIB .     *      * @return The <CODE>snmpProxyDrops</CODE> value.     *     * @since 1.5     */    public Long getSnmpProxyDrops() {        return new Long(0);    }            // PUBLIC METHODS    //---------------     /**     * Allows the MBean to perform any operations it needs before being     * registered in the MBean server.      * If the name of the SNMP protocol adaptor MBean is not specified,      * it is initialized with the default value:     * {@link com.sun.jmx.snmp.ServiceName#DOMAIN      *   com.sun.jmx.snmp.ServiceName.DOMAIN}:{@link      * com.sun.jmx.snmp.ServiceName#SNMP_ADAPTOR_SERVER      * com.sun.jmx.snmp.ServiceName.SNMP_ADAPTOR_SERVER}.     * If any exception is raised, the SNMP protocol adaptor MBean will      * not be registered in the MBean server.     *     * @param server The MBean server to register the service with.     * @param name The object name.     *     * @return The name of the SNMP protocol adaptor registered.     *     * @exception java.lang.Exception     */    public ObjectName preRegister(MBeanServer server, ObjectName name) 	throws java.lang.Exception {        if (name == null) {            name = new ObjectName(server.getDefaultDomain() + ":" + 			     com.sun.jmx.snmp.ServiceName.SNMP_ADAPTOR_SERVER);        }        return (super.preRegister(server, name));    }                /**     * Not used in this context.     */    public void postRegister (Boolean registrationDone) {        super.postRegister(registrationDone);    }     /**     * Not used in this context.     */    public void preDeregister() throws java.lang.Exception {        super.preDeregister();    }    /**     * Not used in this context.     */    public void postDeregister() {        super.postDeregister();    }    /**     * Adds a new MIB in the SNMP MIB handler.     *      * @param mib The MIB to add.     *      * @return A reference to the SNMP MIB handler.      *     * @exception IllegalArgumentException If the parameter is null.     */    public SnmpMibHandler addMib(SnmpMibAgent mib) 	throws IllegalArgumentException {        if (mib == null) {            throw new IllegalArgumentException() ;        }		if(!mibs.contains(mib))	    mibs.addElement(mib);        root.register(mib);            return this;    }        /**     * Adds a new MIB in the SNMP MIB handler.      * This method is to be called to set a specific agent to a specific OID.      * This can be useful when dealing with MIB overlapping.      * Some OID can be implemented in more than one MIB. In this case,      * the OID nearer agent will be used on SNMP operations.     *      * @param mib The MIB to add.     * @param oids The set of OIDs this agent implements.     *      * @return A reference to the SNMP MIB handler.      *     * @exception IllegalArgumentException If the parameter is null.     *     * @since 1.5     */    public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) 	throws IllegalArgumentException {	if (mib == null) {	    throw new IllegalArgumentException() ;	}		//If null oid array, just add it to the mib.	if(oids == null) 	    return addMib(mib);		if(!mibs.contains(mib))	    mibs.addElement(mib);		for (int i = 0; i < oids.length; i++) {	    root.register(mib, oids[i].longValue());	}	return this;    }    /**     * Adds a new MIB in the SNMP MIB handler. In SNMP V1 and V2 the      * <CODE>contextName</CODE> is useless and this method     * is equivalent to <CODE>addMib(SnmpMibAgent mib)</CODE>.     *      * @param mib The MIB to add.      * @param contextName The MIB context name.     * @return A reference on the SNMP MIB handler.      *     * @exception IllegalArgumentException If the parameter is null.     *     * @since 1.5     */    public SnmpMibHandler addMib(SnmpMibAgent mib, String contextName) 	throws IllegalArgumentException {	return addMib(mib);    }        /**     * Adds a new MIB in the SNMP MIB handler. In SNMP V1 and V2 the      * <CODE>contextName</CODE> is useless and this method     * is equivalent to <CODE>addMib(SnmpMibAgent mib, SnmpOid[] oids)</CODE>.     *      * @param mib The MIB to add.     * @param contextName The MIB context. If null is passed, will be      *        registered in the default context.     * @param oids The set of OIDs this agent implements.     *      * @return A reference to the SNMP MIB handler.      *     * @exception IllegalArgumentException If the parameter is null.     *     * @since 1.5     */    public SnmpMibHandler addMib(SnmpMibAgent mib, 				 String contextName, 				 SnmpOid[] oids)         throws IllegalArgumentException {	return addMib(mib, oids);    }        /**     * Removes the specified MIB from the SNMP protocol adaptor.      * In SNMP V1 and V2 the <CODE>contextName</CODE> is useless and this      * method is equivalent to <CODE>removeMib(SnmpMibAgent mib)</CODE>.     *      * @param mib The MIB to be removed.     * @param contextName The context name used at registration time.     *     * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was     * a MIB included in the SNMP MIB handler, <CODE>false</CODE>     * otherwise.     *     * @since 1.5     */    public boolean removeMib(SnmpMibAgent mib, String contextName) {	return removeMib(mib);    }    /**     * Removes the specified MIB from the SNMP protocol adaptor.      *      * @param mib The MIB to be removed.     *     * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was a MIB      *         included in the SNMP MIB handler, <CODE>false</CODE> otherwise.     */    public boolean removeMib(SnmpMibAgent mib) {        root.unregister(mib);        return (mibs.removeElement(mib)) ;    }    /**     * Removes the specified MIB from the SNMP protocol adaptor.      *      * @param mib The MIB to be removed.     * @param oids The oid the MIB was previously registered for.      * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was     * a MIB included in the SNMP MIB handler, <CODE>false</CODE>     * otherwise.     *     * @since 1.5     */    public boolean removeMib(SnmpMibAgent mib, SnmpOid[] oids) {	root.unregister(mib, oids);	return (mibs.removeElement(mib)) ;    }     /**     * Removes the specified MIB from the SNMP protocol adaptor.      *      * @param mib The MIB to be removed.     * @param contextName The context name used at registration time.     * @param oids The oid the MIB was previously registered for.      * @return <CODE>true</CODE> if the specified <CODE>mib</CODE> was     * a MIB included in the SNMP MIB handler, <CODE>false</CODE>     * otherwise.     *     * @since 1.5     */    public boolean removeMib(SnmpMibAgent mib, 			     String contextName, 			     SnmpOid[] oids) {	return removeMib(mib, oids);    }    // SUBCLASSING OF COMMUNICATOR SERVER    //-----------------------------------        /**     * Creates the datagram socket.     */    protected void doBind() 	throws CommunicationException, InterruptedException {        try {	    synchronized (this) {		socket = new DatagramSocket(port, address) ;	    }	    dbgTag = makeDebugTag();        } catch (SocketException e) {            if (e.getMessage().equals(InterruptSysCallMsg))                throw new InterruptedException(e.toString()) ;            else {                if (isDebugOn()) {                    debug("doBind", "cannot bind on port " + port);                }                throw new CommunicationException(e) ;            }        }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -