当前位置: 首页>>代码示例>>Java>>正文


Java MBeanException.getTargetException方法代码示例

本文整理汇总了Java中javax.management.MBeanException.getTargetException方法的典型用法代码示例。如果您正苦于以下问题:Java MBeanException.getTargetException方法的具体用法?Java MBeanException.getTargetException怎么用?Java MBeanException.getTargetException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.MBeanException的用法示例。


在下文中一共展示了MBeanException.getTargetException方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: set

import javax.management.MBeanException; //导入方法依赖的package包/类
/**
 * Set the value of an SNMP variable.
 *
 * <p><b><i>
 * You should never need to use this method directly.
 * </i></b></p>
 *
 * @param meta  The impacted metadata object
 * @param name  The ObjectName of the impacted MBean
 * @param x     The new requested SnmpValue
 * @param id    The OID arc identifying the variable we're trying to set.
 * @param data  User contextual data allocated through the
 *        {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
 *
 * @return The new value of the variable after the operation.
 *
 * @exception SnmpStatusException whenever an SNMP exception must be
 *      raised. Raising an exception will abort the request. <br>
 *      Exceptions should never be raised directly, but only by means of
 * <code>
 * req.registerSetException(<i>VariableId</i>,<i>SnmpStatusException</i>)
 * </code>
 **/
