Package org.apache.openejb

Examples of org.apache.openejb.DeploymentInfo$BusinessLocalBeanHome


            initHandlers();
        } catch (Exception e) {
            throw new WebServiceException("Error configuring handlers", e);
        }
               
        DeploymentInfo deploymentInfo =
            (DeploymentInfo)bus.getExtension(DeploymentInfo.class);
       
        service.setInvoker(new EJBMethodInvoker(this, this.bus, deploymentInfo))
       
        Endpoint endpoint = getEndpoint();
View Full Code Here


        if(!isSessionBean(clazz))
        {
            throw new IllegalArgumentException("Given class is not an session bean class");
        }
       
        DeploymentInfo info = null;
        SessionBeanType type = SessionBeanType.STATELESS;
       
        if(isStatelessBean(clazz))
        {
            info = this.statelessBeans.get(clazz);
View Full Code Here

    {
        if(this.instance == null)
        {
            ContainerSystem containerSystem =  SystemInstance.get().getComponent(ContainerSystem.class);
            Context jndiContext = containerSystem.getJNDIContext();
            DeploymentInfo deploymentInfo = this.getDeploymentInfo();
            try
            {
                if(iface != null)
                {
                    InterfaceType type = deploymentInfo.getInterfaceType(iface);
                    if(!type.equals(InterfaceType.BUSINESS_LOCAL))
                    {
                        throw new IllegalArgumentException("Interface type is not legal business local interface for session bean class : " + getReturnType().getName());
                    }  
                }   
                else
                {
                    iface = this.deploymentInfo.getBusinessLocalInterface();
                }
               
                String jndiName = "java:openejb/Deployment/" + JndiBuilder.format(deploymentInfo.getDeploymentID(), this.iface.getName());
                this.instance = (T)this.iface.cast(jndiContext.lookup(jndiName));                            
               
            }catch(NamingException e)
            {
                throw new RuntimeException(e);
View Full Code Here

    @SuppressWarnings("unchecked")
    public void defineApiType()
    {
        if(isDefaultMetaDataProvider())
        {
            DeploymentInfo info = getBean().getDeploymentInfo();
            List<Class> businessLocals = info.getBusinessLocalInterfaces();
            for(Class clazz : businessLocals)
            {
                getBean().addApiType(clazz);
            }
           
View Full Code Here

        }       
    }
   
    public static boolean isBusinessMethod(Method method, EjbBean<?> bean)
    {
        DeploymentInfo info = bean.getDeploymentInfo();
        List<Class> businessLocals = info.getBusinessLocalInterfaces();
        for(Class clz : businessLocals)
        {
            try
            {
                clz.getMethod(method.getName(), method.getParameterTypes());
View Full Code Here

                for (EnterpriseBeanInfo bean : ejbJar.enterpriseBeans) {
                    if (bean instanceof StatelessBeanInfo) {
                        StatelessBeanInfo statelessBeanInfo = (StatelessBeanInfo) bean;

                        DeploymentInfo deploymentInfo = containerSystem.getDeploymentInfo(statelessBeanInfo.ejbDeploymentId);
                        if (deploymentInfo == null) continue;

                        PortInfo portInfo = ports.get(statelessBeanInfo.ejbName);
                        if (portInfo == null) continue;

                        try {
                            PortData port = WsBuilder.toPortData(portInfo, deploymentInfo.getInjections(), moduleBaseUrl, deploymentInfo.getClassLoader());

                            HttpListener container = createEjbWsContainer(moduleBaseUrl, port, deploymentInfo);

                            // generate a location if one was not assigned
                            String location = port.getLocation();
                            if (location == null) {
                                location = autoAssignWsLocation(bean, port, contextData, deploymentIdTemplate);
                            }
                            if (!location.startsWith("/")) location = "/" + location;
                            ejbLocations.put(statelessBeanInfo.ejbDeploymentId, location);

                            ClassLoader classLoader = deploymentInfo.getClassLoader();
                            if (wsRegistry != null) {
                                // add servlet to web container
                                List<String> addresses = wsRegistry.addWsContainer(location, container, virtualHost, realmName, transportGuarantee, authMethod, classLoader);

                                // one of the registered addresses to be the connonical address
                                String address = selectSingleAddress(addresses);

                                // register wsdl location
                                portAddressRegistry.addPort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId, portInfo.wsdlPort, portInfo.seiInterfaceName, address);
                                logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Ejb(id=" + portInfo.portId + ")");
                                ejbAddresses.put(bean.ejbDeploymentId, address);
                            }
                        } catch (Throwable e) {
                            logger.error("Error deploying CXF webservice for ejb " + deploymentInfo.getDeploymentID(), e);
                        }
                    }
                }
            }
            for (WebAppInfo webApp : appInfo.webApps) {
                WebDeploymentInfo deploymentInfo = containerSystem.getWebDeploymentInfo(webApp.moduleId);
                if (deploymentInfo == null) continue;

                Map<String,PortInfo> ports = new TreeMap<String,PortInfo>();
                for (PortInfo port : webApp.portInfos) {
                    ports.put(port.serviceLink, port);
                }

                URL moduleBaseUrl = null;
                try {
                    moduleBaseUrl = new File(webApp.codebase).toURL();
                } catch (MalformedURLException e) {
                    logger.error("Invalid ejb jar location " + webApp.codebase, e);
                }

                for (ServletInfo servlet : webApp.servlets) {
                    PortInfo portInfo = ports.get(servlet.servletName);
                    if (portInfo == null) continue;

                    try {
                        ClassLoader classLoader = deploymentInfo.getClassLoader();
                        Collection<Injection> injections = deploymentInfo.getInjections();
                        Context context = deploymentInfo.getJndiEnc();
                        Class target = classLoader.loadClass(servlet.servletClass);

                        PortData port = WsBuilder.toPortData(portInfo, injections, moduleBaseUrl, classLoader);

                        HttpListener container = createPojoWsContainer(moduleBaseUrl, port, portInfo.serviceLink, target, context, webApp.contextRoot);
View Full Code Here

        }
    }

    public DeploymentInfo getDeployment(EJBRequest req) throws RemoteException {

        DeploymentInfo info = null;

        if (req.getDeploymentCode() > 0 && req.getDeploymentCode() < deployments.length) {
            info = deployments[req.getDeploymentCode()];
            if (info == null) {
                throw new RemoteException("The deployement with this ID is null");
            }
            req.setDeploymentId((String) info.getDeploymentID());
            return info;
        }

        if (req.getDeploymentId() == null) {
            throw new RemoteException("Invalid deployment id and code: id=" + req.getDeploymentId() + ": code=" + req.getDeploymentCode());
View Full Code Here

    public synchronized DeploymentInfo getDeploymentInfo(Object deploymentID) {
        return deploymentsById.get(deploymentID);
    }

    private DeploymentInfo getDeploymentInfoByClass(Class type) {
        DeploymentInfo deploymentInfo = null;
        while (type != null && deploymentInfo == null) {
            deploymentInfo = deploymentsByClass.get(type);
            type = type.getSuperclass();
        }
View Full Code Here

        }
    }

    protected DeploymentInfo getDeployment(EJBRequest req) throws RemoteException {
        String deploymentId = req.getDeploymentId();
        DeploymentInfo deploymentInfo = containerSystem.getDeploymentInfo(deploymentId);
        if (deploymentInfo == null) throw new RemoteException("No deployment: "+deploymentId);
        return deploymentInfo;
    }
View Full Code Here

        return (EJBLocalObject) newProxy;
    }

    public Object getBusinessObject(Class interfce) {
        ThreadContext threadContext = ThreadContext.getThreadContext();
        DeploymentInfo di = threadContext.getDeploymentInfo();

        InterfaceType interfaceType;
        if (di.getBusinessLocalInterface() != null && di.getBusinessLocalInterface().getName().equals(interfce.getName())) {
            interfaceType = InterfaceType.BUSINESS_LOCAL;
        } else if (di.getBusinessRemoteInterface() != null && di.getBusinessRemoteInterface().getName().equals(interfce.getName())) {
            interfaceType = InterfaceType.BUSINESS_REMOTE;
        } else {
            throw new IllegalArgumentException("Component has no such interface " + interfce.getName());
        }

        Object newProxy;
        try {
            EjbObjectProxyHandler handler = newEjbObjectHandler((RpcContainer) di.getContainer(), threadContext.getPrimaryKey(), di.getDeploymentID(), interfaceType);
            Class[] interfaces = new Class[]{interfce, IntraVmProxy.class};
            newProxy = ProxyManager.newProxyInstance(interfaces, handler);
        } catch (IllegalAccessException iae) {
            throw new InternalErrorException("Could not create IVM proxy for " + interfce.getName() + " interface", iae);
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.DeploymentInfo$BusinessLocalBeanHome

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.