Package org.rhq.core.domain.configuration

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


                propertySimple.mask();
            }
        }
        // If the property is a Map, recurse into it and mask its child properties.
        else if (propertyDefinition instanceof PropertyDefinitionMap) {
            PropertyMap propertyMap = parentPropertyMap.getMap(propertyDefinition.getName());
            PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) propertyDefinition;
            maskPropertyMap(propertyMap, propertyDefinitionMap);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
            PropertyDefinition listMemberPropertyDefinition = propertyDefinitionList.getMemberDefinition();
            // If the property is a List of Maps, iterate the list, and recurse into each Map and mask its child
            // properties.
            if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
                PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition;
                PropertyList propertyList = parentPropertyMap.getList(propertyDefinition.getName());
                for (Property property : propertyList.getList()) {
                    PropertyMap propertyMap = (PropertyMap) property;
                    maskPropertyMap(propertyMap, propertyDefinitionMap);
                }
            }
        }
    }
View Full Code Here


            PropertySimple propertySimple = (PropertySimple) property;
            unmaskPropertySimple(propertySimple, unmaskedParentPropertyMap);
        }
        // If the property is a Map, recurse into it and unmask its child properties.
        else if (property instanceof PropertyMap) {
            PropertyMap propertyMap = (PropertyMap) property;
            PropertyMap unmaskedPropertyMap = unmaskedParentPropertyMap.getMap(property.getName());
            unmaskPropertyMap(propertyMap, unmaskedPropertyMap);
        } else if (property instanceof PropertyList) {
            PropertyList propertyList = (PropertyList) property;
            List<Property> memberProperties = propertyList.getList();
            // If the property is a List of Maps, iterate the list, and recurse into each Map and unmask its child
            // properties.
            if (!memberProperties.isEmpty() && memberProperties.get(0) instanceof PropertyMap) {
                PropertyList unmaskedPropertyList = unmaskedParentPropertyMap.getList(propertyList.getName());
                if (unmaskedPropertyList != null) {
                    List<Property> unmaskedMemberProperties = unmaskedPropertyList.getList();
                    for (int i = 0; (i < memberProperties.size()) && (i < unmaskedMemberProperties.size()); i++) {
                        PropertyMap propertyMap = (PropertyMap) memberProperties.get(i);
                        PropertyMap unmaskedPropertyMap = (PropertyMap) unmaskedMemberProperties.get(i);
                        unmaskPropertyMap(propertyMap, unmaskedPropertyMap);
                    }
                }
            }
        }
View Full Code Here

        importConfig.put(new PropertySimple(MetricTemplateImporter.UPDATE_ALL_SCHEDULES_PROPERTY, false));

        //set the def to update the schedules anyway
        PropertyList list = new PropertyList(MetricTemplateImporter.METRIC_UPDATE_OVERRIDES_PROPERTY);
        importConfig.put(list);
        PropertyMap map = new PropertyMap(MetricTemplateImporter.METRIC_UPDATE_OVERRIDE_PROPERTY);
        list.add(map);
        map.put(new PropertySimple(MetricTemplateImporter.METRIC_NAME_PROPERTY, "def"));
        map.put(new PropertySimple(MetricTemplateImporter.RESOURCE_TYPE_NAME_PROPERTY, FAKE_RESOURCE_TYPE.getName()));
        map.put(new PropertySimple(MetricTemplateImporter.RESOURCE_TYPE_PLUGIN_PROPERTY, FAKE_RESOURCE_TYPE.getPlugin()));
        map.put(new PropertySimple(MetricTemplateImporter.UPDATE_SCHEDULES_PROPERTY, true));

        importer.configure(importConfig);

        ExportedEntityMatcher<MeasurementDefinition, MetricTemplate> matcher = importer.getExportedEntityMatcher();
View Full Code Here

                    } catch (Exception t) {
                        pluginName = "?cannot-parse-descriptor?".intern();
                        pluginDisplayName = "?cannot-parse-descriptor?".intern();
                    }

                    PropertyMap map = new PropertyMap("plugin".intern());
                    map.put(new PropertySimple(PLUGIN_INFO_NAME, pluginName));
                    map.put(new PropertySimple(PLUGIN_INFO_DISPLAY_NAME, pluginDisplayName));
                    map.put(new PropertySimple(PLUGIN_INFO_PATH, plugin.getAbsoluteFile()));
                    map.put(new PropertySimple(PLUGIN_INFO_TIMESTAMP, new Date(plugin.lastModified())));
                    map.put(new PropertySimple(PLUGIN_INFO_SIZE, plugin.length()));
                    // plugin is either whitelisted or the white list is empty
                    boolean isEnabled = enabledPlugins.isEmpty() || enabledPlugins.contains(pluginName);
                    // ..and is not on the black list
                    isEnabled &= !disabledPlugins.contains(pluginName);
                    map.put(new PropertySimple(PLUGIN_INFO_ENABLED, isEnabled));

                    try {
                        map.put(new PropertySimple(PLUGIN_INFO_MD5, MessageDigestGenerator.getDigestString(plugin)));
                    } catch (IOException e) {
                        map.put(new PropertySimple(PLUGIN_INFO_MD5, e.toString()));
                    }

                    list.add(map);
                }
            }
