📄 weblogicdeploymenttool.java
字号:
* @param ejbcClass the name of the class to use. */ public void setEjbcClass(String ejbcClass) { this.ejbcClass = ejbcClass; } /** * Get the ejbc compiler class. * @return the name of the ejbc compiler class. */ public String getEjbcClass() { return ejbcClass; } /** * <b>Deprecated</b>. Defines the location of the ejb-jar DTD in * the weblogic class hierarchy. Should not be needed, and the * nested <dtd> element is recommended when it is. * * @param inString the string to use as the DTD location. */ public void setWeblogicdtd(String inString) { setEJBdtd(inString); } /** * <b>Deprecated</b>. Defines the location of weblogic DTD in * the weblogic class hierarchy. Should not be needed, and the * nested <dtd> element is recommended when it is. * * @param inString the string to use as the DTD location. */ public void setWLdtd(String inString) { this.weblogicDTD = inString; } /** * <b>Deprecated</b>. Defines the location of Sun's EJB DTD in * the weblogic class hierarchy. Should not be needed, and the * nested <dtd> element is recommended when it is. * * @param inString the string to use as the DTD location. */ public void setEJBdtd(String inString) { this.ejb11DTD = inString; } /** * Set the value of the oldCMP scheme. This is an antonym for newCMP * @ant.attribute ignore="true' * @param oldCMP a <code>boolean</code> value. */ public void setOldCMP(boolean oldCMP) { this.newCMP = !oldCMP; } /** * If this is set to true, the new method for locating * CMP descriptors will be used; optional, default false. * <P> * The old CMP scheme locates the * weblogic CMP descriptor based on the naming convention where the * weblogic CMP file is expected to be named with the bean name as the * prefix. Under this scheme the name of the CMP descriptor does not match * the name actually used in the main weblogic EJB descriptor. Also, * descriptors which contain multiple CMP references could not be used. * @param newCMP a <code>boolean</code> value. */ public void setNewCMP(boolean newCMP) { this.newCMP = newCMP; } /** * Do not EJBC the jar after it has been put together; * optional, default false * @param noEJBC a <code>boolean</code> value. */ public void setNoEJBC(boolean noEJBC) { this.noEJBC = noEJBC; } /** * Register the DTDs. * @param handler the handler to use. */ protected void registerKnownDTDs(DescriptorHandler handler) { // register all the known DTDs handler.registerDTD(PUBLICID_EJB11, DEFAULT_WL51_EJB11_DTD_LOCATION); handler.registerDTD(PUBLICID_EJB11, DEFAULT_WL60_EJB11_DTD_LOCATION); handler.registerDTD(PUBLICID_EJB11, ejb11DTD); handler.registerDTD(PUBLICID_EJB20, DEFAULT_WL60_EJB20_DTD_LOCATION); } /** * Get the weblogic descriptor handler. * @param srcDir the source directory. * @return the descriptor. */ protected DescriptorHandler getWeblogicDescriptorHandler(final File srcDir) { DescriptorHandler handler = new DescriptorHandler(getTask(), srcDir) { protected void processElement() { if (currentElement.equals("type-storage")) { // Get the filename of vendor specific descriptor String fileNameWithMETA = currentText; //trim the META_INF\ off of the file name String fileName = fileNameWithMETA.substring(META_DIR.length(), fileNameWithMETA.length()); File descriptorFile = new File(srcDir, fileName); ejbFiles.put(fileNameWithMETA, descriptorFile); } } }; handler.registerDTD(PUBLICID_WEBLOGIC_EJB510, DEFAULT_WL51_DTD_LOCATION); handler.registerDTD(PUBLICID_WEBLOGIC_EJB510, DEFAULT_WL60_51_DTD_LOCATION); handler.registerDTD(PUBLICID_WEBLOGIC_EJB600, DEFAULT_WL60_DTD_LOCATION); handler.registerDTD(PUBLICID_WEBLOGIC_EJB700, DEFAULT_WL70_DTD_LOCATION); handler.registerDTD(PUBLICID_WEBLOGIC_EJB510, weblogicDTD); handler.registerDTD(PUBLICID_WEBLOGIC_EJB600, weblogicDTD); for (Iterator i = getConfig().dtdLocations.iterator(); i.hasNext();) { EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation) i.next(); handler.registerDTD(dtdLocation.getPublicId(), dtdLocation.getLocation()); } return handler; } /** * Add any vendor specific files which should be included in the EJB Jar. * @param ejbFiles the hash table to be populated. * @param ddPrefix the prefix to use. */ protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { File weblogicDD = new File(getConfig().descriptorDir, ddPrefix + WL_DD); if (weblogicDD.exists()) { ejbFiles.put(META_DIR + WL_DD, weblogicDD); } else { log("Unable to locate weblogic deployment descriptor. " + "It was expected to be in " + weblogicDD.getPath(), Project.MSG_WARN); return; } if (!newCMP) { log("The old method for locating CMP files has been DEPRECATED.", Project.MSG_VERBOSE); log("Please adjust your weblogic descriptor and set " + "newCMP=\"true\" to use the new CMP descriptor " + "inclusion mechanism. ", Project.MSG_VERBOSE); // The the weblogic cmp deployment descriptor File weblogicCMPDD = new File(getConfig().descriptorDir, ddPrefix + WL_CMP_DD); if (weblogicCMPDD.exists()) { ejbFiles.put(META_DIR + WL_CMP_DD, weblogicCMPDD); } } else { // now that we have the weblogic descriptor, we parse the file // to find other descriptors needed to deploy the bean. // this could be the weblogic-cmp-rdbms.xml or any other O/R // mapping tool descriptors. try { File ejbDescriptor = (File) ejbFiles.get(META_DIR + EJB_DD); SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); saxParserFactory.setValidating(true); SAXParser saxParser = saxParserFactory.newSAXParser(); DescriptorHandler handler = getWeblogicDescriptorHandler(ejbDescriptor.getParentFile()); saxParser.parse(new InputSource (new FileInputStream(weblogicDD)), handler); Hashtable ht = handler.getFiles(); Enumeration e = ht.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); ejbFiles.put(key, ht.get(key)); } } catch (Exception e) { String msg = "Exception while adding Vendor specific files: " + e.toString(); throw new BuildException(msg, e); } } } /** * Get the vendor specific name of the Jar that will be output. The * modification date of this jar will be checked against the dependent * bean classes. */ File getVendorOutputJarFile(String baseName) { return new File(getDestDir(), baseName + jarSuffix); } /** * Helper method invoked by execute() for each WebLogic jar to be built. * Encapsulates the logic of constructing a java task for calling * weblogic.ejbc and executing it. * * @param sourceJar java.io.File representing the source (EJB1.1) jarfile. * @param destJar java.io.File representing the destination, WebLogic * jarfile. */ private void buildWeblogicJar(File sourceJar, File destJar, String publicId) { Java javaTask = null; if (noEJBC) { try { FILE_UTILS.copyFile(sourceJar, destJar); if (!keepgenerated) { sourceJar.delete(); } return; } catch (IOException e) { throw new BuildException("Unable to write EJB jar", e); } } String ejbcClassName = ejbcClass; try { javaTask = new Java(getTask()); javaTask.setTaskName("ejbc"); javaTask.createJvmarg().setLine(additionalJvmArgs); if (!(sysprops.isEmpty())) { for (Enumeration en = sysprops.elements(); en.hasMoreElements();) { Environment.Variable entry = (Environment.Variable) en.nextElement(); javaTask.addSysproperty(entry); } } if (getJvmDebugLevel() != null) { javaTask.createJvmarg().setLine(" -Dweblogic.StdoutSeverityLevel=" + jvmDebugLevel); } if (ejbcClassName == null) { // try to determine it from publicId if (PUBLICID_EJB11.equals(publicId)) { ejbcClassName = COMPILER_EJB11; } else if (PUBLICID_EJB20.equals(publicId)) { ejbcClassName = COMPILER_EJB20; } else { log("Unrecognized publicId " + publicId + " - using EJB 1.1 compiler", Project.MSG_WARN); ejbcClassName = COMPILER_EJB11; } } javaTask.setClassname(ejbcClassName); javaTask.createArg().setLine(additionalArgs); if (keepgenerated) { javaTask.createArg().setValue("-keepgenerated"); } if (compiler == null) { // try to use the compiler specified by build.compiler. // Right now we are just going to allow Jikes String buildCompiler = getTask().getProject().getProperty("build.compiler"); if (buildCompiler != null && buildCompiler.equals("jikes")) { javaTask.createArg().setValue("-compiler"); javaTask.createArg().setValue("jikes"); } } else { if (!compiler.equals(DEFAULT_COMPILER)) { javaTask.createArg().setValue("-compiler"); javaTask.createArg().setLine(compiler); } } Path combinedClasspath = getCombinedClasspath(); if (wlClasspath != null && combinedClasspath != null && combinedClasspath.toString().trim().length() > 0) { javaTask.createArg().setValue("-classpath"); javaTask.createArg().setPath(combinedClasspath); } javaTask.createArg().setValue(sourceJar.getPath()); if (outputDir == null) { javaTask.createArg().setValue(destJar.getPath()); } else { javaTask.createArg().setValue(outputDir.getPath()); } Path classpath = wlClasspath;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -