Package org.apache.cayenne.util

Examples of org.apache.cayenne.util.ResourceLocator


        }

        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


        if (parentConfiguration != null) {
            resourceFinder = parentConfiguration.getResourceFinder();
        }
        else {
            ResourceLocator resourceLocator = new ResourceLocator();
            resourceLocator.setSkipAbsolutePath(false);
            resourceLocator.setSkipHomeDirectory(true);
            resourceLocator.setSkipClasspath(false);
            resourceLocator.setSkipCurrentDirectory(false);
            resourceFinder = resourceLocator;
        }

        DBCPDataSourceProperties properties = new DBCPDataSourceProperties(
                resourceFinder,
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

        // don't use static getter, since it will do initialization on demand!!!
        Configuration oldConfig = Configuration.sharedConfiguration;
        if (oldConfig instanceof DefaultConfiguration) {

            ResourceLocator locator = oldConfig.getResourceLocator();

            if (locator instanceof WebApplicationResourceLocator) {
                if (((WebApplicationResourceLocator) locator).getServletContext() == context) {
                    return oldConfig;
                }
View Full Code Here

        // 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

    /**
     * Creates and returns a {{org.apache.commons.dbcp.PoolingDataSource}} instance.
     */
    public DataSource getDataSource(String location) throws Exception {

        ResourceLocator resourceLocator;

        if (parentConfiguration != null) {
            resourceLocator = parentConfiguration.getResourceLocator();
        }
        else {
            resourceLocator = new ResourceLocator();
            resourceLocator.setSkipAbsolutePath(false);
            resourceLocator.setSkipHomeDirectory(true);
            resourceLocator.setSkipClasspath(false);
            resourceLocator.setSkipCurrentDirectory(false);
        }

        DBCPDataSourceProperties properties = new DBCPDataSourceProperties(
                resourceLocator,
                location);
View Full Code Here

    // set the project file
    this.projectFile = new File(domainConfigurationName);

    // configure the ResourceLocator for plain files
    ResourceLocator locator = this.getResourceLocator();
    locator.setSkipAbsolutePath(false);
    locator.setSkipClasspath(true);
    locator.setSkipCurrentDirectory(false);
    locator.setSkipHomeDirectory(true);

    // add the file's location to the search path, if it exists
    File projectDirectory = this.getProjectDirectory();
    if (projectDirectory != null) {
      locator.addFilesystemPath(projectDirectory.getPath());
    }
  }
View Full Code Here

    // set the project file
    this.setProjectFile(domainConfigurationFile);

    // configure the ResourceLocator for plain files
    ResourceLocator locator = this.getResourceLocator();
    locator.setSkipAbsolutePath(false);
    locator.setSkipClasspath(true);
    locator.setSkipCurrentDirectory(false);
    locator.setSkipHomeDirectory(true);

    // add the file's location to the search path, if it exists
    File projectDirectory = this.getProjectDirectory();
    if (projectDirectory != null) {
      locator.addFilesystemPath(projectDirectory);
    }
  }
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

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.