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

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


        // First resolve its class
        ClassReference classReference = new ClassReference(implementation.getPOJOName());
        classReference = resolver.resolveModel(ClassReference.class, classReference);
        Class pojoClass = classReference.getJavaClass();
        if (pojoClass == null) {
            throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName());
        }
        implementation.setPOJOClass(pojoClass);
       
        // Check to see if we have a .componentType file describing the POJO class
        ComponentType componentType = assemblyFactory.createComponentType();
        componentType.setUnresolved(true);
        componentType.setURI(implementation.getURI() + ".componentType");
        componentType = resolver.resolveModel(ComponentType.class, componentType);
        if (!componentType.isUnresolved()) {
           
            // We have a component type description, merge it into the POJO model
            implementation.getServices().addAll(componentType.getServices());
            implementation.getReferences().addAll(componentType.getReferences());
            implementation.getProperties().addAll(componentType.getProperties());
           
        } else {
           
            // We have no component type description, simply introspect the POJO and
            // create a single Service for it
            Service service = assemblyFactory.createService();
            service.setName(pojoClass.getSimpleName());
            JavaInterface javaInterface;
            try {
                javaInterface = javaFactory.createJavaInterface(pojoClass);
            } catch (InvalidInterfaceException e) {
                throw new ContributionResolveException(e);
            }
            JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
            interfaceContract.setInterface(javaInterface);
            service.setInterfaceContract(interfaceContract);
            implementation.getServices().add(service);
View Full Code Here


            //validate policysets specified for the attachPoint
            for (PolicySet policySet : policySetAttachPoint.getPolicySets()) {
                appliesTo = policySet.getAppliesTo();
                if ( !policySet.isUnresolved() ) {
                    if (!PolicyValidationUtils.isPolicySetApplicable(scdlFragment, appliesTo, attachPointType)) {
                        throw new ContributionResolveException("Policy Set '" + policySet.getName()
                            + "' does not apply to binding type  "
                            + attachPointType.getName());
        
                    } }
                else {
                    throw new ContributionResolveException("Policy Set '" + policySet.getName()
                           + "' is not defined in this domain  ");
                   
                }
            }
        }
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

    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

        throws ContributionResolveException {
     
      ResourceReference resourceRef = new ResourceReference(xqueryImplementation.getLocation());
      resourceRef = resolver.resolveModel(ResourceReference.class, resourceRef);
      if (resourceRef.isUnresolved()) {
            throw new ContributionResolveException("Could not locate file: " + xqueryImplementation.getLocation());
        }
      xqueryImplementation.setLocationURL(resourceRef.getResource());

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

       
        String xqExpression = null;
        try {
            xqExpression = loadXQExpression(xqueryImplementation.getLocationURL());
        } 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

        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

        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 {
                URL wsdlURL = null;
                ResourceReference reference = new ResourceReference(location);
                ResourceReference resolved = resolver.resolveModel(ResourceReference.class, reference);
                if (resolved == null || resolved.isUnresolved()) {
                    ContributionResolveException loaderException =
                        new ContributionResolveException("Fail to resolve location: " + location);
                    throw loaderException;
                }

                wsdlURL = resolved.getResource();
                InputStream xsdInputStream = wsdlURL.openStream();
                try {
                    XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
                    xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
                } finally {
                    xsdInputStream.close();
                }
            } catch (IOException e) {
                throw new ContributionResolveException(e);
            }
            importSDO.setUnresolved(false);
        }
    }
View Full Code Here

        // First resolve its class
        ClassReference classReference = new ClassReference(implementation.getPOJOName());
        classReference = resolver.resolveModel(ClassReference.class, classReference);
        Class<?> pojoClass = classReference.getJavaClass();
        if (pojoClass == null) {
            throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName());
        }
        implementation.setPOJOClass(pojoClass);
       
        // Check to see if we have a .componentType file describing the POJO class
        ComponentType componentType = assemblyFactory.createComponentType();
        componentType.setUnresolved(true);
        componentType.setURI(implementation.getURI() + ".componentType");
        componentType = resolver.resolveModel(ComponentType.class, componentType);
        if (!componentType.isUnresolved()) {
           
            // We have a component type description, merge it into the POJO model
            implementation.getServices().addAll(componentType.getServices());
            implementation.getReferences().addAll(componentType.getReferences());
            implementation.getProperties().addAll(componentType.getProperties());
           
        } else {
           
            // We have no component type description, simply introspect the POJO and
            // create a single Service for it
            Service service = assemblyFactory.createService();
            service.setName(pojoClass.getSimpleName());
            JavaInterface javaInterface;
            try {
                javaInterface = javaFactory.createJavaInterface(pojoClass);
            } catch (InvalidInterfaceException e) {
                throw new ContributionResolveException(e);
            }
            JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
            interfaceContract.setInterface(javaInterface);
            service.setInterfaceContract(interfaceContract);
            implementation.getServices().add(service);
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.