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


Java ReflectionException.getMessage方法代码示例

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


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

示例1: getRoles

import javax.management.ReflectionException; //导入方法依赖的package包/类
/**
 * Retrieves values of roles with given names in given relation.
 *
 * @param relationId  relation id
 * @param roleNameArray  array of names of roles to be retrieved
 *
 * @return a RoleResult object, including a RoleList (for roles
 * successfully retrieved) and a RoleUnresolvedList (for roles not
 * retrieved).
 *
 * @exception RelationServiceNotRegisteredException  if the Relation
 * Service is not registered in the MBean Server
 * @exception IllegalArgumentException  if null parameter
 * @exception RelationNotFoundException  if no relation with given id
 *
 * @see #setRoles
 */
public RoleResult getRoles(String relationId,
                           String[] roleNameArray)
    throws RelationServiceNotRegisteredException,
           IllegalArgumentException,
           RelationNotFoundException {

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

    RELATION_LOGGER.entering(RelationService.class.getName(),
            "getRoles", relationId);

    // Can throw RelationServiceNotRegisteredException
    isActive();

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

    RoleResult result;

    if (relObj instanceof RelationSupport) {
        // Internal relation
        result = ((RelationSupport)relObj).getRolesInt(roleNameArray,
                                                    true,
                                                    this);
    } else {
        // Relation MBean
        Object[] params = new Object[1];
        params[0] = roleNameArray;
        String[] signature = new String[1];
        try {
            signature[0] = (roleNameArray.getClass()).getName();
        } catch (Exception exc) {
            // OK : This is an array of java.lang.String
            //      so this should never happen...
        }
        // Shall not throw InstanceNotFoundException, ReflectionException
        // or MBeanException
        try {
            result = (RoleResult)
                (myMBeanServer.invoke(((ObjectName)relObj),
                                      "getRoles",
                                      params,
                                      signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            throw new
                RuntimeException((exc3.getTargetException()).getMessage());
        }
    }

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

示例2: getRoleCardinality

import javax.management.ReflectionException; //导入方法依赖的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

示例3: sendRoleUpdateNotification

import javax.management.ReflectionException; //导入方法依赖的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

示例4: updateRelationServiceMap

import javax.management.ReflectionException; //导入方法依赖的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

示例5: getRoles

import javax.management.ReflectionException; //导入方法依赖的package包/类
/**
 * Retrieves values of roles with given names in given relation.
 *
 * @param relationId  relation id
 * @param roleNameArray  array of names of roles to be retrieved
 *
 * @return a RoleResult object, including a RoleList (for roles
 * successfully retrieved) and a RoleUnresolvedList (for roles not
 * retrieved).
 *
 * @exception RelationServiceNotRegisteredException  if the Relation
 * Service is not registered in the MBean Server
 * @exception IllegalArgumentException  if null parameter
 * @exception RelationNotFoundException  if no relation with given id
 *
 * @see #setRoles
 */
public RoleResult getRoles(String relationId,
                           String[] roleNameArray)
    throws RelationServiceNotRegisteredException,
           IllegalArgumentException,
           RelationNotFoundException {

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

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

    // Can throw RelationServiceNotRegisteredException
    isActive();

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

    RoleResult result;

    if (relObj instanceof RelationSupport) {
        // Internal relation
        result = ((RelationSupport)relObj).getRolesInt(roleNameArray,
                                                    true,
                                                    this);
    } else {
        // Relation MBean
        Object[] params = new Object[1];
        params[0] = roleNameArray;
        String[] signature = new String[1];
        try {
            signature[0] = (roleNameArray.getClass()).getName();
        } catch (Exception exc) {
            // OK : This is an array of java.lang.String
            //      so this should never happen...
        }
        // Shall not throw InstanceNotFoundException, ReflectionException
        // or MBeanException
        try {
            result = (RoleResult)
                (myMBeanServer.invoke(((ObjectName)relObj),
                                      "getRoles",
                                      params,
                                      signature));
        } catch (InstanceNotFoundException exc1) {
            throw new RuntimeException(exc1.getMessage());
        } catch (ReflectionException exc2) {
            throw new RuntimeException(exc2.getMessage());
        } catch (MBeanException exc3) {
            throw new
                RuntimeException((exc3.getTargetException()).getMessage());
        }
    }

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

示例6: getRoleCardinality

import javax.management.ReflectionException; //导入方法依赖的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.ReflectionException; //导入方法依赖的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.ReflectionException; //导入方法依赖的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.ReflectionException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。