Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedObject


      KernelDeployment deployment = createKernelDeployment(BEAN_NAMES);
      // install
      installDeployment(deployment);
     
      // Create the managed objects
      ManagedObject deploymentMO = getMOF().initManagedObject(deployment, null);
      ManagedObject mo = getBeanMO("SimpleAnnotatedBean");
      assertNotNull("null mo", mo);
      assertTrue(mo.getAttachment() instanceof BeanMetaData);
      ManagedComponent component = createComponent(mo);
      assertNotNull(component);
      assertEquals(component.getAttachmentName(), SimpleAnnotatedBean.class.getName());

      // Change value
      component.getProperty("stringProperty").setValue(SimpleValueSupport.wrap("changedTestValue"));
     
      PersistenceRoot root = updateComponent(deploymentMO, component);
      assertNotNull(root);

      // Uninstall for offline attachment persistence
      uninstallDeployment(deployment);
     
      // Recreate the kernel deployment
      deployment = createKernelDeployment(BEAN_NAMES);
      getPersistenceFactory().restorePersistenceRoot(root, deployment, null);
     
      // check bean meta data
      BeanMetaData bmd = getBeanMetaData(deployment, "SimpleAnnotatedBean");
      boolean sawProperty = false;
      for(PropertyMetaData prop : bmd.getProperties())
      {
         if(prop.getName().equals("stringProperty"))
         {
            assertEquals("changedTestValue", prop.getValue().getUnderlyingValue());
            sawProperty = true;
         }
      }
      assertTrue(sawProperty);
     
      // install
      installDeployment(deployment);
      mo = getBeanMO("SimpleAnnotatedBean");
      assertNotNull(mo);
     
      assertEquals(SimpleValueSupport.wrap("changedTestValue"),
            mo.getProperty("stringProperty").getValue());

   }
View Full Code Here


      }
     
      protected PersistedComponent createComponent(Object attachment, ManagedComponent component)
      {
         // Note: this is using the TestMgtComponentImpl to get the MO
         ManagedObject mo = (ManagedObject) component.getParent();
         PersistedManagedObject persisted = getPersistencePlugin().createPersistedManagedObject(mo);
         PersistedComponent persistedComponent = new PersistedComponent(persisted);
         setComponentName(persistedComponent, mo);
         return persistedComponent;
      }
View Full Code Here

      assertNotNull(ctx);
      BeanMetaData bmd = ctx.getBeanMetaData();
      assertNotNull(bmd);

      // Create the ManagedObjects
      ManagedObject deploymentMO = getMOF().initManagedObject(deployment, null);
      ManagedObject mo = getMOF().initManagedObject(bmd, null);
      assertNotNull(mo);
      // Change the value
      CollectionValue bindingSets = (CollectionValue) mo.getProperty("standardBindings").getValue();
      assertNotNull(bindingSets);
      setPortValue("HttpsConnector", bindingSets, 13245);

      // Persist
      ManagedComponent component = new ManagedComponentImpl(null, null, mo);
View Full Code Here

      List<PersistedComponent> components = new ArrayList<PersistedComponent>();
      ManagedObjectPersistencePlugin plugin = getPersistenceFactory().getPersistencePlugin();
      for(ServiceMetaData md : deployment.getServices())
      {
         // Bypass the ServiceMetaDataICF...
         ManagedObject mo = getMOF().initManagedObject(md, null);
         PersistedManagedObject persisted = plugin.createPersistedManagedObject(mo);
        
         // Fix the names, as we don't use the ServiceMetaDataICF
         String name = md.getObjectName().getCanonicalName();
         persisted.setName(name);
View Full Code Here

     
      @Override
      protected PersistedComponent createComponent(Object attachment, ManagedComponent component)
      {
         // Note: this is using the TestMgtComponentImpl to get the MO
         ManagedObject mo = (ManagedObject) component.getParent();
         PersistedManagedObject persisted = getPersistencePlugin().createPersistedManagedObject(mo);
         PersistedComponent persistedComponent = new PersistedComponent(persisted);
         setComponentName(persistedComponent, mo);
         return persistedComponent;
      }
View Full Code Here

      assertEquals("JChannelFactory", mc.getName());
     
      for (Map.Entry<String, ManagedProperty> entry : mc.getProperties().entrySet())
      {
         getLog().debug(entry.getKey() + " == " + entry.getValue());
         ManagedObject mo = entry.getValue().getTargetManagedObject();
         if (mo != null)
         {
            getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
         }
      }
View Full Code Here

               return;
            }
           
            Serializable instance = (Serializable) deployment;
            ManagedObjectFactory factory = ManagedObjectFactoryBuilder.create();
            ManagedObject mo = factory.initManagedObject(instance, null, null);
            if (mo != null)
               managedObjects.put(mo.getName(), mo);
         }
      }
   }
View Full Code Here

               return;
            }
           
            Serializable instance = (Serializable) deployment;
            ManagedObjectFactory factory = ManagedObjectFactoryBuilder.create();
            ManagedObject mo = factory.initManagedObject(instance, null, null);
            if (mo != null)
               managedObjects.put(mo.getName(), mo);
         }
      }
   }
View Full Code Here

      for(String name : attachments)
      {
         Object instance = unit.getAttachment(name);
         if (instance != null)
         {
            ManagedObject mo = factory.initManagedObject(instance, null, metaData, name, null);
            if (mo != null)
               managedObjects.put(mo.getName(), mo);
         }
      }
   }
View Full Code Here

    * @return the wrapped managed object
    * @throws Throwable for any error
    */
   public ManagedObject wrapManagedObject(Invocation invocation) throws Throwable
   {
      ManagedObject result = (ManagedObject) invocation.invokeNext();
      return wrapManagedObject(result);
   }
View Full Code Here

TOP

Related Classes of org.jboss.managed.api.ManagedObject

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.