Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.PropertyList


            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<String, ClassLoader> entry : classloaders.entrySet()) {
            String id = entry.getKey();
            ClassLoader classloader = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
            map.put(new PropertySimple("id", id));
            map.put(new PropertySimple("classloaderInfo", classloader));
            list.add(map);
        }

        return info;
    }
View Full Code Here


            Thread.currentThread().setContextClassLoader(originalCL);
        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfResources", String.valueOf(classloaders.size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Entry<CanonicalResourceKey, ClassLoader> entry : classloaders.entrySet()) {
            CanonicalResourceKey canonicalId = entry.getKey();
            ClassLoader classloader = entry.getValue();
            String[] data = canonicalIdMap.get(canonicalId);
            PropertyMap map = new PropertyMap("classloader");
            map.put(new PropertySimple("resourceName", data[0]));
            map.put(new PropertySimple("resourceId", data[1]));
            map.put(new PropertySimple("resourceUuid", data[2]));
            map.put(new PropertySimple("canonicalId", canonicalId.toString()));
            map.put(new PropertySimple("classloaderInfo", classloader));
            list.add(map);
        }

        classloaders.clear(); // don't need this shallow copy anymore, help the GC clean up

        return info;
View Full Code Here

        }

        OperationResult info = new OperationResult();
        PropertySimple numClassLoaders = new PropertySimple("numberOfClassLoaders", String.valueOf(classloaderCounts
            .size()));
        PropertyList list = new PropertyList("classloaders");
        info.getComplexResults().put(numClassLoaders);
        info.getComplexResults().put(list);

        for (Map.Entry<ClassLoader, AtomicInteger> entry : classloaderCounts.entrySet()) {
            ClassLoader classloader = entry.getKey();
            AtomicInteger count = entry.getValue();
            PropertyMap map = new PropertyMap("classloader");
            map.put(new PropertySimple("classloaderInfo", classloader));
            map.put(new PropertySimple("resourceCount", count.get()));
            list.add(map);
        }

        return info;
    }
View Full Code Here

                propertySimple);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            ///@TODO
            PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
            PropertyDefinition memberDefinition = propertyDefinitionList.getMemberDefinition();
            PropertyList propertyList = (PropertyList) property;
            if (propertyList == null) {
                propertyList = new PropertyList(propertyDefinitionList.getName());
                configuration.put(propertyList);
            }
            fieldsForThisProperty = buildFieldsForPropertyList(propertyDefinition, oddRow, propertyDefinitionList,
                memberDefinition, propertyList);
        } else if (propertyDefinition instanceof PropertyDefinitionMap) {
View Full Code Here

                PropertyMap propertyMap = getPropertyMap(mapKey, map);
                config.put(propertyMap);
            }
            else if (mapValue instanceof List) {
                List<Object> objects = (List<Object>) mapValue;
                PropertyList propertyList = getPropertyList(mapKey, objects);
                config.put(propertyList);
            }
            else {
                config.put(new PropertySimple(mapKey,mapValue));
            }
View Full Code Here

        if (property instanceof PropertyMap) {
            PropertyMap propertyMap = (PropertyMap) property;
            target = getInnerMap(propertyMap,(PropertyDefinitionMap) propertyDefinition, strict);
        } else if (property instanceof PropertyList) {
            PropertyList propertyList = (PropertyList) property;
            target = getInnerList(propertyList, (PropertyDefinitionList)propertyDefinition, strict);
        } else {
            target= convertSimplePropertyValue((PropertySimple) property,
                ((PropertyDefinitionSimple) propertyDefinition), strict);
        }
