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

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


    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());
                List<String> propertyNames = new ArrayList<String>();
                for(Property prop : ct.getProperties()) {
                    propertyNames.add(prop.getName());
                }
                // Injection points from optional extension
                for(Map.Entry<String, EjbReferenceInfo> entry : webModuleInfo.getEjbReferences().entrySet()) {
                    EjbReferenceInfo ejbRef = entry.getValue();
                    implementation.getOptExtensionReferenceInjectionPoints().put(ejbRef.injectionTarget, ejbRef.businessInterface);
                }
                for(Map.Entry<String, EnvEntryInfo> entry : webModuleInfo.getEnvEntries().entrySet()) {
                    EnvEntryInfo envEntry = entry.getValue();
                    if(propertyNames.contains(envEntry.name.replace("/", "_"))) {
                        implementation.getOptExtensionPropertyInjectionPoints().put(envEntry.name, envEntry.type);
                    }
                }
            }
           
            // 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());
            for(Map.Entry<String, JavaElementImpl> entry : ji.getReferenceMembers().entrySet()) {
                implementation.getReferenceInjectionPoints().put(entry.getKey(), entry.getValue());
            }
            for(Map.Entry<String, JavaElementImpl> entry : ji.getPropertyMembers().entrySet()) {
                implementation.getPropertyInjectionPoints().put(entry.getKey(), entry.getValue());
            }
            for(Map.Entry<String, JavaResourceImpl> entry : ji.getResources().entrySet()) {
                implementation.getResourceInjectionPoints().put(entry.getKey(), entry.getValue());
            }

            // 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.