Package org.apache.tuscany.sca.contribution.jee

Examples of org.apache.tuscany.sca.contribution.jee.EjbModuleInfo


        String uri = implementation.getURI();
        String ejbLink = implementation.getEJBLink();
        if (ejbLink != null) {
            String module = ejbLink.indexOf('#') != -1 ? ejbLink.substring(0, ejbLink.indexOf('#')) : "";
            String beanName =  ejbLink.indexOf('#') != -1 ? ejbLink.substring(ejbLink.indexOf('#')+1) : ejbLink;
            EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();
            ejbModuleInfo.setUri(URI.create(module));
            ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo);

            if(jeeExtension != null) {
                ComponentType ct = jeeExtension.createImplementationEjbComponentType(ejbModuleInfo, beanName);
                // TODO - SL - TUSCANY-2944 - these new JEE processors are causing problems with existing contributions
                //        ct is null if there is no EJBInfo
                if (ct != null){
                    implementation.getServices().addAll(ct.getServices());
                }
            }

            if(jeeOptionalExtension != null) {
                ComponentType ct = jeeOptionalExtension.createImplementationEjbComponentType(ejbModuleInfo, beanName);
                // TODO - SL - TUSCANY-2944 - these new JEE processors are causing problems with existing contributions
                //              ct is null if there is no EJBInfo
                if (ct != null){
                    implementation.getReferences().addAll(ct.getReferences());
                    implementation.getProperties().addAll(ct.getProperties());
                   
                    // Injection points
                    List<String> propertyNames = new ArrayList<String>();
                    for(Property prop : ct.getProperties()) {
                        propertyNames.add(prop.getName());
                    }
                    EjbInfo ejbInfo = ejbModuleInfo.getEjbInfo(uri);
                    for(Map.Entry<String, EjbReferenceInfo> entry : ejbInfo.ejbReferences.entrySet()) {
                        EjbReferenceInfo ejbRef = entry.getValue();
                        implementation.getOptExtensionReferenceInjectionPoints().put(ejbRef.injectionTarget, ejbRef.businessInterface);
                    }
                    for(Map.Entry<String, EnvEntryInfo> entry : ejbInfo.envEntries.entrySet()) {
                        EnvEntryInfo envEntry = entry.getValue();
                        if(propertyNames.contains(envEntry.name.replace("/", "_"))) {
                            implementation.getOptExtensionPropertyInjectionPoints().put(envEntry.name, envEntry.type);
                        }
                    }
                }
            }

            EjbInfo ejbInfo = ejbModuleInfo.getEjbInfo(uri);
            if (ejbInfo == null) {
                // FIXME:
                logger.severe("EJB " + uri + " is not found in the module");
                // throw new ContributionResolveException("EJB " + uri + " is not found in the module");
            } else {
View Full Code Here


                    if(unresolved != resolved) {
                        moduleInfo = resolved;
                    }
                }
                if(moduleInfo == null) {
                    EjbModuleInfo unresolved = new EjbModuleInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    EjbModuleInfo resolved = resolver.resolveModel(EjbModuleInfo.class, unresolved);
                    if(unresolved != resolved) {
                        moduleInfo = resolved;
                    }
                }
                if(moduleInfo == null) {
                    JavaEEApplicationInfo unresolved = new JavaEEApplicationInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    JavaEEApplicationInfo resolved = resolver.resolveModel(JavaEEApplicationInfo.class, unresolved);
                    if(unresolved != resolved) {
                        moduleInfo = resolved;
                    }
                }
            } else if(uri.endsWith(".war")) {
                WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
                webModuleInfo.setUri(URI.create(archive));
                webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
                moduleInfo = webModuleInfo;
            } else if(uri.endsWith(".jar")) {
                EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();
                ejbModuleInfo.setUri(URI.create(archive));
                ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo);
                moduleInfo = ejbModuleInfo;
            } else if(uri.endsWith(".ear")) {
                final JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl();
                appInfo.setUri(URI.create(archive));
View Full Code Here

        }
        return createEjbModuleInfo(em);
    }

    private EjbModuleInfo createEjbModuleInfo(EjbModule ejbModule) {
        EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();

        EjbJar ejbJar = ejbModule.getEjbJar();
        if (!ejbJar.getVersion().startsWith("3")) {
            // Not an EJB3 module
            // TODO: should throw an exception
            return null;
        }

        ClassLoader classLoader = ejbModule.getClassLoader();
        ejbModuleInfo.setmoduleClassloader(classLoader);
        Map<String, EnterpriseBean> beansMap = ejbJar.getEnterpriseBeansByEjbName();
        for (Map.Entry<String, EnterpriseBean> entry : beansMap.entrySet()) {
            EnterpriseBean bean = entry.getValue();
            EjbInfo ejbInfo = null;
            if (bean instanceof SessionBean) {
                SessionBean sbean = (SessionBean)bean;
                ejbInfo = createEjbInfo(sbean, classLoader);
            } else if (bean instanceof MessageDrivenBean) {
                MessageDrivenBean mdbean = (MessageDrivenBean)bean;
                ejbInfo = createEjbInfo(mdbean, classLoader);
            } else {
                continue;
            }
            if (ejbInfo != null) {
                // Bean is an EJB3 bean
                ejbModuleInfo.getEjbInfos().put(bean.getEjbName(), ejbInfo);
            }
        }

        return ejbModuleInfo;
    }
