Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.Method


      List<Method> methods = methodPermission.getMethod();
      Iterator<Method> methodIter = methods.iterator();

      while (methodIter.hasNext()) {
        Method method = (Method) methodIter.next();
        EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(method.getEjbName());
        try {
          MethodParams methodParams = method.getMethodParams();
          String[] params = methodParams.getMethodParam().toArray(new String[0]);
          if ((!"*".equals(method.getMethodName())) && descriptor.getExcludeList().getMethod().contains(method)) { //$NON-NLS-1$
            annotationHelper.addMethodAnnotation(enterpriseBean.getEjbClass(), method.getMethodName(), params, DenyAll.class, null);
            continue;
          }
          if (methodPermission.getUnchecked()) {
            if ("*".equals(method.getMethodName())) { //$NON-NLS-1$
              annotationHelper.addClassAnnotation(enterpriseBean.getEjbClass(), PermitAll.class, null);
            } else {
              annotationHelper.addMethodAnnotation(enterpriseBean.getEjbClass(), method.getMethodName(), params, PermitAll.class, null);
            }
          } else {
            if ("*".equals(method.getMethodName())) { //$NON-NLS-1$
              annotationHelper.addClassAnnotation(enterpriseBean.getEjbClass(), RolesAllowed.class, roleProps);
            } else {
              annotationHelper.addMethodAnnotation(enterpriseBean.getEjbClass(), method.getMethodName(), params, RolesAllowed.class, roleProps);
            }
          }
        } catch (Exception e) {
          String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.persistence.RolesAllowed", enterpriseBean.getEjbClass());
          annotationHelper.addWarning(warning);
View Full Code Here


            if (method.getLock() != null) {
                info.concurrencyAttribute = method.getLock().toString();
            }
            info.accessTimeout = toInfo(method.getAccessTimeout());

            final Method m = new Method(bean.getEjbName(), null, method.getMethod().getMethodName());
            m.setMethodParams(method.getMethod().getMethodParams());
            info.methods.add(getMethodInfo(m, ejbds));
            ejbJarInfo.methodConcurrency.add(info);
        }
    }
View Full Code Here

@RunWith(ValidationRunner.class)
public class CheckInvalidMethodPermissionsTest {
    @Keys({@Key("methodPermission.ejbNameRequired"), @Key("methodPermission.noSuchEjbName")})
    public EjbJar test() throws Exception {
        final EjbJar ejbJar = new EjbJar();
        final MethodPermission permission = new MethodPermission(new Method((String) null, (String) null));
        ejbJar.getAssemblyDescriptor().getMethodPermission().add(permission);
        final MethodPermission permission1 = new MethodPermission(new Method("wrongEjbName", "wrongMethodName"));
        ejbJar.getAssemblyDescriptor().getMethodPermission().add(permission1);
        return ejbJar;
    }
View Full Code Here

    @Module
    public EjbJar module() throws Exception {
        final EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(OrangeBean.class));

        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));
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

    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

            if (method.getLock() != null) {
                info.concurrencyAttribute = method.getLock().toString();
            }
            info.accessTimeout = toInfo(method.getAccessTimeout());

            final Method m = new Method(bean.getEjbName(), null, method.getMethod().getMethodName());
            m.setMethodParams(method.getMethod().getMethodParams());
            info.methods.add(getMethodInfo(m, ejbds));
            ejbJarInfo.methodConcurrency.add(info);
        }
    }
View Full Code Here

            if (method.getLock() != null) {
                info.concurrencyAttribute = method.getLock().toString();
            }
            info.accessTimeout = toInfo(method.getAccessTimeout());

            final Method m = new Method(bean.getEjbName(), null, method.getMethod().getMethodName());
            m.setMethodParams(method.getMethod().getMethodParams());
            info.methods.add(getMethodInfo(m, ejbds));
            ejbJarInfo.methodConcurrency.add(info);
        }
    }
View Full Code Here

            if (method.getLock() != null) {
                info.concurrencyAttribute = method.getLock().toString();
            }
            info.accessTimeout = toInfo(method.getAccessTimeout());
           
            Method m = new Method(bean.getEjbName(), null, method.getMethod().getMethodName());
            m.setMethodParams(method.getMethod().getMethodParams());           
            info.methods.add(getMethodInfo(m, ejbds));           
            ejbJarInfo.methodConcurrency.add(info);
        }
    }
View Full Code Here

            if (method.getLock() != null) {
                info.concurrencyAttribute = method.getLock().toString();
            }
            info.accessTimeout = toInfo(method.getAccessTimeout());
           
            Method m = new Method(bean.getEjbName(), null, method.getMethod().getMethodName());
            m.setMethodParams(method.getMethod().getMethodParams());           
            info.methods.add(getMethodInfo(m, ejbds));           
            ejbJarInfo.methodConcurrency.add(info);
        }
    }
View Full Code Here

TOP

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

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.