Package org.apache.cayenne.util

Examples of org.apache.cayenne.util.ResourceLocator


        // ignore loading failures
        this.setIgnoringLoadFailures(true);

        // configure deterministic file opening rules
        ResourceLocator locator = this.getResourceLocator();
        locator.setSkipAbsolutePath(false);
        locator.setSkipClasspath(true);
        locator.setSkipCurrentDirectory(true);
        locator.setSkipHomeDirectory(true);
    }
View Full Code Here


     * @deprecated since 3.1 as MapLoader should not bother itself with looking up
     *             resources.
     */
    @Deprecated
    protected ResourceFinder createResourceFinder() {
        ResourceLocator locator = new ResourceLocator();

        // absolute paths are usually passed by the Modeler
        // while runtime would use classpath

        locator.setSkipAbsolutePath(false);
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(false);
        locator.setSkipHomeDirectory(true);
        return locator;
    }
View Full Code Here

     */
    // TODO: refactor EOModelHelper to provide a similar method without loading
    // all entity files in memory... here we simply copied stuff from EOModelHelper
    public Map loadModeIndex(String path) throws Exception {

        ResourceLocator locator = new ResourceLocator();
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(false);
        locator.setSkipHomeDirectory(true);
        locator.setSkipAbsolutePath(false);

        if (!path.endsWith(".eomodeld")) {
            path += ".eomodeld";
        }

        URL base = locator.findDirectoryResource(path);
        if (base == null) {
            throw new FileNotFoundException("Can't find EOModel: " + path);
        }

        Parser plistParser = new Parser();
View Full Code Here

        }

        logger.debug("using domain file name: " + domainConfigurationName);

        // configure CLASSPATH-only locator
        ResourceLocator locator = new ResourceLocator();
        locator.setSkipAbsolutePath(true);
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(true);
        locator.setSkipHomeDirectory(true);

        // add the current Configuration subclass' package as additional path.
        if (!(this.getClass().equals(DefaultConfiguration.class))) {
            locator.addClassPath(Util.getPackagePath(this.getClass().getName()));
        }

        setResourceLocator(locator);
    }
View Full Code Here

     *
     * @throws CayenneRuntimeException if source URI does not resolve to a valid map files
     */
    public DataMap loadDataMap(String uri) throws CayenneRuntimeException {
        // configure resource locator
        ResourceLocator locator = configLocator();
        InputStream in = locator.findResourceStream(uri);
        if (in == null) {
            throw new CayenneRuntimeException("Can't find data map " + uri);
        }

        try {
View Full Code Here

    /**
     * Creates, configures and returns ResourceLocator object used to lookup DataMap
     * files.
     */
    protected ResourceLocator configLocator() {
        ResourceLocator locator = new ResourceLocator();
        locator.setSkipAbsolutePath(true);
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(false);
        locator.setSkipHomeDirectory(false);
        return locator;
    }
View Full Code Here

     * Creates, configures and returns a default ResourceFinder.
     *
     * @since 3.0
     */
    protected ResourceFinder createResourceFinder() {
        ResourceLocator locator = new ResourceLocator();
        locator.setSkipAbsolutePath(true);
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(false);
        locator.setSkipHomeDirectory(false);
        return locator;
    }
View Full Code Here

            // configure resource locator to take absolute path
            MapLoader mapLoader = new MapLoader() {

                @Deprecated
                protected ResourceLocator configLocator() {
                    ResourceLocator locator = new ResourceLocator();
                    locator.setSkipAbsolutePath(false);
                    locator.setSkipClasspath(true);
                    locator.setSkipCurrentDirectory(true);
                    locator.setSkipHomeDirectory(true);
                    return locator;
                }
            };

            DataMap newMap = mapLoader.loadDataMap(dataMapFile.getAbsolutePath());
View Full Code Here

     */
    // TODO: refactor EOModelHelper to provide a similar method without loading
    // all entity files in memory... here we simply copied stuff from EOModelHelper
    public Map loadModeIndex(String path) throws Exception {

        ResourceLocator locator = new ResourceLocator();
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(false);
        locator.setSkipHomeDirectory(true);
        locator.setSkipAbsolutePath(false);

        if (!path.endsWith(".eomodeld")) {
            path += ".eomodeld";
        }

        URL base = locator.findDirectoryResource(path);
        if (base == null) {
            throw new FileNotFoundException("Can't find EOModel: " + path);
        }

        Parser plistParser = new Parser();
View Full Code Here

     * Creates, configures and returns a default ResourceFinder.
     *
     * @since 3.0
     */
    protected ResourceFinder createResourceFinder() {
        ResourceLocator locator = new ResourceLocator();

        // absolute paths are usually passed by the Modeler
        // while runtime would use classpath

        locator.setSkipAbsolutePath(false);
        locator.setSkipClasspath(false);
        locator.setSkipCurrentDirectory(false);
        locator.setSkipHomeDirectory(true);
        return locator;
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.util.ResourceLocator

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.