/** Extract jar file into folder represented by file object. If the JAR contains * files with name filesystem.attributes, it is assumed that these files * has been created by DefaultAttributes implementation and the content * of these files is treated as attributes and added to extracted files. * <p><code>META-INF/</code> directories are skipped over. * * @param fo file object of destination folder * @param is input stream of jar file * @exception IOException if the extraction fails * @deprecated Use of XML filesystem layers generally obsoletes this method. * For tests, use {@link org.openide.util.test.TestFileUtils#unpackZipFile}. */ @Deprecated public static void extractJar(final FileObject fo, final InputStream is) throws IOException { FileSystem fs = fo.getFileSystem(); fs.runAtomicAction( new FileSystem.AtomicAction() { public void run() throws IOException { extractJarImpl(fo, is); } } ); }
getFileSystem().runAtomicAction(r); return r.os;
/** * Executes atomic action. For more info see {@link FileSystem#runAtomicAction}. * <p> * All events about filesystem changes (related to events on all affected instances of <code>FileSystem</code>) * are postponed after the whole <code>atomicCode</code> * is executed. * </p> * @param atomicCode code that is supposed to be run as atomic action. See {@link FileSystem#runAtomicAction} * @throws java.io.IOException * @since 7.5 */ @SuppressWarnings("deprecation") public static final void runAtomicAction(final AtomicAction atomicCode) throws IOException { Repository.getDefault().getDefaultFileSystem().runAtomicAction(atomicCode); }
private void runSaveAA(AtomicAction action) throws IOException { synchronized (saveActions) { saveActions.add(action); } dir.getFileSystem().runAtomicAction(action); }
private void performOperation(final ModelOperation<POMModel> operation) { try { pom.getFileSystem().runAtomicAction(new FileSystem.AtomicAction() { @Override public void run() throws IOException { Utilities.performPOMModelOperations(pom, Collections.singletonList(operation)); } }); } catch (IOException ex) { Exceptions.printStackTrace(ex); } }
public synchronized void save() throws IOException { //System.err.println("save(): dirty=" + dirty + " in " + Thread.currentThread().getName() + " for " + this); if (root == null || !dirty) { return; } //System.err.println("saving in " + Thread.currentThread().getName() + " for " + this); f.getFileSystem().runAtomicAction(this); //System.err.println("!saving in " + Thread.currentThread().getName() + " for " + this); dirty = false; pcs.firePropertyChange(PROP_DIRTY, true, false); } public void run() throws IOException {
private static void extractZip(final FileObject fo, final InputStream is) throws IOException { FileSystem fs = fo.getFileSystem(); fs.runAtomicAction( new FileSystem.AtomicAction() { public void run() throws IOException { extractZipImpl(fo, is); } } ); }
@Override public void saveDocument() throws IOException { dataObject.getPrimaryFile ().getFileSystem ().runAtomicAction (atomicSaveAction); }
/** Executes atomic action with priviledge to create DataObjects. */ public void runAtomicActionSimple (FileObject fo, FileSystem.AtomicAction action) throws java.io.IOException { Collection prev = enterAllowContructor (); try { fo.getFileSystem ().runAtomicAction(action); } finally { exitAllowConstructor (prev); } }
public static DataObject create(final J2MEPlatform plat, final DataFolder f, final String idName) throws IOException { final W w = new W(plat, f, idName); f.getPrimaryFile().getFileSystem().runAtomicAction(w); return w.holder; }
public static DataObject create(final CDCPlatform plat, final DataFolder f, final String idName) throws IOException { W w = new W(plat, f, idName); f.getPrimaryFile().getFileSystem().runAtomicAction(w); return w.holder; }
public static AntProjectHelper createProject(final AppClientProjectCreateData createData) throws IOException { File dir = createData.getProjectDir(); final AntProjectHelper[] h = new AntProjectHelper[1]; final FileObject projectDir = FileUtil.createFolder(dir); // create project in one FS atomic action: FileSystem fs = projectDir.getFileSystem(); fs.runAtomicAction(new FileSystem.AtomicAction() { public void run() throws IOException { AntProjectHelper helper = createProjectImpl(createData, projectDir); h[0] = helper; }}); return h[0]; }
public static AntProjectHelper importProject(final AppClientProjectCreateData createData) throws IOException { File dir = createData.getProjectDir(); final AntProjectHelper[] h = new AntProjectHelper[1]; final FileObject projectDir = FileUtil.createFolder(dir); // create project in one FS atomic action: FileSystem fs = projectDir.getFileSystem(); fs.runAtomicAction(new FileSystem.AtomicAction() { public void run() throws IOException { AntProjectHelper helper = importProjectImpl(createData, projectDir); h[0] = helper; }}); return h[0]; }
public void run() { PropertyChangeEvent e; synchronized (this) { e = keepAlive.removeFirst(); } CDCPlatform plat = (CDCPlatform)e.getSource(); try { holder.getPrimaryFile().getFileSystem().runAtomicAction( new W(plat, holder)); } catch (java.io.IOException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); } }
private void addDescriptorToDeployedDirectory(J2eeModule module, File sunDDFile) { FileObject sunDDTemplate = Utils.getSunDDFromProjectsModuleVersion(module, sunDDFile.getName()); //FileUtil.getConfigFile(resource); if (sunDDTemplate != null) { try { FileObject configFolder = FileUtil.createFolder(sunDDFile.getParentFile()); FileSystem fs = configFolder.getFileSystem(); XmlFileCreator creator = new XmlFileCreator(sunDDTemplate, configFolder, sunDDTemplate.getName(), sunDDTemplate.getExt()); fs.runAtomicAction(creator); } catch (IOException ioe) { Logger.getLogger("glassfish").log(Level.WARNING, "could not create {0}", sunDDTemplate.getPath()); } } }
public void run() { PropertyChangeEvent e; synchronized (this) { e = keepAlive.removeFirst(); } ScalaPlatform plat = (ScalaPlatform)e.getSource(); try { holder.getPrimaryFile().getFileSystem().runAtomicAction( new W(plat, holder, defaultPlatform)); } catch (java.io.IOException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); } }
public static AntProjectHelper createProject(final EjbJarProjectCreateData createData) throws IOException { File dir = createData.getProjectDir(); final FileObject projectDir = FileUtil.createFolder(dir); final AntProjectHelper[] h = new AntProjectHelper[1]; // create project in one FS atomic action: FileSystem fs = projectDir.getFileSystem(); fs.runAtomicAction(new FileSystem.AtomicAction() { public void run() throws IOException { AntProjectHelper helper = createProjectImpl(createData, projectDir); h[0] = helper; }}); return h[0]; }
public static AntProjectHelper importProject(final EjbJarProjectCreateData createData) throws IOException { File dir = createData.getProjectDir(); assert dir != null: "Project folder can't be null"; //NOI18N final FileObject projectDir = FileUtil.createFolder(dir); final AntProjectHelper[] h = new AntProjectHelper[1]; // create project in one FS atomic action: FileSystem fs = projectDir.getFileSystem(); fs.runAtomicAction(new FileSystem.AtomicAction() { public void run() throws IOException { AntProjectHelper helper = importProjectImpl(createData, projectDir); h[0] = helper; }}); return h[0]; }
private void registerDerbyLibrary(final File location) { // , final String name){ final FileObject libsFolder = FileUtil.getConfigFile("org-netbeans-api-project-libraries/Libraries"); //NOI18N if (libsFolder!=null){ try { libsFolder.getFileSystem().runAtomicAction( new DerbyLibraryRegistrar(location,libsFolder)); } catch (FileStateInvalidException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); } catch (IOException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); } } }
private Set<DataObject> createTemplate(TemplateWizard wiz, DataFolder df, String targetName, FileObject cssFolder, JSFVersion jsfVersion) throws IOException { CreateTemplateAction createTemplateAction = new CreateTemplateAction( templatePanel.getComponent(), Templates.getTargetName(wiz), Templates.getTargetFolder(wiz), cssFolder, jsfVersion); df.getPrimaryFile().getFileSystem().runAtomicAction(createTemplateAction); FileObject target = df.getPrimaryFile().getFileObject(targetName, XHTML_EXT); DataObject dob = DataObject.find(target); JSFPaletteUtilities.reformat(dob); return Collections.singleton(dob); }