Package org.apache.openejb

Examples of org.apache.openejb.ProxyInfo


            handleException(txPolicy, e, callContext, bean);
        } finally {
            afterInvoke(txPolicy, callContext);
        }

        return new ProxyInfo(deploymentInfo, primaryKey);

    }
View Full Code Here


        if (returnValue instanceof java.util.Collection) {
            Iterator keys = ((Collection) returnValue).iterator();
            Vector<ProxyInfo> proxies = new Vector<ProxyInfo>();
            while (keys.hasNext()) {
                Object primaryKey = keys.next();
                proxies.addElement(new ProxyInfo(deploymentInfo, primaryKey));
            }
            returnValue = proxies;
        } else if (returnValue instanceof java.util.Enumeration) {
            Enumeration keys = (Enumeration) returnValue;
            Vector<ProxyInfo> proxies = new Vector<ProxyInfo>();
            while (keys.hasMoreElements()) {
                Object primaryKey = keys.nextElement();
                proxies.addElement(new ProxyInfo(deploymentInfo, primaryKey));
            }
            returnValue = new org.apache.openejb.util.ArrayEnumeration(proxies);
        } else
            returnValue = new ProxyInfo(deploymentInfo, returnValue);

        return returnValue;
    }
View Full Code Here

            }
        } finally {
            afterInvoke(txPolicy, callContext);
        }

        return new ProxyInfo(deploymentInfo, primaryKey);
    }
View Full Code Here

            // rebuild the primary key
            KeyGenerator kg = deploymentInfo.getKeyGenerator();
            Object primaryKey = kg.getPrimaryKey(bean);

            // create a new ProxyInfo based on the deployment info and primary key
            return new ProxyInfo(deploymentInfo, primaryKey);
        } catch (javax.ejb.FinderException fe) {
            handleApplicationException(txPolicy, fe, false);
        } catch (Throwable e) {// handle reflection exception
            handleSystemException(txPolicy, e, callContext);
        } finally {
View Full Code Here

                    } else {
                        // get the primary key
                        Object primaryKey = kg.getPrimaryKey(bean);

                        // create a new ProxyInfo based on the deployment info and primary key and add it to the vector
                        proxies.add(new ProxyInfo(deploymentInfo, primaryKey));
                    }
                }
                if (callMethod.getReturnType() == Enumeration.class) {
                    return new Enumerator(proxies);
                } else {
                    return proxies;
                }
            } else {
                if (results.size() != 1) {
                    throw new ObjectNotFoundException("A Enteprise bean with deployment_id = " + deploymentInfo.getDeploymentID() + " and primarykey = " + args[0] + " Does not exist");
                }

                // create a new ProxyInfo based on the deployment info and primary key
                EntityBean bean = (EntityBean) results.get(0);
                if (bean == null) {
                    return null;
                } else {
                    Object primaryKey = kg.getPrimaryKey(bean);
                    return new ProxyInfo(deploymentInfo, primaryKey);
                }
            }
        } catch (javax.ejb.FinderException fe) {
            handleApplicationException(txPolicy, fe, false);
        } catch (Throwable e) {// handle reflection exception
View Full Code Here

        if (retValue instanceof java.util.Collection) {
            Object [] proxyInfos = ((java.util.Collection) retValue).toArray();
            Vector proxies = new Vector();
            for (int i = 0; i < proxyInfos.length; i++) {
                ProxyInfo proxyInfo = (ProxyInfo) proxyInfos[i];
                proxies.addElement(createProxy(proxyInfo.getPrimaryKey()));
            }
            return proxies;
        } else if (retValue instanceof org.apache.openejb.util.ArrayEnumeration) {
            org.apache.openejb.util.ArrayEnumeration enumeration = (org.apache.openejb.util.ArrayEnumeration) retValue;
            for (int i = enumeration.size() - 1; i >= 0; --i) {
                ProxyInfo proxyInfo = ((ProxyInfo) enumeration.get(i));
                enumeration.set(i, createProxy(proxyInfo.getPrimaryKey()));
            }
            return enumeration;
        } else if (retValue instanceof java.util.Enumeration) {
            java.util.Enumeration enumeration = (java.util.Enumeration) retValue;

            java.util.List proxies = new java.util.ArrayList();
            while (enumeration.hasMoreElements()) {
                ProxyInfo proxyInfo = ((ProxyInfo) enumeration.nextElement());
                proxies.add(createProxy(proxyInfo.getPrimaryKey()));
            }
            return new org.apache.openejb.util.ArrayEnumeration(proxies);
        } else {
            org.apache.openejb.ProxyInfo proxyInfo = (org.apache.openejb.ProxyInfo) retValue;


            return createProxy(proxyInfo.getPrimaryKey());
        }

    }
View Full Code Here

        }
        throw new IllegalArgumentException("Uknown MessageContext type: " + messageContext.getClass().getName());
    }

    protected ProxyInfo createEJBObject(org.apache.openejb.core.CoreDeploymentInfo deploymentInfo, Method callMethod) {
        return new ProxyInfo(deploymentInfo, null);
    }
