[jboss-svn-commits] JBL Code SVN: r20717 - in labs/jbossesb/workspace/jimma/product/rosetta: src/org/jboss/soa/esb/listeners/config and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 24 01:15:14 EDT 2008
Author: jim.ma
Date: 2008-06-24 01:15:14 -0400 (Tue, 24 Jun 2008)
New Revision: 20717
Added:
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template
labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java
Removed:
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGenerator.java
labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGeneratorUnitTest.java
Modified:
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
Log:
* Wrap the generated ws war to an .ear file and make it as a subdeployment of esb archive
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2008-06-24 03:06:32 UTC (rev 20716)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -28,7 +28,6 @@
import javassist.CtField;
import javassist.CtMethod;
import javassist.CtNewMethod;
-import javassist.Modifier;
import javassist.NotFoundException;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ConstPool;
@@ -39,7 +38,6 @@
import org.antlr.stringtemplate.StringTemplate;
import org.apache.commons.io.IOUtils;
-import org.jboss.soa.esb.client.ServiceInvoker;
import org.jboss.soa.esb.util.ClassUtil;
public class JAXWSProviderClassGenerator {
@@ -93,7 +91,6 @@
seiClass.getClassFile().addAttribute(attribute);
CtClass invokerCtClass = pool.get("org.jboss.soa.esb.client.ServiceInvoker");
- //CtField.Initializer init = CtField.Initializer.byNew(invokerCtClass, new String[]{epInfo.getServiceCategory(), epInfo.getServiceName()});
String filedStr = "new org.jboss.soa.esb.client.ServiceInvoker(\""
+ epInfo.getServiceCategory() + "\","
+ "\"" + epInfo.getServiceName() + "\");";
@@ -108,8 +105,6 @@
seiClass.getClassFile().getConstPool(),
"Ljava/lang/Object;Ljavax/xml/ws/Provider<Ljavax/xml/soap/SOAPMessage;>;");
seiClass.getClassFile().addAttribute(signatureAttribute);
- // seiClass.freeze();
-
} catch (Exception e) {
throw new WebServicePublishException(
Copied: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java (from rev 20716, labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGenerator.java)
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -0,0 +1,318 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.webservice;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javassist.CtClass;
+
+import org.antlr.stringtemplate.StringTemplate;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.jboss.util.file.JarUtils;
+
+public class JBossWSDeploymentGenerator {
+ private Logger logger = Logger.getLogger(getClass());
+ public String warName;
+ public CopyOnWriteArrayList<File> warFileList = new CopyOnWriteArrayList<File>();
+ public CopyOnWriteArrayList<File> earFileList = new CopyOnWriteArrayList<File>();
+ public String tmpDir = System.getProperty("java.io.tmpdir");
+ public ESBServiceEndpointInfo endpointInfo;
+
+ public JBossWSDeploymentGenerator(ESBServiceEndpointInfo endpoint) {
+ endpointInfo = endpoint;
+ warName = (endpoint.getServiceCategory().toLowerCase() + "-" + endpoint
+ .getServiceName()).toLowerCase()
+ + ".war";
+
+ }
+
+ private File generateEar() throws Exception {
+ try {
+ addFileToEar(generateEarAppXml());
+ File warTmp = File.createTempFile(endpointInfo.getEndpointName()
+ + "ear", "dir");
+ warTmp.delete();
+ warTmp.mkdirs();
+ File earDir = new File(warTmp.getPath() + File.separator + "sub");
+ earDir.mkdir();
+
+ for (File file : earFileList) {
+ File dir = new File(earDir.getCanonicalPath() + File.separator
+ + file.getParentFile().getPath());
+
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+
+ FileUtils.copyFileToDirectory(file, dir);
+ }
+
+ File warFile = this.generateWar();
+ FileUtils.copyFileToDirectory(warFile, earDir);
+ String earName = endpointInfo.getServiceCategory().toLowerCase()
+ + "-" + endpointInfo.getServiceName().toLowerCase()
+ + ".ear";
+ File earFile = new File(warTmp + File.separator + earName);
+ earFile.createNewFile();
+ FileOutputStream fout = new FileOutputStream(earFile);
+ JarUtils.jar(fout, earDir.listFiles());
+ fout.close();
+ logger.log(Level.DEBUG, "Generated ear file for Endpoint "
+ + endpointInfo.getEndpointName());
+ return earFile;
+ } catch (Exception e) {
+ throw e;
+ }
+
+ }
+
+ private File generateWar() throws Exception {
+ try {
+ addFileToWar(generateWebXml());
+ addFileToWar(generateWSDLFile());
+ addFileToWar(generateJbossWebXml());
+ File warTmp = File.createTempFile(endpointInfo.getEndpointName()
+ + "war", "dir");
+ warTmp.delete();
+ warTmp.mkdirs();
+ File warDir = new File(warTmp.getPath() + File.separator + "sub");
+ warDir.mkdir();
+
+ for (File file : warFileList) {
+ File dir = new File(warDir.getCanonicalPath() + File.separator
+ + file.getParentFile().getPath());
+
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+
+ FileUtils.copyFileToDirectory(file, dir);
+ }
+
+ JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator();
+ CtClass providerClass = generator.generate(endpointInfo);
+ providerClass.writeFile(warDir.getCanonicalPath());
+ File warFile = new File(warTmp + File.separator + warName);
+ warFile.createNewFile();
+ FileOutputStream fout = new FileOutputStream(warFile);
+ JarUtils.jar(fout, warDir.listFiles());
+ fout.close();
+ logger.log(Level.DEBUG,
+ "Generated webserivce war file for Endpoint "
+ + endpointInfo.getEndpointName());
+ return warFile;
+ } catch (Exception e) {
+ throw e;
+ }
+
+ }
+ //Directly deploy the generated webservice war file in esb server
+ public void deployWar(File esbFile) throws WebServicePublishException {
+ File wsWar;
+ try {
+ wsWar = generateWar();
+ } catch (Exception e1) {
+ throw new WebServicePublishException(
+ "Failed to generate war file for Endpoint "
+ + endpointInfo.getEndpointName(), e1);
+ }
+ File deployDir = esbFile.getParentFile();
+
+ try {
+ FileUtils.copyFileToDirectory(wsWar, deployDir);
+ } catch (Exception e) {
+ throw new WebServicePublishException(
+ "Failed to add war file to esb service "
+ + esbFile.getName(), e);
+ }
+
+ logger.log(Level.DEBUG, "Deployed webservice war for esb service "
+ + esbFile.getName());
+
+ }
+ //package the web serivice war as a subdeployment of ESB archive
+ public void injectWarToESBArchive(File esbFile)
+ throws WebServicePublishException {
+ File warFile;
+ try {
+ warFile = generateWar();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ throw new WebServicePublishException(
+ "Failed to generate war file for Endpoint "
+ + endpointInfo.getEndpointName(), e1);
+ }
+
+ if (esbFile.exists() && esbFile.isFile()) {
+ try {
+ FileInputStream fin = new FileInputStream(esbFile);
+ File tmpDir = File.createTempFile(esbFile.getName(), ".tmp");
+ tmpDir.delete();
+ tmpDir.mkdirs();
+ JarUtils.unjar(fin, tmpDir);
+ FileUtils.copyFileToDirectory(warFile, tmpDir);
+ fin.close();
+
+ esbFile.delete();
+ esbFile.createNewFile();
+ FileOutputStream fout = new FileOutputStream(esbFile);
+ JarUtils.jar(fout, tmpDir.listFiles());
+ fout.close();
+ } catch (Exception e) {
+ throw new WebServicePublishException(
+ "Failed to package the ear file in esb service archive "
+ + esbFile.getName(), e);
+ }
+ } else if (esbFile.exists() && esbFile.isDirectory()) {
+ try {
+ FileUtils.copyFileToDirectory(warFile, esbFile);
+ } catch (Exception e) {
+ throw new WebServicePublishException(
+ "Failed to add war file to esb service "
+ + esbFile.getName(), e);
+ }
+
+ }
+ logger.log(Level.DEBUG,
+ "Packaged webservice deployment .war into esb service archive "
+ + esbFile.getName());
+
+ }
+ //wrap the generated web service .war as an .ear and package it as a subdeployment of ESB archive
+ public void injectEarToESBArchive(File esbFile)
+ throws WebServicePublishException {
+ File earFile;
+ try {
+ earFile = generateEar();
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ throw new WebServicePublishException(
+ "Failed to Generate ear file for Endpoint "
+ + endpointInfo.getEndpointName(), e1);
+ }
+
+ if (esbFile.exists() && esbFile.isFile()) {
+ try {
+ FileInputStream fin = new FileInputStream(esbFile);
+ File tmpDir = File.createTempFile(esbFile.getName(), ".tmp");
+ tmpDir.delete();
+ tmpDir.mkdirs();
+ JarUtils.unjar(fin, tmpDir);
+ FileUtils.copyFileToDirectory(earFile, tmpDir);
+ fin.close();
+
+ esbFile.delete();
+ esbFile.createNewFile();
+ FileOutputStream fout = new FileOutputStream(esbFile);
+ JarUtils.jar(fout, tmpDir.listFiles());
+ fout.close();
+ } catch (Exception e) {
+ throw new WebServicePublishException(
+ "Failed to package the ear file in esb service archive "
+ + esbFile.getName(), e);
+ }
+ } else if (esbFile.exists() && esbFile.isDirectory()) {
+ try {
+ FileUtils.copyFileToDirectory(earFile, esbFile);
+ } catch (Exception e) {
+ throw new WebServicePublishException(
+ "Failed to add ear file to esb service "
+ + esbFile.getName(), e);
+ }
+
+ }
+ logger.log(Level.DEBUG,
+ "Packaged webservice deployment ear into esb service archive "
+ + esbFile.getName());
+
+ }
+
+ protected void addFileToWar(File file) {
+ warFileList.add(file);
+ }
+
+ protected void addFileToEar(File file) {
+ earFileList.add(file);
+ }
+
+ private File generateWebXml() throws IOException {
+
+ InputStream inTemplate = ClassUtil.getResourceAsStream(
+ "web-xml.template", getClass());
+ StringWriter strWriter = new StringWriter();
+ IOUtils.copy(inTemplate, strWriter);
+ StringTemplate template = new StringTemplate(strWriter.toString());
+ template.setAttribute("ServiceName", endpointInfo.getServiceName());
+ template.setAttribute("Category", endpointInfo.getServiceCategory());
+ template.setAttribute("EndpointClassName", endpointInfo
+ .getWSEndpointClassName());
+ File webXml = new File("WEB-INF/web.xml");
+ FileUtils.writeStringToFile(webXml, template.toString());
+ return webXml;
+ }
+
+ private File generateEarAppXml() throws IOException {
+
+ InputStream inTemplate = ClassUtil.getResourceAsStream(
+ "app-xml.template", getClass());
+ StringWriter strWriter = new StringWriter();
+ IOUtils.copy(inTemplate, strWriter);
+ StringTemplate template = new StringTemplate(strWriter.toString());
+ template.setAttribute("AppName", endpointInfo.getServiceName()
+ .toLowerCase());
+ template.setAttribute("WarName", warName);
+ template.setAttribute("ContextRoot", endpointInfo.getServiceName()
+ .toLowerCase());
+ File appXml = new File("META-INF/application.xml");
+ FileUtils.writeStringToFile(appXml, template.toString());
+ return appXml;
+ }
+
+ private File generateJbossWebXml() throws IOException {
+ InputStream inTemplate = ClassUtil.getResourceAsStream(
+ "jbossweb-xml.template", getClass());
+ StringWriter strWriter = new StringWriter();
+ IOUtils.copy(inTemplate, strWriter);
+ StringTemplate template = new StringTemplate(strWriter.toString());
+ template.setAttribute("ESBArtifact",
+ endpointInfo.getDeploymentInfo().shortName);
+ File jbossWebXml = new File("WEB-INF/jboss-web.xml");
+ FileUtils.writeStringToFile(jbossWebXml, template.toString());
+ return jbossWebXml;
+ }
+
+ private File generateWSDLFile() throws IOException {
+ File wsdlFile = new File("WEB-INF/wsdl/"
+ + endpointInfo.getWSDLFileName());
+ FileUtils.writeStringToFile(wsdlFile, endpointInfo.getWSDL());
+ return wsdlFile;
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGenerator.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGenerator.java 2008-06-24 03:06:32 UTC (rev 20716)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGenerator.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -1,205 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.internal.soa.esb.webservice;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javassist.CtClass;
-
-import org.antlr.stringtemplate.StringTemplate;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.util.ClassUtil;
-import org.jboss.util.file.JarUtils;
-
-public class JBossWSWarGenerator {
- private Logger logger = Logger.getLogger(getClass());
- public String warName;
- public CopyOnWriteArrayList<File> fileList = new CopyOnWriteArrayList<File>();
- public String tmpDir = System.getProperty("java.io.tmpdir");
- public ESBServiceEndpointInfo endpointInfo;
-
- public JBossWSWarGenerator(ESBServiceEndpointInfo endpoint) {
- endpointInfo = endpoint;
- warName = (endpoint.getServiceCategory().toLowerCase() + "-" + endpoint
- .getServiceName()).toLowerCase();
-
- }
-
- private File generateWar() throws Exception {
- try {
- addFile(generateWebXml());
- addFile(generateWSDLFile());
- addFile(generateJbossWebXml());
- File warTmp = File.createTempFile(endpointInfo.getEndpointName()
- + "war", "dir");
- warTmp.delete();
- warTmp.mkdirs();
- File warDir = new File(warTmp.getPath() + File.separator + "sub");
- warDir.mkdir();
-
- for (File file : fileList) {
- File dir = new File(warDir.getCanonicalPath() + File.separator
- + file.getParentFile().getPath());
-
- if (!dir.exists()) {
- dir.mkdirs();
- }
-
- FileUtils.copyFileToDirectory(file, dir);
- }
-
- JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator();
- CtClass providerClass = generator.generate(endpointInfo);
- providerClass.writeFile(warDir.getCanonicalPath());
- File warFile = new File(warTmp + File.separator + warName + ".war");
- warFile.createNewFile();
- FileOutputStream fout = new FileOutputStream(warFile);
- JarUtils.jar(fout, warDir.listFiles());
- fout.close();
- logger.log(Level.DEBUG,
- "Generated webserivce war file for Endpoint "
- + endpointInfo.getEndpointName());
- return warFile;
- } catch (Exception e) {
- throw e;
- }
-
- }
-
- public void deployWar(File esbFile) throws WebServicePublishException {
- File wsWar;
- try {
- wsWar = generateWar();
- } catch (Exception e1) {
- throw new WebServicePublishException(
- "Failed to Generate war file for Endpoint "
- + endpointInfo.getEndpointName(), e1);
- }
- File deployDir = esbFile.getParentFile();
-
- try {
- FileUtils.copyFileToDirectory(wsWar, deployDir);
- } catch (Exception e) {
- throw new WebServicePublishException(
- "Failed to add war file to esb service "
- + esbFile.getName(), e);
- }
-
- logger.log(Level.DEBUG,
- "Deployed webservice war for esb service "
- + esbFile.getName());
-
- }
-
- public void injectWarToESBArchive(File esbFile) throws WebServicePublishException {
- File wsWar;
- try {
- wsWar = generateWar();
- } catch (Exception e1) {
- e1.printStackTrace();
- throw new WebServicePublishException(
- "Failed to Generate war file for Endpoint "
- + endpointInfo.getEndpointName(), e1);
- }
-
- if (esbFile.exists() && esbFile.isFile()) {
- try {
- FileInputStream fin = new FileInputStream(esbFile);
- File tmpDir = File.createTempFile(esbFile.getName(), ".tmp");
- tmpDir.delete();
- tmpDir.mkdirs();
- JarUtils.unjar(fin, tmpDir);
- FileUtils.copyFileToDirectory(wsWar, tmpDir);
- fin.close();
-
- esbFile.delete();
- esbFile.createNewFile();
- FileOutputStream fout = new FileOutputStream(esbFile);
- JarUtils.jar(fout, tmpDir.listFiles());
- fout.close();
- } catch (Exception e) {
- throw new WebServicePublishException(
- "Failed to inject war file in esb service "
- + esbFile.getName(), e);
- }
- } else if (esbFile.exists() && esbFile.isDirectory()) {
- try {
- FileUtils.copyFileToDirectory(wsWar, esbFile);
- } catch (Exception e) {
- throw new WebServicePublishException(
- "Failed to add war file to esb service "
- + esbFile.getName(), e);
- }
-
- }
- logger.log(Level.DEBUG,
- "Injected webservice deployment war to esb service "
- + esbFile.getName());
-
- }
-
- public void addFile(File file) {
- fileList.add(file);
- }
-
-
- private File generateWebXml() throws IOException {
-
- InputStream inTemplate = ClassUtil.getResourceAsStream("web-xml.template", getClass());
- StringWriter strWriter = new StringWriter();
- IOUtils.copy(inTemplate, strWriter);
- StringTemplate template = new StringTemplate(strWriter.toString());
- template.setAttribute("ServiceName", endpointInfo.getServiceName());
- template.setAttribute("Category", endpointInfo.getServiceCategory());
- template.setAttribute("EndpointClassName", endpointInfo.getWSEndpointClassName());
- File webXml = new File("WEB-INF/web.xml");
- FileUtils.writeStringToFile(webXml, template.toString());
- return webXml;
- }
-
- private File generateJbossWebXml() throws IOException {
- InputStream inTemplate = ClassUtil.getResourceAsStream("jbossweb-xml.template", getClass());
- StringWriter strWriter = new StringWriter();
- IOUtils.copy(inTemplate, strWriter);
- StringTemplate template = new StringTemplate(strWriter.toString());
- template.setAttribute("ESBArtifact", endpointInfo.getDeploymentInfo().shortName);
- File jbossWebXml = new File("WEB-INF/jboss-web.xml");
- FileUtils.writeStringToFile(jbossWebXml, template.toString());
- return jbossWebXml;
- }
-
-
- private File generateWSDLFile() throws IOException {
- File wsdlFile = new File("WEB-INF/wsdl/"
- + endpointInfo.getWSDLFileName());
- FileUtils.writeStringToFile(wsdlFile, endpointInfo.getWSDL());
- return wsdlFile;
- }
-
-}
\ No newline at end of file
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java 2008-06-24 03:06:32 UTC (rev 20716)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -23,9 +23,9 @@
public class JBossWSWebServicePublisher implements WebServicePublisher {
public void publish(ESBServiceEndpointInfo endpoint, File esbService) throws WebServicePublishException {
- JBossWSWarGenerator warGenerator = new JBossWSWarGenerator(endpoint);
+ JBossWSDeploymentGenerator warGenerator = new JBossWSDeploymentGenerator(endpoint);
try {
- warGenerator.deployWar(esbService);
+ warGenerator.injectWarToESBArchive(esbService);
} catch (WebServicePublishException e) {
throw new WebServicePublishException(
"Failed to publish webservice "
Added: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template 2008-06-24 05:15:14 UTC (rev 20717)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+ "http://java.sun.com/dtd/application_1_3.dtd">
+<application>
+ <display-name>$AppName$</display-name>
+ <module>
+ <web>
+ <web-uri>$WarName$</web-uri>
+ <context-root>$ContextRoot$</context-root>
+ </web>
+ </module>
+</application>
+
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2008-06-24 03:06:32 UTC (rev 20716)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -1,33 +1,37 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.soa.esb.listeners.config;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.net.URL;
+import java.util.Enumeration;
import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import javax.management.ObjectName;
import javax.xml.transform.stream.StreamSource;
@@ -49,122 +53,169 @@
/**
* comment
- *
+ *
* @author <a href="kurt.stam at jboss.com">Kurt Stam</a>
* @author <a href="bill at jboss.com">Bill Burke</a>
* @version $Revision: 1.1 $
*/
-public class Configuration
-{
- private static final String JBOSSESB_XSD = "/jbossesb-1.0.1.xsd";
+public class Configuration {
+ private static final String JBOSSESB_XSD = "/jbossesb-1.0.1.xsd";
+ private static boolean genratedWSWar = false;
- public static String getStringFromStream(InputStream is) throws Exception
- {
- byte[] bytes = StreamUtils.readStream(is);
- return new String(bytes, "UTF-8");
- }
+ public static String getStringFromStream(InputStream is) throws Exception {
+ byte[] bytes = StreamUtils.readStream(is);
+ return new String(bytes, "UTF-8");
+ }
- public static ManagedLifecycleController create(URL jbossEsbXml)
- {
- String configXml = null;
- try
- {
- configXml = getStringFromStream(jbossEsbXml.openStream());
- return create(configXml);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to load jbossesb.xml file: " + jbossEsbXml, e);
- }
- }
+ public static ManagedLifecycleController create(URL jbossEsbXml) {
+ String configXml = null;
+ try {
+ configXml = getStringFromStream(jbossEsbXml.openStream());
+ return create(configXml);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to load jbossesb.xml file: "
+ + jbossEsbXml, e);
+ }
+ }
- public static ManagedLifecycleController create(String configXml) {
- return create (configXml, null, null);
- }
-
- public static ManagedLifecycleController create(String configXml, DeploymentInfo di, ObjectName serviceName)
- {
- InputStream validationInputStream = ClassUtil.getResourceAsStream(JBOSSESB_XSD, Configuration.class);
- //if this fails try using the
- if (validationInputStream == null)
- {
- throw new IllegalStateException("ESB validation file [" + JBOSSESB_XSD + "] not found.");
- }
- StreamSource validationInputSource = new StreamSource(validationInputStream);
+ public static ManagedLifecycleController create(String configXml) {
+ return create(configXml, null, null);
+ }
- try
- {
- InputSource xmlInputSource = new InputSource(new StringReader(configXml));
- XmlValidator validator = new XmlValidatorImpl();
- if (validator.validate(xmlInputSource, validationInputSource))
- {
- ByteArrayOutputStream listenerXml = new ByteArrayOutputStream();
- ByteArrayOutputStream gatewayXml = new ByteArrayOutputStream();
- Generator generator = new Generator(new ByteArrayInputStream(configXml.getBytes()), listenerXml, gatewayXml);
- generator.generate();
-
- byte[] listenerBytes = listenerXml.toByteArray();
- //System.out.println("*************** listenerBytes: " + new String(listenerBytes));
- ByteArrayInputStream listenerIs = new ByteArrayInputStream(listenerBytes);
- ConfigTree listenerConfig = ConfigTree.fromInputStream(listenerIs);
-
- if (serviceName != null) {
- listenerConfig.setAttribute(ListenerTagNames.DEPLOYMENT_NAME_TAG,
- serviceName.getKeyProperty(ListenerTagNames.DEPLOYMENT_NAME_TAG));
- }
+ public static ManagedLifecycleController create(String configXml,
+ DeploymentInfo di, ObjectName serviceName) {
+ InputStream validationInputStream = ClassUtil.getResourceAsStream(
+ JBOSSESB_XSD, Configuration.class);
+ // if this fails try using the
+ if (validationInputStream == null) {
+ throw new IllegalStateException("ESB validation file ["
+ + JBOSSESB_XSD + "] not found.");
+ }
+ StreamSource validationInputSource = new StreamSource(
+ validationInputStream);
- File esbFile = new File(di.url.getFile());
-
- List<ManagedLifecycle> instances = LifecycleUtil.getListeners(listenerConfig);
+ try {
+ InputSource xmlInputSource = new InputSource(new StringReader(
+ configXml));
+ XmlValidator validator = new XmlValidatorImpl();
+ if (validator.validate(xmlInputSource, validationInputSource)) {
+ ByteArrayOutputStream listenerXml = new ByteArrayOutputStream();
+ ByteArrayOutputStream gatewayXml = new ByteArrayOutputStream();
+ Generator generator = new Generator(new ByteArrayInputStream(
+ configXml.getBytes()), listenerXml, gatewayXml);
+ generator.generate();
- byte[] gatewayBytes = gatewayXml.toByteArray();
- //System.out.println("*************** gatewayBytes: " + new String(gatewayBytes));
- ByteArrayInputStream gatewayIs = new ByteArrayInputStream(gatewayBytes);
- ConfigTree gatewayConfig = ConfigTree.fromInputStream(gatewayIs);
-
- instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
+ byte[] listenerBytes = listenerXml.toByteArray();
+ // System.out.println("*************** listenerBytes: " + new String(listenerBytes));
+ ByteArrayInputStream listenerIs = new ByteArrayInputStream(
+ listenerBytes);
+ ConfigTree listenerConfig = ConfigTree
+ .fromInputStream(listenerIs);
- ManagedLifecycleController controller = new ManagedLifecycleController(instances);
- ScheduleProvider scheduleProvider = ScheduleProviderFactory.createInstance(instances, generator.getModel().getScheduleProvider());
- controller.setScheduleProvider(scheduleProvider);
+ if (serviceName != null) {
+ listenerConfig
+ .setAttribute(
+ ListenerTagNames.DEPLOYMENT_NAME_TAG,
+ serviceName
+ .getKeyProperty(ListenerTagNames.DEPLOYMENT_NAME_TAG));
+ }
- // In parallel, create a map of the contract publication info...
- ServicePublisher.addServicePublishers(controller, generator.getModel());
-
- List<ServicePublisher> servicePublihsers = ServicePublisher.getServicePublisher(controller);
-
- //need to publish esb service as a webService?
- File deployDir = esbFile.getParentFile();
- for(ServicePublisher publisher : servicePublihsers) {
-
- if (publisher.getContractPublisher() instanceof ServiceContractPublisher) {
- //
- ServiceContractPublisher serviceContractpublisher = (ServiceContractPublisher)publisher.getContractPublisher();
- String wsdl = serviceContractpublisher.getWSDL();
- ESBServiceEndpointInfo endpoint = new ESBServiceEndpointInfo(publisher.getCategory(), publisher.getServiceName());
- File publishedWar = new File(deployDir.getCanonicalPath(), publisher.getCategory().toLowerCase() + "-" + publisher.getServiceName().toLowerCase() + ".war");
- if (publishedWar.exists()) {
- continue;
- }
- endpoint.setWSDL(wsdl);
- endpoint.setTargetNamespace("http://soa.jboss.org/" + publisher.getCategory().toLowerCase());
- endpoint.setDeploymentInfo(di);
- //publish this esb service to web service
- WebServicePublisher esbServicePublisher = new JBossWSWebServicePublisher();
- esbServicePublisher.publish(endpoint, esbFile);
- }
- }
- return controller;
- }
- else
- {
- throw new IllegalStateException("ESB file had validation errors.");
+ File esbFile = new File(di.url.getFile());
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
+ List<ManagedLifecycle> instances = LifecycleUtil
+ .getListeners(listenerConfig);
+
+ byte[] gatewayBytes = gatewayXml.toByteArray();
+ // System.out.println("*************** gatewayBytes: " + new String(gatewayBytes));
+ ByteArrayInputStream gatewayIs = new ByteArrayInputStream(
+ gatewayBytes);
+ ConfigTree gatewayConfig = ConfigTree
+ .fromInputStream(gatewayIs);
+
+ instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
+
+ ManagedLifecycleController controller = new ManagedLifecycleController(
+ instances);
+ ScheduleProvider scheduleProvider = ScheduleProviderFactory
+ .createInstance(instances, generator.getModel()
+ .getScheduleProvider());
+ controller.setScheduleProvider(scheduleProvider);
+
+ // In parallel, create a map of the contract publication info...
+ ServicePublisher.addServicePublishers(controller, generator
+ .getModel());
+
+ List<ServicePublisher> servicePublihsers = ServicePublisher
+ .getServicePublisher(controller);
+
+ // need to publish esb service as a webService?
+
+ for (ServicePublisher publisher : servicePublihsers) {
+
+ if (publisher.getContractPublisher() instanceof ServiceContractPublisher) {
+ //
+ ServiceContractPublisher serviceContractpublisher = (ServiceContractPublisher) publisher
+ .getContractPublisher();
+ String wsdl = serviceContractpublisher.getWSDL();
+ ESBServiceEndpointInfo endpoint = new ESBServiceEndpointInfo(
+ publisher.getCategory(), publisher
+ .getServiceName());
+ if (hasPublishedWSWar(esbFile, publisher)) {
+ continue;
+ }
+ genratedWSWar = true;
+ endpoint.setWSDL(wsdl);
+ endpoint.setTargetNamespace("http://soa.jboss.org/"
+ + publisher.getCategory().toLowerCase());
+ endpoint.setDeploymentInfo(di);
+ // publish this esb service to web service
+ WebServicePublisher esbServicePublisher = new JBossWSWebServicePublisher();
+ esbServicePublisher.publish(endpoint, esbFile);
+ }
+ }
+ return controller;
+ } else {
+ throw new IllegalStateException(
+ "ESB file had validation errors.");
+
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static boolean hasPublishedWSWar(File esbFile,
+ ServicePublisher publisher) {
+ String warName = publisher.getCategory().toLowerCase() + "-"
+ + publisher.getServiceName().toLowerCase() + ".war";
+ try {
+ if (esbFile.isDirectory()) {
+ File warFile = new File(esbFile.getCanonicalPath(), warName);
+ if (warFile.exists()) {
+ return true;
+ }
+ } else {
+ JarFile esbArchive = new JarFile(esbFile);
+
+ Enumeration<JarEntry> entryEnum = esbArchive.entries();
+ while (entryEnum.hasMoreElements()) {
+ JarEntry jarEntry = (JarEntry) entryEnum.nextElement();
+ if (jarEntry.getName().equalsIgnoreCase(warName)) {
+ return true;
+ }
+ }
+
+ }
+ } catch (IOException e) {
+
+ }
+
+ return false;
+
+ }
+
+ public static boolean genratedWSWar() {
+ return genratedWSWar;
+ }
+
}
Modified: labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2008-06-24 03:06:32 UTC (rev 20716)
+++ labs/jbossesb/workspace/jimma/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -1,24 +1,24 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.soa.esb.listeners.config;
import java.io.File;
@@ -63,425 +63,378 @@
/**
* comment
- *
+ *
* @author <a href="bill at jboss.com">Bill Burke</a>
* @version $Revision: 1.1 $
*/
-public class JBoss4ESBDeployer extends SubDeployerSupport
- implements SubDeployer, JBoss4ESBDeployerMBean
-{
- private final static Logger log = Logger.getLogger(JBoss4ESBDeployer.class);
+public class JBoss4ESBDeployer extends SubDeployerSupport implements
+ SubDeployer, JBoss4ESBDeployerMBean {
+ private final static Logger log = Logger.getLogger(JBoss4ESBDeployer.class);
- private ServiceControllerMBean serviceController;
- private Properties actionArtifactProperties;
-
- private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
- private static final String ESB_ARTIFACT_NAME = "jbossesb.esb" ;
-
- /**
- * Default CTOR used to set default values to the Suffixes and RelativeOrder
- * attributes. Those are read at subdeployer registration time by the MainDeployer
- * to alter its SuffixOrder.
- */
- public JBoss4ESBDeployer()
- {
- setSuffixes(new String[]{".esb"});
- setRelativeOrder(1000); // before old EJB 2.1 deployer
- }
+ private ServiceControllerMBean serviceController;
+ private Properties actionArtifactProperties;
+ private static boolean redployed = false;
+ private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=";
+ private static final String ESB_ARTIFACT_NAME = "jbossesb.esb";
- public static boolean hasFile(DeploymentInfo di, String filePath)
- {
- String urlStr = di.url.getFile();
- try
- {
- URL dd = di.localCl.findResource(filePath);
- if (dd != null)
- {
+ /**
+ * Default CTOR used to set default values to the Suffixes and RelativeOrder
+ * attributes. Those are read at subdeployer registration time by the
+ * MainDeployer to alter its SuffixOrder.
+ */
+ public JBoss4ESBDeployer() {
+ setSuffixes(new String[] { ".esb" });
+ setRelativeOrder(1000); // before old EJB 2.1 deployer
+ }
- // If the DD url is not a subset of the urlStr then this is coming
- // from a jar referenced by the deployment jar manifest and the
- // this deployment jar it should not be treated as persistence
- if (di.localUrl != null)
- {
- urlStr = di.localUrl.toString();
- }
+ public static boolean hasFile(DeploymentInfo di, String filePath) {
+ String urlStr = di.url.getFile();
+ try {
+ URL dd = di.localCl.findResource(filePath);
+ if (dd != null) {
- String ddStr = dd.toString();
- if (ddStr.indexOf(urlStr) >= 0)
- {
- return true;
- }
- }
- }
- catch (Exception ignore)
- {
- }
- return false;
- }
+ // If the DD url is not a subset of the urlStr then this is
+ // coming
+ // from a jar referenced by the deployment jar manifest and the
+ // this deployment jar it should not be treated as persistence
+ if (di.localUrl != null) {
+ urlStr = di.localUrl.toString();
+ }
- /**
- * Returns true if this deployer can deploy the given DeploymentInfo.
- *
- * @return True if this deployer can deploy the given DeploymentInfo.
- * @jmx:managed-operation
- */
- public boolean accepts(DeploymentInfo di)
- {
- String urlStr = di.url.toString();
- return urlStr.endsWith(".esb") || urlStr.endsWith(".esb/") ||
- urlStr.endsWith("-esb.xml");
- }
+ String ddStr = dd.toString();
+ if (ddStr.indexOf(urlStr) >= 0) {
+ return true;
+ }
+ }
+ } catch (Exception ignore) {
+ }
+ return false;
+ }
- /**
- * Get a reference to the ServiceController
- */
- protected void startService() throws Exception
- {
- final InputStream actionArtifactIS = ClassUtil.getResourceAsStream("/actionArtifactMap.properties", getClass()) ;
- if (actionArtifactIS == null)
- {
- log.debug("No action artifact mapping") ;
- }
- else
- {
- log.debug("Loading action artifact mapping") ;
- final Properties properties = new Properties() ;
- properties.load(actionArtifactIS) ;
- actionArtifactProperties = properties ;
- }
-
- serviceController = (ServiceControllerMBean)
- MBeanProxyExt.create(ServiceControllerMBean.class,
- ServiceControllerMBean.OBJECT_NAME, server);
+ /**
+ * Returns true if this deployer can deploy the given DeploymentInfo.
+ *
+ * @return True if this deployer can deploy the given DeploymentInfo.
+ * @jmx:managed-operation
+ */
+ public boolean accepts(DeploymentInfo di) {
+ String urlStr = di.url.toString();
+ return urlStr.endsWith(".esb") || urlStr.endsWith(".esb/")
+ || urlStr.endsWith("-esb.xml");
+ }
- mainDeployer.addDeployer(this);
- LifecycleResourceManager.deactivateHook() ;
- }
-
- @Override
- protected void stopService() throws Exception
- {
- LifecycleResourceManager.getSingleton().cleanupAllResources() ;
- super.stopService();
- }
+ /**
+ * Get a reference to the ServiceController
+ */
+ protected void startService() throws Exception {
+ final InputStream actionArtifactIS = ClassUtil.getResourceAsStream(
+ "/actionArtifactMap.properties", getClass());
+ if (actionArtifactIS == null) {
+ log.debug("No action artifact mapping");
+ } else {
+ log.debug("Loading action artifact mapping");
+ final Properties properties = new Properties();
+ properties.load(actionArtifactIS);
+ actionArtifactProperties = properties;
+ }
+ serviceController = (ServiceControllerMBean) MBeanProxyExt.create(
+ ServiceControllerMBean.class,
+ ServiceControllerMBean.OBJECT_NAME, server);
- protected URL getDocumentUrl(DeploymentInfo di)
- {
- String urlStr = di.url.toString();
- if (urlStr.endsWith(".esb") || urlStr.endsWith(".esb/"))
- {
- return di.localCl.getResource("META-INF/jboss-esb.xml");
- }
- return di.url;
- }
+ mainDeployer.addDeployer(this);
+ LifecycleResourceManager.deactivateHook();
+ }
- public void init(DeploymentInfo di) throws DeploymentException
- {
- try
- {
- if (di.url.getProtocol().equalsIgnoreCase("file"))
- {
- File file = new File(di.url.getFile());
+ @Override
+ protected void stopService() throws Exception {
+ LifecycleResourceManager.getSingleton().cleanupAllResources();
+ super.stopService();
+ }
- if (!file.isDirectory())
- {
- // If not directory we watch the package
- di.watch = di.url;
- }
- else
- {
- // If directory we watch the xml files
- di.watch = new URL(di.url, "META-INF/jboss-esb.xml");
- }
- }
- else
- {
- // We watch the top only, no directory support
- di.watch = di.url;
- }
+ protected URL getDocumentUrl(DeploymentInfo di) {
+ String urlStr = di.url.toString();
+ if (urlStr.endsWith(".esb") || urlStr.endsWith(".esb/")) {
+ return di.localCl.getResource("META-INF/jboss-esb.xml");
+ }
+ return di.url;
+ }
- XmlFileLoader xfl = new XmlFileLoader();
- InputStream in = di.localCl.getResourceAsStream("META-INF/deployment.xml");
- if (in != null)
- {
- try
- {
- Element jboss = xfl.getDocument(in, "META-INF/deployment.xml").getDocumentElement();
- // Check for a ejb level class loading config
- Element loader = MetaData.getOptionalChild(jboss, "loader-repository");
- if (loader != null)
- {
- LoaderRepositoryFactory.LoaderRepositoryConfig config =
- LoaderRepositoryFactory.parseRepositoryConfig(loader);
- di.setRepositoryInfo(config);
- }
+ public void init(DeploymentInfo di) throws DeploymentException {
+ try {
+ if (di.url.getProtocol().equalsIgnoreCase("file")) {
+ File file = new File(di.url.getFile());
- }
- finally
- {
- in.close();
- }
- }
- }
- catch (Exception e)
- {
- if (e instanceof DeploymentException)
- {
- throw(DeploymentException) e;
- }
- throw new DeploymentException("failed to initialize", e);
- }
+ if (!file.isDirectory()) {
+ // If not directory we watch the package
+ di.watch = di.url;
+ } else {
+ // If directory we watch the xml files
+ di.watch = new URL(di.url, "META-INF/jboss-esb.xml");
+ }
+ } else {
+ // We watch the top only, no directory support
+ di.watch = di.url;
+ }
- // invoke super-class initialization
- super.init(di);
- }
+ XmlFileLoader xfl = new XmlFileLoader();
+ InputStream in = di.localCl
+ .getResourceAsStream("META-INF/deployment.xml");
+ if (in != null) {
+ try {
+ Element jboss = xfl.getDocument(in,
+ "META-INF/deployment.xml").getDocumentElement();
+ // Check for a ejb level class loading config
+ Element loader = MetaData.getOptionalChild(jboss,
+ "loader-repository");
+ if (loader != null) {
+ LoaderRepositoryFactory.LoaderRepositoryConfig config = LoaderRepositoryFactory
+ .parseRepositoryConfig(loader);
+ di.setRepositoryInfo(config);
+ }
- public synchronized void create(DeploymentInfo di) throws DeploymentException
- {
- log.info("create esb service, " + di.shortName);
- URL document = getDocumentUrl(di);
-
- if (document == null)
- {
- throw new DeploymentException("Unable to find document url of META-INF/jboss-esb.xml in: "
- + di.url);
- }
- try
- {
- Set<ObjectName> deps = new HashSet<ObjectName>();
- InputStream in = di.localCl.getResourceAsStream("META-INF/deployment.xml");
- if (in != null)
- {
- try
- {
- XmlFileLoader xfl = new XmlFileLoader();
- Element jboss = xfl.getDocument(in, "META-INF/deployment.xml").getDocumentElement();
- // Check for a ejb level class loading config
- Iterator depends = MetaData.getChildrenByTagName(jboss, "depends");
- if (depends != null)
- {
- while (depends.hasNext())
- {
- Element depend = (Element)depends.next();
- ObjectName depOn = new ObjectName(MetaData.getElementContent(depend));
- deps.add(depOn);
- }
- }
- Iterator esbDepends = MetaData.getChildrenByTagName(jboss, "esb-depends");
- if ((esbDepends != null) && esbDepends.hasNext())
- {
- final Map<String, DeploymentInfo> subDeploymentLocationMap ;
- if (di.subDeployments.size() > 0)
- {
- subDeploymentLocationMap = new HashMap<String, DeploymentInfo>() ;
- final Set<DeploymentInfo> subDeployments = (Set<DeploymentInfo>)di.subDeployments ;
- for(DeploymentInfo subDI : subDeployments)
- {
- final String urlPath = subDI.url.getPath() ;
- final String deployablePath = (urlPath.endsWith("/") ? urlPath.substring(0, urlPath.length()-1) : urlPath) ;
- final int lastSeparator = deployablePath.lastIndexOf('/') ;
- final String deployable = (lastSeparator >= 0 ? deployablePath.substring(lastSeparator+1) : deployablePath) ;
- if (subDeploymentLocationMap.put(deployable, subDI) != null)
- {
- throw new DeploymentException("Duplicate subDeployment name: " + deployable) ;
- }
- }
- }
- else
- {
- throw new DeploymentException("No subdeployments to match esb-depends") ;
- }
-
- do
- {
- Element depend = (Element)esbDepends.next();
- final String deployable = MetaData.getElementContent(depend) ;
- final DeploymentInfo subDI = subDeploymentLocationMap.get(deployable) ;
- if ((subDI != null) && subDI.context.containsKey(AbstractWebContainer.WEB_MODULE))
- {
- final ObjectName jmxName = (ObjectName) subDI.context.get(AbstractWebContainer.WEB_MODULE) ;
- deps.add(jmxName) ;
- }
- else
- {
- throw new DeploymentException("Could not locate WAR subdeployment matching: " + deployable) ;
- }
- }
- while (esbDepends.hasNext()) ;
- }
- }
- finally
- {
- in.close();
- }
- }
+ } finally {
+ in.close();
+ }
+ }
+ } catch (Exception e) {
+ if (e instanceof DeploymentException) {
+ throw (DeploymentException) e;
+ }
+ throw new DeploymentException("failed to initialize", e);
+ }
- final InputStream inputStream = document.openStream();
- final String jbossEsbXml ;
- try
- {
- final StringWriter sw = new StringWriter() ;
- XMLHelper.replaceSystemProperties(XMLHelper.getXMLStreamReader(inputStream),
- XMLHelper.getXMLStreamWriter(sw)) ;
- jbossEsbXml = sw.toString();
- }
- finally
- {
- inputStream.close();
- }
-
- addActionDependencies(di.shortName, jbossEsbXml, deps) ;
-
- JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(jbossEsbXml, di);
- deployment.setClassloader(di.ucl);
- String name = PREFIX_CANONICAL_NAME + di.shortName;
- ObjectName on = ObjectNameConverter.convert(name);
- // Check that the name is not registered
- if (server.isRegistered(on) == true)
- {
- log.debug("The ESBModule name: " + name
- + "is already registered, adding uid=" + System.identityHashCode(deployment));
- name = name + ",uid=" + System.identityHashCode(deployment);
- on = ObjectNameConverter.convert(name);
- }
- server.registerMBean(deployment, on);
- di.deployedObject = on;
- log.debug("Deploying: " + di.url);
- // Invoke the create life cycle method
- serviceController.create(di.deployedObject, deps);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error during create of ESB Module: "
- + di.url, e);
- }
- super.create(di);
- }
+ // invoke super-class initialization
+ super.init(di);
+ }
- private void addActionDependencies(final String deploymentName,
- final String configuration, final Set<ObjectName> deps)
- throws XPathExpressionException, DeploymentException, MalformedObjectNameException
- {
- final XmlFileLoader xfl = new XmlFileLoader() ;
- final StringReader sr = new StringReader(configuration) ;
- final InputSource is = new InputSource(sr) ;
- final Element rootElement = xfl.getDocument(is, "META-INF/jboss-esb.xml").getDocumentElement() ;
+ public synchronized void create(DeploymentInfo di)
+ throws DeploymentException {
+ log.info("create esb service, " + di.shortName);
+ URL document = getDocumentUrl(di);
- final Set<String> artifacts = new HashSet<String>() ;
- artifacts.add(ESB_ARTIFACT_NAME) ;
+ if (document == null) {
+ throw new DeploymentException(
+ "Unable to find document url of META-INF/jboss-esb.xml in: "
+ + di.url);
+ }
+ try {
+ Set<ObjectName> deps = new HashSet<ObjectName>();
+ InputStream in = di.localCl
+ .getResourceAsStream("META-INF/deployment.xml");
+ if (in != null) {
+ try {
+ XmlFileLoader xfl = new XmlFileLoader();
+ Element jboss = xfl.getDocument(in,
+ "META-INF/deployment.xml").getDocumentElement();
+ // Check for a ejb level class loading config
+ Iterator depends = MetaData.getChildrenByTagName(jboss,
+ "depends");
+ if (depends != null) {
+ while (depends.hasNext()) {
+ Element depend = (Element) depends.next();
+ ObjectName depOn = new ObjectName(MetaData
+ .getElementContent(depend));
+ deps.add(depOn);
+ }
+ }
+ Iterator esbDepends = MetaData.getChildrenByTagName(jboss,
+ "esb-depends");
+ if ((esbDepends != null) && esbDepends.hasNext()) {
+ final Map<String, DeploymentInfo> subDeploymentLocationMap;
+ if (di.subDeployments.size() > 0) {
+ subDeploymentLocationMap = new HashMap<String, DeploymentInfo>();
+ final Set<DeploymentInfo> subDeployments = (Set<DeploymentInfo>) di.subDeployments;
+ for (DeploymentInfo subDI : subDeployments) {
+ final String urlPath = subDI.url.getPath();
+ final String deployablePath = (urlPath
+ .endsWith("/") ? urlPath.substring(0,
+ urlPath.length() - 1) : urlPath);
+ final int lastSeparator = deployablePath
+ .lastIndexOf('/');
+ final String deployable = (lastSeparator >= 0 ? deployablePath
+ .substring(lastSeparator + 1)
+ : deployablePath);
+ if (subDeploymentLocationMap.put(deployable,
+ subDI) != null) {
+ throw new DeploymentException(
+ "Duplicate subDeployment name: "
+ + deployable);
+ }
+ }
+ } else {
+ throw new DeploymentException(
+ "No subdeployments to match esb-depends");
+ }
- final String namespaceURI = "http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" ;
-
- final XPath xpathEvaluater = XPathFactory.newInstance().newXPath();
- final XPathNamespaceContext namespaceContext = new XPathNamespaceContext() ;
- namespaceContext.setMapping("jbesb", namespaceURI) ;
- xpathEvaluater.setNamespaceContext(namespaceContext) ;
+ do {
+ Element depend = (Element) esbDepends.next();
+ final String deployable = MetaData
+ .getElementContent(depend);
+ final DeploymentInfo subDI = subDeploymentLocationMap
+ .get(deployable);
+ if ((subDI != null)
+ && subDI.context
+ .containsKey(AbstractWebContainer.WEB_MODULE)) {
+ final ObjectName jmxName = (ObjectName) subDI.context
+ .get(AbstractWebContainer.WEB_MODULE);
+ deps.add(jmxName);
+ } else {
+ throw new DeploymentException(
+ "Could not locate WAR subdeployment matching: "
+ + deployable);
+ }
+ } while (esbDepends.hasNext());
+ }
+ } finally {
+ in.close();
+ }
+ }
- final NodeList actionList = (NodeList) xpathEvaluater.evaluate("/jbesb:jbossesb/jbesb:services/jbesb:service/jbesb:actions/jbesb:action",
- rootElement, XPathConstants.NODESET) ;
- final int numActions = actionList.getLength() ;
- if (numActions > 0)
- {
- final Set<String> actionClasses = new HashSet<String>() ;
- for(int count = 0 ; count < numActions ; count++)
- {
- final Node actionNode = actionList.item(count) ;
- if (!(actionNode instanceof Element))
- {
- log.warn("Action node is not an element: " + actionNode) ;
- }
- else
- {
- final Element actionElement = (Element)actionNode ;
- final String actionClass = actionElement.getAttribute("class") ;
- actionClasses.add(actionClass) ;
- }
- }
-
- final int numActionClasses = actionClasses.size() ;
- if (numActionClasses > 0)
- {
- for(final String actionClass: actionClasses)
- {
- final String artifact = (String)actionArtifactProperties.get(actionClass) ;
- if (artifact != null)
- {
- artifacts.add(artifact) ;
- }
- }
- }
- }
-
- for(final String artifact: artifacts)
- {
- if (!deploymentName.equals(artifact))
- {
- final String canonicalName = PREFIX_CANONICAL_NAME + artifact ;
- final ObjectName on = ObjectNameConverter.convert(canonicalName) ;
- deps.add(on) ;
- }
- }
- }
+ final InputStream inputStream = document.openStream();
+ final String jbossEsbXml;
+ try {
+ final StringWriter sw = new StringWriter();
+ XMLHelper.replaceSystemProperties(XMLHelper
+ .getXMLStreamReader(inputStream), XMLHelper
+ .getXMLStreamWriter(sw));
+ jbossEsbXml = sw.toString();
+ } finally {
+ inputStream.close();
+ }
- public synchronized void start(DeploymentInfo di)
- throws DeploymentException
- {
- try
- {
- serviceController.start(di.deployedObject);
- }
- catch (Exception e)
- {
- try
- {
- stop(di);
- destroy(di);
- }
- catch (DeploymentException ignore)
- {
- }
- throw new DeploymentException("Error during start of ESB Module: "
- + di.url, e);
- }
+ addActionDependencies(di.shortName, jbossEsbXml, deps);
- super.start(di);
- }
+ JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(
+ jbossEsbXml, di);
+ deployment.setClassloader(di.ucl);
+ String name = PREFIX_CANONICAL_NAME + di.shortName;
+ ObjectName on = ObjectNameConverter.convert(name);
+ // Check that the name is not registered
+ if (server.isRegistered(on) == true) {
+ log.debug("The ESBModule name: " + name
+ + "is already registered, adding uid="
+ + System.identityHashCode(deployment));
+ name = name + ",uid=" + System.identityHashCode(deployment);
+ on = ObjectNameConverter.convert(name);
+ }
+ server.registerMBean(deployment, on);
+ di.deployedObject = on;
+ log.debug("Deploying: " + di.url);
+ // Invoke the create life cycle method
+ serviceController.create(di.deployedObject, deps);
+ } catch (Exception e) {
+ throw new DeploymentException("Error during create of ESB Module: "
+ + di.url, e);
+ }
+ super.create(di);
+ }
- public void stop(DeploymentInfo di)
- throws DeploymentException
- {
- if (di.deployedObject != null)
- {
- try
- {
- serviceController.stop(di.deployedObject);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error during stop of ESB Module: "
- + di.url, e);
- }
- }
- super.stop(di);
- }
+ private void addActionDependencies(final String deploymentName,
+ final String configuration, final Set<ObjectName> deps)
+ throws XPathExpressionException, DeploymentException,
+ MalformedObjectNameException {
+ final XmlFileLoader xfl = new XmlFileLoader();
+ final StringReader sr = new StringReader(configuration);
+ final InputSource is = new InputSource(sr);
+ final Element rootElement = xfl.getDocument(is,
+ "META-INF/jboss-esb.xml").getDocumentElement();
- public void destroy(DeploymentInfo di)
- throws DeploymentException
- {
- if (di.deployedObject != null)
- {
- try
- {
- serviceController.destroy(di.deployedObject);
- server.unregisterMBean(di.deployedObject);
- }
- catch (Exception e)
- {
- throw new DeploymentException("Error during stop of ESB Module: "
- + di.url, e);
- }
- }
- super.destroy(di);
- }
+ final Set<String> artifacts = new HashSet<String>();
+ artifacts.add(ESB_ARTIFACT_NAME);
+
+ final String namespaceURI = "http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd";
+
+ final XPath xpathEvaluater = XPathFactory.newInstance().newXPath();
+ final XPathNamespaceContext namespaceContext = new XPathNamespaceContext();
+ namespaceContext.setMapping("jbesb", namespaceURI);
+ xpathEvaluater.setNamespaceContext(namespaceContext);
+
+ final NodeList actionList = (NodeList) xpathEvaluater
+ .evaluate(
+ "/jbesb:jbossesb/jbesb:services/jbesb:service/jbesb:actions/jbesb:action",
+ rootElement, XPathConstants.NODESET);
+ final int numActions = actionList.getLength();
+ if (numActions > 0) {
+ final Set<String> actionClasses = new HashSet<String>();
+ for (int count = 0; count < numActions; count++) {
+ final Node actionNode = actionList.item(count);
+ if (!(actionNode instanceof Element)) {
+ log.warn("Action node is not an element: " + actionNode);
+ } else {
+ final Element actionElement = (Element) actionNode;
+ final String actionClass = actionElement
+ .getAttribute("class");
+ actionClasses.add(actionClass);
+ }
+ }
+
+ final int numActionClasses = actionClasses.size();
+ if (numActionClasses > 0) {
+ for (final String actionClass : actionClasses) {
+ final String artifact = (String) actionArtifactProperties
+ .get(actionClass);
+ if (artifact != null) {
+ artifacts.add(artifact);
+ }
+ }
+ }
+ }
+
+ for (final String artifact : artifacts) {
+ if (!deploymentName.equals(artifact)) {
+ final String canonicalName = PREFIX_CANONICAL_NAME + artifact;
+ final ObjectName on = ObjectNameConverter
+ .convert(canonicalName);
+ deps.add(on);
+ }
+ }
+ }
+
+ public synchronized void start(DeploymentInfo di)
+ throws DeploymentException {
+ try {
+ serviceController.start(di.deployedObject);
+ if (Configuration.genratedWSWar() && !redployed) {
+ log.debug("Redployed " + di.shortName);
+ redployed = true;
+ mainDeployer.redeploy(di);
+ }
+ } catch (Exception e) {
+ try {
+ stop(di);
+ destroy(di);
+ } catch (DeploymentException ignore) {
+ }
+ throw new DeploymentException("Error during start of ESB Module: "
+ + di.url, e);
+ }
+
+ super.start(di);
+ }
+
+ public void stop(DeploymentInfo di) throws DeploymentException {
+ if (di.deployedObject != null) {
+ try {
+ serviceController.stop(di.deployedObject);
+ } catch (Exception e) {
+ throw new DeploymentException(
+ "Error during stop of ESB Module: " + di.url, e);
+ }
+ }
+ super.stop(di);
+ }
+
+ public void destroy(DeploymentInfo di) throws DeploymentException {
+ if (di.deployedObject != null) {
+ try {
+ serviceController.destroy(di.deployedObject);
+ server.unregisterMBean(di.deployedObject);
+ } catch (Exception e) {
+ throw new DeploymentException(
+ "Error during stop of ESB Module: " + di.url, e);
+ }
+ }
+ super.destroy(di);
+ }
}
Copied: labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java (from rev 20415, labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGeneratorUnitTest.java)
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.internal.soa.esb.webservice;
+
+import java.io.File;
+import java.net.URL;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import junit.framework.TestCase;
+
+public class JBossWSWarGeneratorUnitTest extends TestCase {
+
+ public void testInjetWar() {
+ URL url = getClass().getResource("webservice_test.esb");
+ File file = new File(url.getFile());
+ ESBServiceEndpointInfo endpointInfo = new ESBServiceEndpointInfo("MyTest", "test");
+ endpointInfo.setTargetNamespace("http://soa.jboss.org");
+ JBossWSDeploymentGenerator generator = new JBossWSDeploymentGenerator(endpointInfo);
+ boolean warGenerated = false;
+ try {
+ generator.injectWarToESBArchive(file);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ try {
+ JarInputStream jarInput = new JarInputStream(new java.io.FileInputStream(file));
+ JarEntry jarEntry = null;
+
+ while ((jarEntry = jarInput.getNextJarEntry()) != null) {
+ if(jarEntry.getName().equalsIgnoreCase("mytest.war")) {
+ warGenerated = true;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue("the war does not injected into esb file", warGenerated);
+ }
+
+}
Deleted: labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGeneratorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGeneratorUnitTest.java 2008-06-24 03:06:32 UTC (rev 20716)
+++ labs/jbossesb/workspace/jimma/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSWarGeneratorUnitTest.java 2008-06-24 05:15:14 UTC (rev 20717)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.internal.soa.esb.webservice;
-
-import java.io.File;
-import java.net.URL;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import junit.framework.TestCase;
-
-public class JBossWSWarGeneratorUnitTest extends TestCase {
-
- public void testInjetWar() {
- URL url = getClass().getResource("webservice_test.esb");
- File file = new File(url.getFile());
- ESBServiceEndpointInfo endpointInfo = new ESBServiceEndpointInfo("MyTest", "test");
- endpointInfo.setTargetNamespace("http://soa.jboss.org");
- JBossWSWarGenerator generator = new JBossWSWarGenerator(endpointInfo);
- boolean warGenerated = false;
- try {
- generator.injectWarToESBArchive(file);
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- try {
- JarInputStream jarInput = new JarInputStream(new java.io.FileInputStream(file));
- JarEntry jarEntry = null;
-
- while ((jarEntry = jarInput.getNextJarEntry()) != null) {
- if(jarEntry.getName().equalsIgnoreCase("mytest.war")) {
- warGenerated = true;
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- assertTrue("the war does not injected into esb file", warGenerated);
- }
-
-}
More information about the jboss-svn-commits
mailing list