Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.ContainerTransaction


        ejbJar.addEnterpriseBean(new StatelessBean(Red.class));
        ejbJar.addEnterpriseBean(new StatelessBean(Crimson.class));
        ejbJar.addEnterpriseBean(new StatelessBean(Scarlet.class));
        final List<ContainerTransaction> declared = ejbJar.getAssemblyDescriptor().getContainerTransaction();

        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "*", "*", "*"));
        declared.add(new ContainerTransaction(TransAttribute.SUPPORTS, "*", "Crimson", "*"));
        declared.add(new ContainerTransaction(TransAttribute.SUPPORTS, Color.class.getName(), "Scarlet", "*"));
        declared.add(new ContainerTransaction(TransAttribute.NEVER, Red.class.getName(), "Scarlet", "red"));
        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "Scarlet", Scarlet.class.getMethod("scarlet")));

        ejbJar.getAssemblyDescriptor().addInterceptorBinding(new InterceptorBinding("*", AttributeInterceptor.class.getName()));

        final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
        assembler.createApplication(ejbJarInfo);
View Full Code Here


        final Method remoteMethod = new Method("OrangeBean", "isInTransaction").withInterface(MethodIntf.REMOTE);
        final Method localMethod = new Method("OrangeBean", "isInTransaction").withInterface(MethodIntf.LOCAL);

        final List<ContainerTransaction> transactions = ejbJar.getAssemblyDescriptor().getContainerTransaction();

        transactions.add(new ContainerTransaction(TransAttribute.REQUIRED, remoteMethod));
        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, localMethod));

        return ejbJar;
    }
View Full Code Here

        ejbJar.addEnterpriseBean(new StatefulBean(Red.class));
        ejbJar.addEnterpriseBean(new StatefulBean(Crimson.class));
        ejbJar.addEnterpriseBean(new StatefulBean(Scarlet.class));
        final List<ContainerTransaction> declared = ejbJar.getAssemblyDescriptor().getContainerTransaction();

        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "*", "Crimson", "*"));
        declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, "*", "Crimson", "create"));
        final ContainerTransaction o = new ContainerTransaction(TransAttribute.SUPPORTS, "*", "Crimson", "create");
        o.getMethod().get(0).setMethodIntf(MethodIntf.HOME);
        declared.add(o);
        declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, "*", "Crimson", "remove"));
        declared.add(new ContainerTransaction(TransAttribute.REQUIRES_NEW, Color.class.getName(), "Scarlet", "*"));
        declared.add(new ContainerTransaction(TransAttribute.NEVER, Red.class.getName(), "Scarlet", "red"));
        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "Scarlet", Scarlet.class.getMethod("scarlet")));

        final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
        assembler.createApplication(ejbJarInfo);

        final InitialContext context = new InitialContext();
View Full Code Here

@RunWith(ValidationRunner.class)
public class CheckInvalidContainerTransactionTest {
    @Keys({@Key("containerTransaction.ejbNameRequired"), @Key("containerTransaction.noSuchEjbName")})
    public EjbJar test() throws Exception {
        final EjbJar ejbJar = new EjbJar();
        final ContainerTransaction tx = new ContainerTransaction(TransAttribute.REQUIRED, new Method((String) null, (String) null));
        ejbJar.getAssemblyDescriptor().getContainerTransaction().add(tx);
        final ContainerTransaction tx1 = new ContainerTransaction(TransAttribute.REQUIRED, new Method("wrongEjbName", "wrongMethodName"));
        ejbJar.getAssemblyDescriptor().getContainerTransaction().add(tx1);
        return ejbJar;
    }
View Full Code Here

    @Keys(@Key(value = "xml.invalidTransactionAttribute", type = KeyType.WARNING))
    public EjbJar xml() throws SecurityException, NoSuchMethodException {
        final EjbJar ejbJar = new EjbJar();
        final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(CheeseEjb.class));
        bean.setTransactionType(TransactionType.BEAN);
        final ContainerTransaction tx = new ContainerTransaction();
        tx.getMethod().add(new Method(bean.getEjbName(), CheeseEjb.class.getMethod("sayCheesePlease", null)));
        tx.setTransAttribute(TransAttribute.REQUIRED);
        ejbJar.getAssemblyDescriptor().getContainerTransaction().add(tx);
        return ejbJar;
    }
View Full Code Here

            public Map<String, List<MethodAttribute>> getExistingDeclarations() {
                return assemblyDescriptor.getMethodTransactionMap(ejbName);
            }

            public void addClassLevelDeclaration(final TransactionAttribute attribute, final Class type) {
                final ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

                final ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }

            public void addMethodLevelDeclaration(final TransactionAttribute attribute, final Method method) {
                final ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), ejbName, method);
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

        //    <method-name>*</method-name>
        //  </method>
        //  <trans-attribute>Supports</trans-attribute>
        //</container-transaction>

        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MyBmpBean", "*"));
        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MyCmpBean", "*"));
        transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, null, "MySingletonBean", "*"));

        final File f = new File("test").getAbsoluteFile();
        if (!f.exists() && !f.mkdirs()) {
            throw new Exception("Failed to create test directory: " + f);
        }
View Full Code Here

            public Map<String, List<MethodAttribute>> getExistingDeclarations() {
                return assemblyDescriptor.getMethodTransactionMap(ejbName);
            }

            public void addClassLevelDeclaration(TransactionAttribute attribute, Class type) {
                ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

                ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }

            public void addMethodLevelDeclaration(TransactionAttribute attribute, Method method) {
                ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), ejbName, method);
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

TOP

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

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.