View Full Code Here

                res.setResult(new ThrowableArtifact(namingException));
                return;
            }
        }

        ProxyInfo proxyInfo = handler.getProxyInfo();
        DeploymentInfo deployment = proxyInfo.getDeploymentInfo();
        String deploymentID = deployment.getDeploymentID().toString();

        updateServer(req, res, proxyInfo);

        switch(proxyInfo.getInterfaceType()){
            case EJB_HOME: {
                res.setResponseCode(ResponseCodes.JNDI_EJBHOME);
                EJBMetaDataImpl metaData = new EJBMetaDataImpl(deployment.getHomeInterface(),
                        deployment.getRemoteInterface(),
                        deployment.getPrimaryKeyClass(),
                        deployment.getComponentType().toString(),
                        deploymentID,
                        -1, null);
                res.setResult(metaData);
                break;
            }
            case EJB_LOCAL_HOME: {
                res.setResponseCode(ResponseCodes.JNDI_NAMING_EXCEPTION);
                NamingException namingException = new NamingException("Not remotable: '" + name + "'. EJBLocalHome interfaces are not remotable as per the EJB specification.");
                res.setResult(new ThrowableArtifact(namingException));
                break;
            }
            case BUSINESS_REMOTE: {
                res.setResponseCode(ResponseCodes.JNDI_BUSINESS_OBJECT);
                EJBMetaDataImpl metaData = new EJBMetaDataImpl(null,
                        null,
                        deployment.getPrimaryKeyClass(),
                        deployment.getComponentType().toString(),
                        deploymentID,
                        -1, proxyInfo.getInterfaces());
                metaData.setPrimaryKey(proxyInfo.getPrimaryKey());
                res.setResult(metaData);
                break;
            }
            case BUSINESS_LOCAL: {
                String property = SystemInstance.get().getProperty("openejb.remotable.businessLocals", "false");
                if (property.equalsIgnoreCase("true")) {
                    res.setResponseCode(ResponseCodes.JNDI_BUSINESS_OBJECT);
                    EJBMetaDataImpl metaData = new EJBMetaDataImpl(null,
                            null,
                            deployment.getPrimaryKeyClass(),
                            deployment.getComponentType().toString(),
                            deploymentID,
                            -1, proxyInfo.getInterfaces());
                    metaData.setPrimaryKey(proxyInfo.getPrimaryKey());
                    res.setResult(metaData);
                } else {
                    res.setResponseCode(ResponseCodes.JNDI_NAMING_EXCEPTION);
                    NamingException namingException = new NamingException("Not remotable: '" + name + "'. Business Local interfaces are not remotable as per the EJB specification.  To disable this restriction, set the system property 'openejb.remotable.businessLocals=true' in the server.");
                    res.setResult(new ThrowableArtifact(namingException));
View Full Code Here

    protected Object createProxy(Object retValue) throws Throwable {
        if (retValue instanceof java.util.Collection) {
            Object [] proxyInfos = ((java.util.Collection) retValue).toArray();
            Vector proxies = new Vector();
            for (int i = 0; i < proxyInfos.length; i++) {
                ProxyInfo proxyInfo = (ProxyInfo) proxyInfos[i];
                proxies.addElement(Util.getEJBProxy(proxyInfo));
            }
            return proxies;
        } else if (retValue instanceof org.apache.openejb.util.ArrayEnumeration) {
            org.apache.openejb.util.ArrayEnumeration enumeration = (org.apache.openejb.util.ArrayEnumeration) retValue;
            for (int i = enumeration.size() - 1; i >= 0; --i) {
                ProxyInfo proxyInfo = ((ProxyInfo) enumeration.get(i));
                enumeration.set(i, Util.getEJBProxy(proxyInfo));
            }
            return enumeration;
        } else if (retValue instanceof java.util.Enumeration) {
            java.util.Enumeration enumeration = (java.util.Enumeration) retValue;

            java.util.List proxies = new java.util.ArrayList();
            while (enumeration.hasMoreElements()) {
                ProxyInfo proxyInfo = ((ProxyInfo) enumeration.nextElement());
                proxies.add(Util.getEJBProxy(proxyInfo));
            }
            return new org.apache.openejb.util.ArrayEnumeration(proxies);
        } else {
            org.apache.openejb.ProxyInfo proxyInfo = (org.apache.openejb.ProxyInfo) retValue;
View Full Code Here

    protected Object createProxy(Object retValue) throws Throwable {
        if (retValue instanceof java.util.Collection) {
            Object [] proxyInfos = ((java.util.Collection) retValue).toArray();
            Vector proxies = new Vector();
            for (int i = 0; i < proxyInfos.length; i++) {
                ProxyInfo proxyInfo = (ProxyInfo) proxyInfos[i];
                proxies.addElement(Util.getEJBProxy(proxyInfo));
            }
            return proxies;
        } else if (retValue instanceof org.apache.openejb.util.ArrayEnumeration) {
            org.apache.openejb.util.ArrayEnumeration enumeration = (org.apache.openejb.util.ArrayEnumeration) retValue;
            for (int i = enumeration.size() - 1; i >= 0; --i) {
                ProxyInfo proxyInfo = ((ProxyInfo) enumeration.get(i));
                enumeration.set(i, Util.getEJBProxy(proxyInfo));
            }
            return enumeration;
        } else if (retValue instanceof java.util.Enumeration) {
            java.util.Enumeration enumeration = (java.util.Enumeration) retValue;

            java.util.List proxies = new java.util.ArrayList();
            while (enumeration.hasMoreElements()) {
                ProxyInfo proxyInfo = ((ProxyInfo) enumeration.nextElement());
                proxies.add(Util.getEJBProxy(proxyInfo));
            }
            return new org.apache.openejb.util.ArrayEnumeration(proxies);
        } else {
            org.apache.openejb.ProxyInfo proxyInfo = (org.apache.openejb.ProxyInfo) retValue;
View Full Code Here

TOP

Related Classes of org.apache.openejb.ProxyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.