private synchronized FileObject processFile( FileName name, boolean useCache ) throws FileSystemException { if ( !super.getRootName().getRootURI().equals( name.getRootURI() ) ) { throw new FileSystemException( "vfs.provider/mismatched-fs-for-name.error", new Object[] { name, super.getRootName(), name.getRootURI() } ); } else { FileObject file; if ( useCache ) { file = super.getFileFromCache( name ); } else { file = null; } if ( file == null ) { try { file = this.createFile( (AbstractFileName) name ); } catch ( Exception var5 ) { return null; } file = super.decorateFileObject( file ); if ( useCache ) { super.putFileToCache( file ); } } if ( super.getFileSystemManager().getCacheStrategy().equals( CacheStrategy.ON_RESOLVE ) ) { file.refresh(); } return file; } }
/** * Closes this component. */ @Override public void close() { closeCommunicationLink(); parentLayer = null; }
file = getFileFromCache(name); } else { file = null; file = createFile((AbstractFileName) name); } catch (final Exception e) { throw new FileSystemException("vfs.provider/resolve-file.error", name, e); file = decorateFileObject(file); putFileToCache(file); if (getFileSystemManager().getCacheStrategy().equals(CacheStrategy.ON_RESOLVE)) { file.refresh();
/** * Finds a file in this file system. * * @param nameStr The name of the file to resolve. * @return The located FileObject or null if none could be located. * @throws FileSystemException if an error occurs. */ @Override public FileObject resolveFile(final String nameStr) throws FileSystemException { // Resolve the name, and create the file final FileName name = getFileSystemManager().resolveName(rootName, nameStr); return resolveFile(name); }
synchronized (fs) { if (!fs.hasCapability(Capability.LIST_CHILDREN)) { throw new FileNotFolderException(fileName); for (int i = 0; i < files.length; i++) { final String file = files[i]; cache[i] = fs.getFileSystemManager().resolveName(fileName, file, NameScope.CHILD);
/** * Close the FileSystem. * @param filesystem The FileSystem to close. */ public void closeFileSystem(final FileSystem filesystem) { final AbstractFileSystem fs = (AbstractFileSystem) filesystem; synchronized (myFileSystemsLock) { if (fs.getCacheKey() != null) { fileSystems.remove(fs.getCacheKey()); } } removeComponent(fs); fs.close(); }
/** * Free unused resources. */ public void freeUnusedResources() { AbstractFileSystem[] abstractFileSystems; synchronized (fileSystems) { // create snapshot under lock abstractFileSystems = fileSystems.values().toArray(EMPTY_ABSTRACTFILESYSTEMS); } // process snapshot outside lock for (final AbstractFileSystem fs : abstractFileSystems) { if (fs.isReleaseable()) { fs.closeCommunicationLink(); } } }
/** * Close the RAMFileSystem. */ @Override public void close() { this.cache.clear(); super.close(); } }
/** * Creates the FileContentInfo factory. * * @return The FileContentInfoFactory. */ protected FileContentInfoFactory getFileContentInfoFactory() { return fs.getFileSystemManager().getFileContentInfoFactory(); }
@Override public void init() throws FileSystemException { super.init();
/** * Notify the parent of a change to its children, when a child is created or deleted. * * @param childName The name of the child. * @param newType The type of the child. * @throws Exception if an error occurs. */ private void notifyParent(final FileName childName, final FileType newType) throws Exception { if (parent == null) { final FileName parentName = fileName.getParent(); if (parentName != null) { // Locate the parent, if it is cached parent = fs.getFileFromCache(parentName); } } if (parent != null) { FileObjectUtils.getAbstractFileObject(parent).childrenChanged(childName, newType); } }
/** * Close the underlying link used to access the files. */ public void closeCommunicationLink() { synchronized (this) { doCloseCommunicationLink(); } }
/** * Initializes this component. * * @throws FileSystemException if an error occurs. */ @Override public void init() throws FileSystemException { addCapabilities(caps); }
/** * Adds a file system to those cached by this provider. The file system * may implement {@link VfsComponent}, in which case it is initialised. * * @return A FileSystem which was added, or which was already added if that key * already hade associated one */ protected FileSystem addFileSystem(final Comparable<?> key, final FileSystem fs) throws FileSystemException { final FileSystemKey treeKey = new FileSystemKey(key, fs.getFileSystemOptions()); ((AbstractFileSystem) fs).setCacheKey(treeKey); //[IntelliJ] WI-31041 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ FileSystem existingFileSystem; synchronized (myFileSystemsLock) { existingFileSystem = fileSystems.get(treeKey); if (existingFileSystem == null) { // Add to the cache addComponent(fs); fileSystems.put(treeKey, fs); return fs; } } ((AbstractFileSystem) fs).close(); return existingFileSystem; //[IntelliJ] WI-31041 ------------------------------------------------------------- }
file = getFileFromCache(name); } else { file = null; file = createFile((AbstractFileName) name); } catch (final Exception e) { throw new FileSystemException("vfs.provider/resolve-file.error", name, e); file = decorateFileObject(file); putFileToCache(file); if ((file != null) && getFileSystemManager().getCacheStrategy().equals(CacheStrategy.ON_RESOLVE)) { file.refresh();
/** * Finds a file in this file system. * * @param nameStr The name of the file to resolve. * @return The located FileObject or null if none could be located. * @throws FileSystemException if an error occurs. */ @Override public FileObject resolveFile(final String nameStr) throws FileSystemException { // Resolve the name, and create the file final FileName name = getFileSystemManager().resolveName(rootName, nameStr); return resolveFile(name); }
synchronized (fileSystem) { if (!fileSystem.hasCapability(Capability.LIST_CHILDREN)) { throw new FileNotFolderException(fileName); for (int i = 0; i < files.length; i++) { final String file = files[i]; cache[i] = fileSystem.getFileSystemManager().resolveName(fileName, file, NameScope.CHILD);
/** * Close the FileSystem. * * @param filesystem The FileSystem to close. */ public void closeFileSystem(final FileSystem filesystem) { final AbstractFileSystem fs = (AbstractFileSystem) filesystem; final FileSystemKey key = fs.getCacheKey(); if (key != null) { fileSystems.remove(key); } removeComponent(fs); fs.close(); }
/** * Free unused resources. */ public void freeUnusedResources() { AbstractFileSystem[] abstractFileSystems; synchronized (fileSystems) { // create snapshot under lock abstractFileSystems = fileSystems.values().toArray(EMPTY_ABSTRACTFILESYSTEMS); } // process snapshot outside lock for (final AbstractFileSystem fs : abstractFileSystems) { if (fs.isReleaseable()) { fs.closeCommunicationLink(); } } }
@Override public void close() { super.close(); junctions.clear(); } }