Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.SingletonBean


    }

    @Module
    public SessionBean getEjbs() {
        return new SingletonBean(Orange.class);
    }
View Full Code Here


        }
    }

    @Module
    public SessionBean getEjbs() {
        return new SingletonBean(OrangeStatefulBean.class);
    }
View Full Code Here

        // containers
        assembler.createContainer(config.configureService(SingletonSessionContainerInfo.class));

        // Setup the descriptor information

        SingletonBean bean = new SingletonBean(WidgetBean.class);
        bean.addBusinessLocal(Widget.class.getName());
        bean.addBusinessRemote(RemoteWidget.class.getName());
        bean.addPostConstruct("init");
        bean.addPreDestroy("destroy");
        bean.setLocalBean(new Empty());

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(bean);

        assembler.createApplication(config.configureApplication(ejbJar));
View Full Code Here

        assembler.createContainer(config.configureService(SingletonSessionContainerInfo.class));

        // Setup the descriptor information

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new SingletonBean(MySingleton.class));

        assembler.createApplication(config.configureApplication(ejbJar));
    }
View Full Code Here

      System.out.println(String[].class.getCanonicalName());
      //Build the application
      AppModule app = new AppModule(this.getClass().getClassLoader(), "testasynch");
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(TestBeanC.class));
        ejbJar.addEnterpriseBean(new SingletonBean(TestBeanD.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

        AppInfo appInfo = config.configureApplication(app);
        assembler.createApplication(appInfo);
View Full Code Here

  @Test
  public void testClassScopeAsynch() throws Exception {
      //Build the application
        AppModule app = new AppModule(this.getClass().getClassLoader(), "testclassasynch");
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new SingletonBean(TestBeanA.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

        AppInfo appInfo = config.configureApplication(app);
        assembler.createApplication(appInfo);
View Full Code Here

    public void test() throws Exception {

        final Assembler assembler = new Assembler();
        final ConfigurationFactory factory = new ConfigurationFactory();

        final SingletonBean singletonBean = new SingletonBean(Blue.class);
        // keep

        singletonBean.getEnvEntry().add(new EnvEntry()
                .name("message")
                .type(String.class)
                .value("hello")
                .injectionTarget(Blue.class, "message")
        );

        // remove
        singletonBean.getEnvEntry().add(new EnvEntry().name("novalue1").type(String.class));
        singletonBean.getEnvEntry().add(new EnvEntry().name("novalue2"));

        // fill in type
        singletonBean.getEnvEntry().add(new EnvEntry().name("value-but-no-type1").value("10")
                .injectionTarget(Blue.class, "number")
                .injectionTarget(Orange.class, "number") // attempt to confuse the type
        );

        singletonBean.getEnvEntry().add(new EnvEntry().name("value-but-no-type2").value("D")
                .injectionTarget(Blue.class, "letter"))
        ;

        singletonBean.getEnvEntry().add(new EnvEntry().name("value-but-no-type3").value("2")
                .injectionTarget(Blue.class, "vague")    // short
                .injectionTarget(Orange.class, "vague"// character
        );

        final EjbJar ejbJar = new EjbJar();
View Full Code Here

        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new SingletonBean(MySingletonBean.class));
        ejbJar.addEnterpriseBean(new EntityBean(MyBmpBean.class, PersistenceType.BEAN));

        //<entity>
        //  <ejb-name>License</ejb-name>
        //  <local-home>org.apache.openejb.test.entity.cmr.onetoone.LicenseLocalHome</local-home>
View Full Code Here

        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));

        final EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatefulBean("Stateful", MySessionBean.class));
        ejbJar.addEnterpriseBean(new StatelessBean("Stateless", MySessionBean.class));
        ejbJar.addEnterpriseBean(new SingletonBean("Singleton", MySessionBean.class));

        assembler.createApplication(config.configureApplication(ejbJar));

        final Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
View Full Code Here

            assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

            // Setup the descriptor information

            EjbJar ejbJar = new EjbJar("testmodule");
            ejbJar.addEnterpriseBean(new SingletonBean(Bean.class));

            // Deploy the bean a second time to simulate situations
            // where the same java:module java:app java:global names
            // are re-declared in a compatible way
            ejbJar.addEnterpriseBean(new SingletonBean("Other", Bean.class));

            EjbModule ejbModule = new EjbModule(ejbJar);
            AppModule module = new AppModule(ejbModule);
            app = assembler.createApplication(config.configureApplication(module));
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.SingletonBean

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.