Examples of ResourceLocator


Examples of org.apache.jdo.impl.enhancer.util.ResourceLocator

            if (jdoFileNames != null && !jdoFileNames.isEmpty()) {
                final StringBuffer s = new StringBuffer();
                for (Iterator i = jdoFileNames.iterator(); i.hasNext();) {
                    s.append(" " + i.next());
                }
                final ResourceLocator jdos
                    = new ListResourceLocator(out, verbose, jdoFileNames);
                //printMessage(getI18N("enhancer.metadata.using_jdo_files",
                //                     s.toString()));
                locators.add(jdos);
            }

            // create resource locator for specified jar files
            if (jarFileNames != null && !jarFileNames.isEmpty()) {
                final StringBuffer s = new StringBuffer();
                final Iterator i = jarFileNames.iterator();
                s.append(i.next());
                while (i.hasNext()) {
                    s.append(File.pathSeparator + i.next());
                }
                final PathResourceLocator jars
                    = new PathResourceLocator(out, verbose, s.toString());
                //printMessage(getI18N("enhancer.metadata.using_jar_files",
                //                     s.toString()));
                locators.add(jars);
                classLoader = jars.getClassLoader();
            }

            // create resource locator for specified source path
            if (sourcePath != null && sourcePath.length() > 0) {
                final PathResourceLocator path
                    = new PathResourceLocator(out, verbose, sourcePath);
                //printMessage(getI18N("enhancer.metadata.using_source_path",
                //                     sourcePath));
                locators.add(path);
                classLoader = path.getClassLoader();
            }

            if (classLoader == null) {
                // use the current class loader as the default, if there is
                // no -s option and no archives specified.
                classLoader = EnhancerMetaDataJDOModelImpl.class.getClassLoader();
            }

            // print warning if no meta-data source specified
            if (locators.isEmpty()) {
                printWarning(getI18N("enhancer.metadata.using_no_metadata"));
            }

            // create JavaModel with combined resource locators
            final ResourceLocator locator
                = new CombinedResourceLocator(out, verbose, locators);
            //^olsen: wrap with timing jdo file locator
            //if (options.doTiming.value) {
            //    classLocator = new ResourceLocatorTimer(classLocator);
            //}
View Full Code Here

