Package org.jboss.metatype.api.values

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


                //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);
                        return report;
                    }
                }

                // Create a new array that's one element larger than the original array.
                MetaValue[] newBindingSets = new MetaValue[bindingSets.getSize() + 1];
                // Copy the original array into the new array.
                System.arraycopy(bindingSets.getElements(), 0, newBindingSets, 0, bindingSets.getSize());
                // Add the new one as the last element of the new array.
                newBindingSets[bindingSets.getSize()] = newBindingSet;

                CollectionValueSupport newBindingSetsValue = new CollectionValueSupport(bindingSets.getMetaType());
                newBindingSetsValue.setElements(newBindingSets);

                bindingSetsProperty.setValue(newBindingSetsValue);

                updateBindingManager(bindingManagerComponent);
View Full Code Here


        ManagerComponent managerResourceComponent = context.getParentResourceComponent();
        managerResourceComponent.getConnection().getManagementView().load();

        ManagedComponent bindingManagerComponent = managerResourceComponent.getBindingManager();

        CollectionValue bindingSets = (CollectionValue) bindingManagerComponent.getProperty(Util.BINDING_SETS_PROPERTY)
            .getValue();

        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);
View Full Code Here

        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);
View Full Code Here

            //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());

            //create new set of binding sets
            CollectionValue bindingSets = (CollectionValue) bindingSetsProperty.getValue();
            List<MetaValue> newBindingSets = Util.replaceWithNew(bindingSets, thisBindingSetName, currentBindingSet);

            CollectionValueSupport newBindingSetsValue = new CollectionValueSupport(bindingSets.getMetaType());
            newBindingSetsValue.setElements(newBindingSets.toArray(new MetaValue[newBindingSets.size()]));

            bindingSetsProperty.setValue(newBindingSetsValue);

            context.getParentResourceComponent().updateBindingManager(bindingManager);
View Full Code Here

        }

        ManagedProperty bindingSetsProperty = bindingManagerComponent.getProperty(Util.BINDING_SETS_PROPERTY);

        //create new set of binding sets
        CollectionValue bindingSets = (CollectionValue) bindingSetsProperty.getValue();
        List<MetaValue> newBindingSets = Util.replaceWithNew(bindingSets, thisBindingSetName, null);

        CollectionValueSupport newBindingSetsValue = new CollectionValueSupport(bindingSets.getMetaType());
        newBindingSetsValue.setElements(newBindingSets.toArray(new MetaValue[newBindingSets.size()]));

        bindingSetsProperty.setValue(newBindingSetsValue);

        context.getParentResourceComponent().updateBindingManager(bindingManagerComponent);
View Full Code Here

        String bindingSetName = context.getParentResourceComponent().getBindingSetNameFromResourceKey(
            context.getResourceKey());

        ManagedComponent bindingManagerComponent = context.getParentResourceComponent().getBindingManager();

        CollectionValue bindingSets = (CollectionValue) bindingManagerComponent.getProperty(Util.BINDING_SETS_PROPERTY)
            .getValue();

        Iterator<MetaValue> it = bindingSets.iterator();

        while (it.hasNext()) {
            CompositeValue bindingSet = (CompositeValue) it.next();

            String currentName = Util.getValue(bindingSet, "name", String.class);
View Full Code Here

   public void test() throws Throwable
   {
      ManagedObject mo = createTestMO();

      CollectionValue collection = (CollectionValue) mo.getProperty("list").getValue();
      ManagedObject child2 = (ManagedObject) ((GenericValue) collection.getElements()[1]).getValue();
      child2.getProperty("string").setValue(SimpleValueSupport.wrap("changedName"));
      // TODO test generic array
     
      PersistedManagedObject moElement = restore(mo);
View Full Code Here

  
   protected ManagedObject getDeployment(String name, ManagedObject mo)
   {
   
      ManagedProperty p = mo.getProperty("deployments");
      CollectionValue collection = (CollectionValue) p.getValue();
     
      assertTrue(p.getMetaType().isCollection());
      assertNotNull("null collection", collection);
      assertEquals(3, collection.getSize());;
     
      for(MetaValue value : collection)
      {        
         ManagedObject deployment = (ManagedObject) ((GenericValue) value).getValue();
        
View Full Code Here

     
      if ((metaValue instanceof CollectionValue) == false)
      {
         throw new IllegalArgumentException(metaValue + " is not a " + CollectionValue.class.getSimpleName());
      }
      CollectionValue collValue = (CollectionValue) metaValue;
      MetaValue[] elements = collValue.getElements();
     
      ServiceBindingMetadataMapper mapper = new ServiceBindingMetadataMapper();
     
      Set<ServiceBindingSet> result = new HashSet<ServiceBindingSet>(elements.length);
      for (MetaValue element : elements)
View Full Code Here

     
      if ((metaValue instanceof CollectionValue) == false)
      {
         throw new IllegalArgumentException(metaValue + " is not a " + CollectionValue.class.getSimpleName());
      }
      CollectionValue collValue = (CollectionValue) metaValue;
      MetaValue[] elements = collValue.getElements();
      Set<ServiceBindingMetadata> result = new HashSet<ServiceBindingMetadata>(elements.length);
      for (MetaValue element : elements)
      {

         if ((element instanceof CompositeValue) == false)
View Full Code Here

TOP

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

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.