Package com.caucho.vfs

Examples of com.caucho.vfs.Path


   */
  FileSession(FileRepository repository)
  {
    _repository = repository;

    Path root = repository.getRoot();

    if (root.isDirectory())
      _rootNode = new DirectoryNode(this, root);
    else
      _rootNode = new FileNode(this, root);

    _workspace = new BaseWorkspace("default", this);
View Full Code Here


   */
  public void addWebApp(WebAppConfig config)
  {
    String docDir = config.getRootDirectory();

    Path appDir = getExpandDirectory().lookup(docDir);

    _webAppConfigMap.put(appDir, config);

    if (config.getContextPath() != null) {
      _contextPathMap.put(config.getContextPath(), appDir);
     
      String tail = appDir.getTail();
     
      _nameToKeyMap.put(config.getContextPath(), tail);
    }
  }
View Full Code Here

    String key = version.getKey();

    String baseKey = version.getBaseKey();
    String contextPath = keyToName(baseKey);
   
    Path rootDirectory = getExpandPath(key);
   
    if (rootDirectory == null)
      throw new NullPointerException();
   
    if (isVersioning()) {
View Full Code Here

    String key = version.getKey();

    String baseKey = version.getBaseKey();
    String contextPath = keyToName(baseKey);
   
    Path rootDirectory = getExpandPath(key);
    Path archivePath = getArchivePath(key);
    String id = getId() + "/" + key;

    WebAppController controller
      = new WebAppController(id, rootDirectory, _container,
View Full Code Here

  @Override
  protected void mergeController(WebAppController controller,
                                             String key)
  {
    try {
      Path expandDirectory = getExpandDirectory();
      Path rootDirectory = controller.getRootDirectory();

      if (! expandDirectory.equals(rootDirectory.getParent())) {
        return;
      }

      super.mergeController(controller, key);

      if (controller.getArchivePath() == null) {
        String archiveName = rootDirectory.getTail() + ".war";

        Path jarPath = getArchiveDirectory().lookup(archiveName);

        if (! jarPath.isDirectory()) {
          controller.setArchivePath(jarPath);
          controller.addDepend(jarPath);
        }
      }
View Full Code Here

    if (! name.startsWith("/"))
      throw new java.net.MalformedURLException(name);
   
    String realPath = getRealPath(name);

    Path rootDirectory = getRootDirectory();
    Path path = rootDirectory.lookupNative(realPath);

    URL url = new URL("jndi:/server" + getContextPath() + name);

    if (path.exists() && name.startsWith("/resources/")) {
      return url;
    }
    else if (path.isFile()) {
      return url;
    }
    else if (getClassLoader().getResource("META-INF/resources/" + realPath) != null) {
      return url;
    }
    else if (path.exists()) {
      return new URL(path.getURL());
    }

    return null;
  }
View Full Code Here

        }
      }
    }

    String realPath = getRealPath(file);
    Path rootDirectory = getRootDirectory();
    Path path = rootDirectory.lookup(realPath);

    if (path.exists())
      return new URL(path.getURL()).openConnection();

    int fileIdx;

    URLConnection connection = null;

    if (file.length() > 1 && (fileIdx = file.indexOf("/", 1)) > -1) {
      String context = file.substring(0, file.indexOf("/", 1));

      if (context.equals(getContextPath())) {// disable cross-context lookup

        file = file.substring(fileIdx, file.length());
        realPath = getRealPath(file);
        path = rootDirectory.lookup(realPath);

        if (path.exists())
          connection = new URL(path.getURL()).openConnection();
      }
    }

    if (connection != null)
      return connection;
View Full Code Here

 
  public Path getCauchoPath(String name)
  {
    String realPath = getRealPath(name);

    Path rootDirectory = getRootDirectory();
    Path path = rootDirectory.lookupNative(realPath);

    return path;
  }
View Full Code Here

  /**
   * Returns the resource for a uripath as an input stream.
   */
  public InputStream getResourceAsStream(String uripath)
  {
    Path rootDirectory = getRootDirectory();
    Path path = rootDirectory.lookupNative(getRealPath(uripath));

    try {
      if (path.canRead())
        return path.openRead();
      else {
        String resource = "META-INF/resources" + uripath;

        return getClassLoader().getResourceAsStream(resource);
      }
View Full Code Here

  public Set<String> getResourcePaths(String prefix)
  {
    if (! prefix.endsWith("/"))
      prefix = prefix + "/";

    Path path = getRootDirectory().lookup(getRealPath(prefix));

    HashSet<String> set = new HashSet<String>();

    try {
      String []list = path.list();

      for (int i = 0; i < list.length; i++) {
        if (path.lookup(list[i]).isDirectory())
          set.add(prefix + list[i] + '/');
        else
          set.add(prefix + list[i]);
      }
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of com.caucho.vfs.Path

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.