Package org.jboss.managed.api.factory

Examples of org.jboss.managed.api.factory.ManagedObjectFactory


   public void build(DeploymentUnit unit, Set<String> attachments,
      Map<String, ManagedObject> managedObjects)
      throws DeploymentException
   {
      MetaData metaData = unit.getMetaData();
      ManagedObjectFactory factory = mof;
      if(factory == null )
         factory = ManagedObjectFactoryBuilder.create();

      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


   public void build(DeploymentUnit unit, Set<String> attachments,
      Map<String, ManagedObject> managedObjects)
      throws DeploymentException
   {
      MetaData metaData = unit.getMetaData();
      ManagedObjectFactory factory = mof;
      if(factory == null )
         factory = ManagedObjectFactoryBuilder.create();

      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

   }
  
   public void testNoTxDataSourceDeploymentMetaData()
   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      mof.addInstanceClassFactory(new NoTxCFInstanceClassFactory());
      ManagedObject mo = mof.createManagedObject(NoTxDataSourceDeploymentMetaData.class);
      log.info(mo.getProperties());
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
View Full Code Here

      }
   }
   public void testTxConnectionFactoryMetaData()
   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      TxInstanceClassFactory icf = new TxInstanceClassFactory();
      mof.setInstanceClassFactory(TxConnectionFactoryDeploymentMetaData.class, icf);
      TxConnectionFactoryDeploymentMetaData txcf = new TxConnectionFactoryDeploymentMetaData();
      ManagedObject mo = mof.initManagedObject(txcf, "TxConnectionFactoryDeploymentMetaData", null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(TxConnectionFactoryDeploymentMetaData_NAMES));
      Set<String> propertyNames = mo.getPropertyNames();
View Full Code Here

      assertEquals(12345, txcf.getXaResourceTimeout());
   }
   public void testLocalDataSourceDeploymentMetaData()
   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      LocalDSInstanceClassFactory icf = new LocalDSInstanceClassFactory(mof);
      icf.setMof(mof);
      mof.setInstanceClassFactory(LocalDataSourceDeploymentMetaData.class, icf);
      LocalDataSourceDeploymentMetaData lds = new LocalDataSourceDeploymentMetaData();
      // Set a SecurityMetaData to validate its MO
      SecurityMetaData smd = new ApplicationManagedSecurityMetaData();
      smd.setDomain("java:/jaas/SomeDomain");
      lds.setSecurityMetaData(smd);
      ManagedObject mo = mof.initManagedObject(lds, "LocalDataSourceDeploymentMetaData", null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(NonXADataSourceDeploymentMetaData_NAMES));
View Full Code Here

   }
  
   public void testXADataSourceDeploymentMetaData()
   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      XADSInstanceClassFactory icf = new XADSInstanceClassFactory();
      mof.setInstanceClassFactory(XADataSourceDeploymentMetaData.class, icf);
      XADataSourceDeploymentMetaData xads = new XADataSourceDeploymentMetaData();
      ManagedObject mo = mof.initManagedObject(xads, "XADataSourceDeploymentMetaData", null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(XADataSourceDeploymentMetaData_NAMES));
View Full Code Here

   }

   public void testJBossManagedConnectionPool() throws Exception
   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      ServiceMetaDataICF icf = new ServiceMetaDataICF();
      mof.setInstanceClassFactory(ServiceMetaData.class, icf);
      ServiceMetaData smd = new ServiceMetaData();
      smd.setCode(JBossManagedConnectionPool.class.getName());
      smd.setObjectName(new ObjectName("jboss:service=Hypersonic,database=localDB"));
      ManagedObject mo = mof.initManagedObject(smd, null, null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(JBossManagedConnectionPool_NAMES));
      Set<String> propertyNames = mo.getPropertyNames();
      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
View Full Code Here

       * @param clazz - the mbean class to create the ManagedObject for
       * @param metaData - the MDR MetaData view
       */
      public ManagedObject buildManagedObject(Class<?> clazz, MetaData metaData)
      {
         ManagedObjectFactory mof = getMOFactory();
         log.debug("Creating TopicServiceMO template for: " + clazz);
         return mof.createManagedObject(TopicServiceMO.class, metaData);
      }
View Full Code Here

       * @param clazz - the mbean class to create the ManagedObject for
       * @param metaData - the MDR MetaData view
       */
      public ManagedObject buildManagedObject(Class<?> clazz, MetaData metaData)
      {
         ManagedObjectFactory mof = getMOFactory();
         log.debug("Creating QueueServiceMO template for: " + clazz);
         return mof.createManagedObject(QueueServiceMO.class, metaData);
      }
View Full Code Here

      if (propertyInfo != null)
      {
         Object attachment = getManagedObject().getAttachment();
         if (attachment != null)
         {
            ManagedObjectFactory mof = getObjectFactory();
            InstanceClassFactory icf = mof.getInstanceClassFactory(attachment.getClass(), null);
            BeanInfo beanInfo = propertyInfo.getBeanInfo();
            icf.setValue(beanInfo, this, attachment, value);
         }
      }
      // Update the field value only after it has been written to the attachment
View Full Code Here

TOP

Related Classes of org.jboss.managed.api.factory.ManagedObjectFactory

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.