Package org.apache.tuscany.spi.loader

Examples of org.apache.tuscany.spi.loader.MissingResourceException


                                     DeploymentContext deploymentContext)
        throws XMLStreamException, LoaderException {

        String locationAttr = reader.getAttributeValue(null, "location");
        if (locationAttr == null && !contextProvided()) {
            throw new MissingResourceException("No location supplied");
        }

        SpringImplementation implementation = new SpringImplementation();
        ClassLoader classLoader = deploymentContext.getClassLoader();
        if (!contextProvided()) {
View Full Code Here


            // FIXME hack
            URL url = cl.getResource(locationAttr);
            if (url != null) {
                return new UrlResource(url);
            }
            throw new MissingResourceException(locationFile.toString());
        }

        if (locationFile.isDirectory()) {
            try {
                manifestFile = new File(locationFile, "META-INF/MANIFEST.MF");
                if (manifestFile.exists()) {
                    Manifest mf = new Manifest(new FileInputStream(manifestFile));
                    Attributes mainAttrs = mf.getMainAttributes();
                    String appCtxPath = mainAttrs.getValue("Spring-Context");
                    if (appCtxPath != null) {
                        appXmlFile = new File(locationFile, appCtxPath);
                        if (appXmlFile.exists()) {
                            return new UrlResource(appXmlFile.toURL());
                        }
                    }
                }
                // no manifest-specified Spring context, use default
                appXmlFile = new File(locationFile, APPLICATION_CONTEXT);
                if (appXmlFile.exists()) {
                    return new UrlResource(appXmlFile.toURL());
                }
            } catch (IOException e) {
                throw new LoaderException("Error reading manifest " + manifestFile);
            }
        } else {
            try {
                JarFile jf = new JarFile(locationFile);
                JarEntry je;
                Manifest mf = jf.getManifest();
                if (mf != null) {
                    Attributes mainAttrs = mf.getMainAttributes();
                    String appCtxPath = mainAttrs.getValue("Spring-Context");
                    if (appCtxPath != null) {
                        je = jf.getJarEntry(appCtxPath);
                        if (je != null) {
                            // TODO return a Spring specific Resouce type for jars
                            return new UrlResource(new URL("jar:" + locationFile.toURL() + "!/" + appCtxPath));
                        }
                    }
                }
                je = jf.getJarEntry(APPLICATION_CONTEXT);
                if (je != null) {
                    return new UrlResource(new URL("jar:" + locationFile.toURI().toURL() + "!" + APPLICATION_CONTEXT));
                }
            } catch (IOException e) {
                // bad archive
                // TODO: create a more appropriate exception type
                throw new MissingResourceException(locationAttr, e);
            }
        }
        throw new MissingResourceException(APPLICATION_CONTEXT);
    }
View Full Code Here

        String script = reader.getAttributeValue(null,
                                                 "script");
        String rubyClassName  = reader.getAttributeValue(null,"class");
       
        if ( script == null  ) {
            throw new MissingResourceException("No script supplied");
        }

        ClassLoader cl = deploymentContext.getClassLoader();
        String source = loadSource(cl,
                                   script);
View Full Code Here

    }

    protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
        URL url = cl.getResource(resource);
        if (url == null) {
            throw new MissingResourceException(resource);
        }
        InputStream is;
        try {
            is = url.openStream();
        } catch (IOException e) {
            MissingResourceException mre = new MissingResourceException(resource, e);
            mre.setIdentifier(resource);
            throw mre;
        }
        try {
            Reader reader = new InputStreamReader(is, "UTF-8");
            char[] buffer = new char[1024];
View Full Code Here

        } catch (ClassNotFoundException e) {
            classLoader = SimpleDataBinding.class.getClassLoader();
            try {
                return Class.forName(className, false, classLoader);
            } catch (ClassNotFoundException e1) {
                MissingResourceException mre = new MissingResourceException(className, e1);
                throw mre;
            }
        }
    }
View Full Code Here

            try {
                ServiceContract<?> sc = processorRegistry.introspect(Class.forName(serviceClass));
                service.setServiceContract(sc);
                componentType.add(service);
            } catch (ClassNotFoundException e) {
                throw new MissingResourceException("Interface not found", e);
            }
        }
    }
View Full Code Here

            }
        }

        PortType portType = getPortType(interfaceURI);
        if (portType == null) {
            throw new MissingResourceException(interfaceURI);
        }
        PortType callback = null;
        if (callbackURI != null) {
            callback = getPortType(callbackURI);
        }
View Full Code Here

            try {
                ServiceContract<?> sc = processorRegistry.introspect(Class.forName(serviceClass));
                service.setServiceContract(sc);
                componentType.add(service);
            } catch (ClassNotFoundException e) {
                throw new MissingResourceException("Interface not found", e);
            }
        }
    }
View Full Code Here

        ImplementationLoader mockLoader = new ImplementationLoader(registry) {
            protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
                assertSame(classLoader, cl);
                assertEquals("foo.groovy", resource);
                throw new MissingResourceException(resource);
            }
        };
        try {
            mockLoader.load(parent, reader, deploymentContext);
            fail();
View Full Code Here

        URL url;
        if (scdlLocation != null) {
            try {
                url = new URL(deploymentContext.getScdlLocation(), scdlLocation);
            } catch (MalformedURLException e) {
                MissingResourceException mre = new MissingResourceException(scdlLocation, e);
                mre.setIdentifier(name);
                throw mre;
            }
        } else if (scdlResource != null) {
            url = cl.getResource(scdlResource);
            if (url == null) {
                MissingResourceException mre = new MissingResourceException(scdlResource);
                mre.setIdentifier(name);
                throw mre;
            }
        } else {
            MissingIncludeException mie = new MissingIncludeException();
            mie.setIdentifier(name);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.loader.MissingResourceException

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.