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

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


        } else if (propertyDefinition instanceof PropertyDefinitionMap) {
            property = generatePropertyMap((PropertyDefinitionMap) propertyDefinition);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            property = new PropertyList(propertyDefinition.getName());
            PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
            PropertyDefinition listMemberPropertyDefinition = propertyDefinitionList.getMemberDefinition();
            // If the property is a List of Maps, add 10 members to it, then recursively populate them.
            if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
                PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition;
                PropertyList propertyList = (PropertyList) property;
                for (int i = 0; i < 10; i++) {
View Full Code Here


    Object getObjectForProperty(PropertySimple prop, String operationName) {
        ConfigurationDefinition parameterDefinitions = getParameterDefinitionsForOperation(operationName);
        if (parameterDefinitions == null)
            return null;

        PropertyDefinition pd = parameterDefinitions.get(prop.getName());
        if (pd instanceof PropertyDefinitionSimple) {
            PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd;
            return getObjectForProperty(prop, pds);
        } else {
            LOG.warn("Property [" + prop.getName() + "] is not understood yet");
View Full Code Here

    Object getObjectForPropertyList(PropertySimple prop, PropertyList propertyList, String operationName) {
        ConfigurationDefinition parameterDefinitions = getParameterDefinitionsForOperation(operationName);
        if (parameterDefinitions == null)
            return null;

        PropertyDefinition def = parameterDefinitions.get(propertyList.getName());
        if (def instanceof PropertyDefinitionList) {
            PropertyDefinitionList definitionList = (PropertyDefinitionList) def;
            PropertyDefinition tmp = definitionList.getMemberDefinition();
            if (tmp instanceof PropertyDefinitionSimple) {
                return getObjectForProperty(prop, (PropertyDefinitionSimple) tmp);
            }
        }
        return null;
View Full Code Here

        Configuration config = new Configuration();
        ConfigurationDefinition configDef = resourceType.getResourceConfigurationDefinition();
        Map<String, PropertyDefinition> propDefs = configDef.getPropertyDefinitions();
        Set<String> propNames = managedProperties.keySet();
        for (String propName : propNames) {
            PropertyDefinition propertyDefinition = propDefs.get(propName);
            ManagedProperty managedProperty = managedProperties.get(propName);
            if (propertyDefinition == null) {
                if (!managedProperty.hasViewUse(ViewUse.STATISTIC))
                    LOG.debug(resourceType + " does not define a property corresponding to ManagedProperty '"
                        + propName + "'.");
View Full Code Here

        boolean trimManagedProperties) {
        Set<String> missingManagedPropertyNames = new HashSet<String>();
        for (Property property : configuration.getProperties()) {
            String propertyName = property.getName();
            ManagedProperty managedProperty = managedProperties.get(propertyName);
            PropertyDefinition propertyDefinition = configDefinition.get(propertyName);
            if (managedProperty == null) {
                // NOTE: We expect the Profile Service to always return templates that contain *all* ManagedProperties
                //       that are defined for the ComponentType, so this is considered an error. We could build a
                //       ManagedProperty from scratch based on only a PropertyDefinition anyway, since a propDef could
                //       map to multiple different types of MetaValues (e.g. a PropertyList could potentially map to
View Full Code Here

            Collection<PropertyDefinition> memberPropDefs = ((PropertyDefinitionMap) propDef)
                .getOrderedPropertyDefinitions();
            if (memberPropDefs.isEmpty())
                throw new IllegalStateException("PropertyDefinitionMap doesn't contain any member PropertyDefinitions.");
            // NOTE: We assume member prop defs are all of the same type, since for MapCompositeMetaTypes, they have to be.
            PropertyDefinition mapMemberPropDef = memberPropDefs.iterator().next();
            MetaType mapMemberMetaType = convertPropertyDefinitionToMetaType(mapMemberPropDef);
            memberMetaType = new MapCompositeMetaType(mapMemberMetaType);
        } else {
            throw new IllegalStateException("List member PropertyDefinition has unknown type: "
                + propDef.getClass().getName());
View Full Code Here

        MetaValue[] paramMetaValues = new MetaValue[managedParams.length];
        for (int i = 0; i < managedParams.length; i++) {
            ManagedParameter managedParam = managedParams[i];
            String paramName = managedParam.getName();
            Property paramProp = parameters.get(paramName);
            PropertyDefinition paramPropDef = paramPropDefs.get(paramName);
            MetaType metaType = managedParam.getMetaType();
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaType);
            LOG.trace("Converting RHQ operation param property " + paramProp + " with definition " + paramPropDef
                + " to MetaValue of type " + metaType + "...");
            MetaValue paramMetaValue = propertyAdapter.convertToMetaValue(paramProp, paramPropDef, metaType);
View Full Code Here

            // otherwise there will be a huge mismatch.
            if (resultPropDefs.size() > 1)
                LOG.error("Operation [" + operationDefinition.getName()
                    + "] is defined with multiple result properties: " + resultPropDefs.values());

            PropertyDefinition resultPropDef = resultPropDefs.values().iterator().next();

            // Don't return any results, if the actual result object is null.
            if (resultMetaValue == null) {
                // Check if result is required or not, and if it is, log an error.
                if (resultPropDef.isRequired()) {
                    LOG.error("Plugin error: Operation [" + operationDefinition.getName()
                        + "] is defined as returning a required result, but it returned null.");
                }
                return;
            }
View Full Code Here

            } else if (definition instanceof PropertyDefinitionList) {
                PropertyDefinitionList defList = (PropertyDefinitionList) definition;
                TreeNode listNode = new TreeNode(defList.getDisplayName());
                listNode.setAttribute(ATTRIB_ALL_SAME, true);
                if (defList.getMemberDefinition() instanceof PropertyDefinitionMap) { // support list-o-maps only
                    PropertyDefinition memberDef = defList.getMemberDefinition();
                    Collection<PropertyDefinition> memberDefColl = new ArrayList<PropertyDefinition>(1);
                    memberDefColl.add(memberDef);

                    int max = 0; // will be the largest size of any of our lists that are being compared
                    for (AbstractPropertyMap map : maps) {
View Full Code Here

        assert stopOp.getTimeout().equals(new Integer(30));

        assert stopOp.getParametersConfigurationDefinition() != null;
        ConfigurationDefinition parameters = stopOp.getParametersConfigurationDefinition();
        assert parameters.getPropertyDefinitions().size() == 1;
        PropertyDefinition def1 = parameters.get("force");
        PropertyDefinition def2 = parameters.getPropertyDefinitions().get("force");
        assert def1 != null;
        assert def2 != null;
        assert def2.equals(def1);
        assert def1.getName().equals("force");
        assert def1.getDisplayName().equals("Force Kill");
        assert def1
            .getDescription()
            .equals(
                "If true, use operating system to kill the process; otherwise, use JBoss remote JMX method to shut it down");
        assert !def1.isRequired();
        assert def1 instanceof PropertyDefinitionSimple;
        assert ((PropertyDefinitionSimple) def1).getType().equals(PropertySimpleType.BOOLEAN);
        PropertySimple prop = (PropertySimple) def1.getConfigurationDefinition().getDefaultTemplate()
            .getConfiguration().get("force");
        assert prop.getBooleanValue().booleanValue() == false;

        assert stopOp.getResultsConfigurationDefinition() != null;
        ConfigurationDefinition results = stopOp.getResultsConfigurationDefinition();
        assert results.getPropertyDefinitions().size() == 1;
        def1 = results.get("confirmed");
        def2 = results.getPropertyDefinitions().get("confirmed");
        assert def1 != null : results.getPropertyDefinitions();
        assert def2 != null : results.getPropertyDefinitions();
        assert def2.equals(def1);
        assert def1.getName().equals("confirmed");
        assert def1.getDisplayName().equals("Confirmed Down");
        assert def1
            .getDescription()
            .equals(
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.