Package org.apache.commons.vfs2.cache

Examples of org.apache.commons.vfs2.cache.SoftRefFilesCache$SoftRefReleaseThread


    {
        FileObject file = null;
        try
        {
            file = getReadFolder().resolveFile("file1.txt");
            RandomAccessContent ra = file.getContent().getRandomAccessContent(RandomAccessMode.READ);

            // read first byte
            byte c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(0));
            assertEquals("fp", ra.getFilePointer(), 1);

            // start at pos 4
            ra.seek(3);
            c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(3));
            assertEquals("fp", ra.getFilePointer(), 4);

            c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(4));
            assertEquals("fp", ra.getFilePointer(), 5);

            // restart at pos 4
            ra.seek(3);
            c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(3));
            assertEquals("fp", ra.getFilePointer(), 4);

            c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(4));
            assertEquals("fp", ra.getFilePointer(), 5);

            // advance to pos 11
            ra.seek(10);
            c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(10));
            assertEquals("fp", ra.getFilePointer(), 11);

            c = ra.readByte();
            assertEquals(c, TEST_DATA.charAt(11));
            assertEquals("fp", ra.getFilePointer(), 12);
        }
        finally
        {
            if (file != null)
            {
View Full Code Here


    public FilesCache getFilesCache()
    {
        if (cache == null)
        {
            // cache = new DefaultFilesCache();
            cache = new SoftRefFilesCache();
        }

        return cache;
    }
View Full Code Here

  @Override
public void setUp() throws Exception {
    manager = new DefaultFileSystemManager();

    manager.setFilesCache(new SoftRefFilesCache());
    manager.setCacheStrategy(CacheStrategy.ON_RESOLVE);

    manager.addProvider("file", new DefaultLocalFileProvider());
    manager.addProvider("tgz", new TarFileProvider());
    manager.addProvider("tar", new TarFileProvider());
View Full Code Here

      vfs.addExtensionMap("bz2", "bz2");
      vfs.addMimeTypeMap("application/x-tar", "tar");
      vfs.addMimeTypeMap("application/x-gzip", "gz");
      vfs.addMimeTypeMap("application/zip", "zip");
      vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
      vfs.setFilesCache(new SoftRefFilesCache());
      vfs.setReplicator(new DefaultFileReplicator(new File(System.getProperty("java.io.tmpdir"), "accumulo-vfs-cache-"
          + System.getProperty("user.name", "nouser"))));
      vfs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
      vfs.init();
    } catch (FileSystemException e) {
View Full Code Here

    vfs.addExtensionMap("bz2", "bz2");
    vfs.addMimeTypeMap("application/x-tar", "tar");
    vfs.addMimeTypeMap("application/x-gzip", "gz");
    vfs.addMimeTypeMap("application/zip", "zip");
    vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
    vfs.setFilesCache(new SoftRefFilesCache());
    String cacheDirPath = AccumuloClassLoader.getAccumuloString(VFS_CACHE_DIR, "");
    String procName = ManagementFactory.getRuntimeMXBean().getName();
    File cacheDir = new File(System.getProperty("java.io.tmpdir"), "accumulo-vfs-cache-" + procName + "-" + System.getProperty("user.name", "nouser"));
    if (!cacheDirPath.isEmpty())
      cacheDir = new File(cacheDirPath);
View Full Code Here

    public void init() throws FileSystemException
    {
        if (filesCache == null)
        {
            // filesCache = new DefaultFilesCache();
            filesCache = new SoftRefFilesCache();
        }
        if (fileContentInfoFactory == null)
        {
            fileContentInfoFactory = new FileContentInfoFilenameFactory();
        }
View Full Code Here

    vfs.addExtensionMap("bz2", "bz2");
    vfs.addMimeTypeMap("application/x-tar", "tar");
    vfs.addMimeTypeMap("application/x-gzip", "gz");
    vfs.addMimeTypeMap("application/zip", "zip");
    vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
    vfs.setFilesCache(new SoftRefFilesCache());
    String cacheDirPath = AccumuloClassLoader.getAccumuloString(VFS_CACHE_DIR, "");
    File cacheDir = new File(System.getProperty("java.io.tmpdir"), "accumulo-vfs-cache-" + System.getProperty("user.name", "nouser"));
    if (!("".equals(cacheDirPath)))
      cacheDir = new File(cacheDirPath);
    vfs.setReplicator(new UniqueFileReplicator(cacheDir));
View Full Code Here

    vfs.addExtensionMap("bz2", "bz2");
    vfs.addMimeTypeMap("application/x-tar", "tar");
    vfs.addMimeTypeMap("application/x-gzip", "gz");
    vfs.addMimeTypeMap("application/zip", "zip");
    vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
    vfs.setFilesCache(new SoftRefFilesCache());
    String cacheDirPath = AccumuloClassLoader.getAccumuloString(VFS_CACHE_DIR, "");
    File cacheDir = computeTopCacheDir();
    if (!cacheDirPath.isEmpty())
      cacheDir = new File(cacheDirPath, "" + uniqueDirectoryGenerator.getAndIncrement());
    vfs.setReplicator(new UniqueFileReplicator(cacheDir));
View Full Code Here

    public FilesCache getFilesCache()
    {
        if (cache == null)
        {
            // cache = new DefaultFilesCache();
            cache = new SoftRefFilesCache();
        }

        return cache;
    }
View Full Code Here

    public void init() throws FileSystemException
    {
        if (filesCache == null)
        {
            // filesCache = new DefaultFilesCache();
            filesCache = new SoftRefFilesCache();
        }
        if (fileContentInfoFactory == null)
        {
            fileContentInfoFactory = new FileContentInfoFilenameFactory();
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs2.cache.SoftRefFilesCache$SoftRefReleaseThread

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.