Package com.caucho.vfs

Examples of com.caucho.vfs.Path


  {
    String key = version.getKey();
   
    String tag = getId() + "/" + key;
   
    Path rootDirectory = getExpandPath(key);
    Path archivePath = getArchivePath(key);

    EarDeployController controller
      = new EarDeployController(tag, rootDirectory, key,
                                _parentContainer, null);
View Full Code Here


      } catch (SAXException e) {
      }
    }
    */

    Path destDir = null;
    if (dest != null)
      destDir = Vfs.lookup(dest);
    else if (suffix == null)
      destDir = Vfs.lookup("stdout:");

    if (args.length - i  > 1 && (dest == null || destDir.isFile()) &&
        suffix == null) {
      System.err.println("multiple sources require a destination directory");
      System.exit(1);
    }

    try {
      MergePath stylePath = new MergePath();
      stylePath.addMergePath(Vfs.lookup(xslName).getParent());
      stylePath.addMergePath(Vfs.lookup());
      stylePath.addMergePath(CauchoSystem.getResinHome().lookup("xsl"));

      ClassLoader loader = Thread.currentThread().getContextClassLoader();

      if (loader instanceof DynamicClassLoader) {
        DynamicClassLoader dynLoader
          = (DynamicClassLoader) loader;
        String resourcePath = dynLoader.getResourcePathSpecificFirst();
        stylePath.addClassPath(resourcePath);
      }

      // stylePath.addClassPath(

      /*
        Path []stylePath = new Path[] {
        Pwd.lookup(xslName).getParent(),
        Pwd.lookup(),
        CauchoSystem.getResinHome().lookup("xsl")};
      */
      Path []scriptPath = new Path[] {
        Vfs.lookup(),
        Vfs.lookup(xslName).getParent(),
        CauchoSystem.getResinHome().lookup("scripts")
      };

      Path xslPath = stylePath.lookup(xslName);
      if (xslPath == null) {
        System.out.println("can't find `" + xslName + "'");
        System.exit(1);
      }

      AbstractStylesheetFactory xsl;

      if (isStrict)
        xsl = new Xsl();
      else
        xsl = new StyleScript();

      xsl.setStylePath(stylePath);

      Templates stylesheet;

      stylesheet = xsl.newTemplates(xslName);

      for (; i < args.length; i++) {
        String name = args[i];

        Path xmlPath = Vfs.lookup(name);

        HashMap<String,Object> argMap = new HashMap<String,Object>();

        String []childArgs = new String[argList.size() + 1];
        argList.toArray(childArgs);
        childArgs[childArgs.length - 1] = name;

        argMap.put("arguments", childArgs);
        argMap.put("File", Vfs.lookup());

        ReadStream is = xmlPath.openRead();
        Document doc = null;
        try {
          if (isStrict)
            doc = new Xml().parseDocument(is);
          else {
            XmlParser parser = new Html();
            parser.setEntitiesAsText(true);
            doc = parser.parseDocument(is);
          }
        } finally {
          is.close();
        }

        //Document result = xsl.transform(doc, argMap);
        Document result = null;

        Path destPath = null;
        if (dest != null)
          destPath = Vfs.lookup(dest);
        else if (suffix != null)
          destPath = xmlPath.getParent();
        else
          destPath = Vfs.lookup("stdout:");

        if (suffix != null) {
          int p = name.lastIndexOf('.');
          if (p == -1) {
            System.err.println("suffix missing for `" + name + "'");
            System.exit(1);
          }

          String destName = name.substring(0, p);
          if (dest == null) {
            p = destName.lastIndexOf('/');
            if (p >= 0)
              destName = destName.substring(p + 1);
          }

          if (! destPath.isFile())
            destPath = destPath.lookup(destName + '.' + suffix);
          else {
            System.err.println("illegal output combination");
            System.exit(1);
          }
        }
        else if (destPath.isDirectory())
          destPath = destPath.lookup(name);

        try {
          destPath.getParent().mkdirs();
        } catch (IOException e) {
        }

        WriteStream os = destPath.openWrite();

        try {
          Properties output = stylesheet.getOutputProperties();

          String encoding = (String) output.get("encoding");
View Full Code Here

  }

  protected Path calculateRootDirectory()
    throws ELException
  {
    Path rootDir = getRootDirectory();
    EnterpriseApplication eApp = getDeployInstance();

    if (rootDir == null && eApp != null)
      rootDir = eApp.getRootDirectory();
View Full Code Here

  protected synchronized Class<?> loadClass(String name, boolean resolve)
    throws ClassNotFoundException
  {
    String className = name.replace('.', '/') + ".class";

    Path path = _proJar.lookup(className);

    int length = (int) path.getLength();

    if (length > 0) {
      byte []buffer = new byte[length];

      try {
        ReadStream is = null;
        try {
          is = path.openRead();

          is.readAll(buffer, 0, buffer.length);

          Class<?> cl = defineClass(name, buffer, 0, buffer.length,
                                    (CodeSource) null);
View Full Code Here

    int p = path.indexOf(':');
    int q = path.indexOf('!');

    path = path.substring(p + 1, q);

    Path pwd = Vfs.lookup(path).getParent().getParent();

    return pwd;
  }
View Full Code Here

      for (String item : oldClassPath.split("[" + File.pathSeparatorChar + "]")) {
        addClassPath(classPath, item);
      }
    }

    Path javaHome = Vfs.lookup(System.getProperty("java.home"));

    if (javaHome.lookup("lib/tools.jar").canRead())
      addClassPath(classPath, javaHome.lookup("lib/tools.jar").getNativePath());
    else if (javaHome.getTail().startsWith("jre")) {
      String tail = javaHome.getTail();
      tail = "jdk" + tail.substring(3);
      Path jdkHome = javaHome.getParent().lookup(tail);

      if (jdkHome.lookup("lib/tools.jar").canRead())
        addClassPath(classPath, jdkHome.lookup("lib/tools.jar").getNativePath());
    }

    if (javaHome.lookup("../lib/tools.jar").canRead())
      addClassPath(classPath, javaHome.lookup("../lib/tools.jar").getNativePath());

    Path resinLib = resinHome.lookup("lib");

    if (resinLib.lookup("pro.jar").canRead())
      addClassPath(classPath, resinLib.lookup("pro.jar").getNativePath());
    addClassPath(classPath, resinLib.lookup("resin.jar").getNativePath());
    //    addClassPath(classPath, resinLib.lookup("jaxrpc-15.jar").getNativePath());

    String []list = resinLib.list();

    for (int i = 0; i < list.length; i++) {
      if (! list[i].endsWith(".jar"))
        continue;

      Path item = resinLib.lookup(list[i]);

      String pathName = item.getNativePath();

      if (! classPath.contains(pathName))
        addClassPath(classPath, pathName);
    }
View Full Code Here

  {
    _xslGenerator = xslGenerator;
   
    _workPath = xslGenerator.getWorkPath();

    Path path = xslGenerator.getStylePath();

    _context = path;
    _topContext = _context;
    _loader = xslGenerator.getClassLoader();
    if (_loader == null)
View Full Code Here

    scanFiles(top);

    if (_qDoc != null) {
      ArrayList depends = (ArrayList) _qDoc.getProperty(CauchoDocument.DEPENDS);
      for (int i = 0; depends != null && i < depends.size(); i++) {
        Path path = (Path) depends.get(i);
        addDepend(path);
      }
    }
    else {
      addDepend(_path);
View Full Code Here

        rs = _xslGenerator.openPath(href, _context.getURL());
      } catch (Exception e) {
        throw new XslParseException(e);
      }

      Path path = rs.getPath();
     
      Document xsl = readXsl(rs);
      Element subtop = xsl.getDocumentElement();

      if (subtop == null)
        throw error(elt, L.l("xsl:import file {0} is empty", path.getFullPath()));
     
      Path oldContext = _context;

      Path virtualPath = _context.getParent().lookup(href);
      _context = virtualPath;

      _files.put(virtualPath.getPath(), xsl);
     
      scanFiles(subtop);
      _context = oldContext;
    }
  }
View Full Code Here

  {
    QElement element = (QElement) elt;
    _isCauchoXsl = ! element.getAttribute("xsl-caucho").equals("");

    String systemId = element.getBaseURI();
    Path oldContext = _context;

    if (systemId != null)
      _context = _context.lookup(systemId);
   
    XslNode stylesheet = createChild(element);
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.