Package org.jboss.metatype.api.types

Examples of org.jboss.metatype.api.types.CollectionMetaType


                        LOG.info("\t\tProperty Type: " + propType.getTypeName());
                        if (!propType.isGeneric() && !propType.isSimple())
                        {
                            if (propType.isCollection())
                            {
                                CollectionMetaType collMetaType = (CollectionMetaType) propType;
                                LOG.info("\t\t\tCollection Sub Type: " + collMetaType.getTypeName());
                            }
                            if (propType.isComposite())
                            {
                                CompositeMetaType compositeType = (CompositeMetaType) propType;
                                Set<String> items = compositeType.itemSet();
View Full Code Here


        metaTypeInstances.put(SIMPLE_TYPE, simpleMetaType);
        CompositeMetaType compositeMetaType = new MutableCompositeMetaType("String", "Just something");
        metaTypeInstances.put(COMPOSITE_TYPE, compositeMetaType);
        CompositeMetaType mapCompositeMetaType = new MapCompositeMetaType(SimpleMetaType.STRING);
        metaTypeInstances.put(MAP_COMPOSITE_TYPE, mapCompositeMetaType);
        CollectionMetaType collectionMetaType = new CollectionMetaType("ClassName", simpleMetaType);
        metaTypeInstances.put(COLLECTION_TYPE, collectionMetaType);
        ArrayMetaType arrayMetaType = new ArrayMetaType(2, simpleMetaType);
        metaTypeInstances.put(ARRAY_TYPE, arrayMetaType);
        //TableMetaType tableMetaType = new ImmutableTableMetaType("TypeName", "Description", compositeMetaType, new String[]{"Tom", "Dick", "Harry"});
        //metaTypeInstances.put(TABLE_TYPE, tableMetaType);
View Full Code Here

    }

    public MetaValue convertToMetaValue(PropertyList propertyList, PropertyDefinitionList propertyListDefinition, MetaType metaType)
    {
        LOG.debug("GetMetaValue for property: " + propertyList.getName() + " values: " + propertyList.getList().toString());
        CollectionMetaType collectionMetaType = (CollectionMetaType)metaType;
        MetaType memberMetaType = collectionMetaType.getElementType();
        CollectionMetaType collectionType = new CollectionMetaType(propertyListDefinition.getName(), memberMetaType);
        CollectionValue collectionValue = new CollectionValueSupport(collectionType);
        populateMetaValueFromProperty(propertyList, collectionValue, propertyListDefinition);
        return collectionValue;
    }
View Full Code Here

        }
        return report;
    }

    public MetaType getBindingSetValueMetaType(ManagedComponent bindingManager) {
        CollectionMetaType bindingSetsMetaType = (CollectionMetaType) bindingManager.getProperty(
            Util.BINDING_SETS_PROPERTY).getMetaType();

        return bindingSetsMetaType.getElementType();
    }