View Full Code Here

                    // lookup the heavy-weight resource object
                    int resourceId = avail.getResourceId();
                    ResourceContainer resourceContainer = inventoryManager.getResourceContainer(resourceId);
                    Resource resource = resourceContainer.getResource();

                    PropertyMap map = new PropertyMap("resourceAvailability");
                    map.put(new PropertySimple("resourceId", Integer.valueOf(resource.getId())));
                    map.put(new PropertySimple("resourceName", resource.getName()));
                    map.put(new PropertySimple("isAvailable", Boolean.valueOf(isUp)));
                    list.add(map);
                }
            }
        } else {
            // report was null - this means there are no committed resources in inventory
View Full Code Here

        return override.getBooleanValue();
    }

    PropertySimple findOverrideForMetric(MetricTemplate def, PropertyList overrides) {
        for (Property p : overrides.getList()) {
            PropertyMap map = (PropertyMap) p;

            String metricName = map.getSimpleValue(METRIC_NAME_PROPERTY, null);
            String resourceTypeName = map.getSimpleValue(RESOURCE_TYPE_NAME_PROPERTY, null);
            String resourceTypePlugin = map.getSimpleValue(RESOURCE_TYPE_PLUGIN_PROPERTY, null);
            PropertySimple updateSchedules = map.getSimple(UPDATE_SCHEDULES_PROPERTY);

            if (metricName == null || resourceTypeName == null || resourceTypePlugin == null || updateSchedules == null) {
                continue;
            }
View Full Code Here

        configuration.put(new PropertySimple("Float", Math.PI));

        configuration.put(new PropertySimple("StringEnum1", "PA"));
        configuration.put(new PropertySimple("StringEnum2", "blue"));

        PropertyMap propMap1 = new PropertyMap("MapOfSimples");
        propMap1.put(new PropertySimple("String1", "One"));
        propMap1.put(new PropertySimple("String2", "Two"));
        propMap1.put(new PropertySimple("Integer", 11));
        configuration.put(propMap1);

        PropertyMap openPropMap1 = new PropertyMap("OpenMapOfSimples");
        openPropMap1.put(new PropertySimple("PROCESSOR_ARCHITECTURE", "x86"));
        openPropMap1.put(new PropertySimple("PROCESSOR_IDENTIFIER", "x86 Family 6 Model 15 Stepping 6, GenuineIntel"));
        openPropMap1.put(new PropertySimple("PROCESSOR_LEVEL", "6"));
        openPropMap1.put(new PropertySimple("PROCESSOR_REVISION", "0f06"));
        configuration.put(openPropMap1);

        PropertyMap openPropMap2 = new PropertyMap("ReadOnlyOpenMapOfSimples");
        openPropMap2.put(new PropertySimple("ANT_HOME", "C:\\opt\\ant-1.6.5"));
        openPropMap2.put(new PropertySimple("ANT_OPTS", "-Xms128M -Xmx256M"));
        configuration.put(openPropMap2);

        configuration.put(new PropertyList("ListOfStrings", new PropertySimple("note", "Do"), new PropertySimple(
            "note", "Re"), new PropertySimple("note", "Mi"), new PropertySimple("note", "Fa"), new PropertySimple(
            "note", "So"), new PropertySimple("note", "La"), new PropertySimple("note", "Ti")));

        PropertyMap propMap2 = new PropertyMap("MapOfSimples");
        propMap2.put(new PropertySimple("String1", "Uno"));
        propMap2.put(new PropertySimple("String2", "Dos"));
        propMap2.put(new PropertySimple("Integer", Integer.MIN_VALUE));
        PropertyMap propMap3 = new PropertyMap("MapOfSimples");
        propMap3.put(new PropertySimple("String1", "Un"));
        propMap3.put(new PropertySimple("String2", "Deux"));
        propMap3.put(new PropertySimple("Integer", Integer.MAX_VALUE));
        configuration.put(new PropertyList("ListOfMaps", propMap2, propMap3));

        PropertyMap propMap4 = new PropertyMap("MapOfSimplesInReadOnlyList");
        propMap4.put(new PropertySimple("String1", "A"));
        propMap4.put(new PropertySimple("String2", "B"));
        propMap4.put(new PropertySimple("Integer", 999));
        PropertyMap propMap5 = new PropertyMap("MapOfSimplesInReadOnlyList");
        propMap5.put(new PropertySimple("String1", "a"));
        propMap5.put(new PropertySimple("String2", "b"));
        propMap5.put(new PropertySimple("Integer", 0));
        configuration.put(new PropertyList("ReadOnlyListOfMaps", propMap4, propMap5));

        configuration.put(new PropertySimple("myString1", "grouped String 1"));
        configuration.put(new PropertySimple("myString2", "grouped String 2"));
        configuration.put(new PropertySimple("myString3", "strings are cool"));
View Full Code Here

        Configuration extra = cspd.getExtraProperties();
        PropertySimple firstsimple = extra.getSimple("firstsimple");
        PropertySimple secondsimple = extra.getSimple("secondsimple");
        PropertyList firstlist = extra.getList("firstlist");
        PropertyList anotherlist = extra.getList("anotherlist");
        PropertyMap firstmap = extra.getMap("firstmap");
        PropertyList list_o_maps = extra.getList("list-o-maps");
        assert firstsimple != null;
        assert secondsimple != null;
        assert firstlist != null;
        assert anotherlist != null;
        assert firstmap != null;
        assert list_o_maps != null;

        assert "First Simple".equals(firstsimple.getStringValue()) : firstsimple.getStringValue();
        assert "Second Simple".equals(secondsimple.getStringValue()) : secondsimple.getStringValue();

        List<Property> list = firstlist.getList();
        assert 3 == list.size() : list;
        assert "First List #1".equals(((PropertySimple) list.get(0)).getStringValue()) : list;
        assert "First List #2".equals(((PropertySimple) list.get(1)).getStringValue()) : list;
        assert "First List #3".equals(((PropertySimple) list.get(2)).getStringValue()) : list;

        list = anotherlist.getList();
        assert 3 == list.size() : list;
        assert "Another List #1".equals(((PropertySimple) list.get(0)).getStringValue()) : list;
        assert "Another List #2".equals(((PropertySimple) list.get(1)).getStringValue()) : list;
        assert "Another List #3".equals(((PropertySimple) list.get(2)).getStringValue()) : list;

        Map<String, Property> map = firstmap.getMap();
        assert 3 == map.size() : map;
        assert "First Map #1".equals(((PropertySimple) map.get("firstmap1")).getStringValue()) : map;
        assert "First Map #2".equals(((PropertySimple) map.get("firstmap2")).getStringValue()) : map;
        assert "First Map #3".equals(((PropertySimple) map.get("firstmap3")).getStringValue()) : map;

        list = list_o_maps.getList();
        assert 2 == list.size();
        PropertyMap propmap1 = (PropertyMap) list.get(0);
        PropertyMap propmap2 = (PropertyMap) list.get(1);
        assert "map".equals(propmap1.getName());
        assert "map".equals(propmap2.getName());
        Map<String, Property> map1 = propmap1.getMap();
        Map<String, Property> map2 = propmap2.getMap();
        assert 2 == map1.size() : map1;
        assert 2 == map2.size() : map2;
        assert "List-o-Map #1 value 1".equals(((PropertySimple) map1.get("map1value1")).getStringValue()) : map1;
        assert "List-o-Map #1 value 2".equals(((PropertySimple) map1.get("map1value2")).getStringValue()) : map1;
        assert "List-o-Map #2 value 1".equals(((PropertySimple) map2.get("map2value1")).getStringValue()) : map2;
View Full Code Here

        if (false) {
            // All of these properties must exist, any nulls should trigger runtime exceptions which is what we want
            // because if the configuration is bad, this content source should not initialize.
            List<Property> packageTypesList = configuration.getList("packageTypes").getList();
            for (Property property : packageTypesList) {
                PropertyMap pkgType = (PropertyMap) property;
                SupportedPackageType supportedPackageType = new SupportedPackageType();
                supportedPackageType.packageTypeName = pkgType.getSimpleValue("packageTypeName", null);
                supportedPackageType.architectureName = pkgType.getSimpleValue("architectureName", null);
                supportedPackageType.resourceTypeName = pkgType.getSimpleValue("resourceTypeName", null);
                supportedPackageType.resourceTypePluginName = pkgType.getSimpleValue("resourceTypePluginName", null);

                String filenameFilter = pkgType.getSimpleValue("filenameFilter", null);
                supportedPackageTypes.put(filenameFilter, supportedPackageType);
            }
        } else {
            /* THIS CODE IS THE FLAT SET OF PROPS - USE UNTIL WE CAN EDIT MAPS AT WHICH TIME DELETE THIS ELSE CLAUSE */
            SupportedPackageType supportedPackageType = new SupportedPackageType();
View Full Code Here

        if (list != null) {
            // All of these properties must exist, any nulls should trigger runtime exceptions which is what we want
            // because if the configuration is bad, this content source should not initialize.
            List<Property> packageTypesList = list.getList();
            for (Property property : packageTypesList) {
                PropertyMap pkgType = (PropertyMap) property;
                SupportedPackageType supportedPackageType = new SupportedPackageType();
                supportedPackageType.packageTypeName = pkgType.getSimpleValue("packageTypeName", null);
                supportedPackageType.architectureName = pkgType.getSimpleValue("architectureName", null);
                supportedPackageType.resourceTypeName = pkgType.getSimpleValue("resourceTypeName", null);
                supportedPackageType.resourceTypePluginName = pkgType.getSimpleValue("resourceTypePluginName", null);

                String filenameFilter = pkgType.getSimpleValue("filenameFilter", null);
                supportedPackageTypes.put(filenameFilter, supportedPackageType);
            }
        }

        setSupportedPackageTypes(supportedPackageTypes);
View Full Code Here

TOP

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

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.