Search in sources :

Example 76 with MBeanException

use of javax.management.MBeanException in project karaf by apache.

the class ConfigMBeanImpl method update.

@Override
public void update(String pid, Map<String, String> properties) throws MBeanException {
    try {
        if (properties == null) {
            properties = new HashMap<>();
        }
        Dictionary<String, Object> dictionary = toDictionary(properties);
        configRepo.update(pid, dictionary);
    } catch (Exception e) {
        throw new MBeanException(null, e.toString());
    }
}
Also used : NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MalformedURLException(java.net.MalformedURLException) MBeanException(javax.management.MBeanException)

Example 77 with MBeanException

use of javax.management.MBeanException in project karaf by apache.

the class ConfigMBeanImpl method setProperty.

@Override
public void setProperty(String pid, String key, String value) throws MBeanException {
    try {
        Dictionary<String, Object> dictionary = getConfigProperties(pid);
        dictionary.put(key, value);
        configRepo.update(pid, dictionary);
    } catch (Exception e) {
        throw new MBeanException(null, e.toString());
    }
}
Also used : NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MalformedURLException(java.net.MalformedURLException) MBeanException(javax.management.MBeanException)

Example 78 with MBeanException

use of javax.management.MBeanException in project karaf by apache.

the class ConfigMBeanImpl method getProperty.

@Override
public String getProperty(String pid, String key) throws MBeanException {
    try {
        Dictionary<String, Object> dictionary = getConfigProperties(pid);
        Object value = dictionary.get(key);
        if (value != null) {
            return value.toString();
        }
        return null;
    } catch (Exception e) {
        throw new MBeanException(null, e.toString());
    }
}
Also used : NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MalformedURLException(java.net.MalformedURLException) MBeanException(javax.management.MBeanException)

Example 79 with MBeanException

use of javax.management.MBeanException in project karaf by apache.

the class BundlesMBeanImpl method update.

public void update(String bundleId, String location) throws MBeanException {
    try {
        List<Bundle> bundles = selectBundles(bundleId);
        if (location == null) {
            for (Bundle bundle : bundles) {
                bundle.update();
            }
            return;
        }
        if (bundles.size() != 1) {
            throw new IllegalArgumentException("Provided bundle Id doesn't return any bundle or more than one bundle selected");
        }
        InputStream is = new URL(location).openStream();
        bundles.get(0).update(is);
    } catch (Exception e) {
        throw new MBeanException(null, e.toString());
    }
}
Also used : Bundle(org.osgi.framework.Bundle) InputStream(java.io.InputStream) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) URL(java.net.URL) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException)

Example 80 with MBeanException

use of javax.management.MBeanException in project karaf by apache.

the class BundlesMBeanImpl method resolve.

public void resolve(String bundleId) throws MBeanException {
    try {
        List<Bundle> bundles = selectBundles(bundleId);
        getFrameworkWiring().resolveBundles(bundles);
    } catch (Exception e) {
        throw new MBeanException(null, e.toString());
    }
}
Also used : Bundle(org.osgi.framework.Bundle) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanException(javax.management.MBeanException)

Aggregations

MBeanException (javax.management.MBeanException)105 ReflectionException (javax.management.ReflectionException)50 InstanceNotFoundException (javax.management.InstanceNotFoundException)41 AttributeNotFoundException (javax.management.AttributeNotFoundException)35 ObjectName (javax.management.ObjectName)32 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)31 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)26 MalformedObjectNameException (javax.management.MalformedObjectNameException)19 InvocationTargetException (java.lang.reflect.InvocationTargetException)18 RuntimeOperationsException (javax.management.RuntimeOperationsException)18 ServiceNotFoundException (javax.management.ServiceNotFoundException)17 Attribute (javax.management.Attribute)14 RuntimeErrorException (javax.management.RuntimeErrorException)14 Method (java.lang.reflect.Method)10 DynamicMBean (javax.management.DynamicMBean)10 ListenerNotFoundException (javax.management.ListenerNotFoundException)10 Descriptor (javax.management.Descriptor)9 InvalidTargetObjectTypeException (javax.management.modelmbean.InvalidTargetObjectTypeException)8 MalformedURLException (java.net.MalformedURLException)7 MBeanRegistrationException (javax.management.MBeanRegistrationException)7