Package org.rhq.plugins.jbossas5.helper

Examples of org.rhq.plugins.jbossas5.helper.JBossInstallationInfo


                // Don't even add a Property to the Configuration if the ManagedProperty is flagged as removed or has a
                // null value.
                continue;
            }
            PropertySimple customProp = customProps.get(propName);
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getCustomPropertyAdapter(customProp);
            if (propertyAdapter == null) {
                propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaValue);
            }
            if (propertyAdapter == null) {
                LOG.error("Unable to find a PropertyAdapter for ManagedProperty '" + propName + "' with MetaType ["
                    + metaValue.getMetaType() + "] for ResourceType '" + resourceType.getName() + "'.");
                continue;
            }
            Property property;
            try {
                property = propertyAdapter.convertToProperty(metaValue, propertyDefinition);
            } catch (RuntimeException e) {
                throw new RuntimeException("Failed to convert managed property " + managedProperty
                    + " to RHQ property of type " + propertyDefinition + ".", e);
            }
            config.put(property);
View Full Code Here


    private static void populateManagedPropertyFromProperty(Property property, PropertyDefinition propertyDefinition,
        @NotNull
        ManagedProperty managedProperty, @Nullable
        PropertySimple customProperty) {
        // See if there is a custom adapter defined for this property.
        PropertyAdapter propertyAdapter = PropertyAdapterFactory.getCustomPropertyAdapter(customProperty);

        MetaValue metaValue = managedProperty.getValue();
        if (metaValue != null) {
            LOG.trace("Populating existing MetaValue of type " + metaValue.getMetaType() + " from RHQ property "
                + property + " with definition " + propertyDefinition + "...");
            if (propertyAdapter == null) {
                propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaValue);
            }
            propertyAdapter.populateMetaValueFromProperty(property, metaValue, propertyDefinition);
        } else {
            MetaType metaType = managedProperty.getMetaType();
            if (propertyAdapter == null) {
                propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaType);
            }
            LOG.trace("Converting property " + property + " with definition " + propertyDefinition
                + " to MetaValue of type " + metaType + "...");
            metaValue = propertyAdapter.convertToMetaValue(property, propertyDefinition, metaType);
            managedProperty.setValue(metaValue);
        }
    }
View Full Code Here

            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);
            // NOTE: There's no need to set the value on the ManagedParameter, since the invoke() API takes an array of
            //       MetaValues.
            paramMetaValues[i] = paramMetaValue;
        }
        return paramMetaValues;
View Full Code Here

            if (!MetaTypeUtils.instanceOf(resultMetaValue, resultMetaType))
                LOG.debug("Profile Service Error: Result type (" + resultMetaType + ") of [" + operation.getName()
                    + "] ManagedOperation does not match the type of the value returned by invoke() ("
                    + resultMetaValue + ").");

            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(resultMetaValue);
            Property resultProp = propertyAdapter.convertToProperty(resultMetaValue, resultPropDef);
            complexResults.put(resultProp);
        }
    }
View Full Code Here

        PropertyDefinition listMemberPropDef = propertyDefinition.getMemberDefinition();
        List<Property> listMemberProps = property.getList();
        CollectionValueSupport collectionValue = (CollectionValueSupport)metaValue;
        MetaType listMemberMetaType = collectionValue.getMetaType().getElementType();
        MetaValue[] listMemberValues = new MetaValue[listMemberProps.size()];
        PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(listMemberMetaType);
        int memberIndex = 0;
        for (Property listMemberProp : listMemberProps)
        {
            MetaValue listMemberValue = propertyAdapter.convertToMetaValue(listMemberProp, listMemberPropDef, listMemberMetaType);
            listMemberValues[memberIndex++] = listMemberValue;
        }
        // Replace the existing elements with the new ones.
        collectionValue.setElements(listMemberValues);
    }
View Full Code Here

            if (metaValue != null)
            {
                CollectionValue collectionValue = (CollectionValue)metaValue;
                MetaType listMemberMetaType = collectionValue.getMetaType().getElementType();
                MetaValue[] listMemberValues = collectionValue.getElements();
                PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(listMemberMetaType);
                for (MetaValue listMemberValue : listMemberValues)
                {
                    Property listMemberProp = propertyAdapter.convertToProperty(listMemberValue, memberPropDef);
                    propList.add(listMemberProp);
                }
            }
        }
    }
View Full Code Here

            MetaType listMetaType = valueSupport.getMetaType().getElementType();
            List<MetaValue> values = new ArrayList<MetaValue>(properties.size());
            for (Property propertyWithinList : properties)
            {
                MetaValue value = MetaValueFactory.getInstance().create(null);
                PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(listMetaType);
                propertyAdapter.populateMetaValueFromProperty(propertyWithinList, value, memberDefinition);
                values.add(value);
            }
            valueSupport.setValue(values.toArray());
        }
    }
View Full Code Here

        if (metaValue != null)
        {
            ArrayValueSupport valueSupport = (ArrayValueSupport)metaValue;
            MetaType listMetaType = valueSupport.getMetaType().getElementType();
            MetaValue[] metaValues = (MetaValue[])valueSupport.getValue();
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(listMetaType);
            for (MetaValue value : metaValues)
            {
                Property propertyToAddToList = propertyAdapter.convertToProperty(value, memberDefinition);
                properties.add(propertyToAddToList);
            }
        }
    }
View Full Code Here

            {
                PropertyDefinition definition = map.get(key);
                MetaValue[] getKey = new MetaValue[]{SimpleValueSupport.wrap(key)};
                MetaValue value = tableValueSupport.get(getKey);
                Property innerProperty = properties.get(key);
                PropertyAdapter adapter = PropertyAdapterFactory.getPropertyAdapter(value);
                adapter.populateMetaValueFromProperty(innerProperty, value, definition);
            }
        }
    }
View Full Code Here

            {
                // this will occur when new map properties are added since they are not present
                // in the original metaValue which we are using
                mapMemberMetaType = SimpleMetaType.STRING;
            }
            PropertyAdapter adapter = PropertyAdapterFactory.getPropertyAdapter(mapMemberMetaType);
            MetaValue mapMemberMetaValue = adapter.convertToMetaValue(mapMemberProp, mapMemberPropDef, mapMemberMetaType);
            putValue(compositeValue, mapMemberPropName, mapMemberMetaValue);
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.plugins.jbossas5.helper.JBossInstallationInfo

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.