ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException {
   final PathAddress address = resolvePathAddress(name);
   if (address == null) {
     throw MESSAGES.mbeanNotFound(name);
   }
   accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
       name, address, false);
   return new ObjectInstance(name, CLASS_NAME);
 }
 void setAttribute(ObjectName name, Attribute attribute)
     throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
   final ResourceAndRegistration reg = getRootResourceAndRegistration();
   final PathAddress address = resolvePathAddress(name, reg);
   if (address == null) {
     throw MESSAGES.mbeanNotFound(name);
   }
   final ResourceAccessControl accessControl =
       accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
           name, address, false);
   setAttribute(reg, address, name, attribute, accessControl);
 }
 Object getAttribute(final ObjectName name, final String attribute)
     throws AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
   final ResourceAndRegistration reg = getRootResourceAndRegistration();
   final PathAddress address = resolvePathAddress(name, reg);
   if (address == null) {
     throw MESSAGES.mbeanNotFound(name);
   }
   final ResourceAccessControl accessControl =
       accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
           name, address, false);
   return getAttribute(reg, address, name, attribute, accessControl);
 }
 MBeanInfo getMBeanInfo(final ObjectName name) throws InstanceNotFoundException {
   final ResourceAndRegistration reg = getRootResourceAndRegistration();
   final PathAddress address = resolvePathAddress(name, reg);
   if (address == null) {
     throw MESSAGES.mbeanNotFound(name);
   }
   final ResourceAccessControl accessControl =
       accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
           name, address, true);
   return MBeanInfoFactory.createMBeanInfo(
       name,
       converters,
       configuredDomains,
       standalone,
       address,
       getMBeanRegistration(address, reg));
 }
 AttributeList getAttributes(ObjectName name, String[] attributes)
     throws InstanceNotFoundException, ReflectionException {
   final ResourceAndRegistration reg = getRootResourceAndRegistration();
   final PathAddress address = resolvePathAddress(name, reg);
   if (address == null) {
     throw MESSAGES.mbeanNotFound(name);
   }
   final ResourceAccessControl accessControl =
       accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
           name, address, false);
   AttributeList list = new AttributeList();
   for (String attribute : attributes) {
     try {
       list.add(
           new Attribute(attribute, getAttribute(reg, address, name, attribute, accessControl)));
     } catch (AttributeNotFoundException e) {
       throw new ReflectionException(e);
     }
   }
   return list;
 }
  AttributeList setAttributes(ObjectName name, AttributeList attributes)
      throws InstanceNotFoundException, ReflectionException {
    final ResourceAndRegistration reg = getRootResourceAndRegistration();
    final PathAddress address = resolvePathAddress(name, reg);
    if (address == null) {
      throw MESSAGES.mbeanNotFound(name);
    }
    final ResourceAccessControl accessControl =
        accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
            name, address, false);

    for (Attribute attribute : attributes.asList()) {
      try {
        setAttribute(reg, address, name, attribute, accessControl);
      } catch (JMRuntimeException e) {
        // Propagate the JMRuntimeException thrown from authorization
        throw e;
      } catch (Exception e) {
        throw MESSAGES.cannotSetAttribute(e, attribute.getName());
      }
    }

    return attributes;
  }
  private Object invoke(
      final OperationEntry entry, final String operationName, PathAddress address, Object[] params)
      throws InstanceNotFoundException, MBeanException, ReflectionException {
    if (!standalone && !entry.getFlags().contains(OperationEntry.Flag.READ_ONLY)) {
      throw MESSAGES.noOperationCalled(operationName);
    }

    ResourceAccessControl accessControl;
    if (operationName.equals("add")) {
      accessControl = accessControlUtil.getResourceAccess(address, true);
    } else {
      ObjectName objectName = ObjectNameAddressUtil.createObjectName(operationName, address);
      accessControl =
          accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
              objectName, address, true);
    }

    if (!accessControl.isExecutableOperation(operationName)) {
      throw MESSAGES.notAuthorizedToExecuteOperation(operationName);
    }

    final ModelNode description = entry.getDescriptionProvider().getModelDescription(null);
    ModelNode op = new ModelNode();
    op.get(OP).set(operationName);
    op.get(OP_ADDR).set(address.toModelNode());
    if (params.length > 0) {
      ModelNode requestProperties = description.require(REQUEST_PROPERTIES);
      Set<String> keys = requestProperties.keys();
      if (keys.size() != params.length) {
        throw MESSAGES.differentLengths("params", "description");
      }
      Iterator<String> it = requestProperties.keys().iterator();
      for (int i = 0; i < params.length; i++) {
        String attributeName = it.next();
        ModelNode paramDescription = requestProperties.get(attributeName);
        op.get(attributeName).set(converters.toModelNode(paramDescription, params[i]));
      }
    }

    ModelNode result = execute(op);
    String error = getFailureDescription(result);
    if (error != null) {
      if (error.contains(AUTHORIZED_ERROR)) {
        for (Object param : params) {
          // Since read-resource-description does not know the parameters of the operation, i.e. if
          // a vault expression is used or not,
          // check the error code
          // TODO add a separate authorize step where we check ourselves that the operation will
          // pass authorization?
          if (isVaultExpression(param)) {
            throw MESSAGES.notAuthorizedToExecuteOperation(operationName);
          }
        }
      }
      throw new ReflectionException(null, error);
    }

    if (!description.hasDefined(REPLY_PROPERTIES)) {
      return null;
    }
    // TODO we could have more than one reply property
    return converters.fromModelNode(description.get(REPLY_PROPERTIES), result.get(RESULT));
  }