public EObject getPrimaryRootObject() { return ((WARFile) getArchive()).getDeploymentDescriptor(); }
/** * Validate EJB references. */ public void validateEJBRefs(EjbRefImpl eref) { // try { EARFile earFile = warFile.getEARFile(); EnterpriseBean eb = null; if (earFile != null) eb = earFile.getEnterpiseBeanFromRef(eref, warFile.getURI()); if (!(eb == null)) { List ejbRefs = eb.getEjbRefs(); int numRefs = ejbRefs.size(); Set refSet = new HashSet(numRefs); for (int refNo = 0; refNo < numRefs; refNo++) { String nextName = ((EjbRefImpl) (ejbRefs.get(refNo))).getName(); String[] parms = new String[1]; parms[0] = eb.getName(); if (!(refSet.add(nextName))) { addWarning(WAR_CATEGORY, ERROR_EAR_DUPLICATE_ROLES, parms, ejbRefs.get(refNo)); } } } // } catch (UncontainedModuleFileException ue) { // String[] parms = new String[1]; // parms[0] = warFile.getName(); // addError(EREF_CATEGORY, ERROR_EAR_UNCONTAINED_MODULE_FILE_EXCEPTION, parms); // } }
protected File getFile(String name) { //search classes directory first, then war, then nested archives. //search classes directory String swizzledName = ArchiveUtil.concatUri(ArchiveConstants.WEBAPP_CLASSES_URI, name, '/'); try { return getWarFile().getFile(swizzledName); } catch (java.io.FileNotFoundException ex) { } //search war if running with compatibility if (allowLoadingFromWAR) { File file = getFileFromArchive(name); if (file != null) { return file; } } //search nested archives List children = getWarFile().getLibs(); for (int i = 0; i < children.size(); i++) { try { return ((Archive) children.get(i)).getFile(name); } catch (java.io.FileNotFoundException ex) { continue; } } //finally search jars in ear return getFileFromDependentJar(name); }
public void loadDeploymentDescriptor() throws Exception { WebApp webapp = null; webapp = (WebApp) primLoadDeploymentDescriptor(); getWARFile().setDeploymentDescriptor(webapp); } }
List libs = war.getLibArchives(); for (int i = 0; i < libs.size(); i++) { cachedWebLibs.add(new ArchiveWrapper((Archive) libs.get(i)));
/** * 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); // } }
/** * This validator can be used for validation when the reporter and helper have been supplied via * the constructor. */ public void validate(Object aWarFile) throws ValidationException { try { warFile = (WARFile) aWarFile; webDD = warFile.getDeploymentDescriptor(); validate(); } catch (Exception e) { e.printStackTrace(); String[] parms = new String[1]; parms[0] = e.toString(); IMessage errorMsg = new Message(getBaseName(), IMessage.HIGH_SEVERITY, ERROR_WAR_VALIDATION_FAILED, parms); throw new ValidationException(errorMsg); } }
public ModuleFile copy(ModuleFile aModuleFile) { /** * Timing issue; if the resources containing the bindings, extensions, and dd have not yet * be loaded, force that before the copy occurs; otherwise, they will get loaded as the * accessors are invoked during copy. Because they will be loaded but not copied into the * new archive's context, then changes will not get saved. By forcing the load before the * copy commences, the loaded resources will also be copied to the new archive */ aModuleFile.getStandardDeploymentDescriptor(); /* * RLS-8/12/2002 Hack to fix botp defect "141640-failed to install .war file with * filter-mapping" The problem is that there is a transient field on the filter mapping * class for the servlet name the relationship to the servlet is lazily populated the first * time it is requested. If we don't trip it, then it won't get copied. */ if (aModuleFile.isWARFile()) { List filterMappings = ((WARFile) aModuleFile).getDeploymentDescriptor().getFilterMappings(); for (int i = 0; i < filterMappings.size(); i++) { ((FilterMapping) filterMappings.get(i)).getServlet(); } } ModuleFile copied = (ModuleFile) copy((Archive) aModuleFile); return copied; }
webDD = warFile.getDeploymentDescriptor(); validate(); } else {
boolean isVersion22 = warFile.getDeploymentDescriptor().getVersionID() <= J2EEVersionConstants.WEB_2_2_ID;
} else if (anArchive.isWARFile()) { archiveType = WARFILE; WebApp war = ((WARFile) anArchive).getDeploymentDescriptor(); if (war.getVersionID() == J2EEVersionConstants.WEB_2_2_ID) archiveType |= J2EE12;