public static Object newProxyInstance(Class interfaceType, InvocationHandler h) throws IllegalAccessException { return newProxyInstance(new Class[]{interfaceType}, h); }
public static Object newProxyInstance(final Class interfaceType, final InvocationHandler h) throws IllegalAccessException { return newProxyInstance(new Class[]{interfaceType}, h); }
public static Object newProxyInstance(final Class interfaceType, final InvocationHandler h) throws IllegalAccessException { return newProxyInstance(new Class[]{interfaceType}, h); }
public static Object createHomeProxy(DeploymentInfo deploymentInfo, InterfaceType interfaceType, List<Class> objectInterfaces) { if (!interfaceType.isHome()) throw new IllegalArgumentException("InterfaceType is not a Home type: " + interfaceType); try { EjbHomeProxyHandler handler = createHomeHandler(deploymentInfo, interfaceType, objectInterfaces); List<Class> proxyInterfaces = new ArrayList<Class>(2); Class homeInterface = deploymentInfo.getInterface(interfaceType); proxyInterfaces.add(homeInterface); proxyInterfaces.add(IntraVmProxy.class); return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[]{}), handler); } catch (Exception e) { throw new RuntimeException("Can't create EJBHome stub" + e.getMessage(), e); } }
public static Object newProxy(final Class<?> type, final InvocationHandler invocationHandler) { try { return ProxyManager.newProxyInstance(type, new Handler(invocationHandler)); } catch (final IllegalAccessException e) { throw new OpenEJBRuntimeException("illegal access", e); } }
public static Object newProxy(final Class<?> type, final InvocationHandler invocationHandler) { try { return ProxyManager.newProxyInstance(type, new Handler(invocationHandler)); } catch (final IllegalAccessException e) { throw new OpenEJBRuntimeException("illegal access", e); } }
public static Object createHomeProxy(final BeanContext beanContext, final InterfaceType interfaceType, final List<Class> objectInterfaces, final Class mainInterface) { if (!interfaceType.isHome()) { throw new IllegalArgumentException("InterfaceType is not a Home type: " + interfaceType); } try { final EjbHomeProxyHandler handler = createHomeHandler(beanContext, interfaceType, objectInterfaces, mainInterface); final List<Class> proxyInterfaces = new ArrayList<Class>(2); final Class homeInterface = beanContext.getInterface(interfaceType); proxyInterfaces.add(homeInterface); proxyInterfaces.add(IntraVmProxy.class); if (BeanType.STATEFUL.equals(beanContext.getComponentType()) || BeanType.MANAGED.equals(beanContext.getComponentType())) { proxyInterfaces.add(BeanContext.Removable.class); } return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[proxyInterfaces.size()]), handler); } catch (final Exception e) { throw new OpenEJBRuntimeException("Can't create EJBHome stub" + e.getMessage(), e); } }
public static Object createHomeProxy(final BeanContext beanContext, final InterfaceType interfaceType, final List<Class> objectInterfaces, final Class mainInterface) { if (!interfaceType.isHome()) { throw new IllegalArgumentException("InterfaceType is not a Home type: " + interfaceType); } try { final EjbHomeProxyHandler handler = createHomeHandler(beanContext, interfaceType, objectInterfaces, mainInterface); final List<Class> proxyInterfaces = new ArrayList<Class>(2); final Class homeInterface = beanContext.getInterface(interfaceType); proxyInterfaces.add(homeInterface); proxyInterfaces.add(IntraVmProxy.class); if (BeanType.STATEFUL.equals(beanContext.getComponentType()) || BeanType.MANAGED.equals(beanContext.getComponentType())) { proxyInterfaces.add(BeanContext.Removable.class); } return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[proxyInterfaces.size()]), handler); } catch (final Exception e) { throw new OpenEJBRuntimeException("Can't create EJBHome stub" + e.getMessage(), e); } }
interfaces.addAll(di.getInterfaces(interfaceType)); interfaces.add(IntraVmProxy.class); return ProxyManager.newProxyInstance(interfaces.toArray(new Class[interfaces.size()]), handler); } catch (IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + interfce.getName() + " interface", iae);
public Object createProxy(Object primaryKey) { try { InterfaceType objectInterfaceType = this.interfaceType.getCounterpart(); EjbObjectProxyHandler handler = newEjbObjectHandler(getDeploymentInfo(), primaryKey, objectInterfaceType, this.getInterfaces()); List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 1); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(IntraVmProxy.class); if (InterfaceType.LOCALBEAN.equals(objectInterfaceType)) { return LocalBeanProxyFactory.newProxyInstance(handler.getDeploymentInfo().getClassLoader(), handler.getDeploymentInfo().getBeanClass(), handler); } else { return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[]{}), handler); } } catch (IllegalAccessException iae) { throw new RuntimeException("Could not create IVM proxy for " + getInterfaces().get(0), iae); } }
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { ThreadContext threadContext = ThreadContext.getThreadContext(); DeploymentInfo di = threadContext.getDeploymentInfo(); if (di.getLocalInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface"); } EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>()); try { Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class}; return (EJBLocalObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getLocalInterface() + " interface", iae); } }
interfaces.add(BeanContext.Removable.class); return ProxyManager.newProxyInstance(interfaces.toArray(new Class[interfaces.size()]), handler);
interfaces.add(BeanContext.Removable.class); return ProxyManager.newProxyInstance(interfaces.toArray(new Class[interfaces.size()]), handler);
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { check(Call.getEJBLocalObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getLocalInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface"); } final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>(), di.getLocalInterface()); try { final Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class}; return (EJBLocalObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (final IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getLocalInterface() + " interface", iae); } }
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { doCheck(Call.getEJBLocalObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getLocalInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface"); } final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>(), di.getLocalInterface()); try { final Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class}; return (EJBLocalObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (final IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getLocalInterface() + " interface", iae); } }
public EJBObject getEJBObject() throws IllegalStateException { ThreadContext threadContext = ThreadContext.getThreadContext(); DeploymentInfo di = threadContext.getDeploymentInfo(); if (di.getRemoteInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface"); } EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getDeploymentInfo(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>()); try { Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class}; return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae); } }
public EJBObject getEJBObject() throws IllegalStateException { check(Call.getEJBObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getRemoteInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface"); } final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface()); try { final Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class}; return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (final IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae); } }
public Object createProxy(final Object primaryKey, final Class mainInterface) { try { final InterfaceType objectInterfaceType = this.interfaceType.getCounterpart(); final BeanType type = getBeanContext().getComponentType(); final EjbObjectProxyHandler handler = newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, getInterfaces(), mainInterface); // TODO Is it correct for ManagedBean injection via managed bean class? if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType) || getBeanContext().getComponentType().equals(BeanType.MANAGED)) && !getBeanContext().isDynamicallyImplemented()) { return LocalBeanProxyFactory.constructProxy(handler.getBeanContext().get(BeanContext.ProxyClass.class).getProxy(), handler); } else { final List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 2); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(Serializable.class); proxyInterfaces.add(IntraVmProxy.class); if (BeanType.STATEFUL.equals(type) || BeanType.MANAGED.equals(type)) { proxyInterfaces.add(BeanContext.Removable.class); } return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[proxyInterfaces.size()]), handler); } } catch (final IllegalAccessException iae) { throw new OpenEJBRuntimeException("Could not create IVM proxy for " + getInterfaces().get(0), iae); } }
public EJBObject getEJBObject() throws IllegalStateException { doCheck(Call.getEJBObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getRemoteInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface"); } final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface()); try { final Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class}; return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (final IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae); } }
public Object createProxy(final Object primaryKey, final Class mainInterface) { try { final InterfaceType objectInterfaceType = this.interfaceType.getCounterpart(); final BeanType type = getBeanContext().getComponentType(); final EjbObjectProxyHandler handler = newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, getInterfaces(), mainInterface); // TODO Is it correct for ManagedBean injection via managed bean class? if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType) || getBeanContext().getComponentType().equals(BeanType.MANAGED)) && !getBeanContext().isDynamicallyImplemented()) { return LocalBeanProxyFactory.constructProxy(handler.getBeanContext().get(BeanContext.ProxyClass.class).getProxy(), handler); } else { final List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 2); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(Serializable.class); proxyInterfaces.add(IntraVmProxy.class); if (BeanType.STATEFUL.equals(type) || BeanType.MANAGED.equals(type)) { proxyInterfaces.add(BeanContext.Removable.class); } return ProxyManager.newProxyInstance(proxyInterfaces.toArray(new Class[proxyInterfaces.size()]), handler); } } catch (final IllegalAccessException iae) { throw new OpenEJBRuntimeException("Could not create IVM proxy for " + getInterfaces().get(0), iae); } }