protected static ModuleFile getModuleFileUsingAltDD(EARFile ear, Resource res) { if (res == null) return null; String uri = res.getURI().toString(); Module m = ear.getDeploymentDescriptor().getModuleHavingAltDD(uri); if (m == null) return null; ModuleRef ref = ear.getModuleRef(m); if (ref == null) return null; return ref.getModuleFile(); }
protected Archive getResolvedArchive(String mfValue, EARFile ear) { String aUri = ArchiveUtil.deriveEARRelativeURI(mfValue, this); if (aUri == null) return null; try { return (Archive) ear.getFile(aUri); } catch (FileNotFoundException ex) { return null; } catch (ClassCastException ex2) { return null; } }
/** * Checks if the modules are a spec level too high for the EAR file. */ private void validateSpecLevel() { int earVersion = getVersionID(earFile); List modules = earFile.getModuleFiles(); if( !modules.isEmpty() ) { Iterator iterator = modules.iterator(); ModuleFile moduleFile = null; while (iterator.hasNext()) { moduleFile = (ModuleFile)iterator.next(); if (moduleFile != null && getVersionID(moduleFile) > earVersion) { String[] params = new String[] {moduleFile.getURI(), earFile.getName()}; String tmp = NLS.bind(EARValidationMessageResourceHandler.MESSAGE_INCOMPATIBLE_SPEC_WARNING_, params); addLocalizedWarning(tmp, appDD); } } } }
/** * Validate the alt dd * * @param Module m - A module. * @param String altDD - An altDD */ protected void validateAltDD(Module m, String altDD) { //isDuplicate will test if it is a file or a loaded resource if ("".equals(altDD)) { //$NON-NLS-1$ String[] params = new String[2]; params[0] = m.getUri(); params[1] = earFile.getName(); String tmp = NLS.bind(EARValidationMessageResourceHandler.MESSAGE_EMPTY_ALT_DD_ERROR_, params); addLocalizedError(tmp, appDD); } else if (altDD != null && !earFile.isDuplicate(altDD)) { String[] params = new String[3]; params[0] = m.getUri(); params[1] = altDD; params[2] = earFile.getName(); String tmp = NLS.bind(EARValidationMessageResourceHandler.MESSAGE_INVALID_ALT_DD_WARN_, params); addLocalizedWarning(tmp, appDD); }// if }// validateAltDD
earFile = (EARFile) _helper.loadModel(J2EEConstants.EAR_MODEL_NAME); if (earFile != null) { appDD = earFile.getDeploymentDescriptor(); if (appDD != null && appDD.eResource() != null && appDD.eResource().isLoaded()) validate(); String[] param = new String[1]; if (earFile != null) param[0] = earFile.getName(); Logger.getLogger().logError(e); String msg = NLS.bind(EARValidationMessageResourceHandler.EAR_VALIDATION_INTERNAL_ERROR_UI_, param );
/** * Returns a list of all module files which are a spec level too high for the EAR file. If the * EAR is 1.3, returns an empty list. Otherwise returns any J2EE 1.3 modules. */ public static List getIncompatible13ModuleFiles(EARFile earFile) { if (isJ2EE13(earFile)) return Collections.EMPTY_LIST; List moduleFiles = earFile.getModuleFiles(); List result = new ArrayList(); for (int i = 0; i < moduleFiles.size(); i++) { ModuleFile aModuleFile = (ModuleFile) moduleFiles.get(i); if (isJ2EE13(aModuleFile)) result.add(aModuleFile); } return result; }
EjbRef eref = (EjbRef) ejbRefs.get(i); if( eref != null && eref.getLink() != null && eref.getLink().length() > 0) { EnterpriseBean ejb = earFile.getEnterpiseBeanFromRef( eref, uri ); if( ejb == null ) { String[] params = new String[3]; params[0] = eref.getName(); params[1] = uri; params[2] = earFile.getName(); String msg = NLS.bind(ERefValidationMessageResourceHandler.UNRESOLVED_EJB_REF_WARN_, params); addLocalizedWarning(msg, null);
private void validateMDBMessageDestinations() { List moduleList = earFile.getModuleRefs(); params[1] = messageDrivenBean.getName(); params[2] = ref.getUri(); params[3] = earFile.getName(); addError(EREF_CATEGORY, ERROR_UNRESOLVED_MDB_MISSING_MESSAGE_DESTINATION, params,messageDrivenBean, MESSAGE_DESTINATION_MDB_REF_GROUP_NAME);
/** * Gets the resource name * * @return String */ protected String getResourceName() { return earFile.getURI(); }// getResourceName
public EObject getDeploymentDescriptor() throws ArchiveWrappedException { if (getEarFile() == null) return getStandardDeploymentDescriptor(); try { return getEarFile().getDeploymentDescriptor(getModule()); } catch (Exception ex) { throw new ArchiveWrappedException(ex); } }
String[] params = new String[2]; params[0] = m.getUri(); params[1] = earFile.getName(); String tmp = NLS.bind(EARValidationMessageResourceHandler.MESSAGE_EAR_DUPLICATE_URI_ERROR_, params); addLocalizedError(tmp, appDD);
public void closeEARFile() { if (earFile != null) { earFile.close(); earFile = null; } }
public void validateManifests() throws ValidationException { if (earFile == null) return; List archives = earFile.getArchiveFiles(); for (int i = 0; i < archives.size(); i++) { final Archive anArchive = (Archive) archives.get(i); IFile target = getManifestFile(anArchive); if (target != null) _reporter.removeMessageSubset(this, target, MANIFEST_GROUP_NAME); validateManifestCase(anArchive); validateManifestLines(anArchive); validateManifestClasspath(anArchive); } }
/** * Keys are the EJB JAR files and the values are the respective client JARs; includes only key * value pairs for which EJB Client JARs are defined and exist. * * @author schacher */ public static Map collectEJBClientJARs(EARFile earFile) { if (earFile == null) return Collections.EMPTY_MAP; Map ejbClientJARs = null; List ejbJARFiles = earFile.getEJBJarFiles(); Archive clientJAR = null; for (int i = 0; i < ejbJARFiles.size(); i++) { EJBJarFile ejbJarFile = (EJBJarFile) ejbJARFiles.get(i); clientJAR = getClientJAR(ejbJarFile, earFile); if (clientJAR != null) { if (ejbClientJARs == null) ejbClientJARs = new HashMap(); ejbClientJARs.put(ejbJarFile, clientJAR); } } return ejbClientJARs == null ? Collections.EMPTY_MAP : ejbClientJARs; }
public EObject getAltDeploymentDescriptor() throws ArchiveWrappedException { if (getEarFile() == null) return null; try { return getEarFile().getAltDeploymentDescriptor(getModule()); } catch (Exception ex) { throw new ArchiveWrappedException(ex); } }
/** * <p>Answer a parent path for use by the receiver. Take into * account wehther the receiver is a loose application or not. * * <p>Answer null in case an error is encountered while determining * the parent path.</p> * * <p>Added for BZ 170532.</p> * * @return A parent path for use by the receiver. Null in case of an error. * * @see getDependencyClassPathAtThisLevel() */ protected String getParentPath() { try { if ( (getLoadStrategy().getLooseArchive() != null) && getContainer().isEARFile() ) { return getEARFile().getBinariesPath(); } else { return new java.io.File(getBinariesPath()).getParentFile().getAbsolutePath(); } } catch (FileNotFoundException e) { return null; } }
/** * Returns a list of all module files which are a spec level too high for the EAR file. If the * EAR is 1.4, returns an empty list. Otherwise returns any J2EE 1.4 modules. */ public static List getIncompatible14ModuleFiles(EARFile earFile) { if (isJ2EE14(earFile)) return Collections.EMPTY_LIST; List moduleFiles = earFile.getModuleFiles(); List result = new ArrayList(); for (int i = 0; i < moduleFiles.size(); i++) { ModuleFile aModuleFile = (ModuleFile) moduleFiles.get(i); if (isJ2EE14(aModuleFile)) result.add(aModuleFile); } return result; }
public LooseModule findLooseModule(Module m, EARFile ear) { LooseApplication app = findLooseApplication(ear.getURI()); return app == null ? null : findLooseModule(app, m.getUri(), m.getAltDD()); }
/** * validateSecurity(WebApp) - validate security constraints, roles, and security role refs - * details tbd */ public void validateSecurityAndServlets() { EList webRoles = webDD.getSecurityRoles(); // Validate security roles Hashtable secRoles = getAndValidateSecurityRoles(webRoles); // Validate Servlets/JSPs and their role ref. validateServlets(webDD.getServlets(), secRoles); validateSecurityConstraints(webDD.getConstraints(), secRoles); // try { if (!(webRoles.isEmpty())) { EARFile module = warFile.getEARFile(); if (module != null) { EList earRoleList = module.getDeploymentDescriptor().getSecurityRoles(); validateWEBRolesWithEARRoles(earRoleList, webRoles); } } // } catch (UncontainedModuleFileException ue) { // String[] parms = new String[1]; // parms[0] = warFile.getName(); // addError(EREF_CATEGORY, ERROR_EAR_UNCONTAINED_MODULE_FILE_EXCEPTION, parms); // } }