Search in sources :

Example 1 with RemoteBean

use of org.apache.openejb.jee.RemoteBean in project tomee by apache.

the class CheckClasses method validate.

public void validate(final EjbModule ejbModule) {
    final ClassLoader loader = ejbModule.getClassLoader();
    for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
        try {
            final Class<?> beanClass = check_hasEjbClass(loader, bean);
            // All the subsequent checks require the bean class
            if (beanClass == null) {
                continue;
            }
            if (!(bean instanceof RemoteBean)) {
                continue;
            }
            if (bean instanceof SessionBean && ((SessionBean) bean).getProxy() != null) {
                continue;
            }
            final RemoteBean b = (RemoteBean) bean;
            check_isEjbClass(b);
            check_hasDependentClasses(b, b.getEjbClass(), "ejb-class");
            check_hasInterface(b);
            if (b.getRemote() != null) {
                checkInterface(loader, b, beanClass, "remote", b.getRemote());
            }
            if (b.getHome() != null) {
                checkInterface(loader, b, beanClass, "home", b.getHome());
            }
            if (b.getLocal() != null) {
                checkInterface(loader, b, beanClass, "local", b.getLocal());
            }
            if (b.getLocalHome() != null) {
                checkInterface(loader, b, beanClass, "local-home", b.getLocalHome());
            }
            if (b instanceof SessionBean) {
                final SessionBean sessionBean = (SessionBean) b;
                for (final String interfce : sessionBean.getBusinessLocal()) {
                    checkInterface(loader, b, beanClass, "business-local", interfce);
                }
                for (final String interfce : sessionBean.getBusinessRemote()) {
                    checkInterface(loader, b, beanClass, "business-remote", interfce);
                }
            }
        } catch (final RuntimeException e) {
            throw new OpenEJBRuntimeException(bean.getEjbName(), e);
        }
    }
    for (final Interceptor interceptor : ejbModule.getEjbJar().getInterceptors()) {
        check_hasInterceptorClass(loader, interceptor);
    }
}
Also used : OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) OpenEJBRuntimeException(org.apache.openejb.OpenEJBRuntimeException) RemoteBean(org.apache.openejb.jee.RemoteBean) SessionBean(org.apache.openejb.jee.SessionBean) Interceptor(org.apache.openejb.jee.Interceptor)

Example 2 with RemoteBean

use of org.apache.openejb.jee.RemoteBean in project tomee by apache.

the class EjbJarInfoBuilder method resolveRoleLinks.

private void resolveRoleLinks(final EnterpriseBeanInfo bean, final JndiConsumer item) {
    if (!(item instanceof RemoteBean)) {
        return;
    }
    final RemoteBean rb = (RemoteBean) item;
    final List<SecurityRoleRef> refs = rb.getSecurityRoleRef();
    for (final SecurityRoleRef ref : refs) {
        final SecurityRoleReferenceInfo info = new SecurityRoleReferenceInfo();
        info.description = ref.getDescription();
        info.roleLink = ref.getRoleLink();
        info.roleName = ref.getRoleName();
        if (info.roleLink == null) {
            info.roleLink = info.roleName;
        }
        bean.securityRoleReferences.add(info);
    }
}
Also used : SecurityRoleReferenceInfo(org.apache.openejb.assembler.classic.SecurityRoleReferenceInfo) RemoteBean(org.apache.openejb.jee.RemoteBean) SecurityRoleRef(org.apache.openejb.jee.SecurityRoleRef)

Example 3 with RemoteBean

use of org.apache.openejb.jee.RemoteBean in project tomee by apache.

the class CheckMethods method validate.

public void validate(final EjbModule ejbModule) {
    for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
        if (!(bean instanceof RemoteBean)) {
            continue;
        }
        final RemoteBean b = (RemoteBean) bean;
        if (b.getHome() != null) {
            check_remoteInterfaceMethods(b);
            check_homeInterfaceMethods(b);
        }
        if (b.getLocalHome() != null) {
            check_localInterfaceMethods(b);
            check_localHomeInterfaceMethods(b);
        }
        check_unusedCreateMethods(b);
        check_unusedPostCreateMethods(b);
    }
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) RemoteBean(org.apache.openejb.jee.RemoteBean)

Aggregations

RemoteBean (org.apache.openejb.jee.RemoteBean)3 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)2 OpenEJBRuntimeException (org.apache.openejb.OpenEJBRuntimeException)1 SecurityRoleReferenceInfo (org.apache.openejb.assembler.classic.SecurityRoleReferenceInfo)1 Interceptor (org.apache.openejb.jee.Interceptor)1 SecurityRoleRef (org.apache.openejb.jee.SecurityRoleRef)1 SessionBean (org.apache.openejb.jee.SessionBean)1