Package org.rhq.core.domain.configuration.definition

Examples of org.rhq.core.domain.configuration.definition.PropertyDefinition


        Configuration conf = ccd.configuration;

        assertEquals(def.getPropertyDefinitions().size(), 1, "Unexpected number of defined properties");
        assertEquals(conf.getProperties().size(), 1, "Unexpected number of properties");

        PropertyDefinition propDef = def.get("list");
        Property prop = conf.get("list");

        assertNotNull(propDef, "Could not find the expected property definition");
        assertNotNull(prop, "Could not find the expected property");

        assertEquals(propDef.getClass(), PropertyDefinitionList.class, "Unexpected type of the property definition");
        assertEquals(prop.getClass(), PropertyList.class, "Unexpecetd type of the property");

        PropertyDefinitionList listDef = (PropertyDefinitionList) propDef;
        PropertyList listProp = (PropertyList) prop;

        PropertyDefinition memberDef = listDef.getMemberDefinition();
        assertEquals(memberDef.getClass(), PropertyDefinitionSimple.class, "Unexpected type of the list member property definition");

        PropertyDefinitionSimple memberSimpleDef = (PropertyDefinitionSimple) memberDef;
        assertEquals(memberSimpleDef.getName(), "member");
        assertEquals(memberSimpleDef.getType(), PropertySimpleType.INTEGER);
View Full Code Here


        Configuration conf = ccd.configuration;

        assertEquals(def.getPropertyDefinitions().size(), 1, "Unexpected number of defined properties");
        assertEquals(conf.getProperties().size(), 1, "Unexpected number of properties");

        PropertyDefinition propDef = def.get("map");
        Property prop = conf.get("map");

        assertNotNull(propDef, "Could not find the expected property definition");
        assertNotNull(prop, "Could not find the expected property");

        assertEquals(propDef.getClass(), PropertyDefinitionMap.class, "Unexpected type of the property definition");
        assertEquals(prop.getClass(), PropertyMap.class, "Unexpecetd type of the property");

        PropertyDefinitionMap mapDef = (PropertyDefinitionMap) propDef;
        PropertyMap mapProp = (PropertyMap) prop;

        assertEquals(mapDef.getMap().size(), 2, "Unexpected number of map member definitions");
        assertEquals(mapProp.getMap().size(), 2, "Unexpected number of map members");

        PropertyDefinition m1Def = mapDef.get("m1");
        PropertyDefinition m2Def = mapDef.get("m2");
        Property m1Prop = mapProp.get("m1");
        Property m2Prop = mapProp.get("m2");

        assertEquals(m1Def.getClass(), PropertyDefinitionSimple.class);
        assertEquals(m2Def.getClass(), PropertyDefinitionSimple.class);
        assertEquals(m1Prop.getClass(), PropertySimple.class);
        assertEquals(m2Prop.getClass(), PropertySimple.class);

        PropertyDefinitionSimple m1SimpleDef = (PropertyDefinitionSimple) m1Def;
        PropertyDefinitionSimple m2SimpleDef = (PropertyDefinitionSimple) m2Def;
View Full Code Here

        private static void addAll(List<JAXBElement<?>> descriptors, Map<String, PropertyDefinition> defs,
            Map<String, Property> props) {
            for (Map.Entry<String, PropertyDefinition> e : defs.entrySet()) {
                String propName = e.getKey();
                PropertyDefinition def = e.getValue();
                Property prop = props.get(propName);

                addSingle(descriptors, def, prop);
            }
        }
