Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.CompositeValue


    public void populatePropertyFromMetaValue(PropertyMap propMap, MetaValue metaValue, PropertyDefinitionMap propDefMap)
    {
        if (metaValue == null)
            return;
        CompositeValue compositeValue = (CompositeValue)metaValue;
        Set<String> mapMemberPropNames = compositeValue.getMetaType().keySet();
        // There won't be any keys when loading a Configuration for the first time.
        for (String mapMemberPropName : mapMemberPropNames)
        {
            Property mapMemberProp = propMap.get(mapMemberPropName);
            MetaValue mapMemberMetaValue = compositeValue.get(mapMemberPropName);
            MetaType mapMemberMetaType = compositeValue.getMetaType().getType(mapMemberPropName);
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(mapMemberMetaType);
            PropertyDefinition mapMemberPropDef = propDefMap.get(mapMemberPropName);
            if (mapMemberProp == null)
            {
                if (mapMemberPropDef != null)
View Full Code Here


        }
    }

    public void populatePropertyFromMetaValue(PropertyList propertyList, MetaValue metaValue,
        PropertyDefinitionList propertyDefinitionList) {
        CompositeValue compositeValue = (CompositeValue) metaValue;
        CompositeMetaType compositeMetaType = compositeValue.getMetaType();
        PropertyDefinitionMap memberPropertyDefinitionMap = (PropertyDefinitionMap) propertyDefinitionList
            .getMemberDefinition();
        PropertyMapToMapCompositeValueSupportAdapter mapToMapCompositeValueAdapter = new PropertyMapToMapCompositeValueSupportAdapter();
        for (String memberName : compositeMetaType.itemSet()) {
            MetaValue memberMetaValue = compositeValue.get(memberName);
            PropertyMap memberPropertyMap = mapToMapCompositeValueAdapter.convertToProperty(memberMetaValue,
                memberPropertyDefinitionMap);
            memberPropertyMap.put(new PropertySimple("name", memberName)); // add a simple for the role name to the map
            propertyList.add(memberPropertyMap);
        }
View Full Code Here

        PropertyList bindings = new PropertyList(Util.STANDARD_BINDINGS_PROPERTY);
        configuration.put(bindings);

        for (MetaValue b : standardBindings.getElements()) {
            CompositeValue binding = (CompositeValue) b;

            PropertyMap bindingMap = new PropertyMap(BINDING_PROPERTY);
            bindings.add(bindingMap);

            for (PropertySimple prop : Util.getProperties(Arrays.asList(Util.STANDARD_BINDING_PROPERTIES), binding)) {
View Full Code Here

                configurationUpdateReport.setStatus(ConfigurationUpdateStatus.FAILURE);
            }

            boolean found = false;
            for (MetaValue bindingSet : bindingSets) {
                CompositeValue bindingSetComposite = (CompositeValue)bindingSet;
                String bindingSetName = Util.getValue(bindingSetComposite, "name", String.class);

                if (updatedActiveBindingSetName.equals(bindingSetName)) {
                    found = true;
                    break;
View Full Code Here

            if (BINDING_SET_SERVICE_NAME.equals(report.getResourceType().getName())) {
                Configuration bindingConfiguration = report.getResourceConfiguration();

                checkValidity(bindingConfiguration);
               
                CompositeValue newBindingSet = Util.getBindingSetFromConfiguration(
                        getBindingSetValueMetaType(bindingManagerComponent), bindingConfiguration);

                //ok, now we can update the bindingSets property with the update set of binding sets
                ManagedProperty bindingSetsProperty = bindingManagerComponent.getProperty(Util.BINDING_SETS_PROPERTY);

                //check that the provided binding set name is unique
                CollectionValue bindingSets = (CollectionValue) bindingSetsProperty.getValue();
                String newBindingSetName = Util.getValue(newBindingSet, "name", String.class);

                for (MetaValue bindingSet : bindingSets) {
                    CompositeValue bindingSetComposite = (CompositeValue)bindingSet;
                    String bindingSetName = Util.getValue(bindingSetComposite, "name", String.class);

                    if (newBindingSetName.equals(bindingSetName)) {
                        report.setErrorMessage("A binding set with the provided name already exists.");
                        report.setStatus(CreateResourceStatus.FAILURE);
View Full Code Here

        Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>(bindingSets
            .getSize());

        for (MetaValue m : bindingSets.getElements()) {
            CompositeValue bindingSet = (CompositeValue) m;

            String bindingSetName = Util.getValue(bindingSet, Util.NAME_PROPERTY, String.class);
            String resourceKey = context.getParentResourceComponent().getBindingSetResourceKey(bindingSetName);

            DiscoveredResourceDetails resource = new DiscoveredResourceDetails(resourceType, resourceKey,
View Full Code Here

        List<MethodStats> allMethodStats = new ArrayList<MethodStats>();
        Configuration pluginConfig = getResourceContext().getPluginConfiguration();
        String propName = pluginConfig.getSimple("invocationStatsPropertyName").getStringValue();
        ManagedProperty detypedInvokedStatsProp = managedComponent.getProperty(propName);
        invocationStats.endTime = System.currentTimeMillis();
        CompositeValue detypedInvokeStatsMetaValue = (CompositeValue) detypedInvokedStatsProp.getValue();
        CompositeValue allMethodStatsMetaValue = (CompositeValue) detypedInvokeStatsMetaValue.get("methodStats");
        Set<String> methodNames = allMethodStatsMetaValue.getMetaType().keySet();
        for (String methodName : methodNames) {
            CompositeValue methodStatsMetaValue = (CompositeValue) allMethodStatsMetaValue.get(methodName);
            MethodStats methodStats = new MethodStats();
            methodStats.name = methodName;
            methodStats.count = Long.parseLong(((SimpleValue) methodStatsMetaValue.get("count")).getValue().toString());
            methodStats.totalTime = Long.parseLong(((SimpleValue) methodStatsMetaValue.get("totalTime")).getValue()
                .toString());
            methodStats.minTime = Long.parseLong(((SimpleValue) methodStatsMetaValue.get("minTime")).getValue()
                .toString());
            methodStats.maxTime = Long.parseLong(((SimpleValue) methodStatsMetaValue.get("maxTime")).getValue()
                .toString());
            allMethodStats.add(methodStats);
        }
        invocationStats.methodStats = allMethodStats;
View Full Code Here

    public static List<MetaValue> replaceWithNew(CollectionValue collection, String replacedName, MetaValue newValue) {
        List<MetaValue> ret = new ArrayList<MetaValue>();

        Iterator<MetaValue> it = collection.iterator();
        while (it.hasNext()) {
            CompositeValue value = (CompositeValue) it.next();

            String currentName = getValue(value, "name", String.class);
            if (replacedName.equals(currentName)) {
                if (newValue != null) {
                    ret.add(newValue);
View Full Code Here

    public Configuration loadResourceConfiguration() throws Exception {

        Configuration configuration = new Configuration();

        CompositeValue bindingSet = getBindingSet();

        if (bindingSet == null) {
            throw new IllegalStateException("Could not find a binding set called " + context.getResourceKey());
        }

        for (PropertySimple prop : Util.getProperties(Arrays.asList(Util.BINDING_SET_SIMPLE_PROPERTIES), bindingSet)) {
            configuration.put(prop);
        }

        CollectionValue overrideBindings = (CollectionValue) bindingSet.get(Util.OVERRIDE_BINDINGS_PROPERTY);

        PropertyList overrideBindingsList = new PropertyList(Util.OVERRIDE_BINDINGS_PROPERTY);
        configuration.put(overrideBindingsList);

        for (MetaValue m : overrideBindings.getElements()) {
            CompositeValue binding = (CompositeValue) m;

            PropertyMap bindingMap = new PropertyMap(BINDING_PROPERTY);
            overrideBindingsList.add(bindingMap);

            for (PropertySimple prop : Util.getProperties(Arrays.asList(Util.BINDING_SET_OVERRIDE_PROPERTIES), binding)) {
View Full Code Here

            managerResourceComponent.checkValidity(updatedConfiguration);
           
            MetaType bindingSetValueMetaType = managerResourceComponent.getBindingSetValueMetaType(bindingManager);

            CompositeValue currentBindingSet = Util.getBindingSetFromConfiguration(bindingSetValueMetaType,
                updatedConfiguration);

            //ok, now we can update the bindingSets property with the update set of binding sets
            ManagedProperty bindingSetsProperty = bindingManager.getProperty(Util.BINDING_SETS_PROPERTY);
            String thisBindingSetName = managerResourceComponent.getBindingSetNameFromResourceKey(context.getResourceKey());
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.CompositeValue

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.