long start; beginAtomicAction(); closeCurrentRoot(false); j = reOpenJarFile(); } else { if (!duplicateReported) { LOGGER.warning("Duplicate entries in " + getJarFile() + ": " + name + "; please report to JAR creator."); closeCurrentRoot(false); refreshExistingFileObjects(); watcherTask = req.post(watcherTask(), checkTime); finishAtomicAction();
@Override public void fileDeleted(FileEvent fe) { Enumeration<? extends FileObject> en = existingFileObjects(getRoot()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder) en.nextElement(); fo.validFlag = false; fo.fileDeleted0(new FileEvent(fo)); } refreshRoot(); } };
protected Object readAttribute(String name, String attrName) { if ("java.io.File".equals(attrName)) { return null; } Attributes attr1 = getManifest().getAttributes(name); try { return (attr1 == null) ? null : attr1.getValue(attrName); } catch (IllegalArgumentException iax) { return null; } }
protected long size(String name) { long retVal = getEntry(name).getSize(); closeCurrentRoot(false); return (retVal == -1) ? 0 : retVal; }
protected Date lastModified(String name) { long t; if (name.length() == 0) { t = getJarFile().lastModified(); } else { try { t = getEntry(name).getTime(); } finally { closeCurrentRoot(false); } } return new Date(t); }
String oldDisplayName = getDisplayName (); if (getRefreshTime() > 0) setRefreshTime(0); setSystemName (s); } catch (PropertyVetoException vex) { throw vex; closeCurrentRoot (false); jar = tempJar; root = new File (s); softCache.clear(); aliveCount = 0; newRoot = refreshRoot(); manifest = null; lastModification = 0; if (newRoot != null) firePropertyChange ("root", null, newRoot); // NOI18N firePropertyChange (PROP_DISPLAY_NAME, oldDisplayName, getDisplayName ());
String oldDisplayName = getDisplayName(); if (getRefreshTime() > 0) { setRefreshTime(0); _setSystemName(s); closeCurrentRoot(false); setJar(tempJar); openRequestTime = System.currentTimeMillis(); root = new File(s); softCache.clear(); aliveCount = 0; newRoot = refreshRoot(); manifest = null; lastModification = 0; firePropertyChange("root", null, newRoot); // NOI18N firePropertyChange(PROP_DISPLAY_NAME, oldDisplayName, getDisplayName());
private static JarFileSystem findJarFileSystem(File jarFile) { JarFileSystem retVal = null; @SuppressWarnings("deprecation") // keep for backward compatibility w/ NB 3.x Enumeration<? extends FileSystem> en = Repository.getDefault().getFileSystems(); while (en.hasMoreElements()) { FileSystem fs = en.nextElement(); if (fs instanceof JarFileSystem) { File fsJarFile = ((JarFileSystem) fs).getJarFile(); if (fsJarFile.equals(jarFile)) { retVal = (JarFileSystem) fs; break; } } } return retVal; }
/** refreshes children recursively.*/ private void refreshExistingFileObjects() { Cache cache = getCache(); String[] empty = new String[0]; Enumeration<? extends FileObject> en = existingFileObjects(getRoot()); while (en.hasMoreElements()) { AbstractFolder fo = (AbstractFolder) en.nextElement(); assert fo != null; if (fo.isFolder() && !fo.isInitialized()) { continue; } String[] children = cache.getChildrenOf(fo.getPath()); if (children == null) { children = empty; } fo.refresh(null, null, true, true, children); } }
JarFile j = reOpenJarFile(); is = getMemInputStream(j, je); } else { is = getTemporaryInputStream(j, je, (strongCache != null)); throw fnfe; } finally { closeCurrentRoot(false);
mainModuleID.setContextURL(getWebUrl(server_url, JbossWeb.createGraph(file2).getContextRoot())); } else if (file.getName().endsWith(".ear")) { JarFileSystem jfs = new JarFileSystem(); jfs.setJarFile(file); FileObject appXml = jfs.getRoot().getFileObject("META-INF/application.xml"); if (appXml != null) { Application ear = DDProvider.getDefault().getDDRoot(appXml); for (FileObject child : jfs.getRoot().getChildren()) { if (child.hasExt("war") || child.hasExt("jar")) { // NOI18N JBTargetModuleID mod_id = new JBTargetModuleID(target[0], child.getNameExt());
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public synchronized FileSystem getFileSystem() throws IOException { if (fileSystem == null) { fileSystem = new JarFileSystem(new File(zipFilePath)); final FileObject rootFolder = fileSystem.getRoot(); if (rootFolder == null) { throw new FileNotFoundException(zipFilePath); } } return fileSystem; } }
private static Version getVersion(File systemJarFile) { if (!systemJarFile.exists()) { return null; } try { JarFileSystem systemJar = new JarFileSystem(); systemJar.setJarFile(systemJarFile); Attributes attributes = systemJar.getManifest().getMainAttributes(); String version = attributes.getValue("Specification-Version"); // NOI18N if (version != null) { return new Version(version); } return null; } catch (IOException ex) { LOGGER.log(Level.INFO, null, ex); return null; } catch (PropertyVetoException ex) { LOGGER.log(Level.INFO, null, ex); return null; } }
/** * Set name of the ZIP/JAR file. * @param aRoot path to new ZIP or JAR file * @throws IOException if the file is not valid */ public void setJarFile(final File aRoot) throws IOException, PropertyVetoException { setJarFile(aRoot, true, true); }
/** Get the JAR manifest. * It will be lazily initialized. * @return parsed manifest file for this archive */ public Manifest getManifest() { if (manifest == null) { try { synchronized (closeSync) { JarFile j = reOpenJarFile(); manifest = (j == null) ? null : j.getManifest(); manifest = (manifest == null) ? null : new Manifest(manifest); } } catch (IOException ex) { } finally { closeCurrentRoot(false); } if (manifest == null) { manifest = new Manifest(); } } return manifest; }
@Override public void removeNotify() { closeCurrentRoot(true); }
public Enumeration<String> attributes(String name) { return fs.attributes(name); }
public String[] children(String name) { return fs.children(name); }
public void createData(String name) throws IOException { fs.createData(name); }
String oldDisplayName = getDisplayName (); if (getRefreshTime() > 0) setRefreshTime(0); setSystemName (s); } catch (PropertyVetoException vex) { throw vex; closeCurrentRoot (false); jar = tempJar; root = new File (s); softCache.clear(); aliveCount = 0; newRoot = refreshRoot(); manifest = null; lastModification = 0; if (newRoot != null) firePropertyChange ("root", null, newRoot); // NOI18N firePropertyChange (PROP_DISPLAY_NAME, oldDisplayName, getDisplayName ());