Package org.apache.tuscany.sca.contribution.service

Examples of org.apache.tuscany.sca.contribution.service.ContributionResolveException


                WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
                WSDLInterface wsdlInterface;
                try {
                    wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver);
                } catch (InvalidInterfaceException e) {
                    throw new ContributionResolveException(e);
                }
                interfaceContract.setInterface(wsdlInterface);
                model.setBindingInterfaceContract(interfaceContract);
            }
        }
View Full Code Here


        ClassReference classReference = new ClassReference(javaImplementation.getName());
        classReference = resolver.resolveModel(ClassReference.class, classReference);
        Class javaClass = classReference.getJavaClass();
        if (javaClass == null) {
            throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
        }
        javaImplementation.setJavaClass(javaClass);
        javaImplementation.setUnresolved(false);

        try {
            javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
        } catch (IntrospectionException e) {
            throw new ContributionResolveException(e);
        }

        mergeComponentType(resolver, javaImplementation);

        // FIXME the introspector should always create at least one service
View Full Code Here

            new SpringXMLComponentTypeLoader(assemblyFactory, javaFactory, policyFactory);
        try {
            // Load the Spring Implementation information from its application context file...
            springLoader.load(springImplementation);
        } catch (ContributionReadException e) {
            throw new ContributionResolveException(e);
        }

        ComponentType ct = springImplementation.getComponentType();
        if (ct.isUnresolved()) {
            // If the introspection fails to resolve, try to find a side file...
            ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
            if (componentType.isUnresolved()) {
                throw new ContributionResolveException(
                                                       "SpringArtifactProcessor: unable to resolve componentType for Spring component");
            }
            springImplementation.setComponentType(componentType);

            springImplementation.setUnresolved(false);
View Full Code Here

            BundleReference resolvedBundle = resolver.resolveModel(BundleReference.class, bundleReference);
            Bundle bundle = (Bundle)resolvedBundle.getBundle();
            if (bundle != null)
                impl.setOSGiBundle(bundle);
            else
                throw new ContributionResolveException("Could not locate OSGi bundle " +
                        impl.getBundleSymbolicName());
           
            String bundleName = resolvedBundle.getBundleRelativePath();
            String ctURI = bundleName.endsWith(".jar") || bundleName.endsWith(".JAR")?
                    bundleName.substring(0, bundleName.lastIndexOf(".")) : bundleName;
            ctURI = ctURI.replaceAll("\\.", "/");
            ctURI = ctURI + ".componentType";

            ComponentType componentType = assemblyFactory.createComponentType();
            componentType.setURI(ctURI);
            componentType.setUnresolved(true);
            componentType = resolver.resolveModel(ComponentType.class, componentType);
            if (componentType.isUnresolved()) {

                throw new ContributionResolveException("missing .componentType side file " + ctURI);
            }
           
            List<Service> services = componentType.getServices();
            for (Service service : services) {
                Interface interfaze = service.getInterfaceContract().getInterface();
                if (interfaze instanceof JavaInterface) {
                    JavaInterface javaInterface = (JavaInterface)interfaze;
                    if (javaInterface.getJavaClass() == null) {
                       
                        javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName()));
                    }
                    Class<?> callback = null;
                    if (service.getInterfaceContract().getCallbackInterface() instanceof JavaInterface) {
                        JavaInterface callbackInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
                        if (callbackInterface.getJavaClass() == null) {
                            callbackInterface.setJavaClass(getJavaClass(resolver, callbackInterface.getName()));
                        }
                        callback = callbackInterface.getJavaClass();
                    }
                   
                    Service serv = createService(service, javaInterface.getJavaClass(), callback);
                    impl.getServices().add(serv);
                }
            }
           
            List<Reference> references = componentType.getReferences();
            for (Reference reference : references) {
                Interface interfaze = reference.getInterfaceContract().getInterface();
                if (interfaze instanceof JavaInterface) {
                    JavaInterface javaInterface = (JavaInterface)interfaze;
                    if (javaInterface.getJavaClass() == null) {
                        javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName()));
                    }
                    Reference ref = createReference(reference, javaInterface.getJavaClass());
                    impl.getReferences().add(ref);
                }
                else
                    impl.getReferences().add(reference);
            }
           
            List<Property> properties = componentType.getProperties();
            for (Property property : properties) {
                impl.getProperties().add(property);
            }
            impl.setConstrainingType(componentType.getConstrainingType());
          
           
        } catch (Exception e) {
            throw new ContributionResolveException(e);
        }
       
    }