View Full Code Here

        for (PropertyDefinition def : Arrays.asList(BINDING_SET_SIMPLE_PROPERTIES)) {
            currentBindingSet.put(def.propertyName, Util.wrap(configuration.getSimple(def.propertyName),
                def.propertyType));
        }

        CollectionMetaType overrideBindingsMetaType = (CollectionMetaType) ((ImmutableCompositeMetaType) bindingSetValueType)
            .getType(OVERRIDE_BINDINGS_PROPERTY);

        //update the override bindings
        List<MetaValue> updatedOverrideBindings = new ArrayList<MetaValue>();
        for (Property prop : configuration.getList(OVERRIDE_BINDINGS_PROPERTY).getList()) {
            PropertyMap updatedBinding = (PropertyMap) prop;

            MapCompositeValueSupport newBinding = new MapCompositeValueSupport(
                (CompositeMetaType) overrideBindingsMetaType.getElementType());

            for (PropertyDefinition def : Arrays.asList(BINDING_SET_OVERRIDE_PROPERTIES)) {
                newBinding.put(def.propertyName, Util
                    .wrap(updatedBinding.getSimple(def.propertyName), def.propertyType));
            }
View Full Code Here

      Map<String, MetaValue> metadata = new HashMap<String, MetaValue>();
      metadata.put("serviceName", SimpleValueSupport.wrap("AddedOverrideBinding"));
      metadata.put("description", SimpleValueSupport.wrap("description"));
      metadata.put("port", SimpleValueSupport.wrap(54321));
      MapCompositeValueSupport newMetadata = new MapCompositeValueSupport(metadata, SERVICE_BINDING_METADATA_TYPE);
      CollectionValue overrides = new CollectionValueSupport(new CollectionMetaType(Set.class.getName(), SERVICE_BINDING_METADATA_TYPE), new MetaValue[]{newMetadata});
     
      map.put("overrideBindings", overrides);
      MapCompositeValueSupport newElement = new MapCompositeValueSupport(map, SERVICE_BINDING_SET_TYPE);
      newElements[newElements.length - 1] = newElement;
      CollectionValue newVal = new CollectionValueSupport(new CollectionMetaType(Set.class.getName(), SERVICE_BINDING_SET_TYPE), newElements);
      prop.setValue(newVal);
     
      // Before updating get a ref to the standard bindings so we can use it
      // in later validation
      Map<String, MetaValue> standardBindings = new HashMap<String, MetaValue>();
      prop = properties.get("standardBindings");
      assertNotNull("Missing property standardBindings", prop);
      val =  prop.getValue();
      assertNotNull("property standardBindings has no value", val);
      assertTrue("property standardBindings value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] elements = ((CollectionValue) val).getElements();
      assertNotNull("property standardBindings value has elements", elements);
      for (MetaValue mv : elements)
      {
         standardBindings.put(getSimpleValue(mv, "fullyQualifiedName", String.class), mv);
      }
     
      try
      {
         getManagementView().updateComponent(component);
      }
      catch (Exception e)
      {
         log.error("Failed updating " + component, e);
         throw e;
      }
     
      // B) Validate the addition from A) took effect and then UPDATE the added binding set
     
      component = getServiceBindingManagerManagedComponent()
      properties = component.getProperties();
      assertNotNull(properties);
     
      IndexedArray indexedArray = checkAddedBindingSet(properties, newElements.length, 500, 54321, standardBindings);
     
      prop = properties.get("bindingSets");     
      assertNotNull("Missing property bindingSets", prop);
      val =  prop.getValue();
      assertNotNull("property bindingSets has no value", val);
      assertTrue("property bindingSets value is CollectionValue", val instanceof CollectionValue);
      MetaValue[] updated = newElements.clone();
      MapCompositeValueSupport updatedBindingSet = cloneCompositeValue((CompositeValue) updated[indexedArray.index]);
      updatedBindingSet.put("portOffset", SimpleValueSupport.wrap(400));
     
      MetaValue[] updatedOverrides = ((CollectionValue) updatedBindingSet.get("overrideBindings")).getElements();
      assertEquals("single override binding", 1, updatedOverrides.length);
      MapCompositeValueSupport updatedOverride = cloneCompositeValue((CompositeValue) updatedOverrides[0]);
      updatedOverride.put("port", SimpleValueSupport.wrap(43210));
      updatedBindingSet.put("overrideBindings", new CollectionValueSupport(new CollectionMetaType(Set.class.getName(), SERVICE_BINDING_METADATA_TYPE), new MetaValue[]{updatedOverride}));
     
      updated[indexedArray.index] = updatedBindingSet;
      newVal = new CollectionValueSupport(new CollectionMetaType(Set.class.getName(), SERVICE_BINDING_SET_TYPE), updated);
      prop.setValue(newVal);

      try
      {
         getManagementView().updateComponent(component);
View Full Code Here

               {
                  TypeInfo typeInfo = propertyInfo.getType();
                  if(typeInfo.isArray())
                     metaType = new ArrayMetaType(1, MANAGED_OBJECT_META_TYPE);
                  else if (typeInfo.isCollection())
                     metaType = new CollectionMetaType(typeInfo.getName(), MANAGED_OBJECT_META_TYPE);
                  else
                     metaType = MANAGED_OBJECT_META_TYPE;
               }
               else
               {
View Full Code Here

            return moArrayValue;
         }
      }
      else if (propertyType.isCollection())
      {
         CollectionMetaType collectionType = CollectionMetaType.class.cast(propertyType);
         if (MANAGED_OBJECT_META_TYPE == collectionType.getElementType())
         {
            Collection<?> cvalue = getAsCollection(value);
            List<GenericValueSupport> tmp = new ArrayList<GenericValueSupport>();
            for(Object element : cvalue)
            {
               ManagedObject mo = initManagedObject((Serializable) element, null, null);
               tmp.add(new GenericValueSupport(MANAGED_OBJECT_META_TYPE, mo));
            }
            GenericValueSupport[] mos = new GenericValueSupport[tmp.size()];
            CollectionMetaType moType = new CollectionMetaType(propertyType.getClassName(), MANAGED_OBJECT_META_TYPE);
            return new CollectionValueSupport(moType, tmp.toArray(mos));
         }
      }

      return metaValueFactory.create(value, propertyInfo.getType());
View Full Code Here

                  {
                     TypeInfo typeInfo = propertyInfo.getType();
                     if(typeInfo.isArray())
                        metaType = new ArrayMetaType(1, MANAGED_OBJECT_META_TYPE);
                     else if (typeInfo.isCollection())
                        metaType = new CollectionMetaType(typeInfo.getName(), MANAGED_OBJECT_META_TYPE);
                     else
                        metaType = MANAGED_OBJECT_META_TYPE;
                  }
                  else
                  {
View Full Code Here

            {
               TypeInfo typeInfo = propertyInfo.getType();
               if(typeInfo.isArray())
                  metaType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
               else if (typeInfo.isCollection())
                  metaType = new CollectionMetaType(typeInfo.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
               else
                  metaType = AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE;
            }
            else
            {
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.types.CollectionMetaType

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.