/** * 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" } }
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); }
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); } }
/** * @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); }
/** * @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); }
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()})); }
private byte[] getData(File file) { if (null != file) { try { return ArchiveUtil.inputStreamToBytes(file.getInputStream()); } catch (FileNotFoundException e) { return null; } catch (IOException e) { throw new ArchiveRuntimeException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.io_ex_loading_EXC_, (new Object[]{file.getName()})), e); // = "An IO exception occurred loading " } } } return null; }
/** * @see com.ibm.etools.commonarchive.Archive#makeMofResource(String, EList) */ public Resource makeMofResource(String aUri, EList extent) throws DuplicateObjectException { if (isDuplicate(aUri)) throw new DuplicateObjectException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.duplicate_entry_EXC_, (new Object[]{aUri, getURI()}))); // = "A file or resource with uri {0} already exists in the archive named {1}" return getLoadStrategy().makeMofResource(aUri, extent); }
/** * @see com.ibm.etools.commonarchive.EARFile */ public void renameSecurityRole(String existingRoleName, String newRoleName) throws ObjectNotFoundException, DuplicateObjectException { Application app = getDeploymentDescriptor(); SecurityRole aRole = app.getSecurityRoleNamed(existingRoleName); if (aRole == null) throw new ObjectNotFoundException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.no_sec_role_EXC_, (new Object[]{getURI(), existingRoleName}))); // = ": EAR File deployment descriptor does not contain a security role named " if (app.getSecurityRoleNamed(newRoleName) != null) throw new DuplicateObjectException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.dup_sec_role_EXC_, (new Object[]{getURI(), newRoleName})), app.getSecurityRoleNamed(newRoleName)); // = ": EAR File deployment descriptor already contains a security role named " aRole.setRoleName(newRoleName); renameRolesInModuleDDs(existingRoleName, newRoleName); }
/** * An exception was caught reading the nested jar; throws a runtime exception */ protected void throwNestedJarException(Exception caughtException) { throw new NestedJarException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.nested_jar_EXC_, (new Object[]{getContainer().getURI(), getParent().getContainer().getURI()})), caughtException);// = "An error occurred reading {0} from {1}" }
protected void renameRolesInModuleDDs(String existingRoleName, String newRoleName) { List modules = getDeploymentDescriptor().getModules(); for (int i = 0; i < modules.size(); i++) { Module m = (Module) modules.get(i); try { if (m.isEjbModule()) getDeploymentDescriptor((EjbModule) m).renameSecurityRole(existingRoleName, newRoleName); else if (m.isWebModule()) getDeploymentDescriptor((WebModule) m).renameSecurityRole(existingRoleName, newRoleName); } catch (Exception e) { throw new DeploymentDescriptorLoadException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.dd_in_ear_load_EXC_, (new Object[]{m.getUri(), getURI()})), e); // = "Exception occurred loading deployment descriptor for module "{0}" in ear file "{1}"" } } }
protected ArchiveOptions getOptionsForOpening(LooseArchive loose) throws IOException, OpenFailureException{ if(loose.getBinariesPath() == null){ throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.open_nested_EXC_, (new Object[] {loose.getUri(), getURI()})), null); // = "Could not open the nested archive "{0}" in "{1}"" } LoadStrategy strategy = getCommonArchiveFactory().createLoadStrategy(loose.getBinariesPath()); strategy.setLooseArchive(loose); return getOptions().cloneWith(strategy, loose.getUri()); }
/** * @see com.ibm.etools.commonarchive.EARFile */ public EList getRolesFromModule(Module aModule) { EList roleList = new org.eclipse.emf.common.util.BasicEList(); try { if (aModule.isWebModule()) roleList = getDeploymentDescriptor((WebModule) aModule).getSecurityRoles(); else if (aModule.isEjbModule()) roleList = getAssemblyDescriptorAddIfNecessary(getDeploymentDescriptor((EjbModule) aModule)).getSecurityRoles(); } catch (Exception e) { throw new DeploymentDescriptorLoadException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.dd_in_ear_load_EXC_, (new Object[]{aModule.getUri(), getURI()})), e); // = "Exception occurred loading deployment descriptor for module "{0}" in ear file "{1}"" } return roleList; }