Package org.jboss.beans.metadata.spi.factory

Examples of org.jboss.beans.metadata.spi.factory.GenericBeanFactoryMetaData$PropertyMap


      {
         String name = factory.name();
         if (name == null)
            throw new IllegalArgumentException("Null bean name: " + factory);

         GenericBeanFactoryMetaData gbfmd = new GenericBeanFactoryMetaData(name, clazz.getName());
         Class<?> factoryClass = factory.getFactoryClass();
         if (void.class.equals(factoryClass) == false)
            gbfmd.setFactoryClass(factoryClass.getName());
         String[] aliases = factory.aliases();
         if (aliases != null && aliases.length > 0)
         {
            Set<AliasMetaData> aliasesMD = new HashSet<AliasMetaData>();
            for (String alias : aliases)
            {
               AbstractAliasMetaData aamd = new AbstractAliasMetaData();
               aamd.setAlias(alias);
               aliasesMD.add(aamd);
            }
            gbfmd.setAliases(aliasesMD);
         }
         gbfmd.setMode(factory.mode());
         gbfmd.setAccessMode(factory.accessMode());

         return gbfmd.getBeanMetaData();
      }
View Full Code Here


      return installFactory(controller, name, beanClass.getName());
   }

   protected GenericBeanFactoryMetaData installFactory(KernelController controller, String name, String beanClassName) throws Throwable
   {
      GenericBeanFactoryMetaData factory = new GenericBeanFactoryMetaData();
      factory.setName(name);
      factory.setBean(beanClassName);

      for (BeanMetaData bean : factory.getBeans())
         controller.install(bean);

      return factory;
   }
View Full Code Here

   }

   protected void setupBeanMetaDatas() throws Throwable
   {
      AbstractBeanMetaData metaData1 = new AbstractBeanMetaData("Name1", GenericBeanFactoryRepository.class.getName());
      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("Name2", SimpleBeanImpl.class.getName());

      ArrayList<InstallMetaData> installs = new ArrayList<InstallMetaData>();
      AbstractInstallMetaData install = new AbstractInstallMetaData();
      install.setBean("Name1");
      install.setMethodName("addGenericBeanFactory");
      ArrayList<ParameterMetaData> parameters = new ArrayList<ParameterMetaData>();
      parameters.add(new AbstractParameterMetaData(null, new ThisValueMetaData()));
      install.setParameters(parameters);
      installs.add(install);
      metaData2.setInstalls(installs);
     
      ArrayList<InstallMetaData> uninstalls = new ArrayList<InstallMetaData>();
      AbstractInstallMetaData uninstall = new AbstractInstallMetaData();
      uninstall.setBean("Name1");
      uninstall.setMethodName("removeGenericBeanFactory");
      parameters = new ArrayList<ParameterMetaData>();
      parameters.add(new AbstractParameterMetaData(null, new ThisValueMetaData()));
      uninstall.setParameters(parameters);
      uninstalls.add(uninstall);
      metaData2.setUninstalls(uninstalls);

      setBeanMetaDatas(new BeanMetaData[] { metaData1, getBeanMetaData(metaData2) });
   }
View Full Code Here

   protected void setBeanMetaDatas() throws Throwable
   {
      BeanMetaDataBuilder b1 = BeanMetaDataBuilderFactory.createBuilder("set_name_bean", BeanNameAwareBean.class.getName());

      GenericBeanFactoryMetaData b2 = new GenericBeanFactoryMetaData("set_name_factory", NameAwareBean.class.getName());
      AbstractInjectionValueMetaData v2 = new AbstractInjectionValueMetaData();
      v2.setFromContext(FromContext.NAME);
      addBeanProperty(b2, new AbstractPropertyMetaData("name", v2));

      BeanMetaDataBuilder b3 = BeanMetaDataBuilderFactory.createBuilder("aliases", AliasesAwareBean.class.getName());
View Full Code Here

      super(name);
   }

   protected GenericBeanFactoryMetaData createBeanFactory()
   {
      GenericBeanFactoryMetaData beanFactoryMetaData = new GenericBeanFactoryMetaData("Name2", SimplerBeanImpl.class.getName());
      beanFactoryMetaData.setAccessMode(BeanAccessMode.FIELDS);
      return beanFactoryMetaData;
   }
View Full Code Here

      buildMetaData();
   }

   protected void buildMetaData()
   {
      GenericBeanFactoryMetaData metaData1 = new GenericBeanFactoryMetaData("Name1", SimpleBeanImpl.class.getName());
      addBeanProperty(metaData1, new AbstractPropertyMetaData("string", "String1"));

      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("Name2", SimpleBeanWithConstructorDependencyImpl.class.getName());
      addBeanProperty(metaData2, new AbstractPropertyMetaData("string", "String2"));
      AbstractConstructorMetaData cmd = new AbstractConstructorMetaData();
      ArrayList<ParameterMetaData> constructor2 = new ArrayList<ParameterMetaData>();
      constructor2.add(new AbstractParameterMetaData(GenericBeanFactory.class.getName(), new AbstractDependencyValueMetaData("Name1")));
      cmd.setParameters(constructor2);
      metaData2.setConstructor(cmd);

      setBeanMetaDatas(new BeanMetaData[] { getBeanMetaData(metaData1), getBeanMetaData(metaData2) });
   }