public SnmpValue set(SnmpGenericMetaServer meta, ObjectName name,
                     SnmpValue x, long id, Object data)
    throws SnmpStatusException {
    final String attname = meta.getAttributeName(id);
    final Object attvalue=
        meta.buildAttributeValue(id,x);
    final Attribute att = new Attribute(attname,attvalue);

    Object result = null;

    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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:SnmpGenericObjectServer.java

示例2: get

import javax.management.MBeanException; //导入方法依赖的package包/类
/**
 * Get the value of an SNMP variable.
 *
 * <p><b><i>
 * You should never need to use this method directly.
 * </i></b></p>
 *
 * @param meta  The impacted metadata object
 * @param name  The ObjectName of the impacted MBean
 * @param id    The OID arc identifying the variable we're trying to set.
 * @param data  User contextual data allocated through the
 *        {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}
 *
 * @return The value of the variable.
 *
 * @exception SnmpStatusException whenever an SNMP exception must be
 *      raised. Raising an exception will abort the request. <br>
 *      Exceptions should never be raised directly, but only by means of
 * <code>
 * req.registerGetException(<i>VariableId</i>,<i>SnmpStatusException</i>)
 * </code>
 **/
public SnmpValue get(SnmpGenericMetaServer meta, ObjectName name,
                     long id, Object data)
    throws SnmpStatusException {
    final String attname = meta.getAttributeName(id);
    Object result = null;

    try {
        result = server.getAttribute(name,attname);
    } catch (MBeanException m) {
        Exception t = m.getTargetException();
        if (t instanceof SnmpStatusException)
            throw (SnmpStatusException) t;
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    } catch (Exception e) {
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    }

    return meta.buildSnmpValue(id,result);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:SnmpGenericObjectServer.java

示例3: getRoleCardinality

import javax.management.MBeanException; //导入方法依赖的package包/类
/**
 * Retrieves the number of MBeans currently referenced in the given role.
 *
 * @param relationId  relation id
 * @param roleName  name of role
 *
 * @return the number of currently referenced MBeans in that role
 *
 * @exception IllegalArgumentException  if null parameter
 * @exception RelationNotFoundException  if no relation with given id
 * @exception RoleNotFoundException  if there is no role with given name
 */
public Integer getRoleCardinality(String relationId,
                                  String roleName)
    throws IllegalArgumentException,
           RelationNotFoundException,
           RoleNotFoundException {

    if (relationId == null || roleName == null) {
        String excMsg = "Invalid parameter.";
        throw new IllegalArgumentException(excMsg);
    }

    RELATION_LOGGER.entering(RelationService.class.getName(),
            "getRoleCardinality", new Object[] {relationId, roleName});

    // Can throw a RelationNotFoundException
    Object relObj = getRelation(relationId);

    Integer result;

    if (relObj instanceof RelationSupport) {
        // Internal relation
        // Can throw RoleNotFoundException
        result = ((RelationSupport)relObj).getRoleCardinality(roleName);

    } else {
        // Relation MBean
        Object[] params = new Object[1];
        params[0] = roleName;
        String[] signature = new String[1];
        signature[0] = "java.lang.String";
        // Can throw MBeanException wrapping RoleNotFoundException:
        // throw wrapped exception
        //
        // Shall not throw InstanceNotFoundException or ReflectionException
        try {
            result = (Integer)
                (myMBeanServer.invoke(((ObjectName)relObj),
                                      "getRoleCardinality",
                                      params,
                                      signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RoleNotFoundException) {
                throw ((RoleNotFoundException)wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }

    RELATION_LOGGER.exiting(RelationService.class.getName(),
            "getRoleCardinality");
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:71,代码来源:RelationService.java

示例4: sendRoleUpdateNotification

import javax.management.MBeanException; //导入方法依赖的package包/类
private void sendRoleUpdateNotification(Role newRole,
                                        List<ObjectName> oldRoleValue,
                                        boolean relationServCallFlg,
                                        RelationService relationServ)
    throws IllegalArgumentException,
           RelationServiceNotRegisteredException,
           RelationNotFoundException {

    if (newRole == null ||
        oldRoleValue == null ||
        (relationServCallFlg && relationServ == null)) {
        String excMsg = "Invalid parameter.";
        throw new IllegalArgumentException(excMsg);
    }

    RELATION_LOGGER.entering(RelationSupport.class.getName(),
            "sendRoleUpdateNotification", new Object[] {newRole,
            oldRoleValue, relationServCallFlg, relationServ});

    if (relationServCallFlg) {
        // Direct call to the Relation Service
        // Shall not throw a RelationNotFoundException for an internal
        // relation
        try {
            relationServ.sendRoleUpdateNotification(myRelId,
                                                  newRole,
                                                  oldRoleValue);
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }

    } else {

        Object[] params = new Object[3];
        params[0] = myRelId;
        params[1] = newRole;
        params[2] = oldRoleValue;
        String[] signature = new String[3];
        signature[0] = "java.lang.String";
        signature[1] = "javax.management.relation.Role";
        signature[2] = "java.util.List";

        // Can throw InstanceNotFoundException if the Relation Service
        // is not registered (to be transformed).
        //
        // Can throw a MBeanException wrapping a
        // RelationNotFoundException (to be raised in any case): wrapped
        // exception to be thrown
        //
        // Shall not throw a ReflectionException
        try {
            myRelServiceMBeanServer.invoke(myRelServiceName,
                                           "sendRoleUpdateNotification",
                                           params,
                                           signature);
        } catch (ReflectionException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (InstanceNotFoundException exc2) {
            throw new RelationServiceNotRegisteredException(
                                                        exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RelationNotFoundException) {
                throw ((RelationNotFoundException)wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }

    RELATION_LOGGER.exiting(RelationSupport.class.getName(),
            "sendRoleUpdateNotification");
    return;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:75,代码来源:RelationSupport.java

示例5: updateRelationServiceMap

import javax.management.MBeanException; //导入方法依赖的package包/类
private void updateRelationServiceMap(Role newRole,
                                      List<ObjectName> oldRoleValue,
                                      boolean relationServCallFlg,
                                      RelationService relationServ)
    throws IllegalArgumentException,
           RelationServiceNotRegisteredException,
           RelationNotFoundException {

    if (newRole == null ||
        oldRoleValue == null ||
        (relationServCallFlg && relationServ == null)) {
        String excMsg = "Invalid parameter.";
        throw new IllegalArgumentException(excMsg);
    }

    RELATION_LOGGER.entering(RelationSupport.class.getName(),
            "updateRelationServiceMap", new Object[] {newRole,
            oldRoleValue, relationServCallFlg, relationServ});

    if (relationServCallFlg) {
        // Direct call to the Relation Service
        // Shall not throw a RelationNotFoundException
        try {
            relationServ.updateRoleMap(myRelId,
                                     newRole,
                                     oldRoleValue);
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }

    } else {
        Object[] params = new Object[3];
        params[0] = myRelId;
        params[1] = newRole;
        params[2] = oldRoleValue;
        String[] signature = new String[3];
        signature[0] = "java.lang.String";
        signature[1] = "javax.management.relation.Role";
        signature[2] = "java.util.List";
        // Can throw InstanceNotFoundException if the Relation Service
        // is not registered (to be transformed).
        // Can throw a MBeanException wrapping a RelationNotFoundException:
        // wrapped exception to be thrown
        //
        // Shall not throw a ReflectionException
        try {
            myRelServiceMBeanServer.invoke(myRelServiceName,
                                           "updateRoleMap",
                                           params,
                                           signature);
        } catch (ReflectionException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (InstanceNotFoundException exc2) {
            throw new
                 RelationServiceNotRegisteredException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RelationNotFoundException) {
                throw ((RelationNotFoundException)wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }

    RELATION_LOGGER.exiting(RelationSupport.class.getName(),
            "updateRelationServiceMap");
    return;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:70,代码来源:RelationSupport.java

示例6: getRoleCardinality

import javax.management.MBeanException; //导入方法依赖的package包/类
/**
 * Retrieves the number of MBeans currently referenced in the given role.
 *
 * @param relationId  relation id
 * @param roleName  name of role
 *
 * @return the number of currently referenced MBeans in that role
 *
 * @exception IllegalArgumentException  if null parameter
 * @exception RelationNotFoundException  if no relation with given id
 * @exception RoleNotFoundException  if there is no role with given name
 */
public Integer getRoleCardinality(String relationId,
                                  String roleName)
    throws IllegalArgumentException,
           RelationNotFoundException,
           RoleNotFoundException {

    if (relationId == null || roleName == null) {
        String excMsg = "Invalid parameter.";
        throw new IllegalArgumentException(excMsg);
    }

    RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
                        relationId, roleName);

    // Can throw a RelationNotFoundException
    Object relObj = getRelation(relationId);

    Integer result;

    if (relObj instanceof RelationSupport) {
        // Internal relation
        // Can throw RoleNotFoundException
        result = ((RelationSupport)relObj).getRoleCardinality(roleName);

    } else {
        // Relation MBean
        Object[] params = new Object[1];
        params[0] = roleName;
        String[] signature = new String[1];
        signature[0] = "java.lang.String";
        // Can throw MBeanException wrapping RoleNotFoundException:
        // throw wrapped exception
        //
        // Shall not throw InstanceNotFoundException or ReflectionException
        try {
            result = (Integer)
                (myMBeanServer.invoke(((ObjectName)relObj),
                                      "getRoleCardinality",
                                      params,
                                      signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RoleNotFoundException) {
                throw ((RoleNotFoundException)wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }

    RELATION_LOGGER.log(Level.TRACE, "RETURN");
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:70,代码来源:RelationService.java

示例7: sendRoleUpdateNotification

import javax.management.MBeanException; //导入方法依赖的package包/类
private void sendRoleUpdateNotification(Role newRole,
                                        List<ObjectName> oldRoleValue,
                                        boolean relationServCallFlg,
                                        RelationService relationServ)
    throws IllegalArgumentException,
           RelationServiceNotRegisteredException,
           RelationNotFoundException {

    if (newRole == null ||
        oldRoleValue == null ||
        (relationServCallFlg && relationServ == null)) {
        String excMsg = "Invalid parameter.";
        throw new IllegalArgumentException(excMsg);
    }

    RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
                        newRole, oldRoleValue, relationServCallFlg,
                        relationServ);

    if (relationServCallFlg) {
        // Direct call to the Relation Service
        // Shall not throw a RelationNotFoundException for an internal
        // relation
        try {
            relationServ.sendRoleUpdateNotification(myRelId,
                                                  newRole,
                                                  oldRoleValue);
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }

    } else {

        Object[] params = new Object[3];
        params[0] = myRelId;
        params[1] = newRole;
        params[2] = oldRoleValue;
        String[] signature = new String[3];
        signature[0] = "java.lang.String";
        signature[1] = "javax.management.relation.Role";
        signature[2] = "java.util.List";

        // Can throw InstanceNotFoundException if the Relation Service
        // is not registered (to be transformed).
        //
        // Can throw a MBeanException wrapping a
        // RelationNotFoundException (to be raised in any case): wrapped
        // exception to be thrown
        //
        // Shall not throw a ReflectionException
        try {
            myRelServiceMBeanServer.invoke(myRelServiceName,
                                           "sendRoleUpdateNotification",
                                           params,
                                           signature);
        } catch (ReflectionException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (InstanceNotFoundException exc2) {
            throw new RelationServiceNotRegisteredException(
                                                        exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RelationNotFoundException) {
                throw ((RelationNotFoundException)wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }

    RELATION_LOGGER.log(Level.TRACE, "RETURN");
    return;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:74,代码来源:RelationSupport.java

示例8: updateRelationServiceMap

import javax.management.MBeanException; //导入方法依赖的package包/类
private void updateRelationServiceMap(Role newRole,
                                      List<ObjectName> oldRoleValue,
                                      boolean relationServCallFlg,
                                      RelationService relationServ)
    throws IllegalArgumentException,
           RelationServiceNotRegisteredException,
           RelationNotFoundException {

    if (newRole == null ||
        oldRoleValue == null ||
        (relationServCallFlg && relationServ == null)) {
        String excMsg = "Invalid parameter.";
        throw new IllegalArgumentException(excMsg);
    }

    RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
                        newRole, oldRoleValue, relationServCallFlg,
                        relationServ);

    if (relationServCallFlg) {
        // Direct call to the Relation Service
        // Shall not throw a RelationNotFoundException
        try {
            relationServ.updateRoleMap(myRelId,
                                     newRole,
                                     oldRoleValue);
        } catch (RelationNotFoundException exc) {
            throw new RuntimeException(exc.getMessage());
        }

    } else {
        Object[] params = new Object[3];
        params[0] = myRelId;
        params[1] = newRole;
        params[2] = oldRoleValue;
        String[] signature = new String[3];
        signature[0] = "java.lang.String";
        signature[1] = "javax.management.relation.Role";
        signature[2] = "java.util.List";
        // Can throw InstanceNotFoundException if the Relation Service
        // is not registered (to be transformed).
        // Can throw a MBeanException wrapping a RelationNotFoundException:
        // wrapped exception to be thrown
        //
        // Shall not throw a ReflectionException
        try {
            myRelServiceMBeanServer.invoke(myRelServiceName,
                                           "updateRoleMap",
                                           params,
                                           signature);
        } catch (ReflectionException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (InstanceNotFoundException exc2) {
            throw new
                 RelationServiceNotRegisteredException(exc2.getMessage());
        } catch (MBeanException exc3) {
            Exception wrappedExc = exc3.getTargetException();
            if (wrappedExc instanceof RelationNotFoundException) {
                throw ((RelationNotFoundException)wrappedExc);
            } else {
                throw new RuntimeException(wrappedExc.getMessage());
            }
        }
    }

    RELATION_LOGGER.log(Level.TRACE, "RETURN");
    return;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:69,代码来源:RelationSupport.java


注:本文中的javax.management.MBeanException.getTargetException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。