public void validate(EjbModule ejbModule) {
    if (ejbModule.getFinder() == null) {
      return;
    }

    if (ejbModule.getBeans() == null && hasAtInject(ejbModule.getFinder())) {
      warn(ejbModule.getModuleId(), "cdi.notEnabled", ejbModule.getModuleId());
    }
  }
Example #2
0
  public void validate(final EjbModule ejbModule) {
    if (ejbModule.getFinder() == null
        || ejbModule.getProperties().containsKey("openejb.cdi.activated")) {
      return;
    }

    if (ejbModule.getBeans() == null && hasAtInject(ejbModule.getFinder())) {
      warn(ejbModule.getModuleId(), "cdi.notEnabled", ejbModule.getModuleId());
    }
  }
 @Override
 public void validate(EjbModule ejbModule) {
   check(ejbModule.getClassLoader());
 }
  public void validate(EjbModule module) {
    Set<String> applicationExceptions = new HashSet<String>();
    for (ApplicationException applicationException :
        module.getEjbJar().getAssemblyDescriptor().getApplicationException()) {
      applicationExceptions.add(applicationException.getExceptionClass());
    }
    for (EnterpriseBean bean : module.getEjbJar().getEnterpriseBeans()) {
      Class<?> ejbClass = null;
      try {
        ejbClass = loadClass(bean.getEjbClass());
      } catch (OpenEJBException e) {
        continue;
      }
      if (bean instanceof SessionBean) {
        SessionBean session = (SessionBean) bean;
        for (AsyncMethod asyncMethod : session.getAsyncMethod()) {
          Method method = getMethod(ejbClass, asyncMethod);
          if (method == null) {
            fail(
                bean,
                "asynchronous.missing",
                asyncMethod.getMethodName(),
                ejbClass.getName(),
                getParameters(asyncMethod.getMethodParams()));
          } else {
            checkAsynchronousMethod(session, ejbClass, method, applicationExceptions);
          }
        }

        for (String className : session.getAsynchronousClasses()) {
          try {
            Class<?> cls = loadClass(className);
            for (Method method : cls.getDeclaredMethods()) {
              if (Modifier.isPublic(method.getModifiers()) && !method.isSynthetic()) {
                checkAsynchronousMethod(session, ejbClass, method, applicationExceptions);
              } else {
                // warn(session, "asynchronous.methodignored", ejbClass.getName(),
                // method.getName());
              }
            }
          } catch (OpenEJBException e) {
            // ignore ?
          }
        }
      } else {
        ClassFinder classFinder = new ClassFinder(ejbClass);
        for (Method method : classFinder.findAnnotatedMethods(Asynchronous.class)) {
          ignoredMethodAnnotation(
              "Asynchronous",
              bean,
              bean.getEjbClass(),
              method.getName(),
              bean.getClass().getSimpleName());
        }
        if (ejbClass.getAnnotation(Asynchronous.class) != null) {
          ignoredClassAnnotation(
              "Asynchronous", bean, bean.getEjbClass(), bean.getClass().getSimpleName());
        }
      }
    }
  }