Java Code Examples for javax.ejb.Local

The following are top voted examples for showing how to use javax.ejb.Local. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: oscm   File: TransactionMandatoryTest.java   View source code 5 votes vote down vote up
private List<Class<?>> getLocalInterfaces(Class<?> clazz) {
    List<Class<?>> localInterfaces = new ArrayList<Class<?>>();
    for (Class<?> c : clazz.getInterfaces()) {
        if (c.getAnnotation(Local.class) != null) {
            localInterfaces.add(c);
        }
    }
    return localInterfaces;
}
 
Example 2
Project: oscm   File: InterfaceMap.java   View source code 5 votes vote down vote up
private boolean considerInterface(Class<?> i) {
    if (i.getAnnotation(Local.class) != null) {
        return true;
    } else if (i.getAnnotation(Remote.class) != null) {
        return true;
    } else {
        return isExcplicitlyRequiredClass(i);
    }
}
 
Example 3
Project: development   File: TransactionMandatoryTest.java   View source code 5 votes vote down vote up
private List<Class<?>> getLocalInterfaces(Class<?> clazz) {
    List<Class<?>> localInterfaces = new ArrayList<Class<?>>();
    for (Class<?> c : clazz.getInterfaces()) {
        if (c.getAnnotation(Local.class) != null) {
            localInterfaces.add(c);
        }
    }
    return localInterfaces;
}
 
Example 4
Project: development   File: InterfaceMap.java   View source code 5 votes vote down vote up
private boolean considerInterface(Class<?> i) {
    if (i.getAnnotation(Local.class) != null) {
        return true;
    } else if (i.getAnnotation(Remote.class) != null) {
        return true;
    } else {
        return isExcplicitlyRequiredClass(i);
    }
}
 
Example 5
Project: lightmare   File: BeanDeployer.java   View source code 5 votes vote down vote up
/**
 * Retrieves interface classes from passed {@link Local} or {@link Remote}
 * annotation
 *
 * @param annotation
 * @return {@link Class}[] array of interface classes
 */
private Class<?>[] ejbInterfaces(Annotation annotation) {

    Class<?>[] interfaces;

    if (annotation instanceof Remote) {
        interfaces = ObjectUtils.cast(annotation, Remote.class).value();
    } else if (annotation instanceof Local) {
        interfaces = ObjectUtils.cast(annotation, Local.class).value();
    } else {
        interfaces = null;
    }

    return interfaces;
}
 
Example 6
Project: lightmare   File: BeanDeployer.java   View source code 5 votes vote down vote up
/**
 * Identifies and caches EJB bean's {@link Local} and / or {@link Remote}
 * annotated interfaces
 *
 * @param beanClass
 */
private void initInterfaces(Class<?> beanClass, Class<? extends Annotation> type) {

    Class<?>[] interfaces = null;
    Set<Class<?>> interfacesSet = new HashSet<Class<?>>();
    Annotation ejbAnnotation = beanClass.getAnnotation(type);
    Class<?>[] ejbInterfaces = beanClass.getInterfaces();

    if (ObjectUtils.notNull(ejbAnnotation)) {
        interfaces = ejbInterfaces(ejbAnnotation);
        if (CollectionUtils.valid(interfaces)) {
            interfacesSet.addAll(Arrays.asList(interfaces));
        }
    }

    for (Class<?> interfaceClass : ejbInterfaces) {
        if (interfaceClass.isAnnotationPresent(type))
            interfacesSet.add(interfaceClass);
    }

    if (CollectionUtils.valid(interfacesSet)) {
        interfaces = toArray(interfacesSet);
        if (ejbAnnotation instanceof Local) {
            metaData.setRemoteInterfaces(interfaces);
        } else if (ejbAnnotation instanceof Remote) {
            metaData.setRemoteInterfaces(interfaces);
        }
    }
}
 
Example 7
Project: oscm   File: ClassFilter.java   View source code 4 votes vote down vote up
@Override
public boolean isNeglectableClass(Class<?> clazz) {
    boolean isInterface = clazz.isInterface();
    Local annotation = clazz.getAnnotation(Local.class);
    return !(isInterface && annotation != null);
}
 
Example 8
Project: ArchUnit   File: SessionBeanRulesTest.java   View source code 4 votes vote down vote up
private boolean isLocalBeanImplementation(JavaClass bean, JavaClass businessInterfaceType) {
    return bean.isAnnotatedWith(Local.class) &&
            bean.getAnnotationOfType(Local.class).value()[0].getName()
                    .equals(businessInterfaceType.getName());
}
 
Example 9
Project: development   File: ClassFilter.java   View source code 4 votes vote down vote up
@Override
public boolean isNeglectableClass(Class<?> clazz) {
    boolean isInterface = clazz.isInterface();
    Local annotation = clazz.getAnnotation(Local.class);
    return !(isInterface && annotation != null);
}
 
Example 10
Project: tomee   File: CheckClasses.java   View source code 3 votes vote down vote up
private boolean isValidInterface(final RemoteBean b, final Class clazz, final Class beanClass, final String tag) {

        if (clazz.equals(beanClass)) {

            fail(b, "xml." + tag + ".beanClass", clazz.getName());

        } else if (!clazz.isInterface()) {

            fail(b, "xml." + tag + ".notInterface", clazz.getName());

        } else if (EJBHome.class.isAssignableFrom(clazz)) {

            if (tag.equals("home")) {
                return true;
            }

            fail(b, "xml." + tag + ".ejbHome", clazz.getName());

        } else if (EJBLocalHome.class.isAssignableFrom(clazz)) {

            if (tag.equals("localHome")) {
                return true;
            }

            fail(b, "xml." + tag + ".ejbLocalHome", clazz.getName());

        } else if (EJBObject.class.isAssignableFrom(clazz)) {

            if (tag.equals("remote")) {
                return true;
            }

            fail(b, "xml." + tag + ".ejbObject", clazz.getName());

        } else if (EJBLocalObject.class.isAssignableFrom(clazz)) {

            if (tag.equals("local")) {
                return true;
            }

            fail(b, "xml." + tag + ".ejbLocalObject", clazz.getName());

        } else {
            if (tag.equals("businessLocal") || tag.equals("businessRemote")) {

                return true;

            } else if (clazz.isAnnotationPresent(Local.class)) {

                fail(b, "xml." + tag + ".businessLocal", clazz.getName());

            } else if (clazz.isAnnotationPresent(Remote.class)) {

                fail(b, "xml." + tag + ".businessRemote", clazz.getName());

            } else {

                fail(b, "xml." + tag + ".unknown", clazz.getName());

            }

        }

        // must be tagged as <home>, <local-home>, <remote>, or <local>

        return false;
    }
 
Example 11
Project: lightmare   File: BeanDeployer.java   View source code 2 votes vote down vote up
/**
 * Identifies and caches EJB bean interfaces
 *
 * @param beanClass
 */
private void indentifyInterfaces(Class<?> beanClass) {
    initInterfaces(beanClass, Local.class);
    initInterfaces(beanClass, Remote.class);
}