Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.EjbJar


        return convert(prefix + "ejb-jar.xml", prefix + "openejb-jar.xml", prefix + "orm.xml");
    }

    private EntityMappings convert(String ejbJarFileName, String openejbJarFileName, String expectedFileName) throws Exception {
        InputStream in = getClass().getClassLoader().getResourceAsStream(ejbJarFileName);
        EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, new ByteArrayInputStream(readContent(in).getBytes()));

        // create and configure the module
        EjbModule ejbModule = new EjbModule(getClass().getClassLoader(), "TestModule", ejbJarFileName, ejbJar, new OpenejbJar());
        InitEjbDeployments initEjbDeployments = new InitEjbDeployments();
        initEjbDeployments.deploy(ejbModule, new HashMap<String,String>());
View Full Code Here


*/
public class CheckInjectionTargetsTest extends TestCase {

    public void test() throws Exception {

        EjbModule module = new EjbModule(new EjbJar());
        StatelessBean bean = module.getEjbJar().addEnterpriseBean(new StatelessBean("CheeseEjb", "org.acme.CheeseEjb"));

        // Valid
        EnvEntry envEntry = new EnvEntry("count", Integer.class.getName(), "10");
        envEntry.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/count"));
View Full Code Here

            moduleName = naming.createChildName(earName, targetPath, NameFactory.EJB_MODULE);
            ejbModule.setModuleId(targetPath);
        }

        // Create XMLBeans version of EjbJarType for the AnnotatedApp interface
        EjbJar ejbJar = ejbModule.getEjbJar();
        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
        AnnotatedEjbJar annotatedEjbJar = new AnnotatedEjbJar(ejbJarType);

        EjbModule module = new EjbModule(ejbModule, standAlone, moduleName, environment, moduleFile, targetPath, "", annotatedEjbJar);
View Full Code Here

        EjbJarInfo ejbJarInfo = getEjbJarInfo(earContext, ejbModule, classLoader);

        ejbModule.setEjbJarInfo(ejbJarInfo);

        // update the original spec dd with the metadata complete dd
        EjbJar ejbJar = ejbModule.getEjbJar();
        ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));

        // Get the geronimo-openejb plan
        GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getEjbModule().getAltDDs().get("geronimo-openejb.xml");
View Full Code Here

        // classes annotated with ejb annotations, it is not an ejb module
        if (ejbJarXml == null && !isEjbAnnotatedModule(moduleFile)) {
            return null;
        }

        EjbJar ejbJar = XmlUtil.unmarshal(EjbJar.class, ejbJarXml);
        if (ejbJar == null){
            ejbJar = new EjbJar();
        }

        // load the geronimo-openejb.xml
        boolean standAlone = earEnvironment == null;
        OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.loadGeronimOpenejbJar(plan, moduleFile, standAlone, targetPath, ejbJar);
        if (geronimoOpenejb == null) {
            // Avoid NPE GERONIMO-1220; todo: remove this if we can work around the requirement for a plan
            throw new DeploymentException("Currently a Geronimo deployment plan is required for an EJB module.  Please provide a plan as a deployer argument or packaged in the EJB JAR at META-INF/openejb-jar.xml");
        }

        // load the openejb-jar.xml
        XmlObject object = null;
        if (geronimoOpenejb.isSetOpenejbJar()) {
            XmlCursor xmlCursor = geronimoOpenejb.getOpenejbJar().newCursor();
            xmlCursor.toFirstChild();
            object = xmlCursor.getObject();
        }
        String openejbJarXml = XmlUtil.loadOpenejbJarXml(object, moduleFile);
        OpenejbJar openejbJar = XmlUtil.unmarshal(OpenejbJar.class, openejbJarXml);
        if (openejbJar == null){
            openejbJar = new OpenejbJar();
        }

        // initialize the geronimo environment
        EnvironmentType environmentType = geronimoOpenejb.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        if (earEnvironment != null) {
            EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
            environment = earEnvironment;
            if (!environment.getConfigId().isResolved()) {
                throw new IllegalStateException("EJB module ID should be fully resolved (not " + environment.getConfigId() + ")");
            }
        } else {
            idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
        }

        // todo THIS WILL NOT WORK WITH ANNOTATIONS... move this to initContext when naming is fixed
        // since assembly descriptor will only be valid once metadata complete
        // which is only available once a class loader has been constructed in the init phase
        EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
        if (ejbJar.getAssemblyDescriptor() != null) {
            AssemblyDescriptorType assemblyDescriptor = ejbJarType.getAssemblyDescriptor();
            namingBuilder.buildEnvironment(assemblyDescriptor, geronimoOpenejb, environment);
        }

        //overridden web service locations
