Search in sources :

Example 96 with ReflectionException

use of javax.management.ReflectionException in project wildfly-core by wildfly.

the class PluggableMBeanServerImpl method createMBean.

@Override
public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) throws ReflectionException, InstanceAlreadyExistsException, MBeanException, NotCompliantMBeanException {
    params = nullAsEmpty(params);
    signature = nullAsEmpty(signature);
    Throwable error = null;
    MBeanServerPlugin delegate = null;
    final boolean readOnly = false;
    try {
        delegate = findDelegateForNewObject(name);
        authorizeMBeanOperation(delegate, name, CREATE_MBEAN, null, JmxAction.Impact.WRITE);
        return checkNotAReservedDomainRegistrationIfObjectNameWasChanged(name, delegate.createMBean(className, name, params, signature), delegate);
    } catch (Exception e) {
        error = e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        if (e instanceof InstanceAlreadyExistsException)
            throw (InstanceAlreadyExistsException) e;
        if (e instanceof MBeanException)
            throw (MBeanException) e;
        if (e instanceof NotCompliantMBeanException)
            throw (NotCompliantMBeanException) e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).createMBean(className, name, params, signature);
        }
    }
}
Also used : ReflectionException(javax.management.ReflectionException) MBeanServerPlugin(org.jboss.as.server.jmx.MBeanServerPlugin) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) IntrospectionException(javax.management.IntrospectionException) OperationsException(javax.management.OperationsException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ReflectionException(javax.management.ReflectionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) ListenerNotFoundException(javax.management.ListenerNotFoundException) RuntimeOperationsException(javax.management.RuntimeOperationsException) AttributeNotFoundException(javax.management.AttributeNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) PrivilegedActionException(java.security.PrivilegedActionException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException)

Example 97 with ReflectionException

use of javax.management.ReflectionException in project wildfly-core by wildfly.

the class PluggableMBeanServerImpl method getMBeanInfo.

private MBeanInfo getMBeanInfo(ObjectName name, boolean logAndAuthorize, boolean nullIfNotFound) throws InstanceNotFoundException, IntrospectionException, ReflectionException {
    Throwable error = null;
    MBeanServerPlugin delegate = null;
    final boolean readOnly = true;
    try {
        delegate = findDelegate(name);
        if (logAndAuthorize) {
            authorizeMBeanOperation(delegate, name, GET_MBEAN_INFO, null, JmxAction.Impact.READ_ONLY);
        }
        return delegate.getMBeanInfo(name);
    } catch (Exception e) {
        if (nullIfNotFound) {
            return null;
        }
        error = e;
        if (e instanceof InstanceNotFoundException)
            throw (InstanceNotFoundException) e;
        if (e instanceof IntrospectionException)
            throw (IntrospectionException) e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        throw makeRuntimeException(e);
    } finally {
        if (logAndAuthorize && shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getMBeanInfo(name);
        }
    }
}
Also used : ReflectionException(javax.management.ReflectionException) MBeanServerPlugin(org.jboss.as.server.jmx.MBeanServerPlugin) InstanceNotFoundException(javax.management.InstanceNotFoundException) IntrospectionException(javax.management.IntrospectionException) IntrospectionException(javax.management.IntrospectionException) OperationsException(javax.management.OperationsException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ReflectionException(javax.management.ReflectionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) ListenerNotFoundException(javax.management.ListenerNotFoundException) RuntimeOperationsException(javax.management.RuntimeOperationsException) AttributeNotFoundException(javax.management.AttributeNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) PrivilegedActionException(java.security.PrivilegedActionException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException)

Example 98 with ReflectionException

use of javax.management.ReflectionException in project wildfly-core by wildfly.

the class PluggableMBeanServerImpl method instantiate.

@Override
public Object instantiate(String className, Object[] params, String[] signature) throws ReflectionException, MBeanException {
    params = nullAsEmpty(params);
    signature = nullAsEmpty(signature);
    Throwable error = null;
    MBeanServerPlugin delegate = rootMBeanServer;
    final boolean readOnly = false;
    try {
        // Special authorization
        authorizeClassloadingOperation(delegate, INSTANTIATE);
        return delegate.instantiate(className, params, signature);
    } catch (Exception e) {
        error = e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        if (e instanceof MBeanException)
            throw (MBeanException) e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).instantiate(className, params, signature);
        }
    }
}
Also used : ReflectionException(javax.management.ReflectionException) MBeanServerPlugin(org.jboss.as.server.jmx.MBeanServerPlugin) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) IntrospectionException(javax.management.IntrospectionException) OperationsException(javax.management.OperationsException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ReflectionException(javax.management.ReflectionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) ListenerNotFoundException(javax.management.ListenerNotFoundException) RuntimeOperationsException(javax.management.RuntimeOperationsException) AttributeNotFoundException(javax.management.AttributeNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) PrivilegedActionException(java.security.PrivilegedActionException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException)

Example 99 with ReflectionException

use of javax.management.ReflectionException in project wildfly-core by wildfly.

the class PluggableMBeanServerImpl method deserialize.

@Override
@Deprecated
public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) throws OperationsException, ReflectionException {
    Throwable error = null;
    MBeanServerPlugin delegate = rootMBeanServer;
    final boolean readOnly = true;
    try {
        // Special authorization
        authorizeClassloadingOperation(delegate, loaderName, DESERIALIZE);
        return delegate.deserialize(className, loaderName, data);
    } catch (Exception e) {
        error = e;
        if (e instanceof OperationsException)
            throw (OperationsException) e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).deserialize(className, loaderName, data);
        }
    }
}
Also used : ReflectionException(javax.management.ReflectionException) MBeanServerPlugin(org.jboss.as.server.jmx.MBeanServerPlugin) IntrospectionException(javax.management.IntrospectionException) OperationsException(javax.management.OperationsException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ReflectionException(javax.management.ReflectionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) ListenerNotFoundException(javax.management.ListenerNotFoundException) RuntimeOperationsException(javax.management.RuntimeOperationsException) AttributeNotFoundException(javax.management.AttributeNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) PrivilegedActionException(java.security.PrivilegedActionException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException) OperationsException(javax.management.OperationsException) RuntimeOperationsException(javax.management.RuntimeOperationsException)

Example 100 with ReflectionException

use of javax.management.ReflectionException in project wildfly-core by wildfly.

the class PluggableMBeanServerImpl method instantiate.

@Override
public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, MBeanException, InstanceNotFoundException {
    Throwable error = null;
    MBeanServerPlugin delegate = rootMBeanServer;
    final boolean readOnly = false;
    try {
        // Special authorization
        authorizeClassloadingOperation(delegate, INSTANTIATE);
        return delegate.instantiate(className, loaderName);
    } catch (Exception e) {
        error = e;
        if (e instanceof ReflectionException)
            throw (ReflectionException) e;
        if (e instanceof MBeanException)
            throw (MBeanException) e;
        if (e instanceof InstanceNotFoundException)
            throw (InstanceNotFoundException) e;
        throw makeRuntimeException(e);
    } finally {
        if (shouldAuditLog(delegate, readOnly)) {
            new MBeanServerAuditLogRecordFormatter(this, error, readOnly).instantiate(className, loaderName);
        }
    }
}
Also used : ReflectionException(javax.management.ReflectionException) MBeanServerPlugin(org.jboss.as.server.jmx.MBeanServerPlugin) InstanceNotFoundException(javax.management.InstanceNotFoundException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) IntrospectionException(javax.management.IntrospectionException) OperationsException(javax.management.OperationsException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ReflectionException(javax.management.ReflectionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) ListenerNotFoundException(javax.management.ListenerNotFoundException) RuntimeOperationsException(javax.management.RuntimeOperationsException) AttributeNotFoundException(javax.management.AttributeNotFoundException) MBeanRegistrationException(javax.management.MBeanRegistrationException) InstanceNotFoundException(javax.management.InstanceNotFoundException) PrivilegedActionException(java.security.PrivilegedActionException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) MBeanException(javax.management.MBeanException)

Aggregations

ReflectionException (javax.management.ReflectionException)290 InstanceNotFoundException (javax.management.InstanceNotFoundException)223 MBeanException (javax.management.MBeanException)186 AttributeNotFoundException (javax.management.AttributeNotFoundException)147 IntrospectionException (javax.management.IntrospectionException)110 Attribute (javax.management.Attribute)99 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)83 ObjectName (javax.management.ObjectName)83 Test (org.testng.annotations.Test)83 AttributeList (javax.management.AttributeList)78 MalformedObjectNameException (javax.management.MalformedObjectNameException)65 MBeanInfo (javax.management.MBeanInfo)53 IOException (java.io.IOException)49 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)46 RuntimeOperationsException (javax.management.RuntimeOperationsException)40 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)38 ListenerNotFoundException (javax.management.ListenerNotFoundException)36 MBeanOperationInfo (javax.management.MBeanOperationInfo)30 MBeanServer (javax.management.MBeanServer)28 MBeanRegistrationException (javax.management.MBeanRegistrationException)27