/** This filesystem is readonly if it has not writable system. */ public @Override boolean isReadOnly() { return WRITE_SYSTEM_INDEX >= systems.length || systems[WRITE_SYSTEM_INDEX] == null || systems[WRITE_SYSTEM_INDEX].isReadOnly(); }
boolean canHaveRootAttributeOnReadOnlyFS(String name) { Set<String> tmp = rootAttributes; if (tmp == null) { tmp = new HashSet<String>(); for (FileSystem fs : getDelegates()) { if (fs == null) { continue; } if (!fs.isReadOnly()) { continue; } Enumeration<String> en = fs.getRoot().getAttributes(); while (en.hasMoreElements()) { tmp.add(en.nextElement()); } rootAttributes = tmp; } } if (tmp == Collections.<String>emptySet()) { return true; } return tmp.contains(name); } }
/** Deletes a all mask files that mask the given file. All * higher levels then fs are checked and mask is deleted if necessary * @param fs filesystem where res is placed * @param res resource name of the file that should be unmasked * @exception IOException if it fails */ void unmaskFileOnAll(FileSystem fs, String res) throws IOException { FileSystem[] fss = this.getDelegates(); for (int i = 0; i < fss.length; i++) { if ((fss[i] == null) || fss[i].isReadOnly()) { continue; } unmaskFile(fss[i], res); /** unamsk on all higher levels, which mask files on fs-layer */ if (fss[i] == fs) { return; } } }
/** 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); }
fire && (added == null) && (removed == null) && !getFileSystem().isReadOnly() && !(this instanceof MultiFileObject) ) {
if (getFileSystem().isReadOnly()) { throw new FSException(NbBundle.getMessage(AbstractFileObject.class, "EXC_FSisRO", getAbstractFileSystem().getDisplayName()));
try { FileSystem foFs = localFo.getFileSystem(); if (!foFs.isReadOnly() || getMultiFileSystem().canHaveRootAttributeOnReadOnlyFS(prefixattr)) { localFo = foFs.getRoot(); oPerf = getAttribute(localFo, prefixattr, ""); // NOI18N writable != null && !writable.isReadOnly(); //NOI18N !systems[i].isReadOnly() || getMultiFileSystem().canHaveRootAttributeOnReadOnlyFS(prefixattr) ) {
if (getFileSystem().isReadOnly()) { throw new FSException(NbBundle.getMessage(MultiFileObject.class, "EXC_FSisRO", getMultiFileSystem().getDisplayName()));
/** This filesystem is readonly if it has not writable system. */ public boolean isReadOnly () { return systems[WRITE_SYSTEM_INDEX] == null || systems[WRITE_SYSTEM_INDEX].isReadOnly (); }
@Override public boolean isReadOnly() { return this.explicit!=null?this.explicit.isReadOnly():false; }
/** This filesystem is readonly if it has not writable system. */ public boolean isReadOnly () { return systems[WRITE_SYSTEM_INDEX] == null || systems[WRITE_SYSTEM_INDEX].isReadOnly (); }
/** 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 (systems[WRITE_SYSTEM_INDEX] == null || systems[WRITE_SYSTEM_INDEX].isReadOnly ()) { FSException.io ("EXC_FSisRO", getDisplayName ()); // NOI18N } return systems[WRITE_SYSTEM_INDEX]; }
/** 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 (systems[WRITE_SYSTEM_INDEX] == null || systems[WRITE_SYSTEM_INDEX].isReadOnly ()) { FSException.io ("EXC_FSisRO", getDisplayName ()); // NOI18N } return systems[WRITE_SYSTEM_INDEX]; }
/** Deletes a all mask files that mask the given file. All * higher levels then fs are checked and mask is deleted if necessary * @param fs filesystem where res is placed * @param res resource name of the file that should be unmasked * @exception IOException if it fails */ void unmaskFileOnAll (FileSystem fs,String res) throws IOException { FileSystem[] fss = this.getDelegates(); for (int i = 0; i < fss.length ; i++) { if (fss[i] == null || fss[i].isReadOnly()) continue; unmaskFile (fss[i], res); /** unamsk on all higher levels, which mask files on fs-layer */ if (fss[i] == fs) return; } }
@Override protected FileSystem createWritableOn(String name) throws IOException { if( name.endsWith(LayerUtil.HIDDEN) ) { FileObject fo = findResource(name); if( null != fo ) { try { FileSystem fs = findSystem(fo); if( fs.isReadOnly() ) throw new IOException(); } catch( IllegalArgumentException e ) { //ignore } } } return super.createWritableOn(name); } }
/** Deletes a all mask files that mask the given file. All * higher levels then fs are checked and mask is deleted if necessary * @param fs filesystem where res is placed * @param res resource name of the file that should be unmasked * @exception IOException if it fails */ void unmaskFileOnAll (FileSystem fs,String res) throws IOException { FileSystem[] fss = this.getDelegates(); for (int i = 0; i < fss.length ; i++) { if (fss[i] == null || fss[i].isReadOnly()) continue; unmaskFile (fss[i], res); /** unamsk on all higher levels, which mask files on fs-layer */ if (fss[i] == fs) return; } }
if (((FileSystem)fileSystemRef.get ()).isReadOnly ()) return NbBundle.getMessage(TemplateWizard2.class, "MSG_fs_is_readonly"); // NOI18N
/** fireFileChange defines if should be fired fileChanged event after close of stream*/ synchronized OutputStream getOutputStream (FileLock lock, boolean fireFileChanged) throws java.io.IOException { FileSystem fs = getAbstractFileSystem (); if (fs.isReadOnly()) FSException.io("EXC_FSisRO", fs.getDisplayName ()); // NOI18N if (isReadOnly()) FSException.io("EXC_FisRO", name, fs.getDisplayName ()); // NOI18N testLock (lock); return StreamPool.createOutputStream(this, fireFileChanged); }
/** fireFileChange defines if should be fired fileChanged event after close of stream*/ synchronized OutputStream getOutputStream (FileLock lock, boolean fireFileChanged) throws java.io.IOException { FileSystem fs = getAbstractFileSystem (); if (fs.isReadOnly()) FSException.io("EXC_FSisRO", fs.getDisplayName ()); // NOI18N if (isReadOnly()) FSException.io("EXC_FisRO", name, fs.getDisplayName ()); // NOI18N testLock (lock); return StreamPool.createOutputStream(this, fireFileChanged); }
FSException.io ("EXC_CannotRename", getPath (), getAbstractFileSystem ().getDisplayName (), newFullName); // NOI18N if (getFileSystem ().isReadOnly()) { FSException.io ("EXC_FSisRO", getAbstractFileSystem ().getDisplayName ()); // NOI18N