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

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


                // If the Java interface has never been resolved yet, do it now
                ClassReference classReference = new ClassReference(javaInterface.getName());
                classReference = resolver.resolveModel(ClassReference.class, classReference);
                Class javaClass = classReference.getJavaClass();
                if (javaClass == null) {
                    throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
                }
                try {
                       
                    // Introspect the Java interface and populate the interface and
                    // operations
                    javaInterface = introspector.introspect(javaClass);
               
                } catch (InvalidInterfaceException e) {
                    throw new ContributionResolveException(e);
                }

                // Cache the resolved interface
                javaInterface.setUnresolved(false);
                resolver.addModel(javaInterface);
View Full Code Here


                          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);
        } // end if
View Full Code Here

        if (resolved.getLocation() != null) {
            try {
                impl.setLocationURL(new URL(resolved.getLocation()));
                impl.setUnresolved(false);
            } catch (IOException e) {
                throw new ContributionResolveException(e);
            }
        }
    }
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 {
            introspector.introspect(javaImplementation.getJavaClass(), javaImplementation);
        } catch (IntrospectionException e) {
            throw new ContributionResolveException(e);
        }

        // FIXME the introspector should always create at least one service
        if (javaImplementation.getServices().isEmpty()) {
            javaImplementation.getServices().add(assemblyFactory.createService());
View Full Code Here

            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            try {
                Class<?> factoryClass = cl.loadClass(factoryName);
                register(factoryClass, importSDO.getHelperContext());
            } catch (Exception e) {
                throw new ContributionResolveException(e);
            }
            importSDO.setUnresolved(false);
        }
    }
View Full Code Here

                if (uri.isAbsolute()) {
                    wsdlURL = uri.toURL();
                }
                wsdlURL = Thread.currentThread().getContextClassLoader().getResource(location);
                if (null == wsdlURL) {
                    ContributionResolveException loaderException = new ContributionResolveException(
                                                                                                    "WSDL location error");
                    throw loaderException;
                }
                InputStream xsdInputStream = wsdlURL.openStream();
                try {
                    XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
                    xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
                } finally {
                    xsdInputStream.close();
                }
                // FIXME: How do we associate the application HelperContext with
                // the one
                // imported by the composite
                HelperContext defaultContext = HelperProvider.getDefaultContext();
                xsdInputStream = wsdlURL.openStream();
                try {
                    XSDHelper xsdHelper = defaultContext.getXSDHelper();
                    ClassLoader cl = Thread.currentThread().getContextClassLoader();
                    xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
                } finally {
                    xsdInputStream.close();
                }
            } catch (IOException e) {
                throw new ContributionResolveException(e);
            }
            importSDO.setUnresolved(false);
        }
    }
View Full Code Here

                        // Introspect the WSDL portType and add the resulting
                        // WSDLInterface to the resolver
                        try {
                            wsdlInterface = wsdlIntrospector.introspect(portType, wsdlDefinition.getInlinedSchemas(), resolver);
                        } catch (InvalidInterfaceException e) {
                            throw new ContributionResolveException(e);
                        }
                        resolver.addModel(wsdlInterface);
                        wsdlInterface.setWsdlDefinition(wsdlDefinition);
                    }
                }
View Full Code Here

        javaImplementation.setJavaClass(javaClass);       

        try {
            javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
        } catch (IntrospectionException e) {
          ContributionResolveException ce = new ContributionResolveException(e);
          error("ContributionResolveException", javaFactory, ce);
            //throw ce;
          return;
        }
       
View Full Code Here

                impl.getProperties().add(property);
            }
            impl.setConstrainingType(componentType.getConstrainingType());
           
        } catch (InvalidInterfaceException e) {
          ContributionResolveException ce = new ContributionResolveException(e);
          error("ContributionResolveException", resolver, ce);
            //throw ce;
        }
       
    }
View Full Code Here

     */
    public Map<String, JavaElementImpl> introspectBean(Class<?> beanClass, ComponentType componentType)
        throws ContributionResolveException {

        if (componentType == null)
            throw new ContributionResolveException("Introspect Spring bean: supplied componentType is null");

        // Create a Java implementation ready for the introspection
        JavaImplementation javaImplementation = javaImplementationFactory.createJavaImplementation();

        try {
            // Introspect the bean...the results of the introspection are placed into the Java implementation
            javaImplementationFactory.createJavaImplementation(javaImplementation, beanClass);

            // Extract the services, references & properties found through introspection
            // put the services, references and properties into the component type
            componentType.getServices().addAll(javaImplementation.getServices());
            componentType.getReferences().addAll(javaImplementation.getReferences());
            componentType.getProperties().addAll(javaImplementation.getProperties());
        } catch (IntrospectionException e) {
            throw new ContributionResolveException(e);
        } // end try

        //List<Service> services = javaImplementation.getServices();
        //for (Service service : services) {
            //String name = service.getName();
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.