public Class getBusinessLocalBeanInterface() { if (this.isLocalbean()) { return this.beanClass; } return null; }
public Class getBusinessLocalBeanInterface() { if (this.isLocalbean()) { return this.beanClass; } return null; }
public boolean needsBeanLocalViewAddedToTypes() { return beanContext.isLocalbean() && beanContext.getBeanClass().getAnnotation(Typed.class) == null; }
public boolean needsBeanLocalViewAddedToTypes() { return beanContext.isLocalbean() && beanContext.getBeanClass().getAnnotation(Typed.class) == null; }
public static Object proxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0], IntraVmProxy.class, Serializable.class); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
public static Object proxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0], IntraVmProxy.class, Serializable.class); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
public static Object simpleProxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0]); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
public static Object simpleProxy(final BeanContext beanContext, final Class<?>[] itfs) { if (beanContext.isLocalbean()) { return LocalBeanProxyFactory.newProxyInstance(itfs[0].getClassLoader(), new Handler(beanContext), itfs[0]); } return Proxy.newProxyInstance(itfs[0].getClassLoader(), itfs, new Handler(beanContext)); }
private static void validateDisposeMethods(final CdiEjbBean<?> bean) { if (!bean.getBeanContext().isLocalbean()) { for (final Method m : bean.getBeanContext().getBeanClass().getMethods()) { if (m.getDeclaringClass().equals(Object.class)) { continue; } if (m.getParameterTypes().length > 0) { for (final Annotation[] a : m.getParameterAnnotations()) { for (final Annotation ann : a) { if (ann.annotationType().equals(Disposes.class) && doResolveViewMethod(bean, m) == null) { throw new WebBeansConfigurationException("@Disposes is forbidden on non business EJB methods"); } } } } } } }
private static void validateObserverMethods(final CdiEjbBean<?> bean, final Map<ObserverMethod<?>, AnnotatedMethod<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final Map.Entry<ObserverMethod<?>, AnnotatedMethod<?>> m : methods.entrySet()) { final Method method = m.getValue().getJavaMember(); if (!Modifier.isStatic(method.getModifiers()) && doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Observes " + method + " neither in the ejb view of ejb " + bean.getBeanContext().getEjbName() + " nor static"); } } }
private static void validateObserverMethods(final CdiEjbBean<?> bean, final Map<ObserverMethod<?>, AnnotatedMethod<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final Map.Entry<ObserverMethod<?>, AnnotatedMethod<?>> m : methods.entrySet()) { final Method method = m.getValue().getJavaMember(); if (!Modifier.isStatic(method.getModifiers()) && doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Observes " + method + " neither in the ejb view of ejb " + bean.getBeanContext().getEjbName() + " nor static"); } } }
private static void eagerInitOfLocalBeanProxies(final Collection<BeanContext> beans, final ClassLoader classLoader) { for (final BeanContext deployment : beans) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { // init proxy eagerly otherwise deserialization of serialized object can't work final List<Class> interfaces = new ArrayList<>(2); interfaces.add(Serializable.class); interfaces.add(IntraVmProxy.class); final BeanType type = deployment.getComponentType(); if (BeanType.STATEFUL.equals(type) || BeanType.MANAGED.equals(type)) { interfaces.add(BeanContext.Removable.class); } try { LocalBeanProxyFactory.createProxy(deployment.getBeanClass(), classLoader, interfaces.toArray(new Class<?>[interfaces.size()])); } catch (final Exception e) { // no-op: as before } } } }
public void configureDeployments(final List<BeanContext> ejbDeployments) { beans = new WeakHashMap<Class<?>, BeanContext>(); for (final BeanContext deployment : ejbDeployments) { if (deployment.getComponentType().isSession()) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { beans.put(deployment.get(BeanContext.ProxyClass.class).getProxy(), deployment); } beans.put(deployment.getBeanClass(), deployment); } } }
public void configureDeployments(final List<BeanContext> ejbDeployments) { beans = new WeakHashMap<>(); for (final BeanContext deployment : ejbDeployments) { if (deployment.getComponentType().isCdiCompatible()) { if (deployment.isLocalbean() && !deployment.isDynamicallyImplemented()) { beans.put(deployment.get(BeanContext.ProxyClass.class).getProxy(), deployment); } beans.put(deployment.getBeanClass(), deployment); } } }
public void initTypes() { if (beanContext.isLocalbean()) { addApiTypes(ejbTypes, beanContext.getBeanClass()); } if (beanContext.getProxyClass() != null) { addApiTypes(ejbTypes, beanContext.getProxyClass()); } final List<Class> cl = beanContext.getBusinessLocalInterfaces(); if (cl != null && !cl.isEmpty()) { for (final Class<?> c : cl) { ejbTypes.add(c); } } if (!ejbTypes.contains(Serializable.class)) { ejbTypes.add(Serializable.class); } ejbTypes.add(Object.class); }
public void initInternals() { final List<Class> classes = beanContext.getBusinessLocalInterfaces(); final boolean noLocalInterface = classes.isEmpty(); if (noLocalInterface && beanContext.isLocalbean()) { homeLocalBean = beanContext.getBusinessLocalBeanHome(); home = null; } else if (!noLocalInterface) { final Class<?> mainInterface = classes.get(0); final List<Class> interfaces = ProxyInterfaceResolver.getInterfaces(beanContext.getBeanClass(), mainInterface, classes); home = beanContext.getBusinessLocalHome(interfaces, mainInterface); homeLocalBean = null; } // else remote }
private static void validateProduceMethods(final CdiEjbBean<?> bean, final Set<ProducerMethodBean<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final ProducerMethodBean<?> m : methods) { final Method method = m.getCreatorMethod(); if (doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Produces " + method + " not in the ejb view of ejb " + beanContext.getEjbName()); } } }
private static void validateProduceMethods(final CdiEjbBean<?> bean, final Set<ProducerMethodBean<?>> methods) { final BeanContext beanContext = bean.getBeanContext(); if (beanContext.isLocalbean()) { return; } for (final ProducerMethodBean<?> m : methods) { final Method method = m.getCreatorMethod(); if (doResolveViewMethod(bean, method) == null) { throw new WebBeansConfigurationException("@Produces " + method + " not in the ejb view of ejb " + beanContext.getEjbName()); } } }
@Override public List<Method> getRemoveMethods() { // Should we delegate to super and merge both? if (beanContext.isLocalbean()) { return findRemove(beanContext.getBeanClass(), beanContext.getBeanClass()); } return findRemove(beanContext.getBeanClass(), beanContext.getBusinessLocalInterface()); }
@Override public List<Method> getRemoveMethods() { // Should we delegate to super and merge both? if (beanContext.isLocalbean()) { return findRemove(beanContext.getBeanClass(), beanContext.getBeanClass()); } return findRemove(beanContext.getBeanClass(), beanContext.getBusinessLocalInterface()); }