/** * SubclassResponsibilityException constructor comment. * * @param s * java.lang.String */ public SubclassResponsibilityException(String methodName) { super(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.subclass_responsibilty_EXC_, (new Object[]{methodName}))); // = " must be implemented in subclass" } }
protected String getXmlDDMessage(String archiveType, String ddUri) { return CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.invalid_archive_EXC_, (new Object[]{archiveType, ddUri})); // = "Archive is not a valid {0} because the deployment descriptor can not be found (case sensitive): {1}" }
public ZipFileLoadStrategyImpl createLoadStrategy(String uri) throws FileNotFoundException, IOException { String filename = uri.replace('/', java.io.File.separatorChar); java.io.File file = new java.io.File(filename); if (!file.exists()) { throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = "URI Name: {0}; File name: {1}" } if (file.isDirectory()) { throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = "URI Name: {0}; File name: {1}" } return new org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl(file); }
public ZipFileLoadStrategyImpl createLoadStrategy(String uri) throws FileNotFoundException, IOException { String filename = uri.replace('/', java.io.File.separatorChar); java.io.File file = new java.io.File(filename); if (!file.exists()) { throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = } if (file.isDirectory()) { throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = } return new org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl(file); } }
protected SaveStrategy createSaveStrategyForJar(java.io.File aFile) throws java.io.IOException { if (aFile.exists() && aFile.isDirectory()) throw new IOException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_exist_as_dir_EXC_, (new Object[]{aFile.getAbsolutePath()})));// = "A file named {0} exists and is a directory" java.io.File parent = aFile.getParentFile(); if (parent != null) parent.mkdirs(); java.io.OutputStream out = new java.io.FileOutputStream(aFile); return new ZipStreamSaveStrategyImpl(out); }
/** * Helper method to dynamically build a load strategy from the file system. Determines whether * the uri points to a jar file or directory and returns the appropriate strategy */ public LoadStrategy createLoadStrategy(String uri) throws FileNotFoundException, IOException { String filename = uri.replace('/', java.io.File.separatorChar); java.io.File file = new java.io.File(filename); if (!file.exists()) { throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[]{uri, file.getAbsolutePath()}))); // = "URI Name: {0}; File name: {1}" } if (file.isDirectory()) { return new DirectoryArchiveLoadStrategyImpl(uri); } return new org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl(file); }
protected static BinaryZipFileLoadStrategy createBinaryLoadStrategy(EnterpriseBinaryComponentHelper helper) throws OpenFailureException { String archiveURI = helper.getArchiveURI(); String filename = archiveURI.replace('/', java.io.File.separatorChar); java.io.File file = new java.io.File(filename); if (!file.exists()) { throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[] { archiveURI, file.getAbsolutePath() }))); } try { BinaryZipFileLoadStrategy strategy = new BinaryZipFileLoadStrategy(file); return strategy; } catch (IOException ex) { throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.could_not_open_EXC_, (new Object[] { archiveURI })), ex); } }
/** * openReadOnlyDirectory method comment. */ public ReadOnlyDirectory openReadOnlyDirectory(java.lang.String uri) throws java.io.IOException { java.io.File aFile = new java.io.File(uri); if (!aFile.exists()) throw new FileNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.could_not_find_dir_EXC_, (new Object[]{uri}))); // = "Unable to open directory " if (!aFile.isDirectory()) throw new IOException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.not_a_dir_EXC_, (new Object[]{uri}))); // = "Unable to open directory because file is not a directory :" LoadStrategy strategy = new ReadOnlyDirectoryLoadStrategyImpl(uri); ReadOnlyDirectory container = createReadOnlyDirectory(); container.setURI(uri); container.setLoadStrategy(strategy); container.setLastModified(aFile.lastModified()); return container; }
/** * @see com.ibm.etools.commonarchive.WARFile */ public File addCopyClass(File aFile) throws DuplicateObjectException { if (aFile.isReadOnlyDirectory()) throw new IllegalArgumentException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.add_copy_class_dir_EXC_, (new Object[]{aFile.getURI()}))); // = "Method addCopyClass not supported for directories :" return addCopyFileAddingPrefix(aFile, ArchiveConstants.WEBAPP_CLASSES_URI); }
/** * @see com.ibm.etools.commonarchive.WARFile */ public File addCopyLib(File aFile) throws DuplicateObjectException { if (aFile.isReadOnlyDirectory()) throw new IllegalArgumentException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.add_copy_lib_dir_EXC_, (new Object[]{aFile.getURI()}))); // = "Method addCopyLib not supported for directories :" return addCopyFileAddingPrefix(aFile, ArchiveConstants.WEBAPP_LIB_URI); }
/** * Sets the temp directory to the specified path; creates it and sets it to be deleted on exit * if it does not exist. * * @param newTempDirectoryName * java.lang.String * @throws ArchiveException * thrown if the directory does not exist and can not be created */ public static void setTempDirectoryName(java.lang.String newTempDirectoryName) throws ArchiveException { java.io.File dir = new java.io.File(newTempDirectoryName); if (!dir.exists()) { dir.mkdirs(); if (!dir.exists()) throw new ArchiveException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.make_temp_dir_EXC_, (new Object[]{newTempDirectoryName}))); // = "Unable to make temp directory: " DeleteOnExitUtility.markForDeletion(dir); } setTempDirectory(dir); }
protected void throwResourceLoadException(String resourceUri, Exception ex) throws ResourceLoadException { throw new ResourceLoadException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.load_resource_EXC_, (new Object[]{resourceUri, getURI()})), ex); // = "Could not load resource "{0}" in archive "{1}"" }
/** * @see com.ibm.etools.commonarchive.WARFile */ public File addCopyClass(File aFile) throws org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException { if (aFile.isReadOnlyDirectory()) throw new IllegalArgumentException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.add_copy_class_dir_EXC_, (new Object[]{aFile.getURI()}))); // = "Method addCopyClass not supported for directories :" return addCopyFileAddingPrefix(aFile, ArchiveConstants.WEBAPP_CLASSES_URI); }
boolean deleteWorked = false; if (original.isDirectory() && !isRenameable(original)) { throw new SaveFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.unable_replace_EXC_, (new Object[]{original.getAbsolutePath()}))); // = "Unable to replace original archive " throw new SaveFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.unable_replace_EXC_, (new Object[]{original.getAbsolutePath()}))); // = "Unable to replace original archive "
protected void checkAddValid(String aUri) throws DuplicateObjectException { try { File f = getFile(aUri); if (f != null) throw new DuplicateObjectException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.duplicate_file_EXC_, (new Object[]{getURI(), aUri})), f); // = "The archive named {0} already contains a file named {1}" } catch (FileNotFoundException ok) { //Ignore } }
protected void checkModuleFile() { getModuleFile(); if (moduleFile == null) throw new NoModuleFileException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.Module_file_does_not_exist_2, new Object[]{getUri()})); }
public InputStream getResourceAsStream(String name) { try { File file = getFile(name); if (null != file) { return file.getInputStream(); } } catch (IOException e) { throw new ArchiveRuntimeException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.io_ex_loading_EXC_, (new Object[]{name})), e); // = "An IO exception occurred loading " } return null; }
protected void checkDuplicate(String aUri) throws DuplicateObjectException { if (isDuplicate(aUri)) throw new DuplicateObjectException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.dup_resource_EXC_, (new Object[]{aUri, getURI()}))); // = "Resource named "{0}" already exists in archive "{1}"" }
protected void checkEARFile() { if (getEarFile() == null) throw new ArchiveRuntimeException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.Module_not_in_EAR, new Object[]{getUri()})); }
protected void throwResourceLoadException(String resourceUri, Exception ex) throws ResourceLoadException { throw new ResourceLoadException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.load_resource_EXC_, (new Object[]{resourceUri, getContainer().getURI()})), ex); // = "Could not load resource "{0}" in archive "{1}"" }