Package org.jboss.metatype.api.values

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


     
      map.put("read", new SimpleValueSupport(SimpleMetaType.BOOLEAN, read));
      map.put("write", new SimpleValueSupport(SimpleMetaType.BOOLEAN, write));
      map.put("create", new SimpleValueSupport(SimpleMetaType.BOOLEAN, create));
     
      return new CompositeValueSupport(composite, map);
   }
View Full Code Here


      }
     
      String typeName = ct.getTypeName();
      String description = ct.getDescription();
      CompositeMetaType cmt = new ImmutableCompositeMetaType(typeName, description, itemNames, itemDescriptions, itemTypes);
      CompositeValueSupport cv = new CompositeValueSupport(cmt, itemNames, itemValues);
      return cv;
   }
View Full Code Here

      {
         // Extract the meta types
         CompositeMetaType composite = (CompositeMetaType) metaType;
         EnumMetaType enumMetaType= (EnumMetaType) composite.getType(DeploymentTypeName);
         // Create the composite value
         CompositeValueSupport securityDomain = new CompositeValueSupport(composite);
         // Set a default deplooymentType
         SecurityDeploymentType deploymentType = object.getSecurityDeploymentType();
         if(deploymentType == null)
            deploymentType = SecurityDeploymentType.NONE;
        
         // Set domain and deployment type
         securityDomain.set(DOMAIN, SimpleValueSupport.wrap(object.getDomain()));
         securityDomain.set(DeploymentTypeName, new EnumValueSupport(enumMetaType, deploymentType));
         //
         return securityDomain;
      }
      throw new IllegalArgumentException("Cannot convert securityDomain " + object);
   }
View Full Code Here

         PropertyList property = new PropertyList("result");
         CollectionValueSupport valueSupport = (CollectionValueSupport) val;
         MetaValue[] msgs =  valueSupport.getElements();
         for (MetaValue mv : msgs)
         {
            CompositeValueSupport msg = (CompositeValueSupport) mv;
            org.rhq.core.domain.configuration.PropertyMap p1 = new org.rhq.core.domain.configuration.PropertyMap("element");
            property.add(p1);
            ImmutableCompositeMetaType metaType = (ImmutableCompositeMetaType) msg.getMetaType();
            Set<String> keys = metaType.keySet();
            for (String key : keys)
            {
               SimpleValueSupport sattr = (SimpleValueSupport) msg.get(key);
               p1.put(new PropertySimple(key,sattr.getValue()));
            }
         }
         c.put(property);
         return operationResult;
      }
      else if (val instanceof CompositeValueSupport)
      {
         CompositeValueSupport valueSupport = (CompositeValueSupport) val;
         if (valueSupport.containsKey("cause"))
         {
            CompositeValueSupport cause = (CompositeValueSupport) valueSupport.get("cause");
            SimpleValueSupport message = (SimpleValueSupport) cause.get("message");
            Exception exception = new Exception(message.toString());
            throw exception;
         }
         return new OperationResult("not yet");
      }
View Full Code Here

   public CompositeValue createCompositeValue(CompositeMetaType type, Object value, Map<Object, MetaValue> mapping)
   {
      if (value == null)
         return null;
     
      CompositeValueSupport result = new CompositeValueSupport(type);
      mapping.put(value, result);

      BeanInfo beanInfo;
      try
      {
         ClassLoader cl = value.getClass().getClassLoader();
         if (cl == null)
            beanInfo = configuration.getBeanInfo(value.getClass());
         else
            beanInfo = configuration.getBeanInfo(type.getTypeName(), cl);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Error retrieving BeanInfo for " + type);
      }

      for (String name : type.keySet())
      {
         MetaType itemType = type.getType(name);
         Object itemValue;
         try
         {
            itemValue = beanInfo.getProperty(value, name);
         }
         catch (RuntimeException e)
         {
            throw e;
         }
         catch (Error e)
         {
            throw e;
         }
         catch (Throwable t)
         {
            throw new RuntimeException("Error getting property: " + name + " for " + value.getClass(), t);
         }

         MetaValue item = internalCreate(itemValue, null, itemType);
         result.set(name, item);
      }
     
      return result;
   }
View Full Code Here

      for (Iterator<Map.Entry> i = value.entrySet().iterator(); i.hasNext();)
      {
         Map.Entry entry = i.next();
         MetaValue key = internalCreate(entry.getKey(), null, keyType);
         MetaValue val = internalCreate(entry.getValue(), null, valType);
         CompositeValueSupport data = new CompositeValueSupport(entryType, DefaultMetaTypeFactory.MAP_ITEM_NAMES, new MetaValue[] { key, val });
         table.put(data);
      }
     
      return table;
   }
View Full Code Here

    * @return the type
    */
   protected CompositeValue initCompositeValue(CompositeMetaType rowType)
   {
      Map<String, MetaValue> map = initMapValues();
      CompositeValue compData = new CompositeValueSupport(rowType, map);
      return compData;
   }
View Full Code Here

    * @return the type
    */
   protected CompositeValue initCompositeValue2(CompositeMetaType rowType)
   {
      Map<String, MetaValue> map = initMapValues2();
      CompositeValue compData = new CompositeValueSupport(rowType, map);
      return compData;
   }
View Full Code Here

    * @return the type
    */
   protected CompositeValue initCompositeValue3(TableValue tableValue)
   {
      Map<String, MetaValue> map = initMapValues3();
      CompositeValue compData = new CompositeValueSupport(tableValue.getMetaType().getRowType(), map);
      return compData;
   }
View Full Code Here

    * @return the type
    */
   protected CompositeValue initCompositeValue4(TableValue tableValue)
   {
      Map<String, MetaValue> map = initMapValues4();
      CompositeValue compData = new CompositeValueSupport(tableValue.getMetaType().getRowType(), map);
      return compData;
   }
View Full Code Here

TOP

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

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.