public void initializeNewArchive(Archive anArchive, String uri, ArchiveOptions options) { if (options.getLoadStrategy() == null) { try { options.setLoadStrategy(createEmptyLoadStrategy()); } catch (Exception ex) { Logger.getLogger().logError(ex); } } anArchive.setURI(uri); anArchive.setSize(0); anArchive.setLastModified(System.currentTimeMillis()); anArchive.setDirectoryEntry(false); anArchive.setLoadStrategy(options.getLoadStrategy()); anArchive.setOptions(options); }
/** * open the archive, setting up the appropriate strategies, using the loadStrategy passed in; * URI still necessary so the archive has a name, but it will not be used for io. */ public Archive primOpenArchive(ArchiveOptions options, String uri) throws OpenFailureException { if (options.getLoadStrategy() == null) { try { options.setLoadStrategy(createLoadStrategy(uri)); } catch (IOException ex) { throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.could_not_open_EXC_, (new Object[]{uri})), ex); // = "Could not open " } } Archive anArchive = createArchive(); anArchive.setURI(uri); anArchive.setOriginalURI(uri); anArchive.setLoadStrategy(options.getLoadStrategy()); anArchive.setOptions(options); ArchiveTypeDiscriminatorRegistry.getInstance().contributeTypes(anArchive); return anArchive; }
/** * @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; }