View Full Code Here

        } catch (IOException e) {
            throw new DeploymentException(e);
        }

        // update the original spec dd with the metadata complete dd
        EjbJar ejbJar = ejbModule.getEjbJar();
        ejbModule.setOriginalSpecDD(XmlUtil.marshal(ejbModule.getEjbJar()));

        // We must set all mapped name references back to null or Geronimo will blow up
        unmapReferences(ejbJar);
View Full Code Here

        // Setup the descriptor information

        WidgetBean.lifecycle.clear();

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new MessageDrivenBean(WidgetBean.class));

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

        InitialContext initialContext = new InitialContext();
View Full Code Here

                processSecurityAnnotations(clazz, ejbName, ejbModule, inheritedClassFinder, bean);

                for (Class<?> interceptorsAnnotatedClass : inheritedClassFinder.findAnnotatedClasses(Interceptors.class)) {
                    Interceptors interceptors = interceptorsAnnotatedClass.getAnnotation(Interceptors.class);
                    EjbJar ejbJar = ejbModule.getEjbJar();
                    for (Class interceptor : interceptors.value()) {
                        if (ejbJar.getInterceptor(interceptor.getName()) == null) {
                            ejbJar.addInterceptor(new Interceptor(interceptor.getName()));
                        }
                    }

                    InterceptorBinding binding = new InterceptorBinding(bean);
                    assemblyDescriptor.getInterceptorBinding().add(0, binding);

                    for (Class interceptor : interceptors.value()) {
                        binding.getInterceptorClass().add(interceptor.getName());
                    }
                }

                for (Method method : inheritedClassFinder.findAnnotatedMethods(Interceptors.class)) {
                    Interceptors interceptors = method.getAnnotation(Interceptors.class);
                    if (interceptors != null) {
                        EjbJar ejbJar = ejbModule.getEjbJar();
                        for (Class interceptor : interceptors.value()) {
                            if (ejbJar.getInterceptor(interceptor.getName()) == null) {
                                ejbJar.addInterceptor(new Interceptor(interceptor.getName()));
                            }
                        }

                        InterceptorBinding binding = new InterceptorBinding(bean);
                        assemblyDescriptor.getInterceptorBinding().add(0, binding);
View Full Code Here

        MessageAdapter messageAdapter = inbound.setMessageAdapter(new MessageAdapter());
        MessageListener listener = messageAdapter.addMessageListener(new MessageListener(EmailConsumer.class, EmailAccountInfo.class));
        listener.getActivationSpec().addRequiredConfigProperty("address");
        app.getResourceModules().add(new ConnectorModule(connector));

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

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

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

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new SingletonBean(Color.class));
        ejbJar.addEnterpriseBean(new SingletonBean(Red.class));
        ejbJar.addEnterpriseBean(new SingletonBean(Crimson.class));
        ejbJar.addEnterpriseBean(new SingletonBean(Scarlet.class));
        List<ContainerConcurrency> declared = ejbJar.getAssemblyDescriptor().getContainerConcurrency();

        declared.add(new ContainerConcurrency(ConcurrencyAttribute.WRITE, "*", "*", "*"));
        declared.add(new ContainerConcurrency(ConcurrencyAttribute.READ, "*", "Crimson", "*"));
        declared.add(new ContainerConcurrency(ConcurrencyAttribute.READ, Color.class.getName(), "Scarlet", "*"));
        declared.add(new ContainerConcurrency(ConcurrencyAttribute.READ, Red.class.getName(), "Scarlet", "red"));
View Full Code Here

TOP

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

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.