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

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


        if (uri != null) {
            Object moduleInfo = null;
            ExternalEarInfo extEar = null;           
            if(uri.equals("")) {
                if(moduleInfo == null) {
                    WebModuleInfo unresolved = new WebModuleInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    WebModuleInfo resolved = resolver.resolveModel(WebModuleInfo.class, unresolved);
                    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));
View Full Code Here


        }
        return createWebModuleInfo(wm);
    }

    private WebModuleInfo createWebModuleInfo(WebModule webModule) {
        WebModuleInfo wmInfo = new WebModuleInfoImpl();

        WebApp webApp = webModule.getWebApp();
        ClassLoader classLoader = webModule.getClassLoader();
        wmInfo.setmoduleClassloader(classLoader);

        // Process Remote EJB References
        for (Map.Entry<String, EjbRef> entry : webApp.getEjbRefMap().entrySet()) {
            EjbRef ejbRef = entry.getValue();
            if(ejbRef.getHome() != null) {
                // References to only EJB3 beans need to be considered.
                // Skip the current on as it is not a reference to an EJB3 bean.
                continue;
            }
            if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
                // Only Remote EJB references need to be considered.
                // Skip the current one as it is not a remote reference.
                continue;
            }
            //FIXME: ejbRef.getEjbRefType() is null sometimes.  Need a different way to figure the type.
            if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
                // Only references to Session beans need to be considered.
                // Skip the current one as it is not a Session bean.
                continue;
            }

            try {
                wmInfo.getEjbReferences().put(ejbRef.getEjbRefName(), createEjbReferenceInfo(ejbRef, classLoader));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Process env-entries to compute properties
        for (Map.Entry<String, EnvEntry> entry : webApp.getEnvEntryMap().entrySet()) {
            EnvEntry envEntry = entry.getValue();
            wmInfo.getEnvEntries().put(envEntry.getEnvEntryName(), createEnvEntryInfo(envEntry));
        }

        // Process Servlets
        for(Servlet servlet: webApp.getServlet()) {
            try {
                wmInfo.getServletClasses().add(classLoader.loadClass(servlet.getServletClass()));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Process Filters
        for(Filter filter: webApp.getFilter()) {
            try {
                wmInfo.getFilterClasses().add(classLoader.loadClass(filter.getFilterClass()));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Process Listeners
        for(Listener listener: webApp.getListener()) {
            try {
                wmInfo.getListenerClasses().add(classLoader.loadClass(listener.getListenerClass()));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
View Full Code Here

            ejbModuleInfo.setModuleName(em.getModuleId());
            appInfo.getEjbModuleInfos().put(em.getModuleId(), ejbModuleInfo);
        }

        for(WebModule wm : appModule.getWebModules()) {
            WebModuleInfo webModuleInfo = createWebModuleInfo(wm);
            webModuleInfo.setModuleName(wm.getModuleId());
            appInfo.getWebModuleInfos().put(wm.getModuleId(), webModuleInfo);
        }

        return appInfo;
    }
View Full Code Here

        if (uri != null) {
            Object moduleInfo = null;
            ExternalEarInfo extEar = null;           
            if(uri.equals("")) {
                if(moduleInfo == null) {
                    WebModuleInfo unresolved = new WebModuleInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    WebModuleInfo resolved = resolver.resolveModel(WebModuleInfo.class, unresolved);
                    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));
View Full Code Here

    public String getArtifactType() {
        return ".war";
    }

    public WebModuleInfo read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
        WebModuleInfo webModuleInfo = jeeIntrospector.introspectWebArchive(artifactURL);
        webModuleInfo.setUri(artifactURI);
        webModuleInfo.setModuleName(new File(artifactURL.getFile()).getName());
        return webModuleInfo;
    }
View Full Code Here

    public void resolve(WebImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
       
        // Resolve the component type
        String uri = implementation.getURI();
        if (uri != null) {
            WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
            webModuleInfo.setUri(URI.create(uri));
            webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
            if(jeeOptionalExtension != null) {
                ComponentType ct = jeeOptionalExtension.createImplementationWebComponentType(webModuleInfo);
                implementation.getReferences().addAll(ct.getReferences());
                implementation.getProperties().addAll(ct.getProperties());
            }
           
            // Introspection of classes
            List<Class<?>> webArtifacts = new ArrayList<Class<?>>();
            webArtifacts.addAll(webModuleInfo.getServletClasses());
            webArtifacts.addAll(webModuleInfo.getFilterClasses());
            webArtifacts.addAll(webModuleInfo.getListenerClasses());
            webArtifacts.addAll(webModuleInfo.getJSFClasses());
            JavaImplementation ji = javaImplementationFactory.createJavaImplementation();
            for(Class<?> clazz : webArtifacts) {
                try {
                    javaImplementationFactory.createJavaImplementation(ji, clazz);
                } catch (IntrospectionException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            implementation.getReferences().addAll(ji.getReferences());
            implementation.getProperties().addAll(ji.getProperties());

            // SCA References in JSP Tags
            for(JspReferenceTagInfo jspRefTag : webModuleInfo.getJspReferenceTags()) {
                ComponentReference ref = assemblyFactory.createComponentReference();
                ref.setName(jspRefTag.name);
                JavaInterfaceContract intfContract = javaInterfaceFactory.createJavaInterfaceContract();
                try {
                    intfContract.setInterface(javaInterfaceFactory.createJavaInterface(jspRefTag.type));
View Full Code Here

        }
        return createWebModuleInfo(wm);
    }

    private WebModuleInfo createWebModuleInfo(WebModule webModule) {
        WebModuleInfo wmInfo = new WebModuleInfoImpl();

        WebApp webApp = webModule.getWebApp();
        ClassLoader classLoader = webModule.getClassLoader();
        wmInfo.setmoduleClassloader(classLoader);

        // Process Remote EJB References
        for (Map.Entry<String, EjbRef> entry : webApp.getEjbRefMap().entrySet()) {
            EjbRef ejbRef = entry.getValue();
            if(ejbRef.getHome() != null) {
                // References to only EJB3 beans need to be considered.
                // Skip the current on as it is not a reference to an EJB3 bean.
                continue;
            }
            if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
                // Only Remote EJB references need to be considered.
                // Skip the current one as it is not a remote reference.
                continue;
            }
            //FIXME: ejbRef.getEjbRefType() is null sometimes.  Need a different way to figure the type.
            if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
                // Only references to Session beans need to be considered.
                // Skip the current one as it is not a Session bean.
                continue;
            }

            try {
                wmInfo.getEjbReferences().put(ejbRef.getEjbRefName(), createEjbReferenceInfo(ejbRef, classLoader));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Process env-entries to compute properties
        for (Map.Entry<String, EnvEntry> entry : webApp.getEnvEntryMap().entrySet()) {
            EnvEntry envEntry = entry.getValue();
            wmInfo.getEnvEntries().put(envEntry.getEnvEntryName(), createEnvEntryInfo(envEntry));
        }

        // Process Servlets
        for(Servlet servlet: webApp.getServlet()) {
            try {
                wmInfo.getServletClasses().add(classLoader.loadClass(servlet.getServletClass()));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Process Filters
        for(Filter filter: webApp.getFilter()) {
            try {
                wmInfo.getFilterClasses().add(classLoader.loadClass(filter.getFilterClass()));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        // Process Listeners
        for(Listener listener: webApp.getListener()) {
            try {
                wmInfo.getListenerClasses().add(classLoader.loadClass(listener.getListenerClass()));
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
View Full Code Here

            ejbModuleInfo.setModuleName(em.getModuleId());
            appInfo.getEjbModuleInfos().put(em.getModuleId(), ejbModuleInfo);
        }

        for(WebModule wm : appModule.getWebModules()) {
            WebModuleInfo webModuleInfo = createWebModuleInfo(wm);
            webModuleInfo.setModuleName(wm.getModuleId());
            appInfo.getWebModuleInfos().put(wm.getModuleId(), webModuleInfo);
        }

        return appInfo;
    }
View Full Code Here

    public void resolve(WebImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
       
        // Resolve the component type
        String uri = implementation.getURI();
        if (uri != null) {
            WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
            webModuleInfo.setUri(URI.create(uri));
            webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
            if(jeeOptionalExtension != null) {
                ComponentType ct = jeeOptionalExtension.createImplementationWebComponentType(webModuleInfo);
                implementation.getReferences().addAll(ct.getReferences());
                implementation.getProperties().addAll(ct.getProperties());
            }
           
            // Introspection of classes
            List<Class<?>> webArtifacts = new ArrayList<Class<?>>();
            webArtifacts.addAll(webModuleInfo.getServletClasses());
            webArtifacts.addAll(webModuleInfo.getFilterClasses());
            webArtifacts.addAll(webModuleInfo.getListenerClasses());
            webArtifacts.addAll(webModuleInfo.getJSFClasses());
            JavaImplementation ji = javaImplementationFactory.createJavaImplementation();
            for(Class<?> clazz : webArtifacts) {
                try {
                    javaImplementationFactory.createJavaImplementation(ji, clazz);
                } catch (IntrospectionException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            implementation.getReferences().addAll(ji.getReferences());
            implementation.getProperties().addAll(ji.getProperties());

            // SCA References in JSP Tags
            for(JspReferenceTagInfo jspRefTag : webModuleInfo.getJspReferenceTags()) {
                ComponentReference ref = assemblyFactory.createComponentReference();
                ref.setName(jspRefTag.name);
                JavaInterfaceContract intfContract = javaInterfaceFactory.createJavaInterfaceContract();
                try {
                    intfContract.setInterface(javaInterfaceFactory.createJavaInterface(jspRefTag.type));
View Full Code Here

        if (uri != null) {
            Object moduleInfo = null;
            ExternalEarInfo extEar = null;           
            if(uri.equals("")) {
                if(moduleInfo == null) {
                    WebModuleInfo unresolved = new WebModuleInfoImpl();
                    unresolved.setUri(URI.create(archive));
                    WebModuleInfo resolved = resolver.resolveModel(WebModuleInfo.class, unresolved);
                    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));
View Full Code Here

TOP

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

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.