Java Code Examples for javax.management.openmbean.CompositeData#containsKey()

The following examples show how to use javax.management.openmbean.CompositeData#containsKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultMXBeanMappingFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 2
Source File: AttributeStore.java    From red5-server-common with Apache License 2.0 6 votes vote down vote up
/**
 * Allows for reconstruction via CompositeData.
 * 
 * @param cd
 *            composite data
 * @return AttributeStore class instance
 */
@SuppressWarnings("unchecked")
public static AttributeStore from(CompositeData cd) {
    AttributeStore instance = null;
    if (cd.containsKey("attributes")) {
        Object cn = cd.get("attributes");
        if (cn != null) {
            if (cn instanceof IAttributeStore) {
                instance = new AttributeStore((IAttributeStore) cn);
            } else if (cn instanceof Map) {
                instance = new AttributeStore((Map<String, Object>) cn);
            }
        } else {
            instance = new AttributeStore();
        }
    } else {
        instance = new AttributeStore();
    }
    return instance;
}
 
Example 3
Source File: DefaultMXBeanMappingFactory.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 4
Source File: DefaultMXBeanMappingFactory.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 5
Source File: DefaultMXBeanMappingFactory.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 6
Source File: DefaultMXBeanMappingFactory.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 7
Source File: DefaultMXBeanMappingFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 8
Source File: DefaultMXBeanMappingFactory.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 9
Source File: DefaultMXBeanMappingFactory.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 10
Source File: DefaultMXBeanMappingFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        @SuppressWarnings("deprecation")
        Object tmp = targetClass.newInstance();
        o = tmp;
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 11
Source File: DefaultMXBeanMappingFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 12
Source File: DefaultMXBeanMappingFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 13
Source File: DefaultMXBeanMappingFactory.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 14
Source File: DefaultMXBeanMappingFactory.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 15
Source File: DefaultMXBeanMappingFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 16
Source File: DefaultMXBeanMappingFactory.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
Object fromCompositeData(CompositeData cd,
                         String[] itemNames,
                         MXBeanMapping[] converters)
        throws InvalidObjectException {
    Object o;
    try {
        final Class<?> targetClass = getTargetClass();
        ReflectUtil.checkPackageAccess(targetClass);
        o = targetClass.newInstance();
        for (int i = 0; i < itemNames.length; i++) {
            if (cd.containsKey(itemNames[i])) {
                Object openItem = cd.get(itemNames[i]);
                Object javaItem =
                    converters[i].fromOpenValue(openItem);
                MethodUtil.invoke(setters[i], o, new Object[] {javaItem});
            }
        }
    } catch (Exception e) {
        throw invalidObjectException(e);
    }
    return o;
}
 
Example 17
Source File: TriggerSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static OperableTrigger newTrigger(CompositeData cData) throws ParseException {
    OperableTrigger result = null;
    if(cData.containsKey("cronExpression")) {
        result = CronTriggerSupport.newTrigger(cData);
    } else {
        result = SimpleTriggerSupport.newTrigger(cData);
    }
    return result;
}
 
Example 18
Source File: CronTriggerSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static OperableTrigger newTrigger(CompositeData cData) throws ParseException {
    CronTriggerImpl result = new CronTriggerImpl();
    result.setCronExpression((String) cData.get("cronExpression"));
    if(cData.containsKey("timeZone")) {
        result.setTimeZone(TimeZone.getTimeZone((String)cData.get("timeZone")));
    }
    TriggerSupport.initializeTrigger(result, cData);
    return result;
}
 
Example 19
Source File: Red5.java    From red5-server-common with Apache License 2.0 5 votes vote down vote up
/**
 * Allows for reconstruction via CompositeData.
 * 
 * @param cd
 *            composite data
 * @return Red5 class instance
 */
public static Red5 from(CompositeData cd) {
    Red5 instance = null;
    if (cd.containsKey("connection")) {
        Object cn = cd.get("connection");
        if (cn != null && cn instanceof IConnection) {
            instance = new Red5((IConnection) cn);
        } else {
            instance = new Red5();
        }
    } else {
        instance = new Red5();
    }
    return instance;
}
 
Example 20
Source File: Client.java    From red5-server-common with Apache License 2.0 5 votes vote down vote up
/**
 * Allows for reconstruction via CompositeData.
 *
 * @param cd
 *            composite data
 * @return Client class instance
 */
public static Client from(CompositeData cd) {
    Client instance = null;
    if (cd.containsKey("id")) {
        String id = (String) cd.get("id");
        instance = new Client(id, (Long) cd.get("creationTime"), null);
        instance.setAttribute(PERMISSIONS, cd.get(PERMISSIONS));
    }
    if (cd.containsKey("attributes")) {
        AttributeStore attrs = (AttributeStore) cd.get("attributes");
        instance.setAttributes(attrs);
    }
    return instance;
}