Package com.sun.jmx.snmp

Examples of com.sun.jmx.snmp.SnmpStatusException


  final Iterator it = result.iterator();
 
  for (int j=0; j < i; j++) {
      if (!it.hasNext()) {
    final SnmpStatusException x =
        new SnmpStatusException(errorCode);
    req.registerSetException(varList[j],x);
    continue;
      }

      final Attribute att = (Attribute) it.next();

      while ((j < i) && (! nameList[j].equals(att.getName()))) {
    final SnmpStatusException x =
        new SnmpStatusException(SnmpStatusException.noAccess);
    req.registerSetException(varList[j],x);
    j++;
      }

      if ( j == i) break;
View Full Code Here


  try {
      server.setAttribute(name,att);
      result = server.getAttribute(name,attname);
  } catch(InvalidAttributeValueException iv) {
      throw new
    SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
  } catch (InstanceNotFoundException f) {
      throw new
    SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
  } catch (ReflectionException r) {
      throw new
    SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
  } catch (MBeanException m) {
      Exception t = m.getTargetException();
      if (t instanceof SnmpStatusException)
    throw (SnmpStatusException) t;
      throw new
    SnmpStatusException(SnmpStatusException.noAccess);
  } catch (Exception e) {
      throw new
    SnmpStatusException(SnmpStatusException.noAccess);
  }

  return meta.buildSnmpValue(id,result);
    }
View Full Code Here

  } catch( SnmpStatusException e) {
      throw e; 
  }
  catch (InstanceNotFoundException i) {
      throw new
    SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
  } catch (ReflectionException r) {
      // checkXXXX() not defined => do nothing
  } catch (MBeanException m) {
      Exception t = m.getTargetException();
      if (t instanceof SnmpStatusException)
    throw (SnmpStatusException) t;
      throw new SnmpStatusException(SnmpStatusException.noAccess);
  } catch (Exception e) {
      throw new
    SnmpStatusException(SnmpStatusException.noAccess);
  }
    }
View Full Code Here

    public void registerTableEntry(SnmpMibTable meta, SnmpOid rowOid,
           ObjectName objname, Object entry)
  throws SnmpStatusException {
        if (objname == null)
           throw new
       SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
        try  {
            if (entry != null && !server.isRegistered(objname))
                server.registerMBean(entry, objname);
  } catch (InstanceAlreadyExistsException e) {
            throw new
        SnmpStatusException(SnmpStatusException.snmpRspInconsistentName);
  } catch (MBeanRegistrationException e) {
            throw new SnmpStatusException(SnmpStatusException.snmpRspNoAccess);
  } catch (NotCompliantMBeanException e) {
            throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
  } catch (RuntimeOperationsException e) {
            throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
        } catch(Exception e) {
            throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);
        }
    }
View Full Code Here

        SnmpOidRecord var  = (SnmpOidRecord)oidStore.get(name)
        if (var != null) {
            return var;
        } else {
            throw new SnmpStatusException("Variable name <" + name + "> not found in Oid repository") ;
        }
    }
View Full Code Here

        // Try to see if the variable name is actually an OID to resolve.
        //
        int index = oid.indexOf('.') ;
        if (index < 0) {
            throw new SnmpStatusException("Variable oid <" + oid + "> not found in Oid repository") ;
        }
        if (index == 0) {
            // The oid starts with a '.' ala CMU.
            //
            oid= oid.substring(1, oid.length());
        }
     
        // Go through the oidStore ... Good luck !
        //
        for(Enumeration list= oidStore.elements(); list.hasMoreElements(); ) {
            SnmpOidRecord element= (SnmpOidRecord) list.nextElement();
            if (element.getOid().equals(oid))
                return element;
        }

        throw new SnmpStatusException("Variable oid <" + oid + "> not found in Oid repository") ;
    }  
View Full Code Here

        //
        SnmpMessage msg = null ;
        try {
            msg = (SnmpMessage)pduFactory.encodeSnmpPdu(pdu, bufferSize) ;
            if (msg == null) {
                throw new SnmpStatusException(
        SnmpDefinitions.snmpRspAuthorizationError) ;
            }
        }
        catch (SnmpTooBigException x) {
            if (isDebugOn()) {
                debug("sendTrapPdu", "trap pdu is too big");
                debug("sendTrapPdu", "trap hasn't been sent to anyone");
            }
            throw new SnmpStatusException(SnmpDefinitions.snmpRspTooBig) ;
            // FIXME: is the right exception to throw ?
            // We could simply forward SnmpTooBigException ?
        }
   
        // Now send the SNMP message to each destination
View Full Code Here

        //
        SnmpMessage msg = null ;
        try {
            msg = (SnmpMessage)pduFactory.encodeSnmpPdu(pdu, bufferSize) ;
            if (msg == null) {
                throw new SnmpStatusException(
                          SnmpDefinitions.snmpRspAuthorizationError) ;
            }
        } catch (SnmpTooBigException x) {
            if (isDebugOn()) {
                debug("sendTrapPdu", "trap pdu is too big");
                debug("sendTrapPdu",
          "trap hasn't been sent to the specified host");
            }
            throw new SnmpStatusException(SnmpDefinitions.snmpRspTooBig) ;
            // FIXME: is the right exception to throw ?
            // We could simply forward SnmpTooBigException ?
        }
   
        // Now send the SNMP message to specified destination
View Full Code Here

  public void get(SnmpMibRequest inRequest) throws SnmpStatusException {
   
    if(isDebugOn()) trace("get","Get in Exception");
   
    if(inRequest.getVersion() == SnmpDefinitions.snmpVersionOne)
      throw new SnmpStatusException(SnmpStatusException.noSuchName);
   
    Enumeration l = inRequest.getElements();
    while(l.hasMoreElements()) {
      SnmpVarBind varbind = (SnmpVarBind) l.nextElement();
      varbind.setNoSuchObject();
View Full Code Here

  public void check(SnmpMibRequest inRequest) throws SnmpStatusException {

    if(isDebugOn()) trace("check","Check in Exception");

    throw new SnmpStatusException(SnmpDefinitions.snmpRspNotWritable);
  }
View Full Code Here

TOP

Related Classes of com.sun.jmx.snmp.SnmpStatusException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.