/** * @see com.ibm.etools.commonarchive.impl.ModuleFileImpl */ public org.eclipse.emf.ecore.EObject makeDeploymentDescriptor(XMLResource resource) { EJBJar ejbJar = ((EjbPackage) EPackage.Registry.INSTANCE.getEPackage(EjbPackage.eNS_URI)).getEjbFactory().createEJBJar(); resource.setID(ejbJar, J2EEConstants.EJBJAR_ID); setDeploymentDescriptorGen(ejbJar); resource.getContents().add(ejbJar); return ejbJar; }
/** * The only resources webservice manager is concerned about are: * webservice.xml, webserviceclient.xml, and J2EE 1.4 web.xml, ejb-jar-xml, and application-client.xml * @param res * @return boolean isInterested */ private boolean isInterestedInResource(Resource res) { if (res instanceof WsddResource || res instanceof WebServicesResource) { return true; } else if (res instanceof EJBResource || res instanceof WebAppResource || res instanceof ApplicationClientResource) { return ((XMLResource)res).getJ2EEVersionID()>J2EEVersionConstants.J2EE_1_3_ID; } else { return false; } }
/** * @see org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl#createResource(URI) */ public final Resource createResource(URI uri) { XMLResource resource = primCreateResource(uri); resource.getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); resource.getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_LINE_WIDTH, new Integer(80)); return resource; }
/** * @see com.ibm.etools.emf.ecore.utilities.copy.EtoolsCopySession#newInstance(Resource, String) */ public Resource newInstance(Resource aResource, String newUri) { Resource copyResource = super.newInstance(aResource, newUri); if (aResource instanceof XMLResource) ((XMLResource) copyResource).setVersionID(((XMLResource) aResource).getVersionID()); return copyResource; }
if (aResource.getContents() == null || aResource.getContents().isEmpty()) { EJBJar ejbJar = EjbFactory.eINSTANCE.createEJBJar(); aResource.getContents().add(ejbJar); EJBJar ejbJar = (EJBJar) aResource.getContents().get(0); URI moduleURI = getArtifactEditModel().getModuleURI(); try { aResource.setID(ejbJar, J2EEConstants.EJBJAR_ID); if (aResource.isModified()) aResource.saveIfNecessary(); } catch (Exception e) {
/** * @see com.ibm.etools.commonarchive.impl.ModuleFileImpl */ public org.eclipse.emf.ecore.EObject makeDeploymentDescriptor(XMLResource resource) { JcaPackage p = (JcaPackage) EPackage.Registry.INSTANCE.getEPackage(JcaPackage.eNS_URI); JcaFactory fct = p.getJcaFactory(); Connector connector = fct.createConnector(); setDeploymentDescriptor(connector); resource.getContents().add(connector); return connector; }
/** * Retrieves the deployment descriptor root element for the specified module. Takes into account * altDD indirection. * * @return Only return null if an altDD is not defined. */ public EObject getAltDeploymentDescriptor(Module aModule) throws FileNotFoundException, ResourceLoadException, EmptyResourceException { // Look for altDD String altDD = aModule.getAltDD(); if (ArchiveUtil.isNullOrEmpty(altDD)) return null; if (!isMofResourceLoaded(altDD.trim())) registerResourceFactory(aModule, altDD); XMLResource ddRes = (XMLResource) getMofResource(altDD.trim()); if (!ddRes.isAlt()) { ddRes.setIsAlt(true); ddRes.setApplication(getDeploymentDescriptor()); } return ArchiveUtil.getRoot(ddRes); }
/** * Return boolean indicating if this Application was populated from an Applcation1.2 compliant descriptor * @return boolean * @deprecated Use getVersionID() to determine module level */ public boolean isVersion1_2Descriptor() { CommonUtil.checkDDObjectForVersion(this); String systemId = ((XMLResource)eResource()).getSystemId(); return systemId == null ? false : systemId.equals(J2EEConstants.APPLICATION_SYSTEMID_1_2); } /**
/** * Return the version ID of the module For example, "20" * * @return int */ public int getSpecVersionID() { try { return ((XMLResource) getDeploymentDescriptorResource()).getModuleVersionID(); } catch (Exception e) { throw new ArchiveRuntimeException(e); } }
/** * For the given object in the deployment descriptor, return the owning module file; for * example, retrieve the EJBJarFile that owns the EJBJar. This works even for alts */ public static ModuleFile getModuleFile(EObject ddObject) { Resource res = ddObject.eResource(); if (res == null) return null; Archive archive = getArchive(res); if (archive == null || !archive.isModuleFile()) return null; if (!(res instanceof XMLResource)) return null; XMLResource xmlRes = (XMLResource) res; if (xmlRes.isAlt()) return getModuleFileUsingAltDD((EARFile) archive, res); return (ModuleFile) archive; }
/** * Method createDefaultMessage. * @return String */ private String createDefaultMessage() { String objDesc; if (getResource() != null) objDesc = getResource().getURI().toString(); else if (getTargetObject() != null && getTargetObject() instanceof ENamedElement) objDesc = ((ENamedElement) getTargetObject()).getName(); else return null; switch (getSeverity()) { case COMPLETED_OK : return format(DEFAULT_COMPLETED_STATUS_MSG, objDesc); case NOT_NEEDED : return format(DEFAULT_NOT_NEEDED_STATUS_MSG, objDesc); case NOT_POSSIBLE : return format(DEFAULT_NOT_POSSIBLE_STATUS_MSG, objDesc); case ERROR : return format(DEFAULT_ERROR_STATUS_MSG, objDesc); } return null; }
/** * Return boolean indicating if this Web App was populated from an Servlet2.2 compliant descriptor * @return boolean * @deprecated Use getVersionID() to determine module level */ public boolean isVersion2_2Descriptor() { CommonUtil.checkDDObjectForVersion(this); String systemId = ((XMLResource)eResource()).getSystemId(); return systemId == null ? false : systemId.equals(J2EEConstants.WEBAPP_SYSTEMID_2_2); } /**
/** * @see com.ibm.etools.commonarchive.impl.ModuleFileImpl */ public org.eclipse.emf.ecore.EObject makeDeploymentDescriptor(XMLResource resource) { WebApp webApp = ((WebapplicationPackage) EPackage.Registry.INSTANCE.getEPackage(WebapplicationPackage.eNS_URI)).getWebapplicationFactory().createWebApp(); resource.setID(webApp, J2EEConstants.WEBAPP_ID); setDeploymentDescriptorGen(webApp); resource.getContents().add(webApp); return webApp; }
public static boolean isJ2EE13(ModuleFile aModuleFile) { try { XMLResource xmlResource = (XMLResource) aModuleFile.getDeploymentDescriptorResource(); return xmlResource.getJ2EEVersionID() == J2EEVersionConstants.J2EE_1_3_ID; } catch (FileNotFoundException ex) { return false; } }
/** * Return boolean indicating if this Web App was populated from an Servlet2.3 compliant descriptor * @return boolean * @deprecated Use getVersionID() to determine module level */ public boolean isVersion2_3Descriptor() { CommonUtil.checkDDObjectForVersion(this); String systemId = ((XMLResource)eResource()).getSystemId(); return systemId == null ? false : systemId.equals(J2EEConstants.WEBAPP_SYSTEMID_2_3); } /**
/** * @see com.ibm.etools.commonarchive.impl.ModuleFileImpl */ public org.eclipse.emf.ecore.EObject makeDeploymentDescriptor(XMLResource resource) { Application appl = ((ApplicationPackage) EPackage.Registry.INSTANCE.getEPackage(ApplicationPackage.eNS_URI)).getApplicationFactory().createApplication(); resource.setID(appl, J2EEConstants.APPL_ID); setDeploymentDescriptorGen(appl); resource.getContents().add(appl); return appl; }
public static boolean isJ2EE14(ModuleFile aModuleFile) { try { XMLResource xmlResource = (XMLResource) aModuleFile.getDeploymentDescriptorResource(); return xmlResource.getJ2EEVersionID() == J2EEVersionConstants.J2EE_1_4_ID; } catch (FileNotFoundException ex) { return false; } }
/** * Return boolean indicating if this Application Client was populated from an Application Client 1.2 compliant descriptor * @return boolean * @deprecated Use getVersionID() to determine module level */ public boolean isVersion1_2Descriptor() { CommonUtil.checkDDObjectForVersion(this); String systemId = ((XMLResource)eResource()).getSystemId(); return systemId == null ? false : systemId.equals(J2EEConstants.APP_CLIENT_SYSTEMID_1_2); } /**
/** * @see com.ibm.etools.commonarchive.impl.ModuleFileImpl */ public org.eclipse.emf.ecore.EObject makeDeploymentDescriptor(XMLResource resource) { ApplicationClient aClient = ((ClientPackage) EPackage.Registry.INSTANCE.getEPackage(ClientPackage.eNS_URI)).getClientFactory().createApplicationClient(); resource.setID(aClient, J2EEConstants.APP_CLIENT_ID); setDeploymentDescriptorGen(aClient); resource.getContents().add(aClient); return aClient; }
/** * @param moduleFile * @return */ private int getVersionID(ModuleFile moduleFile) { XMLResource res = null; try { res = (XMLResource) moduleFile.getDeploymentDescriptorResource(); } catch (ResourceLoadException e) { //Ignore } catch (FileNotFoundException e) { //Ignore } if (res != null) return res.getJ2EEVersionID(); return -1; }