Package org.apache.tuscany.core.config

Examples of org.apache.tuscany.core.config.ConfigurationLoadException


                case END_ELEMENT:
                    List<Property> props = component.getImplementation().getComponentType().getProperties();
                    for (Property property : props) {
                        if (property.isRequired()) {
                            if (component.getConfiguredProperty(property.getName()) == null) {
                                ConfigurationLoadException e = new ConfigurationLoadException("Required property not configured");
                                e.setIdentifier(property.getName());
                                throw e;
                            }
                        }
                    }
                    return component;
View Full Code Here


            switch (reader.next()) {
                case START_ELEMENT:
                    String name = reader.getLocalName();
                    Property property = componentType.getProperty(name);
                    if (property == null) {
                        throw new ConfigurationLoadException(name);
                    }
                    OverrideOption override = StAXUtil.overrideOption(reader.getAttributeValue(null, "override"), OverrideOption.NO);

// get a factory for the property
                    StAXPropertyFactory<?> propertyFactory;
View Full Code Here

        try {
            XMLStreamReader reader = xmlFactory.createXMLStreamReader(url.openStream());
            getDocumentRoot(reader);
            return (Module) registry.load(reader, new LoaderContext(resourceLoader));
        } catch (XMLStreamException e) {
            ConfigurationLoadException ce = new ConfigurationLoadException(e);
            ce.setResourceURI(url.toString());
            throw ce;
        } catch (IOException e) {
            ConfigurationLoadException ce = new ConfigurationLoadException(e);
            ce.setResourceURI(url.toString());
            throw ce;
        } finally {
            registry.setContext(null);
        }
    }
View Full Code Here

        try {
            XMLStreamReader reader = xmlFactory.createXMLStreamReader(url.openStream());
            getDocumentRoot(reader);
            return (ModuleFragment) registry.load(reader, new LoaderContext(resourceLoader));
        } catch (XMLStreamException e) {
            ConfigurationLoadException ce = new ConfigurationLoadException(e);
            ce.setResourceURI(url.toString());
            throw ce;
        } catch (IOException e) {
            ConfigurationLoadException ce = new ConfigurationLoadException(e);
            ce.setResourceURI(url.toString());
            throw ce;
        } finally {
            registry.setContext(null);
        }
    }
View Full Code Here

        Class<?> implementationClass;
        try {
            implementationClass = loaderContext.getResourceLoader().loadClass(implClass);
            implementation.setImplementationClass(implementationClass);
        } catch (ClassNotFoundException e) {
            throw new ConfigurationLoadException(e);
        }

        // todo we should allow componentType sidefiles for system implementations
        implementation.setComponentType(introspector.introspect(implementationClass));
View Full Code Here

        URL moduleUrl;
        moduleUrl = resourceLoader.getResource(moduleFileName);


        if (moduleUrl == null) {
            throw new ConfigurationLoadException(moduleFileName);
        }

        // Load the sca.fragment files
        Iterator<URL> i;
        try {
            i = resourceLoader.getResources(fragmentFileName);
        } catch (IOException e) {
            throw new ConfigurationLoadException(fragmentFileName, e);
        }
        List<URL> moduleFragmentUris=new ArrayList<URL>();
        while (i.hasNext()) {
            URL url=i.next();
            moduleFragmentUris.add(url);
View Full Code Here

        try {
            // set TCCL in case the application code needs it
            Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
            return resourceLoader.loadClass(typeName);
        } catch (ClassNotFoundException e) {
            throw new ConfigurationLoadException(e.getMessage(), e);
        } finally {
            Thread.currentThread().setContextClassLoader(oldCL);
        }
    }
View Full Code Here

                // set TCCL as SDO needs it
                Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader());
                Class<?> factoryClass = resourceLoader.loadClass(factoryName);
                SDOUtil.registerStaticTypes(factoryClass);
            } catch (ClassNotFoundException e) {
                throw new ConfigurationLoadException(e.getMessage(), e);
            } finally {
                Thread.currentThread().setContextClassLoader(oldCL);
            }
        }
    }
View Full Code Here

        Init init = method.getAnnotation(Init.class);
        if (init == null) {
            return;
        }
        if (method.getParameterTypes().length != 0) {
            throw new ConfigurationLoadException("Initialize methods cannot take parameters");
        }
        type.getExtensibilityElements().add(new InitInvokerExtensibilityElement(method, init.eager()));
    }
View Full Code Here

    }

    protected String loadScript(String scriptFile, ResourceLoader resourceLoader) throws ConfigurationLoadException {
        URL url = resourceLoader.getResource(scriptFile);
        if (url == null) {
            throw new ConfigurationLoadException(scriptFile);
        }
        InputStream inputStream;
        try {
            inputStream = url.openStream();
        } catch (IOException e) {
            throw new ConfigurationLoadException(scriptFile, e);
        }
        try {
            StringBuilder sb = new StringBuilder(1024);
            int n;
            while ((n = inputStream.read()) != -1) {
                sb.append((char) n);
            }
            return sb.toString();
        } catch (IOException e) {
            throw new ConfigurationLoadException(scriptFile, e);
        } finally {
            try {
                inputStream.close();
            } catch (IOException e) {
                // ignore
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.config.ConfigurationLoadException

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.