View Full Code Here

    }

    private org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo createJavaEEApplicationInfo(AppModule appModule) {
        JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl();
        for(EjbModule em : appModule.getEjbModules()){
            EjbModuleInfo ejbModuleInfo = createEjbModuleInfo(em);
            ejbModuleInfo.setModuleName(em.getModuleId());
            appInfo.getEjbModuleInfos().put(em.getModuleId(), ejbModuleInfo);
        }

        for(WebModule wm : appModule.getWebModules()) {
            WebModuleInfo webModuleInfo = createWebModuleInfo(wm);
View Full Code Here

        return ".jar";
    }

    public EjbModuleInfo read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
        if (jeeIntrospector != null) {
            EjbModuleInfo ejbModuleInfo = jeeIntrospector.introspectEjbArchive(artifactURL);
            if(ejbModuleInfo != null) {
                ejbModuleInfo.setUri(artifactURI);
                ejbModuleInfo.setModuleName(new File(artifactURL.getFile()).getName());
            }
            return ejbModuleInfo;
        }
        return null;
    }
View Full Code Here

    public ComponentType createImplementationJeeComponentType(JavaEEApplicationInfo appInfo) {
        ComponentType componentType = assemblyFactory.createComponentType();
       
        for(Map.Entry<String, EjbModuleInfo> entry0 : appInfo.getEjbModuleInfos().entrySet()) {
            EjbModuleInfo ejbModule = entry0.getValue();
           
            for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
                EjbInfo ejbInfo = entry.getValue();
                if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
                    for(Class<?> intf : ejbInfo.businessRemote) {
                        Service service = assemblyFactory.createComponentService();
                        String intfName = intf.getName();
View Full Code Here

                    if(unresolved != resolved) {
                        moduleInfo = resolved;
                    }
                }
                if(moduleInfo == null) {
                    EjbModuleInfo unresolved = new EjbModuleInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    EjbModuleInfo resolved = resolver.resolveModel(EjbModuleInfo.class, unresolved);
                    if(unresolved != resolved) {
                        moduleInfo = resolved;
                    }
                }
                if(moduleInfo == null) {
                    JavaEEApplicationInfo unresolved = new JavaEEApplicationInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    JavaEEApplicationInfo resolved = resolver.resolveModel(JavaEEApplicationInfo.class, unresolved);
                    if(unresolved != resolved) {
                        moduleInfo = resolved;
                    }
                }
            } else if(uri.endsWith(".war")) {
                WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
                webModuleInfo.setUri(URI.create(archive));
                webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
                moduleInfo = webModuleInfo;
            } else if(uri.endsWith(".jar")) {
                EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();
                ejbModuleInfo.setUri(URI.create(archive));
                ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo);
                moduleInfo = ejbModuleInfo;
            } else if(uri.endsWith(".ear")) {
                final JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl();
                appInfo.setUri(URI.create(archive));
View Full Code Here

    public ComponentType createImplementationJeeComponentType(JavaEEApplicationInfo appInfo) {
        ComponentType componentType = assemblyFactory.createComponentType();
       
        for(Map.Entry<String, EjbModuleInfo> entry0 : appInfo.getEjbModuleInfos().entrySet()) {
            EjbModuleInfo ejbModule = entry0.getValue();
           
            for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
                EjbInfo ejbInfo = entry.getValue();
                // Process Remote EJB References
                for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
                    EjbReferenceInfo ejbRef = entry1.getValue();
                    String referenceName = ejbRef.referenceName;
View Full Code Here

        return ".jar";
    }

    public EjbModuleInfo read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
        if (jeeIntrospector != null) {
            EjbModuleInfo ejbModuleInfo = jeeIntrospector.introspectEjbArchive(artifactURL);
            if(ejbModuleInfo != null) {
                ejbModuleInfo.setUri(artifactURI);
                ejbModuleInfo.setModuleName(new File(artifactURL.getFile()).getName());
            }
            return ejbModuleInfo;
        }
        return null;
    }
View Full Code Here

        }
        return createEjbModuleInfo(em);
    }

    private EjbModuleInfo createEjbModuleInfo(EjbModule ejbModule) {
        EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();

        EjbJar ejbJar = ejbModule.getEjbJar();
        if (!ejbJar.getVersion().startsWith("3")) {
            // Not an EJB3 module
            // TODO: should throw an exception
            return null;
        }

        ClassLoader classLoader = ejbModule.getClassLoader();
        ejbModuleInfo.setmoduleClassloader(classLoader);
        Map<String, EnterpriseBean> beansMap = ejbJar.getEnterpriseBeansByEjbName();
        for (Map.Entry<String, EnterpriseBean> entry : beansMap.entrySet()) {
            EnterpriseBean bean = entry.getValue();
            EjbInfo ejbInfo = null;
            if (bean instanceof SessionBean) {
                SessionBean sbean = (SessionBean)bean;
                ejbInfo = createEjbInfo(sbean, classLoader);
            } else if (bean instanceof MessageDrivenBean) {
                MessageDrivenBean mdbean = (MessageDrivenBean)bean;
                ejbInfo = createEjbInfo(mdbean, classLoader);
            } else {
                continue;
            }
            if (ejbInfo != null) {
                // Bean is an EJB3 bean
                ejbModuleInfo.getEjbInfos().put(bean.getEjbName(), ejbInfo);
            }
        }

        return ejbModuleInfo;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.jee.EjbModuleInfo

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.