public static Object createProxy(final BeanContext beanContext, final Object primaryKey, final InterfaceType interfaceType, final Class mainInterface) { return createProxy(beanContext, primaryKey, interfaceType, null, mainInterface); }
protected Object getEJBHome(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return getBeanContext().getEJBHome(); }
@Override public ProxyInfo getProxyInfo() { return new ProxyInfo(getBeanContext(), primaryKey, getInterfaces(), interfaceType, getMainInterface()); }
public org.apache.openejb.ProxyInfo getProxyInfo() { return new org.apache.openejb.ProxyInfo(getDeploymentInfo(), primaryKey, getInterfaces(), interfaceType); }
retValue = businessMethod(interfce, m, a, p); } else { switch (operation.intValue()) { case 1: retValue = getHandle(m, a, p); break; case 2: retValue = getPrimaryKey(m, a, p); break; case 3: retValue = isIdentical(m, a, p); break; case 4: retValue = remove(interfce, m, a, p); break; case 5: retValue = getEJBHome(m, a, p); break; case 6: retValue = getEJBLocalHome(m, a, p); break; default: invalidateAllHandlers(getRegistryId()); exc = (ire.getRootCause() != null) ? ire.getRootCause() : ire; throw exc; invalidateReference(); exc = (se.getRootCause() != null) ? se.getRootCause() : se;
public Object createProxy(final Object primaryKey, final Class mainInterface) { final Object proxy = super.createProxy(primaryKey, mainInterface); EjbObjectProxyHandler handler = null; try { handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); } catch (final Exception e) { // try getting the invocation handler from the localbean try { final Field field = proxy.getClass().getDeclaredField("invocationHandler"); field.setAccessible(true); handler = (EjbObjectProxyHandler) field.get(proxy); } catch (final Exception e1) { // no-op } } registerHandler(handler.getRegistryId(), handler); return proxy; }
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); } }
protected Object getEJBHome(Method method, Object[] args, Object proxy) throws Throwable { checkAuthorization(method); return getDeploymentInfo().getEJBHome(); }
protected Object getHandle(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return new IntraVmHandle(proxy); }
ApplicationServer applicationServer = ServerFederation.getApplicationServer(); if (interfaceType.isBusiness()){ return applicationServer.getBusinessObject(this.getProxyInfo()); } else { return applicationServer.getEJBObject(this.getProxyInfo());
retValue = businessMethod(interfce, m, a, p); } else { switch (operation) { case 1: retValue = getHandle(m, a, p); break; case 2: retValue = getPrimaryKey(m, a, p); break; case 3: retValue = isIdentical(m, a, p); break; case 4: retValue = remove(interfce, m, a, p); break; case 5: retValue = getEJBHome(m, a, p); break; case 6: retValue = getEJBLocalHome(m, a, p); break; default: invalidateAllHandlers(getRegistryId()); exc = ire.getRootCause() != null ? ire.getRootCause() : new RemoteException("InvalidateReferenceException: " + ire); throw exc; invalidateReference(); exc = se.getRootCause() != null ? se.getRootCause() : se;
public Object createProxy(Object primaryKey) { Object proxy = super.createProxy(primaryKey); EjbObjectProxyHandler handler = null; try { handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); } catch (Exception e) { // try getting the invocation handler from the localbean try { Field field = proxy.getClass().getDeclaredField("invocationHandler"); field.setAccessible(true); handler = (EjbObjectProxyHandler) field.get(proxy); } catch (Exception e1) { } } registerHandler(handler.getRegistryId(), handler); return proxy; }
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 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); } }
protected Object getEJBLocalHome(Method method, Object[] args, Object proxy) throws Throwable { checkAuthorization(method); return getDeploymentInfo().getEJBLocalHome(); }
protected Object getHandle(final Method method, final Object[] args, final Object proxy) throws Throwable { checkAuthorization(method); return new IntraVmHandle(proxy); }
final ApplicationServer applicationServer = ServerFederation.getApplicationServer(); if (interfaceType.isBusiness()) { return applicationServer.getBusinessObject(this.getProxyInfo()); } else { return applicationServer.getEJBObject(this.getProxyInfo());
retValue = businessMethod(interfce, m, a, p); } else { switch (operation) { case 1: retValue = getHandle(m, a, p); break; case 2: retValue = getPrimaryKey(m, a, p); break; case 3: retValue = isIdentical(m, a, p); break; case 4: retValue = remove(interfce, m, a, p); break; case 5: retValue = getEJBHome(m, a, p); break; case 6: retValue = getEJBLocalHome(m, a, p); break; default: invalidateAllHandlers(getRegistryId()); exc = ire.getRootCause() != null ? ire.getRootCause() : new RemoteException("InvalidateReferenceException: " + ire); throw exc; invalidateReference(); } catch (final IllegalStateException ignore) {
public static Object createProxy(final BeanContext beanContext, final Object primaryKey, final InterfaceType interfaceType, final Class mainInterface) { return createProxy(beanContext, primaryKey, interfaceType, null, mainInterface); }
public Object createProxy(final Object primaryKey, final Class mainInterface) { final Object proxy = super.createProxy(primaryKey, mainInterface); EjbObjectProxyHandler handler = null; try { handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy); } catch (final Exception e) { // try getting the invocation handler from the localbean try { final Field field = proxy.getClass().getDeclaredField("invocationHandler"); field.setAccessible(true); handler = (EjbObjectProxyHandler) field.get(proxy); } catch (final Exception e1) { // no-op } } registerHandler(handler.getRegistryId(), handler); return proxy; }