@Override public int getDepth() { return fileName.getDepth(); }
protected boolean doIsWriteable() throws Exception { if ( getName().getDepth() < 2 ) { return false; } return true; }
/** * Determines the type of this file. Must not return null. The return value of this method is cached, so the * implementation can be expensive. */ protected FileType doGetType() throws Exception { if ( getName().getDepth() < 2 ) { return FileType.FOLDER; } if ( fs.exists( getName() ) == false ) { return FileType.IMAGINARY; } if ( fs.isDirectory( getName() ) ) { return FileType.FOLDER; } return FileType.FILE; }
/** * Saves a file * * @param file * @throws FileSystemException */ void save(final RamFileObject file) throws FileSystemException { // Validate name if (file.getData().getName() == null) { throw new FileSystemException(new IllegalStateException("The data has no name. " + file)); } // Add to the parent if (file.getName().getDepth() > 0) { final RamFileData parentData = this.cache.get(file.getParent().getName()); // Only if not already added if (!parentData.hasChildren(file.getData())) { final RamFileObject parent = (RamFileObject) file.getParent(); parent.getData().addChild(file.getData()); parent.close(); } } // Store in cache cache.put(file.getName(), file.getData()); file.getData().updateLastModified(); file.close(); }
/** * Saves a file * * @param file * @throws FileSystemException */ void save(final RamFileObject file) throws FileSystemException { // Validate name if (file.getData().getName() == null) { throw new FileSystemException(new IllegalStateException("The data has no name. " + file)); } // Add to the parent if (file.getName().getDepth() > 0) { final RamFileData parentData = this.cache.get(file.getParent().getName()); // Only if not already added if (!parentData.hasChildren(file.getData())) { final RamFileObject parent = (RamFileObject) file.getParent(); parent.getData().addChild(file.getData()); parent.close(); } } // Store in cache cache.put(file.getName(), file.getData()); file.getData().updateLastModified(); file.close(); }
/** * Saves a file * * @param file * @throws FileSystemException */ void save(final RamFileObject file) throws FileSystemException { // Validate name if (file.getData().getName() == null) { throw new FileSystemException(new IllegalStateException("The data has no name. " + file)); } // Add to the parent if (file.getName().getDepth() > 0) { final RamFileData parentData = this.cache.get(file.getParent().getName()); // Only if not already added if (!parentData.hasChildren(file.getData())) { final RamFileObject parent = (RamFileObject) file.getParent(); parent.getData().addChild(file.getData()); parent.close(); } } // Store in cache cache.put(file.getName(), file.getData()); file.getData().updateLastModified(); file.close(); }
if (file.getName().getDepth() > 0)