View Full Code Here

        if (resolved.getLocation() != null) {
            try {
                implementation.setLocationURL(new URL(resolved.getLocation()));
                implementation.setUnresolved(false);
            } catch (IOException e) {
                throw new ContributionResolveException(e);
            }
        }
    }
View Full Code Here

        String factoryName = importSDO.getFactoryClassName();
        if (factoryName != null) {
            ClassReference reference = new ClassReference(factoryName);
            ClassReference resolved = resolver.resolveModel(ClassReference.class, reference);
            if (resolved == null || resolved.isUnresolved()) {
                ContributionResolveException loaderException =
                    new ContributionResolveException("Fail to resolve class: " + factoryName);
                throw loaderException;
            }
            try {
                Class<?> factoryClass = resolved.getJavaClass();
                register(factoryClass, importSDO.getHelperContext());
            } catch (Exception e) {
                throw new ContributionResolveException(e);
            }
            importSDO.setUnresolved(false);
        }
    }
View Full Code Here

            try {
                Artifact artifact = contributionFactory.createArtifact();
                artifact.setURI(location);
                artifact = resolver.resolveModel(Artifact.class, artifact);
                if (artifact.getLocation() == null) {
                    ContributionResolveException loaderException =
                        new ContributionResolveException("Fail to resolve location: " + location);
                    throw loaderException;
                }

                String wsdlURL = artifact.getLocation();
                URLConnection connection = new URL(wsdlURL).openConnection();
                connection.setUseCaches(false);
                InputStream xsdInputStream = connection.getInputStream();
                try {
                    XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
                    xsdHelper.define(xsdInputStream, wsdlURL);
                } finally {
                    xsdInputStream.close();
                }
            } catch (IOException e) {
                throw new ContributionResolveException(e);
            }
            importSDO.setUnresolved(false);
        }
    }
View Full Code Here

    public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
        if( impl != null && impl.isUnresolved()) {
            BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(impl, resolver);
            if(processDefinition.isUnresolved()) {
                throw new ContributionResolveException("Can't find BPEL Process : " + processDefinition.getName());
            }
           
            impl.setProcessDefinition(processDefinition);
           
            //resolve component type
View Full Code Here

        Artifact artifact = contributionFactory.createArtifact();
        artifact.setURI(xqueryImplementation.getLocation());
      artifact = resolver.resolveModel(Artifact.class, artifact);
      if (artifact.getLocation() == null) {
            throw new ContributionResolveException("Could not locate file: " + xqueryImplementation.getLocation());
        }
      xqueryImplementation.setLocationURL(artifact.getLocation());

        XQueryIntrospector introspector = new XQueryIntrospector(assemblyFactory, javaFactory);
View Full Code Here

        String xqExpression = null;
        try {
            URL url = new URL(xqueryImplementation.getLocationURL());
            xqExpression = loadXQExpression(url);
        } catch (FileNotFoundException e) {
            throw new ContributionResolveException(e);
        } catch (IOException e) {
            throw new ContributionResolveException(e);
        }

        if (xqExpression == null) {
            return false;
        }

        xqueryImplementation.setXqExpression(xqExpression);

        xqExpression += "\r\n<dummy></dummy>";

        Configuration config = new Configuration();
        StaticQueryContext sqc = new StaticQueryContext(config);
        XQueryExpression exp = null;
        try {
            exp = sqc.compileQuery(xqExpression);
        } catch (XPathException e) {
            throw new ContributionResolveException(e);
        }

        if (exp == null) {
            return false;
        }
        xqueryImplementation.getCompiledExpressionsCache().put(xqExpression, exp);

        try {
            introspectServicesAndReferences(xqueryImplementation, exp, resolver);
        } catch (ClassNotFoundException e) {
            throw new ContributionResolveException(e);
        } catch (InvalidInterfaceException e) {
            throw new ContributionResolveException(e);
        }

        fillExpressionExtensions(xqueryImplementation);

        return true;
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.service.ContributionResolveException

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.