protected void lock(String name) throws IOException { throw new FSException(NbBundle.getMessage(JarFileSystem.class, "EXC_CannotLock_JAR", name, root)); }
public void lock(String name) throws IOException { throw new FSException(NbBundle.getMessage(XMLFileSystem.class, "EXC_CannotLock", null, null, name)); }
protected void createFolder(String name) throws java.io.IOException { File f = getFile(name); if (name.equals("")) { // NOI18N throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotCreateF", f.getName(), getDisplayName(), f.getAbsolutePath())); } if (f.exists()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_FolderAlreadyExist", f.getName(), getDisplayName(), f.getAbsolutePath())); } boolean b = createRecursiveFolder(f); if (!b) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotCreateF", f.getName(), getDisplayName(), f.getAbsolutePath())); } }
protected void lock(String name) throws IOException { File file = getFile(name); if ((!file.canWrite() && file.exists()) || isReadOnly()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotLock", null, null, file.getAbsolutePath())); } }
/** Finds the system to create writable version of the file on. * * @param name name of the file (full) * @return the first one * @exception IOException if the filesystem is readonly */ protected FileSystem createWritableOn(String name) throws IOException { if (isReadOnly()) { throw new FSException(NbBundle.getMessage(MultiFileSystem.class, "EXC_FSisRO", getDisplayName())); } return systems[WRITE_SYSTEM_INDEX]; }
/** Copies this file. This allows the filesystem to perform any additional * operation associated with the copy. But the default implementation is simple * copy of the file and its attributes * * @param target target folder to move this file to * @param name new basename of file * @param ext new extension of file (ignored for folders) * @return the newly created file object representing the moved file */ public FileObject copy(FileObject target, String name, String ext) throws IOException { if (FileUtil.isParentOf(this, target)) { throw new FSException(NbBundle.getMessage(FileObject.class, "EXC_CopyChild", this, target)); // NOI18N } return leader.copy(target, name, ext); }
/** Tests the lock if it is valid, if not throws exception. * @param l lock to test */ private void testLock(FileLock l) throws IOException { if (lock == null) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_InvalidLock", l, getPath(), getAbstractFileSystem().getDisplayName(), lock)); } if (lock.get() != l) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_InvalidLock", l, getPath(), getAbstractFileSystem().getDisplayName(), lock.get())); } }
/** Tests the lock if it is valid, if not throws exception. * @param l lock to test * @return the mf lock for this file object */ private MfLock testLock(FileLock l) throws java.io.IOException { if (lock == null) { throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_InvalidLock", l, getPath(), getMultiFileSystem().getDisplayName(), lock)); } if (lock.get() != l) { throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_InvalidLock", l, getPath(), getMultiFileSystem().getDisplayName(), lock.get())); } return (MfLock) l; }
final String msg = NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotRename", oldName, getDisplayName(), newName, existsNF, rename); if (retry > 10) { throw new FSException(msg);
/** fireFileChange defines if should be fired fileChanged event after close of stream*/ synchronized OutputStream getOutputStream(FileLock lock, boolean fireFileChanged) throws IOException { FileSystem fs = getAbstractFileSystem(); if (fs.isReadOnly()) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", fs.getDisplayName())); } if (isReadOnly()) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FisRO", name, fs.getDisplayName())); } testLock(lock); return StreamPool.createOutputStream(this, fireFileChanged); }
/** Set the root directory of the filesystem. * @param r file to set root to * @exception PropertyVetoException if the value if vetoed by someone else (usually * by the {@link org.openide.filesystems.Repository Repository}) * @exception IOException if the root does not exists or some other error occured */ public synchronized void setRootDirectory(File r) throws PropertyVetoException, IOException { if (!r.exists() || r.isFile()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_RootNotExist", r.getAbsolutePath())); } String oldDisplayName = getDisplayName(); _setSystemName(computeSystemName(r)); rootFile = r; firePropertyChange(PROP_ROOT, null, refreshRoot()); firePropertyChange(PROP_DISPLAY_NAME, oldDisplayName, getDisplayName()); }
protected void delete(String name) throws IOException { File file = getFile(name); if (deleteFile(file) != SUCCESS) { if (file.exists()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath())); } else { /** When file externaly deleted and fo.delete () is called before periodical refresh */ FileObject thisFo = findResource(name); if (thisFo != null) { if (thisFo.getParent() != null) { thisFo.getParent().refresh(); } thisFo.refresh(); if (thisFo.isValid()) { throw new FSException(NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotDelete", name, getDisplayName(), file.getAbsolutePath())); } } } } }
throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_SlashNotAllowed", name)); throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", fs.getDisplayName())); throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FisRO", name, fs.getDisplayName())); throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FoNotFolder", name, getPath(), fs.getDisplayName()));
throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", fs.getDisplayName())); throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FisRO", name, fs.getDisplayName())); throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FoNotFolder", n, getPath(), fs.getDisplayName()));
throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FSisRO", fs.getDisplayName())); throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FisRO", name, fs.getDisplayName())); throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FoNotFolder", n, getPath(), fs.getDisplayName())); throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_DataAlreadyExist", n, fs.getDisplayName(), getPath()));
/** Copies this file. This allows the filesystem to perform any additional * operation associated with the copy. But the default implementation is simple * copy of the file and its attributes * * @param target target folder to move this file to * @param name new basename of file * @param ext new extension of file (ignored for folders) * @return the newly created file object representing the moved file */ public FileObject copy(FileObject target, String name, String ext) throws IOException { if (isFolder()) { if (FileUtil.isParentOf(this, target)) { throw new FSException(NbBundle.getMessage(FileObject.class, "EXC_OperateChild", this, target)); // NOI18N } FileObject peer = target.createFolder(name); FileUtil.copyAttributes(this, peer); for (FileObject fo : getChildren()) { fo.copy(peer, fo.getName(), fo.getExt()); } return peer; } FileObject dest = FileUtil.copyFileImpl(this, target, name, ext); return dest; }
throws IOException { if (FileUtil.isParentOf(this, target)) { throw new FSException(NbBundle.getMessage(FileObject.class, "EXC_MoveChild", this, target)); // NOI18N throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_CannotDeleteRoot", fs.getDisplayName())); throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FSisRO", fs.getDisplayName()));
throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FSisRO", fs.getDisplayName())); throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FoNotFolder", name, getPath(), fs.getDisplayName())); throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FolderAlreadyExist", name, fs.getDisplayName(), getPath()));
void handleDelete(FileLock lock) throws IOException { if (parent == null) { throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_CannotDeleteRoot", getMultiFileSystem().getDisplayName())); } MultiFileSystem fs = getMultiFileSystem(); try { getFileSystem().beginAtomicAction(); synchronized (parent) { String fullName = getPath(); FileSystem single = fs.createWritableOn(fullName); if (needsMask(lock, true)) { getMultiFileSystem().maskFile(single, fullName); updateFoldersLock(getParent()); } String n = name; validFlag = false; /** [PENDING] expected rename of some refresh method */ //parent.internalRefresh (null, n, true, false, null); parent.refresh(null, n, true, false); if (hasAtLeastOneListeners()) { fileDeleted0(new FileEvent(this)); } } } finally { getFileSystem().finishAtomicAction(); } }
void handleDelete(FileLock lock) throws IOException { if (parent == null) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_CannotDeleteRoot", getAbstractFileSystem().getDisplayName()));