protected void saveEnclosedFile(Archive anArchive, IProject p, String uri) throws IOException { try { File aFile = anArchive.getFile(uri); saveFile(aFile, p); } catch (FileNotFoundException ignore) { } }
} else { try { File manifestToCopy = source.getFile(J2EEConstants.MANIFEST_URI); if (manifestToCopy != null) { File copiedManifest = (File) getCopy(manifestToCopy);
protected File getFileFromArchive(String name) { try { return getArchive().getFile(name); } catch (FileNotFoundException e) { } return null; }
protected void setTimestampAfterSaving(String uri) { org.eclipse.jst.j2ee.commonarchivecore.internal.File aFile = null; try { aFile = getArchive().getFile(uri); } catch (FileNotFoundException mustBeANewEntry) { return; } setTimestampAfterSaving(aFile); }
protected File getFile(String name) { List children = getRarFile().getArchiveFiles(); for (int i = 0; i < children.size(); i++) { try { return ((Archive) children.get(i)).getFile(name); } catch (java.io.FileNotFoundException ex) { continue; } } return getFileFromDependentJar(name); }
/** * Answer whether an element in the archive having the uri should be saved; the uri may be for a * file, a nested archive, or a loaded mof resource. For deployed jars, if the file came was * copied from the orignal jar file, always save */ public boolean shouldSave(java.lang.String uri, Archive anArchive) { File aFile = null; try { aFile = anArchive.getFile(uri); } catch (java.io.FileNotFoundException mustBeAResource) { //Ignore } if (aFile == null) return targetShouldSave(uri, anArchive); return aFile.getLoadingContainer() != anArchive || targetShouldSave(uri, anArchive); }
protected File getFile(String name) { //search classes directory first, then war, then nested archives. //search classes directory String swizzledName = ArchiveUtil.concatUri(ArchiveConstants.WEBAPP_CLASSES_URI, name, '/'); try { return getWarFile().getFile(swizzledName); } catch (java.io.FileNotFoundException ex) { } //search war if running with compatibility if (allowLoadingFromWAR) { File file = getFileFromArchive(name); if (file != null) { return file; } } //search nested archives List children = getWarFile().getLibs(); for (int i = 0; i < children.size(); i++) { try { return ((Archive) children.get(i)).getFile(name); } catch (java.io.FileNotFoundException ex) { continue; } } //finally search jars in ear return getFileFromDependentJar(name); }
protected Object getResourceInDependentJarInEAR(String name, Set visitedArchives, int type) { String[] classpath = archive.getManifest().getClassPathTokenized(); for (int i = 0; i < classpath.length; i++) { try { String uri = ArchiveUtil.deriveEARRelativeURI(classpath[i], archive); if (uri == null) continue; File jarFile = getEARFile().getFile(uri); if (jarFile.isArchive()) { Archive dep = (Archive) jarFile; switch (type) { case CLASS_TYPE : try { return ((ArchiveFileDynamicClassLoader) dep.getArchiveClassLoader()).loadClass(name, visitedArchives); } catch (ClassNotFoundException noDice) { continue; } case FILE_TYPE : try { return dep.getFile(name); } catch (FileNotFoundException noDice) { continue; } } } } catch (java.io.FileNotFoundException depJarNotInEAR) { } } return null; }