protected Archive openArchive(String uri) throws OpenFailureException { return CommonarchiveFactory.eINSTANCE.openApplicationClientFile(getArchiveOptions(), uri); }
public Archive asArchive(boolean includeSource, boolean includeClasspathComponents) throws OpenFailureException{ if (isBinary()) { return ((EnterpriseBinaryComponentHelper) getBinaryComponentHelper()).accessArchive(); } else { AppClientComponentLoadStrategyImpl loader = new AppClientComponentLoadStrategyImpl(getComponent()); loader.setExportSource(includeSource); String uri = ModuleURIUtil.getHandleString(getComponent()); return CommonarchiveFactory.eINSTANCE.openApplicationClientFile(loader, uri); } }
public void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException { IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK); IArchive archiveFromComponent = null; try { archiveFromComponent = JavaEEArchiveUtilities.INSTANCE.openArchive(getComponent()); JavaEEQuickPeek quickPeek = JavaEEArchiveUtilities.INSTANCE.getJavaEEQuickPeek(archiveFromComponent); if (quickPeek.getJavaEEVersion() == J2EEConstants.JEE_5_0_ID) { saveArchive(archiveFromComponent, getDestinationPath().toOSString(), subMonitor); } else { CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory(); AppClientComponentLoadStrategyImpl ls = new AppClientComponentLoadStrategyImpl(getComponent()); ls.setExportSource(isExportSource()); setModuleFile(caf.openApplicationClientFile(ls, getDestinationPath().toOSString())); ls.setProgressMonitor(subMonitor); getModuleFile().saveAsNoReopen(getDestinationPath().toOSString()); } } catch (SaveFailureException ex) { throw ex; } catch (Exception e) { throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e); } finally { if (archiveFromComponent != null) JavaEEArchiveUtilities.INSTANCE.closeArchive(archiveFromComponent); subMonitor.done(); } }
protected Archive openNestedArchive(Module m, ArchiveOptions archiveOptions) throws OpenFailureException { String aUri = m.getUri(); try { /* * Since we have a clue about the type of archive to open Use the appropriate open * method, so if a failure occurrs, we can get a more specific message */ if (m.isWebModule()) return getCommonArchiveFactory().openWARFile(archiveOptions, aUri); else if (m.isEjbModule()) return getCommonArchiveFactory().openEJBJarFile(archiveOptions, aUri); else if (m.isJavaModule()) return getCommonArchiveFactory().openApplicationClientFile(archiveOptions, aUri); else if (m.isConnectorModule()) return getCommonArchiveFactory().openRARFile(archiveOptions, aUri); } catch (OpenFailureException ex) { throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.nested_open_fail_EXC_, (new Object[]{aUri, getURI()})), ex); // = "Unable to open module file "{0}" in EAR file "{1}"" } //Should never reach the code below return null; }