View Full Code Here

        }

        private static void add(ConfigurationDefinition configurationDefinition, Configuration configuration,
            PropertyDefinition parentDef, Property parentProp, Object propertyInstance) {
            Property prop = null;
            PropertyDefinition def = null;

            if (propertyInstance instanceof SimplePropertyInstanceDescriptor) {
                def = convert((ConfigurationProperty) propertyInstance);
                def.setConfigurationDefinition(configurationDefinition);

                SimplePropertyInstanceDescriptor simpleInstance = (SimplePropertyInstanceDescriptor) propertyInstance;

                PropertySimple simpleProp = new PropertySimple(simpleInstance.getName(), simpleInstance.getValue());
                prop = simpleProp;
            } else if (propertyInstance instanceof ListPropertyInstanceDescriptor) {
                def = convert((ConfigurationProperty) propertyInstance);
                def.setConfigurationDefinition(configurationDefinition);

                ListPropertyInstanceDescriptor listInstance = (ListPropertyInstanceDescriptor) propertyInstance;
                PropertyList listProp = new PropertyList(listInstance.getName());

                PropertyDefinition memberDefinition = ((PropertyDefinitionList) def).getMemberDefinition();

                if (listInstance.getValues() != null) {
                    for (JAXBElement<?> val : listInstance.getValues().getComplexValue()) {
                        ComplexValueDescriptor valDesc = (ComplexValueDescriptor) val.getValue();
                        Property child = convert(memberDefinition, valDesc);
                        listProp.add(child);
                    }
                }

                prop = listProp;
            } else if (propertyInstance instanceof MapPropertyInstanceDescriptor) {
                def = convert((ConfigurationProperty) propertyInstance);
                def.setConfigurationDefinition(configurationDefinition);

                MapPropertyInstanceDescriptor mapInstance = (MapPropertyInstanceDescriptor) propertyInstance;
                PropertyMap mapProp = new PropertyMap(mapInstance.getName());

                if (mapInstance.getValues() != null) {
                    for (JAXBElement<?> val : mapInstance.getValues().getComplexValue()) {
                        ComplexValueDescriptor valueDesc = (ComplexValueDescriptor) val.getValue();
                        PropertyDefinition valueDefinition = ((PropertyDefinitionMap) def).get(valueDesc
                            .getPropertyName());

                        Property child = convert(valueDefinition, valueDesc);
                        mapProp.put(child);
                    }
View Full Code Here

                PropertyDefinitionMap mapDefinition = (PropertyDefinitionMap) definition;

                for (JAXBElement<?> val : mapValue.getComplexValue()) {
                    ComplexValueDescriptor childDesc = (ComplexValueDescriptor) val.getValue();

                    PropertyDefinition childDefinition = mapDefinition.get(childDesc.getPropertyName());

                    Property child = convert(childDefinition, childDesc);
                    map.put(child);
                }
View Full Code Here

            targetParentPropertyMap.put(targetPropertyMap);
            calculateGroupPropertyMap((PropertyDefinitionMap) propertyDefinition, nestedSourceParentPropertyMaps,
                targetPropertyMap);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
            PropertyDefinition listMemberPropertyDefinition = propertyDefinitionList.getMemberDefinition();
            PropertyList targetPropertyList = new PropertyList(propertyDefinition.getName());
            targetParentPropertyMap.put(targetPropertyList);
            if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
                PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition;
                // TODO: How do we group together Lists of Maps? Not trivial...
View Full Code Here

            groupParentPropertyMap.put(groupPropertyMap);
            mergePropertyMap((PropertyDefinitionMap) propertyDefinition, nestedSourceParentPropertyMaps,
                groupPropertyMap);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
            PropertyDefinition listMemberPropertyDefinition = propertyDefinitionList.getMemberDefinition();
            PropertyList groupPropertyList = groupParentPropertyMap.getList(propertyDefinition.getName());
            if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
                PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition;
                // TODO: How do we merge Lists of Maps? Not trivial...
            }
View Full Code Here

    public PropertyDefinitionSimple getPropertyDefinition() {
        PropertySimple propertySimple = getProperty();
        if (propertySimple == null)
            return null;
        ConfigurationDefinition configurationDefinition = getConfigurationSet().getConfigurationDefinition();
        PropertyDefinition propertyDefinition = ConfigurationUtility.getPropertyDefinitionForProperty(propertySimple,
                configurationDefinition);
        return (PropertyDefinitionSimple)propertyDefinition;
    }
View Full Code Here

        // if the config is missing any properties for which we have defaults, set them to their defaults
        //
        Map<String, PropertyDefinition> allDefinitions = def.getPropertyDefinitions();
        for (Map.Entry<String, PropertyDefinition> defEntry : allDefinitions.entrySet()) {
            String propertyName = defEntry.getKey();
            PropertyDefinition propertyDef = defEntry.getValue();
            if (config.get(propertyName) == null) {
                if (propertyDef instanceof PropertyDefinitionSimple
                    && ((PropertyDefinitionSimple) propertyDef).getDefaultValue() != null) {
                    config.put(new PropertySimple(propertyName, ((PropertyDefinitionSimple) propertyDef)
                        .getDefaultValue()));
View Full Code Here

    private void fireInitialPropertyChangedEvent() {
        Map<?, ?> validationErrors = this.topLevelPropertiesValuesManager.getErrors();
        if (validationErrors != null) {
            for (Object key : validationErrors.keySet()) {
                String propertyName = (String) key;
                PropertyDefinition propertyDefinition = this.configurationDefinition.get(propertyName);
                this.invalidPropertyNameToDisplayNameMap.put(propertyName, propertyDefinition.getDisplayName());
            }
        }
        for (Map.Entry<PropertyDefinitionList, ListGrid> entry : listOfMapsGrids.entrySet()) {
            PropertyDefinitionList propertyDefinitionList = entry.getKey();
            int listMin = propertyDefinitionList.getMin();
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.definition.PropertyDefinition

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.