Examples of FileSystemManager

@author Adam Murdoch
  • org.apache.commons.vfs2.FileSystemManager
    here.org/somefile

  • Absolute local file name. For example, /home/someuser/a-file or c:\dir\somefile.html. Elements in the name can be separated using any of the following characters: /, \, or the native file separator character. For example, the following file names are the same:

     c:\somedir\somefile.xml c:/somedir/somefile.xml 

  • Relative path. For example: ../somefile or somedir/file.txt. The file system manager resolves relative paths against its base file. Elements in the relative path can be separated using /, \, or file system specific separator characters. Relative paths may also contain .. and . elements. See {@link FileObject#resolveFile} for moredetails.

    @author Commons VFS team

  • org.apache.ftpserver.ftplet.FileSystemManager
    This is the file system manager - it returns the file system view for user.
  • org.freeplane.plugin.workspace.io.FileSystemManager

  • Examples of org.apache.commons.vfs2.FileSystemManager

        RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();
        return factory.getScriptEngine(createSession(servletContext));
      }

      public static Session createSession(ServletContext servletContext) {
        FileSystemManager fileSystemManager;
        try {
          fileSystemManager = createFileSystemManager(servletContext);
        } catch (FileSystemException e) {
          LOG.log(Level.SEVERE, "Failed to initialize VFS file system manager", e);
          throw new RuntimeException(e);
        }
        try {

          // initialize our master context here; a fresh but shallow copy will
          // be forked on each incoming request
          Session session = new SessionBuilder()
          .withFileSystemManager(fileSystemManager)
          .withDefaultPackages()
          .build();
         
          session.setWorkingDirectory(fileSystemManager.resolveFile("file:///"));
         
          return session;
        } catch (IOException e) {
          LOG.log(Level.SEVERE, "Failed to initialize master context", e);
          throw new RuntimeException(e);
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

      public void test() throws FileSystemException {

        File basePath = new File(getClass().getResource("/jarfiletest.jar").getFile())
                          .getParentFile();

        FileSystemManager dfsm = AppEngineContextFactory.createFileSystemManager(
            new AppEngineLocalFilesSystemProvider(basePath));

        FileObject jarFile = dfsm.resolveFile("/jarfiletest.jar");
        assertThat(jarFile.getName().getURI(), equalTo("file:///jarfiletest.jar"));
        assertThat(jarFile.exists(), equalTo(true));

        FileObject jarRoot = dfsm.resolveFile("jar:file:///jarfiletest.jar!/r/library");
        assertThat(jarRoot.exists(), equalTo(true));
        assertThat(jarRoot.getType(), equalTo(FileType.FOLDER));
        assertThat(jarRoot.getChildren().length, equalTo(1));
      }
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

    public class AppEngineContextFactoryTest {

      @Test
      public void rootFile() throws IOException {
        DefaultLocalFileProvider localFileProvider = new DefaultLocalFileProvider();
        FileSystemManager fsm = AppEngineContextFactory.createFileSystemManager(localFileProvider);

        Session session = new SessionBuilder()
        .withFileSystemManager(fsm)
        .build();
       
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

        ReloadingClassLoader localLoader = loader;
        while (null == localLoader) {
          synchronized (lock) {
            if (null == loader) {
             
              FileSystemManager vfs = generateVfs();
             
              // Set up the 2nd tier class loader
              if (null == parent) {
                parent = AccumuloClassLoader.getClassLoader();
              }
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

                return null;
            }

            try
            {
                FileSystemManager fsManager = VFS.getManager();
                String uri = resolveFileURI();
                if (uri == null)
                {
                    throw new ConfigurationRuntimeException("Unable to determine file to monitor");
                }
                return fsManager.resolveFile(uri);
            }
            catch (FileSystemException fse)
            {
                String msg = "Unable to monitor " + getFileHandler().getURL().toString();
                log.error(msg);
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

        public OutputStream getOutputStream(URL url) throws ConfigurationException
        {
            try
            {
                FileSystemOptions opts = getOptions(url.getProtocol());
                FileSystemManager fsManager = VFS.getManager();
                FileObject file = (opts == null) ? fsManager.resolveFile(url.toString())
                        : fsManager.resolveFile(url.toString(), opts);
                // throw an exception if the target URL is a directory
                if (file == null || file.getType() == FileType.FOLDER)
                {
                    throw new ConfigurationException("Cannot save a configuration to a directory");
                }
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

            {
                return super.getPath(file, url, basePath, fileName);
            }
            try
            {
                FileSystemManager fsManager = VFS.getManager();
                if (url != null)
                {
                    FileName name = fsManager.resolveURI(url.toString());
                    if (name != null)
                    {
                        return name.toString();
                    }
                }

                if (UriParser.extractScheme(fileName) != null)
                {
                    return fileName;
                }
                else if (basePath != null)
                {
                    FileName base = fsManager.resolveURI(basePath);
                    return fsManager.resolveName(base, fileName).getURI();
                }
                else
                {
                    FileName name = fsManager.resolveURI(fileName);
                    FileName base = name.getParent();
                    return fsManager.resolveName(base, name.getBaseName()).getURI();
                }
            }
            catch (FileSystemException fse)
            {
                fse.printStackTrace();
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

            {
                return super.getBasePath(path);
            }
            try
            {
                FileSystemManager fsManager = VFS.getManager();
                FileName name = fsManager.resolveURI(path);
                return name.getParent().getURI();
            }
            catch (FileSystemException fse)
            {
                fse.printStackTrace();
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

            {
                return super.getFileName(path);
            }
            try
            {
                FileSystemManager fsManager = VFS.getManager();
                FileName name = fsManager.resolveURI(path);
                return name.getBaseName();
            }
            catch (FileSystemException fse)
            {
                fse.printStackTrace();
    View Full Code Here

    Examples of org.apache.commons.vfs2.FileSystemManager

            {
                return super.getURL(basePath, file);
            }
            try
            {
                FileSystemManager fsManager = VFS.getManager();

                FileName path;
                if (basePath != null && UriParser.extractScheme(file) == null)
                {
                    FileName base = fsManager.resolveURI(basePath);
                    path = fsManager.resolveName(base, file);
                }
                else
                {
                    path = fsManager.resolveURI(file);
                }

                URLStreamHandler handler = new VFSURLStreamHandler(path);
                return new URL(null, path.getURI(), handler);
            }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.