Package org.jboss.managed.api.factory

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


      return suite(BeanMetaDataICFTestCase.class);
   }

   public void testICF() throws Exception
   {
      ManagedObjectFactory factory = ManagedObjectFactory.getInstance();
      BeanInstanceClassFactory instanceClassFactory = new BeanInstanceClassFactory();
      factory.setInstanceClassFactory(AbstractBeanMetaData.class, instanceClassFactory);
      try
      {
         AbstractBeanMetaData plainMCBean = new AbstractBeanMetaData("plain", PlainMCBean.class.getName());
         plainMCBean.addProperty(new AbstractPropertyMetaData("id", "PlainMCBean"));
         ManagedObject mo = factory.initManagedObject(plainMCBean, "PlainMCBean", "MC");
         assertNotNull(mo);
         assertEquals("plain", mo.getComponentName());

         AbstractBeanMetaData runtimeMCBean = new AbstractBeanMetaData("runtime", MCBeanWithRuntimeName.class.getName());
         runtimeMCBean.addProperty(new AbstractPropertyMetaData("id", "RuntimeMCBean"));
         runtimeMCBean.addProperty(new AbstractPropertyMetaData("componentName", "FromObjectRuntime"));
         ManagedObject mo2 = factory.initManagedObject(runtimeMCBean, "RuntimeMCBean", "MC");
         assertNotNull(mo2);
         assertEquals("FromObjectRuntime", mo2.getComponentName());
      }
      finally
      {
         factory.setInstanceClassFactory(AbstractBeanMetaData.class, null);
      }
   }
View Full Code Here


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

               log.debug("Skipping ManagedObject since T(" + deployment + ") is not Serializable");
               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

/*     */   protected void writeTemplate(File dsXml, DeploymentTemplateInfo values)
/*     */     throws Exception
/*     */   {
/*  90 */     String cfType = ((DsDataSourceTemplateInfo)values).getConnectionFactoryType();
/*     */
/*  93 */     ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
/*     */
/*  96 */     String rootElementName = "datasources";
/*     */     ManagedObject cfMO;
/*  97 */     if ("local-tx-datasource".equals(cfType))
/*     */     {
/*  99 */       ManagedConnectionFactoryDeploymentMetaData mcf = new LocalDataSourceDeploymentMetaData();
/* 100 */       mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/* 101 */       cfMO = mof.initManagedObject(mcf, KnownComponentTypes.DataSourceTypes.LocalTx.getType().getType(), KnownComponentTypes.DataSourceTypes.LocalTx.getType().getSubtype());
/*     */     }
/*     */     else
/*     */     {
/*     */       ManagedObject cfMO;
/* 105 */       if ("xa-datasource".equals(cfType))
/*     */       {
/* 107 */         ManagedConnectionFactoryDeploymentMetaData mcf = new XADataSourceDeploymentMetaData();
/* 108 */         mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/* 109 */         cfMO = mof.initManagedObject(mcf, KnownComponentTypes.DataSourceTypes.XA.getType().getType(), KnownComponentTypes.DataSourceTypes.XA.getType().getSubtype());
/*     */       }
/*     */       else
/*     */       {
/*     */         ManagedObject cfMO;
/* 113 */         if ("tx-connection-factory".equals(cfType))
/*     */         {
/* 115 */           rootElementName = "connection-factories";
/* 116 */           ManagedConnectionFactoryDeploymentMetaData mcf = new TxConnectionFactoryDeploymentMetaData();
/* 117 */           mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/*     */
/* 119 */           cfMO = mof.initManagedObject(mcf, "ConnectionFactory", "XA");
/*     */         }
/*     */         else
/*     */         {
/*     */           ManagedObject cfMO;
/* 123 */           if ("no-tx-connection-factory".equals(cfType))
/*     */           {
/* 125 */             rootElementName = "connection-factories";
/* 126 */             ManagedConnectionFactoryDeploymentMetaData mcf = new NoTxConnectionFactoryDeploymentMetaData();
/* 127 */             mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/*     */
/* 129 */             cfMO = mof.initManagedObject(mcf, "ConnectionFactory", "NoTx");
/*     */           }
/*     */           else
/*     */           {
/*     */             ManagedObject cfMO;
/* 133 */             if ("no-tx-datasource".equals(cfType))
/*     */             {
/* 135 */               ManagedConnectionFactoryDeploymentMetaData mcf = new NoTxDataSourceDeploymentMetaData();
/* 136 */               mof.setBuilder(mcf.getClass(), new XADataSourceDeploymentMetaDataBuilder());
/* 137 */               cfMO = mof.initManagedObject(mcf, KnownComponentTypes.DataSourceTypes.NoTx.getType().getType(), KnownComponentTypes.DataSourceTypes.NoTx.getType().getSubtype());
/*     */             }
/*     */             else
/*     */             {
/* 142 */               throw new IllegalStateException("Unexpected value connection factory type: " + cfType);
/*     */             }
View Full Code Here

/* 284 */           this.log.debug("Skipping ManagedObject since T(" + deployment + ") is not Serializable");
/* 285 */           return;
/*     */         }
/*     */
/* 288 */         Serializable instance = (Serializable)deployment;
/* 289 */         ManagedObjectFactory factory = ManagedObjectFactoryBuilder.create();
/* 290 */         ManagedObject mo = factory.initManagedObject(instance, null, null);
/* 291 */         if (mo != null)
/* 292 */           managedObjects.put(mo.getName(), mo);
/*     */       }
/*     */     }
/*     */   }
View Full Code Here

/*     */   {
/*  79 */     this.icf = icf;
/*     */
/*  81 */     if (icf != null)
/*     */     {
/*  84 */       ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
/*  85 */       mof.setInstanceClassFactory(ServiceMetaData.class, icf);
/*     */     }
/*     */   }
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

               log.debug("Skipping ManagedObject since T(" + deployment + ") is not Serializable");
               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

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.