Package org.apache.openejb.config

Examples of org.apache.openejb.config.AppModule


    @Keys( { @Key(value = "persistenceContextRef.noUnitName"),@Key(value = "persistenceContextRef.noMatches") })
    public AppModule noUnitName() {
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessOne.class));
        EjbModule ejbModule = new EjbModule(ejbJar);
        AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
        appModule.getEjbModules().add(ejbModule);
        PersistenceUnit pu = new PersistenceUnit("fooUnit");
        PersistenceUnit pu1 = new PersistenceUnit("fooUnit1");
        PersistenceUnit pu2 = new PersistenceUnit("fooUnit");
        org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu, pu1, pu2);
        PersistenceModule pm = new PersistenceModule("foo", p);
        appModule.getPersistenceModules().add(pm);
        return appModule;
    }
View Full Code Here


    @Keys( { @Key(value = "persistenceContextRef.vagueMatches") })
    public AppModule vagueMatches() {
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessTwo.class));
        EjbModule ejbModule = new EjbModule(ejbJar);
        AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
        appModule.getEjbModules().add(ejbModule);
        PersistenceUnit pu = new PersistenceUnit("fooUnit");
        org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu);
        PersistenceModule pm = new PersistenceModule("foo", p);
        appModule.getPersistenceModules().add(pm);
        PersistenceUnit pu1 = new PersistenceUnit("fooUnit");
        org.apache.openejb.jee.jpa.unit.Persistence p1 = new org.apache.openejb.jee.jpa.unit.Persistence(pu1);
        PersistenceModule pm1 = new PersistenceModule("foo1", p1);
        appModule.getPersistenceModules().add(pm1);
        return appModule;
    }
View Full Code Here

//        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, ExtendedContextBean.class.getName(), "TransactionToExtended", "*"));       

        EjbModule ejbModule = new EjbModule(ejbJar);

        // Create an "ear"
        AppModule appModule = new AppModule(ejbModule.getClassLoader(), "test-app");

        // Add the ejb-jar.xml to the ear
        appModule.getEjbModules().add(ejbModule);

        // Create a persistence-unit for this app
        PersistenceUnit unit = new PersistenceUnit("testUnit");
        unit.addClass(Color.class);
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");

        // Add the persistence.xml to the "ear"
        appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));

        // Configure and assemble the ear -- aka. deploy it
        AppInfo info = config.configureApplication(appModule);
        assembler.createApplication(info);
    }
View Full Code Here

        // Setup the descriptor information

        CronBean.lifecycle.clear();


        AppModule app = new AppModule(this.getClass().getClassLoader(), "testapp");

        Connector connector = new Connector("email-ra");
        ResourceAdapter adapter = new ResourceAdapter(QuartzResourceAdapter.class);
        connector.setResourceAdapter(adapter);
        InboundResourceadapter inbound = adapter.setInboundResourceAdapter(new InboundResourceadapter());
        MessageAdapter messageAdapter = inbound.setMessageAdapter(new MessageAdapter());
        MessageListener listener = messageAdapter.addMessageListener(new MessageListener(Job.class, JobSpec.class));
        listener.getActivationSpec().addRequiredConfigProperty("cronExpression");
        app.getConnectorModules().add(new ConnectorModule(connector));

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new MessageDrivenBean(CronBean.class));
        app.getEjbModules().add(new EjbModule(ejbJar));

        AppInfo appInfo = config.configureApplication(app);
        assembler.createApplication(appInfo);

View Full Code Here

    @Keys( { @Key(value = "persistenceUnitRef.noMatches"), @Key(value = "persistenceUnitRef.noUnitName") })
    public AppModule noUnitName() {
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessOne.class));
        EjbModule ejbModule = new EjbModule(ejbJar);
        AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
        appModule.getEjbModules().add(ejbModule);
        PersistenceUnit pu = new PersistenceUnit("fooUnit");
        PersistenceUnit pu1 = new PersistenceUnit("fooUnit1");
        PersistenceUnit pu2 = new PersistenceUnit("fooUnit");
        org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu, pu1, pu2);
        PersistenceModule pm = new PersistenceModule("foo", p);
        appModule.getPersistenceModules().add(pm);
        return appModule;
    }