View Full Code Here

        return result;
    }

    private static PropertyList getPropertyList(String propertyName, List<Object> objects) {
        PropertyList propertyList = new PropertyList(propertyName);

        Property target;
        for (Object o : objects) {
            if (o instanceof List) {
                // Not sure if we actually support that at all inside RHQ
                List list = (List) o;
                target = getPropertyList(propertyName,list); // TODO propertyName?
            } else if (o instanceof Map) {
                Map map = (Map) o;
                target = getPropertyMap(propertyName,map); // TODO propertyName?
            } else {
                target = new PropertySimple(propertyName,o);
            }
            propertyList.add(target);
        }
        return propertyList;
    }
View Full Code Here

        if (good) {
            if (property instanceof PropertySimple) {
                checkDataTypeOfSimpleProperty((PropertyDefinitionSimple) propertyDefinition, (PropertySimple) property,
                    messages);
            } else if (property instanceof PropertyList) {
                PropertyList propertyList = (PropertyList) property;
                PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
                for (Property prop : propertyList.getList()) {
                    checkProperty(messages, propertyDefinitionList.getMemberDefinition(), prop);
                }
            } else if (property instanceof PropertyMap) {
                PropertyMap propertyMap = (PropertyMap) property;
                PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) propertyDefinition;
View Full Code Here

        c1.put(new PropertySimple("one", null));
        c2.put(new PropertySimple("one", null));
        assert c1.equals(c2); // null property matches a null property
        assert c2.equals(c1);

        PropertyList list1 = new PropertyList("listA");
        list1.setList(new ArrayList<Property>());
        c1.put(list1);
        PropertyList list2 = new PropertyList("listA");
        list2.setList(null);
        c2.put(list2);
        assert c1.equals(c2); // empty list is the same as a null list
        assert c2.equals(c1);

        list1.add(new PropertySimple("x", "y"));
        assert !c1.equals(c2);
        assert !c2.equals(c1);

        list2.add(new PropertySimple("x", "y"));
        assert c1.equals(c2);
        assert c2.equals(c1);

        PropertyMap map1 = new PropertyMap("mapB");
        map1.setMap(new HashMap<String, Property>());
View Full Code Here

            c1.put(new PropertySimple("one", null));
            c2.put(new PropertySimple("one", null));
            assert c1.equals(c2); // null property matches a null property
            assert c2.equals(c1);

            PropertyList list1 = new PropertyList("listA");
            list1.setList(new ArrayList<Property>());
            c1.put(list1);
            PropertyList list2 = new PropertyList("listA");
            list2.setList(null);
            c2.put(list2);

            em.flush();
            em.refresh(c2);

            assert c1.equals(c2); // empty list is the same as a null list
            assert c2.equals(c1);

            list1.add(new PropertySimple("x", "y"));
            assert !c1.equals(c2);
            assert !c2.equals(c1);

            list2.add(new PropertySimple("x", "y"));
            em.flush();
            em.refresh(c2);
            assert c1.equals(c2);
            assert c2.equals(c1);

            PropertyMap map1 = new PropertyMap("mapB");
            map1.setMap(new HashMap<String, Property>());
            c1.put(map1);
            PropertyMap map2 = new PropertyMap("mapB");
            map1.setMap(null);
            c2.put(map2);
            em.flush();
            em.refresh(c2);
            assert c1.equals(c2); // empty map is the same as a null map
            assert c2.equals(c1);

            map1.put(new PropertySimple("m", "n"));
            assert !c1.equals(c2);
            assert !c2.equals(c1);

            map2.put(new PropertySimple("m", "n"));
            em.flush();
            em.refresh(c2);
            assert c1.equals(c2);
            assert c2.equals(c1);

            map1.put(list1);
            map2.put(list2);
            em.flush();
            em.refresh(c2);
            assert c1.equals(c2); // innerList is empty, so its same as a null
            assert c2.equals(c1);
            list1.add(new PropertySimple("x", "z"));
            assert !c1.equals(c2);
            assert !c2.equals(c1);
            list2.add(new PropertySimple("x", "z"));
            em.flush();
            em.refresh(c2);

            assert c1.equals(c2);
            assert c2.equals(c1);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.PropertyList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.