protected IVirtualComponent getComponent(Archive anArchive) { LoadStrategy loader = anArchive.getLoadStrategy(); if (loader instanceof ComponentLoadStrategyImpl) return ((ComponentLoadStrategyImpl) loader).getComponent(); return null; }
/** * Answer whether the nested archive needs to be saved one file at a time, or if we can bulk * save it from the original */ protected boolean shouldIterateOver(Archive anArchive) { return anArchive.getLoadStrategy().requiresIterationOnSave(); }
public ArchiveURIConverterImpl(org.eclipse.jst.j2ee.commonarchivecore.internal.Archive anArchive, String resourcesPath) { setArchive(anArchive); this.resourcesPath = resourcesPath; setInputFilepath(resourcesPath); String outpath = resourcesPath; if (outpath == null) { LoadStrategy l = anArchive.getLoadStrategy(); if (l != null && l.isDirectory()) { try { outpath = l.getAbsolutePath(); } catch (FileNotFoundException ignore) { //Ignore } } } setOutputFilepath(outpath); }
/** * @see CommonarchiveFactory */ public Archive openNestedArchive(String uri, Archive parent) throws OpenFailureException { try { LoadStrategy childStrategy = createChildLoadStrategy(uri, parent.getLoadStrategy()); ArchiveOptions options = parent.getOptions().cloneWith(childStrategy, uri); if (options.shouldDiscriminateNestedArchives()) return openArchive(options, uri); return primOpenArchive(options, uri); } catch (IOException ex) { throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.open_nested_EXC_, (new Object[]{uri, parent.getURI()})), ex); // = "Could not open the nested archive "{0}" in "{1}"" } }
protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException { LoadStrategy aLoadStrategy = null; LooseArchive loose = getLoadStrategy().getLooseArchive(); if (loose != null) { aLoadStrategy = getCommonArchiveFactory().createLoadStrategy(loose.getBinariesPath()); aLoadStrategy.setLooseArchive(loose); } else if (parent == null) aLoadStrategy = getCommonArchiveFactory().createLoadStrategy(getURI()); else aLoadStrategy = getCommonArchiveFactory().createChildLoadStrategy(getURI(), parent.getLoadStrategy()); return aLoadStrategy; }
protected boolean shouldSave(File aFile) { boolean loaded = isLoadedResourceOrManifest(aFile); if (loaded) { Resource res = archive.getLoadStrategy().getExistingMofResource(aFile.getURI()); if (res == null) return false; //must be manifest return !shouldSave(res); } if (getArchive().isModuleFile()) { ModuleFile m = (ModuleFile) getArchive(); if (m.getExportStrategy() != null && m.getExportStrategy().hasSaved(aFile.getURI())) return false; } return shouldSave(aFile.getURI()); }
/** * @see com.ibm.etools.archive.ArchiveTypeDiscriminator */ public Archive convert(Archive anArchive) throws OpenFailureException { Archive destination = createConvertedArchive(); //turn of notifications destination.eSetDeliver(false); destination.eSetDeliver(false); //Copy the relevant attributes destination.setURI(anArchive.getURI()); destination.setOriginalURI(anArchive.getURI()); destination.setSize(anArchive.getSize()); destination.setLastModified(anArchive.getLastModified()); destination.setLoadStrategy(anArchive.getLoadStrategy()); destination.setOptions(anArchive.getOptions()); destination.setExtraClasspath(anArchive.getExtraClasspath()); if (destination.isModuleFile()) { ImportStrategy importStrategy = createImportStrategy(anArchive, destination); ((ModuleFile) destination).setImportStrategy(importStrategy); } //turn notifications back on destination.eSetDeliver(true); destination.eSetDeliver(true); return destination; }