/** * This returns Application.gif. */ public Object getImage(Object object) { String key = null; if (((Application) object).eResource() == null) return J2EEPlugin.getPlugin().getImage("earFile_obj"); //$NON-NLS-1$ switch (((Application) object).getVersionID()) { case J2EEVersionConstants.J2EE_1_2_ID : key = "12_ear_obj"; //$NON-NLS-1$ break; case J2EEVersionConstants.J2EE_1_3_ID : key = "13_ear_obj"; //$NON-NLS-1$ break; case J2EEVersionConstants.J2EE_1_4_ID : default : key = "14_ear_obj"; //$NON-NLS-1$ break; } return J2EEPlugin.getPlugin().getImage(key); }
/** * Return true if super returns true, or return whether the app dd contains a module having the * uri */ public boolean isNestedArchive(String aUri) { if (super.isNestedArchive(aUri)) return true; return getDeploymentDescriptor().getFirstModule(aUri) != null; }
/** * @see EARFile */ public void pushDownRole(SecurityRole role) { if (role == null) throw new IllegalArgumentException(CommonArchiveResourceHandler.Parameter_should_not_be_nu_EXC_); // = "Parameter should not be null" List modules = getDeploymentDescriptor().getModules(); for (int i = 0; i < modules.size(); i++) { Module m = (Module) modules.get(i); pushDownRole(role, m); } }
/** * @see com.ibm.etools.commonarchive.EARFile */ public SecurityRole addCopyIfNotExists(SecurityRole aRole) { Application dd = getDeploymentDescriptor(); SecurityRole copy = null; if (!dd.containsSecurityRole(aRole.getRoleName())) { copy = (SecurityRole) EtoolsCopyUtility.createCopy(aRole); dd.getSecurityRoles().add(copy); } return copy; }
/** * validate security constraints, roles, and security role refs. */ public void validateSecurity() { EList earRoleList = appDD.getSecurityRoles(); if (!earRoleList.isEmpty()) validateEarRoles(earRoleList); EList moduleList = appDD.getModules(); if (!moduleList.isEmpty()) { for (int i = 0; i < moduleList.size(); i++) { Module m = (Module) moduleList.get(i); if (m.isEjbModule()) { EList ejbRoles = m.getApplication().getSecurityRoles(); if (!ejbRoles.isEmpty()) validateEJBRolesWithEARRoles(earRoleList, ejbRoles); }// if if (m.isWebModule()) { EList webRoles = m.getApplication().getSecurityRoles(); if (!webRoles.isEmpty()) validateWEBRolesWithEARRoles(earRoleList, webRoles); }// if }// for }// if }// validateSecurity
/** * @see com.ibm.etools.commonarchive.EARFile */ public Module getModule(String aUri, String altDD) { return getDeploymentDescriptor().getModule(aUri, altDD); }
/** * Checks if the nature is consistent with doc type. */ protected void validateDocType(EnterpriseArtifactEdit edit,IVirtualComponent module) { if (edit == null) return; if (edit.getJ2EEVersion() >= J2EEVersionConstants.J2EE_1_3_ID && appDD.getVersionID() < J2EEVersionConstants.J2EE_1_3_ID) { String[] params = new String[3]; params[0] = DOCTYPE_1_2; params[1] = getResourceName(); params[2] = DOCTYPE_1_3; String tmp = NLS.bind(EARValidationMessageResourceHandler.EAR_INVALID_DOC_TYPE_ERROR_, params); addLocalizedError(tmp, appDD); } else if (edit.getJ2EEVersion() < J2EEVersionConstants.J2EE_1_3_ID && appDD.getVersionID() >= J2EEVersionConstants.J2EE_1_3_ID) { String[] params = new String[3]; params[0] = DOCTYPE_1_3; params[1] = getResourceName(); params[2] = DOCTYPE_1_2; String tmp = NLS.bind(EARValidationMessageResourceHandler.EAR_INVALID_DOC_TYPE_ERROR_, params); addLocalizedError(tmp, appDD); } }
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(); }
public String getText(Object object) { String displayName = ((Application) object).getDisplayName(); return displayName == null ? ApplicationProvidersResourceHandler.getString("<<No_display_name>>_ERROR_") : displayName; //$NON-NLS-1$ }
/** * @generated This field/method will be replaced during code generation */ public Application getDeploymentDescriptorGen() { if (deploymentDescriptor != null && deploymentDescriptor.eIsProxy()) { InternalEObject oldDeploymentDescriptor = (InternalEObject)deploymentDescriptor; deploymentDescriptor = (Application)eResolveProxy(oldDeploymentDescriptor); if (deploymentDescriptor != oldDeploymentDescriptor) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, CommonarchivePackage.EAR_FILE__DEPLOYMENT_DESCRIPTOR, oldDeploymentDescriptor, deploymentDescriptor)); } } return deploymentDescriptor; }
/** * This method will return the context root in this application for the passed in web project. * * @param webProject * @return contextRoot String */ public String getWebContextRoot(IProject webProject) { verifyOperationSupported(); if (webProject == null || !J2EEProjectUtilities.isDynamicWebProject(webProject)) return null; IVirtualComponent webComp = ComponentCore.createComponent(webProject); String webModuleURI = getModuleURI(webComp); if (webModuleURI != null) { WebModule webModule = (WebModule) getApplication().getModule(webModuleURI, null); if (webModule != null) return webModule.getContextRoot(); } return null; }
archiveType = EARFILE; Application app = ((EARFile) anArchive).getDeploymentDescriptor(); if (app.getVersionID() == J2EEVersionConstants.J2EE_1_2_ID) archiveType |= J2EE12; else if (app.getVersionID() == J2EEVersionConstants.J2EE_1_3_ID) archiveType |= J2EE13; else if (app.getVersionID() == J2EEVersionConstants.J2EE_1_4_ID) archiveType |= J2EE14;
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(); }
public void initRefs(EList refs) { List modules = getDeploymentDescriptor().getModules(); for (int i = 0; i < modules.size(); i++) { Module module = (Module) modules.get(i); refs.add(createModuleRef(module, null)); } }
for (Iterator referenceItr = implicitUtilityReferences.iterator(); referenceItr.hasNext(); ) { reference = (IVirtualReference) referenceItr.next(); module = application.getFirstModule(reference.getArchiveName()); if(module != null) referenceItr.remove();
/** * This method will set the context root on the application for the passed in contextRoot. This * must be called in a write artifact edit and be saved for changes to be saved. * * @param webProject * @param aContextRoot */ public void setWebContextRoot(IProject webProject, String aContextRoot) { verifyOperationSupported(); if (webProject == null || !J2EEProjectUtilities.isDynamicWebProject(webProject)) return; IVirtualComponent webComp = ComponentCore.createComponent(webProject); String webModuleURI = getModuleURI(webComp); if (webModuleURI != null) { WebModule webModule = (WebModule) getApplication().getModule(webModuleURI, null); if (webModule != null) webModule.setContextRoot(aContextRoot); } } public IModelProvider create(IProject project) {
/** * @see com.ibm.etools.commonarchive.EARFile */ public void rollUpRoles() { List modules = getDeploymentDescriptor().getModules(); for (int i = 0; i < modules.size(); i++) { Module aModule = (Module) modules.get(i); rollUpRoles(aModule); } }