Examples of org.apache.jdo.impl.enhancer.util.ResourceLocator

        try {
            final List locators = new ArrayList();

            // create resource locator for specified class files
            if (classFileNames != null && !classFileNames.isEmpty()) {
                final ResourceLocator classes
                    = new ListResourceLocator(out, verbose, classFileNames);
                if (verbose) {
                    out.println("Class Locator: using class files: {");
                    for (Iterator i = classFileNames.iterator(); i.hasNext();) {
                        out.println("    " + i.next());
                    }
                    out.println("}");
                }
                locators.add(classes);
            }

            // create resource locator for specified zip files
            if (zipFileNames != null && !zipFileNames.isEmpty()) {
                final StringBuffer s = new StringBuffer();
                final Iterator i = zipFileNames.iterator();
                s.append(i.next());
                while (i.hasNext()) {
                    s.append(File.pathSeparator + i.next());
                }
                final ResourceLocator zips
                    = new PathResourceLocator(out, verbose, s.toString());
                if (verbose)
                    out.println("Class Locator: using jar/zip files: "
                                + s.toString());
                locators.add(zips);
            }

            // create resource locator for specified source path
            if (sourcePath != null && sourcePath.length() > 0) {
                final ResourceLocator path
                    = new PathResourceLocator(out, verbose, sourcePath);
                if (verbose)
                    out.println("Class Locator: using source path: "
                                + sourcePath);
                locators.add(path);
View Full Code Here

Examples of org.apache.jdo.impl.enhancer.util.ResourceLocator

        try {
            final List locators = new ArrayList();

            // create resource locator for specified class files
            if (classFileNames != null && !classFileNames.isEmpty()) {
                final ResourceLocator classes
                    = new ListResourceLocator(out, verbose, classFileNames);
                if (verbose) {
                    out.println("Class Locator: using class files: {");
                    for (Iterator i = classFileNames.iterator(); i.hasNext();) {
                        out.println("    " + i.next());
                    }
                    out.println("}");
                }
                locators.add(classes);
            }

            // create resource locator for specified zip files
            if (zipFileNames != null && !zipFileNames.isEmpty()) {
                final StringBuffer s = new StringBuffer();
                final Iterator i = zipFileNames.iterator();
                s.append(i.next());
                while (i.hasNext()) {
                    s.append(File.pathSeparator + i.next());
                }
                final ResourceLocator zips
                    = new PathResourceLocator(out, verbose, s.toString());
                if (verbose)
                    out.println("Class Locator: using jar/zip files: "
                                + s.toString());
                locators.add(zips);
            }

            // create resource locator for specified source path
            if (sourcePath != null && sourcePath.length() > 0) {
                final ResourceLocator path
                    = new PathResourceLocator(out, verbose, sourcePath);
                if (verbose)
                    out.println("Class Locator: using source path: "
                                + sourcePath);
                locators.add(path);
View Full Code Here

Examples of org.apache.jdo.impl.enhancer.util.ResourceLocator

            if (jdoFileNames != null && !jdoFileNames.isEmpty()) {
                final StringBuffer s = new StringBuffer();
                for (Iterator i = jdoFileNames.iterator(); i.hasNext();) {
                    s.append(" " + i.next());
                }
                final ResourceLocator jdos
                    = new ListResourceLocator(out, verbose, jdoFileNames);
                //printMessage(getI18N("enhancer.metadata.using_jdo_files",
                //                     s.toString()));
                locators.add(jdos);
            }

            // create resource locator for specified jar files
            if (jarFileNames != null && !jarFileNames.isEmpty()) {
                final StringBuffer s = new StringBuffer();
                final Iterator i = jarFileNames.iterator();
                s.append(i.next());
                while (i.hasNext()) {
                    s.append(File.pathSeparator + i.next());
                }
                final PathResourceLocator jars
                    = new PathResourceLocator(out, verbose, s.toString());
                //printMessage(getI18N("enhancer.metadata.using_jar_files",
                //                     s.toString()));
                locators.add(jars);
                classLoader = jars.getClassLoader();
            }

            // create resource locator for specified source path
            if (sourcePath != null && sourcePath.length() > 0) {
                final PathResourceLocator path
                    = new PathResourceLocator(out, verbose, sourcePath);
                //printMessage(getI18N("enhancer.metadata.using_source_path",
                //                     sourcePath));
                locators.add(path);
                classLoader = path.getClassLoader();
            }

            if (classLoader == null) {
                // use the current class loader as the default, if there is
                // no -s option and no archives specified.
                classLoader = EnhancerMetaDataJDOModelImpl.class.getClassLoader();
            }

            // print warning if no meta-data source specified
            if (locators.isEmpty()) {
                printWarning(getI18N("enhancer.metadata.using_no_metadata"));
            }

            // create JavaModel with combined resource locators
            final ResourceLocator locator
                = new CombinedResourceLocator(out, verbose, locators);
            //^olsen: wrap with timing jdo file locator
            //if (options.doTiming.value) {
            //    classLocator = new ResourceLocatorTimer(classLocator);
            //}
View Full Code Here

Examples of org.archenos.locator.ResourceLocator

import org.junit.Test;

public final class CurrentClassLoaderResourceLocatorTest {
    @Test
    public void testFindResource() {
        ResourceLocator locator = new CurrentClassLoaderResourceLocator();

        try {
            URL url = locator.findResource("file1.txt");
            Assert.assertNotNull(url);
        } catch (ResourceNotFoundException e) {
            Assert.fail("Resource should be found but was not found.");
        }

        try {
            URL url = locator.findResource("one/file2.txt");
            Assert.assertNotNull(url);
        } catch (ResourceNotFoundException e) {
            Assert.fail("Resource should be found but was not found.");
        }

        try {
            URL url = locator.findResource("one/two/file3.txt");
            Assert.assertNotNull(url);
        } catch (ResourceNotFoundException e) {
            Assert.fail("Resource should be found but was not found.");
        }

        try {
            locator.findResource("missing.txt");
            Assert.fail("Resource should not be found but was found.");
        } catch (ResourceNotFoundException e) {
            // Expected.
        }
    }
View Full Code Here

Examples of org.broad.igv.util.ResourceLocator

    private void loadHeader() {

        InputStream is = null;
        SAMFileReader reader = null;
        try {
            is = ParsingUtils.openInputStreamGZ(new ResourceLocator(samFile));
            BufferedInputStream bis = new BufferedInputStream(is);
            SAMFileReader.setDefaultValidationStringency(ValidationStringency.SILENT);
            reader = new SAMFileReader(bis);
            header = reader.getFileHeader();
        } catch (IOException e) {
View Full Code Here

Examples of org.codehaus.dna.ResourceLocator

        if( null != resource )
        {
            return resource;
        }

        final ResourceLocator parent = getParent();
        if( null != parent )
        {
            return parent.lookup( key );
        }
        else
        {
            final String message = "Unable to locate resource " + key + ".";
            throw new MissingResourceException( message, key );
View Full Code Here

Examples of org.codehaus.dna.ResourceLocator

        if( null != resource )
        {
            return true;
        }

        final ResourceLocator parent = getParent();
        if( null != parent )
        {
            return parent.contains( key );
        }
        else
        {
            return false;
        }
View Full Code Here

Examples of org.codehaus.dna.ResourceLocator

    public void testComposeOnComponentImplementingStage()
        throws Exception
    {
        final MockComponent object = new MockComponent();
        final ResourceLocator resource = new DefaultResourceLocator();

        ContainerUtil.compose( object, resource );

        assertEquals( resource, object.getServices() );
    }
View Full Code Here

Examples of org.codehaus.dna.ResourceLocator

    public void testComposeOnComponentImplementingStageButNullLogger()
        throws Exception
    {
        final MockComponent object = new MockComponent();
        final ResourceLocator resource = null;

        try
        {
            ContainerUtil.compose( object, resource );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.