View Full Code Here

    @Keys( { @Key(value = "persistenceUnitRef.vagueMatches") })
    public AppModule vagueMatches() {
        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessTwo.class));
        EjbModule ejbModule = new EjbModule(ejbJar);
        AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
        appModule.getEjbModules().add(ejbModule);
        PersistenceUnit pu = new PersistenceUnit("fooUnit");
        org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu);
        PersistenceModule pm = new PersistenceModule("foo", p);
        appModule.getPersistenceModules().add(pm);
        PersistenceUnit pu1 = new PersistenceUnit("fooUnit");
        org.apache.openejb.jee.jpa.unit.Persistence p1 = new org.apache.openejb.jee.jpa.unit.Persistence(pu1);
        PersistenceModule pm1 = new PersistenceModule("foo1", p1);
        appModule.getPersistenceModules().add(pm1);
        return appModule;
    }
View Full Code Here

            System.out.println("[Deployer] bundle location: " + location);
            try {
                File file = new File(new URL(location).getFile());
                try {
                    DeploymentLoader deploymentLoader = new DeploymentLoader();
                    AppModule appModule = deploymentLoader.load(file);

                    ConfigurationFactory configurationFactory = new ConfigurationFactory();
                    AppInfo appInfo = configurationFactory.configureApplication(appModule);

                    Assembler assembler = (Assembler) SystemInstance.get().getComponent(Assembler.class);
View Full Code Here

        Assembler assembler = new Assembler();

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

        AppModule app = new AppModule(OpenEJBXmlByModuleTest.class.getClassLoader(), OpenEJBXmlByModuleTest.class.getSimpleName());

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new SingletonBean(UselessBean.class));
        app.getEjbModules().add(new EjbModule(ejbJar));
        app.getEjbModules().iterator().next().getAltDDs().put("resources.xml", getClass().getClassLoader().getResource("META-INF/resource/appresource.openejb.xml"));

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

        Properties properties = new Properties();
        properties.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
View Full Code Here

            }

            // Read in the deploument desiptor files
            ReadDescriptors readDescriptors = new ReadDescriptors();
            try {
                readDescriptors.deploy(new AppModule(ejbModule));
            } catch (OpenEJBException e) {
                throw new DeploymentException("Failed parsing descriptors for module: " + moduleFile.getName(), e);
            }

            // Get the geronimo-openejb.xml tree
View Full Code Here

            // temporary classloader is used for processing ejb annotations and byte code manipulation during ejb load
//            TemporaryClassLoader temporaryClassLoader = new TemporaryClassLoader(new URL[0], bundleLoader);

            // create an openejb app module for the ear containing all ejb modules
            AppModule appModule = new AppModule(bundleLoader, earContext.getConfigID().toString(), null, ejbModule.isStandAlone());
            for (EjbModule module : earData.getEjbModules()) {
                module.setClassLoader(bundleLoader);
                appModule.getEjbModules().add(module.getEjbModule());
            }

            if(!ejbModule.isStandAlone())
            {
               appModule.setModuleId(ejbModule.getParentModule().getName());
            }

            // build the config info tree
            // this method fills in the ejbJar jaxb tree based on the annotations
            // (metadata complete) and it run the openejb verifier
            AppInfo appInfo;
            try {
                appInfo = configureApplication(appModule, ejbModule, earContext.getConfiguration());
            } catch (ValidationFailedException set) {
                StringBuilder sb = new StringBuilder();
                sb.append("Jar failed validation: ").append(appModule.getModuleId());

                for (ValidationError e : set.getErrors()) {
                    sb.append(e.getPrefix()).append(" ... ").append(e.getComponentName()).append(":\t").append(e.getMessage(2));
                }
View Full Code Here

TOP

Related Classes of org.apache.openejb.config.AppModule

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.