/** * 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(); }
parent.getData().addChild(file.getData()); parent.close();