Package org.apache.cayenne.util

Examples of org.apache.cayenne.util.ResourceLocator


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


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

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

            ResourceLocator locator = ((DefaultConfiguration) oldConfig)
                    .getResourceLocator();

            if (locator instanceof WebApplicationResourceLocator) {
                if (((WebApplicationResourceLocator) locator).getServletContext() == context) {
                    logObj
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

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

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

  public BasicServletConfiguration(ServletContext ctxt) {
    super();
    this.setServletContext(ctxt);

    ResourceLocator l = new WebApplicationResourceLocator(servletContext);
    l.setSkipAbsolutePath(true);
    l.setSkipClasspath(false);
    l.setSkipCurrentDirectory(true);
    l.setSkipHomeDirectory(true);

    // check for a configuration path in the context parameters
    String configurationPath =
      ctxt.getInitParameter(CONFIGURATION_PATH_KEY);
    if (configurationPath != null
      && configurationPath.trim().length() > 0) {
      l.addFilesystemPath(configurationPath);
    }

    this.setResourceLocator(l);
  }
View Full Code Here

     * CLASSPATH.
     */
    public synchronized static void configureCommonLogging() {
        if (!Configuration.isLoggingConfigured()) {
            // create a simple CLASSPATH/$HOME locator
            ResourceLocator locator = new ResourceLocator();
            locator.setSkipAbsolutePath(true);
            locator.setSkipClasspath(false);
            locator.setSkipCurrentDirectory(true);
            locator.setSkipHomeDirectory(false);

            // and load the default logging config file
            URL configURL = locator.findResource(DEFAULT_LOGGING_PROPS_FILE);
            Configuration.configureCommonLogging(configURL);
        }
    }
View Full Code Here

        }

        logObj.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

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.