Examples of FSEntry


Examples of ca.carleton.gcrc.couch.fsentry.FSEntry

     
      // htdocs from atlas project
      {
        File htdocsDir = new File(atlasDir, "htdocs");
        if( htdocsDir.exists() && htdocsDir.isDirectory() ) {
          FSEntry positionedHtDocs = FSEntryFile.getPositionedFile("d/_attachments", htdocsDir);
          mergedEntries.add(positionedHtDocs);
        }
      }
     
      // site from atlas project
      {
        File siteDir = new File(atlasDir, "site");
        if( siteDir.exists() && siteDir.isDirectory() ) {
          FSEntry siteEntry = new FSEntryFile(siteDir);
          mergedEntries.add(siteEntry);
        }
      }

      // Create atlas designator
      {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
       
        pw.println("var n2atlas = {");
        pw.println("\tname: \""+atlasProperties.getAtlasName()+"\"");
        pw.println("\t,restricted: "+atlasProperties.isRestricted());
        pw.println("};");
        pw.println("if( typeof(exports) === 'object' ) {");
        pw.println("\texports.name = n2atlas.name;");
        pw.println("\texports.restricted = n2atlas.restricted;");
        pw.println("};");
       
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString());
        mergedEntries.add(f);
        f = FSEntryBuffer.getPositionedBuffer("a/_attachments/lib/atlas.js", sw.toString());
        mergedEntries.add(f);
      }
     
     
      // Template for _design/site
      {
        File siteDesignDocDir = PathComputer.computeSiteDesignDir( gs.getInstallDir() );
        if( siteDesignDocDir.exists() && siteDesignDocDir.isDirectory() ){
          FSEntry templateDir = new FSEntryFile(siteDesignDocDir);
          mergedEntries.add(templateDir);
        } else {
          throw new Exception("Unable to find internal template for _design/site");
        }
      }
     
      FSEntry merged = new FSEntryMerged(mergedEntries);
      doc = DocumentFile.createDocument(merged);
    }

    // Update document
    updateProcess.update(doc);
View Full Code Here

Examples of org.jnode.fs.FSEntry

    }
   
    @Test
    public void testGetRootEntry() throws Exception {
        setUp();
        FSEntry rootEntry = getFs().getRootEntry();
        log.debug(FSUtils.toString(rootEntry, false));
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

                // success
            }
            assertContainsOnly("must be empty", rootDir.iterator(), getEmptyDirNames(config, true));
        } else {
            try {
                FSEntry entry = rootDir.addDirectory(dirName);
                // success
                log.debug("added directory entry=" + FSUtils.toString(entry, true));
            } catch (ReadOnlyFileSystemException e) {
                fail("addDirectory must succeed in read/write mode");
            }
            assertContainsOnly("must contain " + dirName, rootDir.iterator(),
                TestUtils.append(getEmptyDirNames(config, true), new String[]{dirName}));
            FSEntry gotEntry = rootDir.getEntry(dirName);
            assertNotNull("must contain the added directory", gotEntry);
            assertEquals("returned bad entry", dirName, gotEntry.getName());
        }
        log.debug("Root dir after testAddDirectory :\n" + rootDir);
        TestUtils.listEntries(rootDir.iterator());
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

            }

            assertContainsOnly("must be empty", rootDir.iterator(), getEmptyDirNames(config, true));
        } else {
            try {
                FSEntry entry = rootDir.addFile(fileName);
                // success
                log.debug("added file entry=" + FSUtils.toString(entry, true));
            } catch (ReadOnlyFileSystemException e) {
                fail("addFile must succeed in read/write mode");
            }
            assertContainsOnly("must contain " + fileName, rootDir.iterator(),
                TestUtils.append(getEmptyDirNames(config, true), new String[]{fileName}));
            FSEntry gotEntry = rootDir.getEntry(fileName);
            assertNotNull("must contain the added file", gotEntry);
            assertEquals("returned bad entry", fileName, gotEntry.getName());
        }
        log.debug("Root dir after testAddFile :\n" + rootDir);
        TestUtils.listEntries(rootDir.iterator());
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

        if (!config.isReadOnly()) {
            setUp();

            String filename = "a file to test.text";
            FSDirectory rootDir = getFs().getRootEntry().getDirectory();
            FSEntry entry = rootDir.addFile(filename);
            FSEntry gotEntry = rootDir.getEntry(filename);
            assertNotNull("must contain the added file", gotEntry);
            assertEquals("returned bad entry", filename, gotEntry.getName());

            log.debug("entry before remount=" + FSUtils.toString(entry, true));
            remountFS(config, config.isReadOnly());

            FSDirectory rootDir2 = getFs().getRootEntry().getDirectory();
            TestUtils.listEntries(rootDir2.iterator());
            assertFalse("same ref (rootDir) after remount", rootDir == rootDir2);
            FSEntry gotEntry2 = rootDir2.getEntry(filename);
            assertFalse("same ref (gotEntry2) after remount", gotEntry == gotEntry2);
            assertNotNull("must contain the added file", gotEntry2);
            assertEquals("returned bad entry", filename, gotEntry2.getName());
            log.debug("entry after remount=" + FSUtils.toString(gotEntry2, true));
        }
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

            String filename = "a file to test.text";
            FSDirectory rootDir = getFs().getRootEntry().getDirectory();
            /*FSEntry entry =*/
            rootDir.addFile(filename);
            FSEntry gotEntry = rootDir.getEntry(filename);
            assertNotNull("must contain the added file", gotEntry);
            assertEquals("returned bad entry", filename, gotEntry.getName());

            rootDir.remove(filename);
            assertNull("must not contain the removed file", rootDir.getEntry(filename));

            remountFS(config, config.isReadOnly());

            FSDirectory rootDir2 = getFs().getRootEntry().getDirectory();
            TestUtils.listEntries(rootDir2.iterator());
            assertFalse("same ref (rootDir) after remount", rootDir == rootDir2);
            FSEntry gotEntry2 = rootDir2.getEntry(filename);
            assertNull("must not contain the removed file: FS=" + getFs().getType().getName(), gotEntry2);
        }
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

    /**
     * Does the given file exist?
     */
    public boolean fileExists(String file) {
        final FSEntry entry = getEntry(file);
        return (entry != null);
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

    /**
     * Is the given File a plain file?
     */
    public boolean isFile(String file) {
        final FSEntry entry = getEntry(file);
        return (entry != null) && (entry.isFile());
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

    /**
     * Is the given File a directory?
     */
    public boolean isDirectory(String file) {
        final FSEntry entry = getEntry(file);
        return (entry != null) && (entry.isDirectory());
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

     * exist.
     *
     * @param file
     */
    public long getLength(String file) {
        final FSEntry entry = getEntry(file);
        if (entry != null) {
            if (entry.isFile()) {
                try {
                    return entry.getFile().getLength();
                } catch (IOException ex) {
                    log.debug("Error in getLength", ex);
                    return 0;
                }
            } else {
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.