View Full Code Here

   {
      AbstractKernelDeployment deployment = new AbstractKernelDeployment();
      deployment.setName("DependencyInjectionOfBean");
      ArrayList<BeanMetaDataFactory> beanFactories = new ArrayList<BeanMetaDataFactory>();
      // Bean1TypeFactory
      GenericBeanFactoryMetaData Bean1TypeFactory = new GenericBeanFactoryMetaData("Bean1TypeFactory",
            "org.jboss.test.kernel.deployment.support.container.Bean1Type");
      beanFactories.add(Bean1TypeFactory);
      // Bean1TypePool
      AbstractBeanMetaData Bean1TypePool = new AbstractBeanMetaData("Bean1TypePool",
            "org.jboss.test.kernel.deployment.support.container.BeanPool");
      Set<PropertyMetaData> Bean1TypePool_propertys = new HashSet<PropertyMetaData>();
      Bean1TypePool_propertys.add(new AbstractPropertyMetaData("factory",
            new AbstractDependencyValueMetaData("Bean1TypeFactory")));
      Bean1TypePool.setProperties(Bean1TypePool_propertys);
      beanFactories.add(Bean1TypePool);
      // BeanContainer1Type
      AbstractBeanMetaData BeanContainer1Type = new AbstractBeanMetaData("BeanContainer1Type",
         "org.jboss.test.kernel.deployment.support.container.BeanContainer");
      Set<PropertyMetaData> BeanContainer1Type_propertys = new HashSet<PropertyMetaData>();
      BeanContainer1Type_propertys.add(new AbstractPropertyMetaData("pool",
            new AbstractDependencyValueMetaData("Bean1TypePool")));
      BeanContainer1Type.setProperties(BeanContainer1Type_propertys);
      beanFactories.add(BeanContainer1Type);

      // Bean2TypeFactory
      GenericBeanFactoryMetaData Bean2TypeFactory = new GenericBeanFactoryMetaData("Bean2TypeFactory",
      "org.jboss.test.kernel.deployment.support.container.Bean2Type");
      Set<PropertyMetaData> Bean2TypeFactory_propertys = new HashSet<PropertyMetaData>();
      AbstractValueFactoryMetaData bean1CreateMethod = new AbstractValueFactoryMetaData("Bean1TypePool", "createBean");
      Bean2TypeFactory_propertys.add(new AbstractPropertyMetaData("bean1", bean1CreateMethod));
      Bean2TypeFactory.setProperties(Bean2TypeFactory_propertys);
      beanFactories.add(Bean2TypeFactory);
      // Bean2TypePool
      AbstractBeanMetaData Bean2TypePool = new AbstractBeanMetaData("Bean2TypePool",
            "org.jboss.test.kernel.deployment.support.container.BeanPool");
      Set<PropertyMetaData> Bean2TypePool_propertys = new HashSet<PropertyMetaData>();
View Full Code Here

      assertNull(factory.getUninstallCallbacks());
   }

   public void testBeanFactoryWithFactoryClass() throws Exception
   {
      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
      assertNull(factory.getName());
      assertEquals("Dummy", factory.getBean());
      assertNull(factory.getMode());
      assertEquals("MyFactory", factory.getFactoryClass());
      assertNull(factory.getAccessMode());
      assertNull(factory.getAnnotations());
      assertNull(factory.getClassLoader());
      assertNull(factory.getConstructor());
      assertNull(factory.getProperties());
      assertNull(factory.getCreate());
      assertNull(factory.getStart());
      assertNull(factory.getDepends());
      assertNull(factory.getDemands());
      assertNull(factory.getSupplies());
      assertNull(factory.getInstalls());
      assertNull(factory.getUninstalls());
      assertNull(factory.getInstallCallbacks());
      assertNull(factory.getUninstallCallbacks());
   }
View Full Code Here

      assertNull(factory.getUninstallCallbacks());
   }

   public void testBeanFactoryWithMode() throws Exception
   {
      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
      assertNull(factory.getName());
      assertEquals("Dummy", factory.getBean());
      assertEquals(ControllerMode.MANUAL, factory.getMode());
      assertNull(factory.getAccessMode());
      assertNull(factory.getFactoryClass());
      assertNull(factory.getAnnotations());
      assertNull(factory.getClassLoader());
      assertNull(factory.getConstructor());
      assertNull(factory.getProperties());
      assertNull(factory.getCreate());
      assertNull(factory.getStart());
      assertNull(factory.getDepends());
      assertNull(factory.getDemands());
      assertNull(factory.getSupplies());
      assertNull(factory.getInstalls());
      assertNull(factory.getUninstalls());
      assertNull(factory.getInstallCallbacks());
      assertNull(factory.getUninstallCallbacks());
   }
View Full Code Here

      assertNull(factory.getUninstallCallbacks());
   }

   public void testBeanFactoryWithAccessMode() throws Exception
   {
      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
      assertNull(factory.getName());
      assertEquals("Dummy", factory.getBean());
      assertNull(factory.getMode());
      assertNull(factory.getFactoryClass());
      assertEquals(BeanAccessMode.FIELDS, factory.getAccessMode());
      assertNull(factory.getAnnotations());
      assertNull(factory.getClassLoader());
      assertNull(factory.getConstructor());
      assertNull(factory.getProperties());
      assertNull(factory.getCreate());
      assertNull(factory.getStart());
      assertNull(factory.getDepends());
      assertNull(factory.getDemands());
      assertNull(factory.getSupplies());
      assertNull(factory.getInstalls());
      assertNull(factory.getUninstalls());
      assertNull(factory.getInstallCallbacks());
      assertNull(factory.getUninstallCallbacks());
   }
View Full Code Here

TOP

Related Classes of org.jboss.beans.metadata.spi.factory.GenericBeanFactoryMetaData$PropertyMap

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.