[jboss-svn-commits] JBL Code SVN: r20890 - in labs/jbossesb/workspace/kevin/product: rosetta and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Jul 2 18:59:28 EDT 2008
Author: kevin.conner at jboss.com
Date: 2008-07-02 18:59:28 -0400 (Wed, 02 Jul 2008)
New Revision: 20890
Added:
labs/jbossesb/workspace/kevin/product/lib/ext/servlet-api-2.3.jar
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/publish/ServletContractPublisher.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeploymentMetaData.java
Removed:
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServicePublisher.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jbossweb-xml.template
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/web-xml.template
labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGeneratorUnitTest.java
labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java
labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/webservice_test.esb
labs/jbossesb/workspace/kevin/product/services/soap/lib/ext/build-time/servlet-api-2.3.jar
Modified:
labs/jbossesb/workspace/kevin/product/rosetta/build.xml
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/ESBContractGeneratorUnitTest.java
labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/jbossesb_config_06.xml
labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbm-queue-service.xml
labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbmq-queue-service.xml
labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SOAPTest.java
labs/jbossesb/workspace/kevin/product/services/soap/build.xml
labs/jbossesb/workspace/kevin/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
labs/jbossesb/workspace/kevin/product/tools/console/contract-web/src/main/webapp/contract.jsp
Log:
Updates to Jim's code
Copied: labs/jbossesb/workspace/kevin/product/lib/ext/servlet-api-2.3.jar (from rev 20854, labs/jbossesb/workspace/jimma/product/services/soap/lib/ext/build-time/servlet-api-2.3.jar)
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/kevin/product/rosetta/build.xml
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/build.xml 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/build.xml 2008-07-02 22:59:28 UTC (rev 20890)
@@ -50,11 +50,7 @@
>
<src path="${org.jboss.esb.rosetta.src.dir}"/>
</javac>
- <copy todir="${org.jboss.esb.rosetta.classes.dir}">
- <fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.template"/>
- </copy>
-
</target>
<target name="recompile" depends="clean,org.jboss.esb.rosetta.compile"
@@ -86,8 +82,7 @@
excludes="test/**"
>
<fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.groovy"/>
- <fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.properties"/>
- <fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.template"/>
+ <fileset dir="${org.jboss.esb.rosetta.src.dir}" includes="**/*.properties"/>
</jar>
<jar destfile="${org.jboss.esb.rosetta.distrib.dir}/lib/test-util.jar">
<fileset dir="${org.jboss.esb.internal.dest}/tests/"
Added: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/publish/ServletContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/publish/ServletContractPublisher.java (rev 0)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/publish/ServletContractPublisher.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -0,0 +1,48 @@
+/*
+* 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.internal.soa.esb.publish;
+
+import org.jboss.soa.esb.addressing.EPR;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Action contract Publisher.
+ *
+ * @author
+ */
+public interface ServletContractPublisher extends ContractPublisher {
+
+ /**
+ * Get the contract information within a servlet context.
+ * <p/>
+ * A Service may publish a number of addressable endpoints. The publisher
+ * will likely return different contract info depending on the endpoint EPR.
+ * <p/>
+ * This info can be stored and published from a global registry of some sort.
+ *
+ * @param epr Endpoint EPR.
+ * @param servletRequest The servlet request context.
+ * @return Contract information.
+ */
+ public ContractInfo getContractInfo(final EPR epr, final HttpServletRequest servletRequest) ;
+}
Property changes on: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/publish/ServletContractPublisher.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -20,6 +20,9 @@
package org.jboss.internal.soa.esb.webservice;
import java.io.StringWriter;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import javax.wsdl.Binding;
import javax.wsdl.BindingFault;
@@ -39,9 +42,7 @@
import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
-import org.jboss.internal.soa.esb.publish.ContractInfo;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
import org.jboss.soa.esb.util.ClassUtil;
@@ -56,26 +57,15 @@
import com.ibm.wsdl.extensions.soap.SOAPFaultImpl;
public class ESBContractGenerator {
- private final QName XSD_QN = new QName("http://www.w3.org/2001/XMLSchema", "schema");
- private String wsdl;
- private Definition def = null;
- private int nsSuffixCounter = 1;
- private Service svcConfig;
+ private static final QName XSD_QN = new QName("http://www.w3.org/2001/XMLSchema", "schema");
+ private static WSDLFactory wsdlFactory ;
- public ESBContractGenerator(Service serviceConfig) {
- svcConfig = serviceConfig;
- }
-
- public void generateWSDL() throws ConfigurationException {
- String targetNamespace = "http://soa.jboss.org/" + svcConfig.getCategory().toLowerCase();
- String serviceName = svcConfig.getName();
- try {
- def = WSDLFactory.newInstance().newDefinition();
- } catch (WSDLException e1) {
- e1.printStackTrace();
- }
- def.setTargetNamespace(targetNamespace);
- def.addNamespace("tns", targetNamespace);
+ public static String generateWSDL(final Service serviceConfig, final ESBServiceEndpointInfo serviceInfo)
+ throws ConfigurationException {
+ final Definition def = getWSDLFactory().newDefinition() ;
+ final String namespace = serviceInfo.getNamespace() ;
+ def.setTargetNamespace(namespace);
+ def.addNamespace("tns", namespace);
def.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
// add types
Types types = def.createTypes();
@@ -85,85 +75,83 @@
Message resMessage = null;
Message faultMessage = null;
- String inXsd = svcConfig.getActions().getInXsd();
- String outXsd = svcConfig.getActions().getOutXsd();
- String faultXsd = svcConfig.getActions().getFaultXsd();
+ String inXsd = serviceConfig.getActions().getInXsd();
+ String outXsd = serviceConfig.getActions().getOutXsd();
+ String faultXsd = serviceConfig.getActions().getFaultXsd();
+ int nsSuffixCounter = 0 ;
if (inXsd != null) {
try {
Document doc = YADOMUtil.parseStream(ClassUtil
- .getResourceAsStream(inXsd, getClass()), false, false);
+ .getResourceAsStream(inXsd, ESBContractGenerator.class),
+ false, false);
if (doc != null) {
- reqMessage = addMessage(doc.getDocumentElement(),
- serviceName + "Req", "in");
+ reqMessage = addMessage(def, doc.getDocumentElement(),
+ serviceInfo.getRequestName(), "in", ++nsSuffixCounter);
}
} catch (Exception e) {
- throw new ConfigurationException("File defined in inXsd attribute '" + svcConfig.getActions().getInXsd() + "' not found in classpath.", e);
+ throw new ConfigurationException("File defined in inXsd attribute '" + serviceConfig.getActions().getInXsd() + "' not found in classpath.", e);
}
}
if (outXsd != null) {
try {
Document doc = YADOMUtil.parseStream(ClassUtil
- .getResourceAsStream(outXsd, getClass()), false, false);
+ .getResourceAsStream(outXsd, ESBContractGenerator.class),
+ false, false);
if (doc != null) {
- resMessage = addMessage(doc.getDocumentElement(),
- serviceName + "Res", "out");
+ resMessage = addMessage(def, doc.getDocumentElement(),
+ serviceInfo.getResponseName(), "out", ++nsSuffixCounter);
}
} catch (Exception e) {
- throw new ConfigurationException("File defined in outXsd attribute '" + svcConfig.getActions().getOutXsd() + "' not found in classpath.", e);
+ throw new ConfigurationException("File defined in outXsd attribute '" + serviceConfig.getActions().getOutXsd() + "' not found in classpath.", e);
}
}
if (faultXsd != null) {
+ // KEV
+ // Shouldn't there be more faults specified here?
try {
Document doc = YADOMUtil.parseStream(ClassUtil
- .getResourceAsStream(faultXsd, getClass()), false,
- false);
+ .getResourceAsStream(faultXsd, ESBContractGenerator.class),
+ false, false);
if (doc != null) {
- faultMessage = addMessage(doc.getDocumentElement(),
- serviceName + "fault", "fault");
+ faultMessage = addMessage(def, doc.getDocumentElement(),
+ serviceInfo.getFaultName(), "fault", ++nsSuffixCounter);
}
} catch (Exception e) {
- throw new ConfigurationException("File defined in faultXsd attribute '" + svcConfig.getActions().getFaultXsd() + "' not found in classpath.", e);
+ throw new ConfigurationException("File defined in faultXsd attribute '" + serviceConfig.getActions().getFaultXsd() + "' not found in classpath.", e);
}
}
- PortType portType = addPortType(serviceName, reqMessage, resMessage,
- faultMessage);
- Binding binding = addBinding(serviceName, portType);
- addService(serviceName, binding);
+ PortType portType = addPortType(def, serviceInfo, reqMessage,
+ resMessage, faultMessage);
+ Binding binding = addBinding(def, serviceInfo, portType);
+ addService(def, serviceInfo, binding);
StringWriter sw = new java.io.StringWriter();
try {
- WSDLFactory.newInstance().newWSDLWriter().writeWSDL(def, sw);
+ getWSDLFactory().newWSDLWriter().writeWSDL(def, sw);
} catch (WSDLException e) {
- new ConfigurationException("Failed to generate wsdl for service:" + svcConfig.getCategory() + "/" + svcConfig.getName() , e);
+ new ConfigurationException("Failed to generate wsdl for service:" + serviceConfig.getCategory() + "/" + serviceConfig.getName() , e);
}
- wsdl = sw.toString();
+ return sw.toString();
}
- public ContractInfo getContractInfo(EPR epr) {
-
- return new ContractInfo("text/html", wsdl);
- }
-
- private void addSchema(Types types, Element xsdElement) {
+ private static void addSchema(Types types, Element xsdElement) {
SchemaImpl schemaImpl = new SchemaImpl();
schemaImpl.setElement(xsdElement);
schemaImpl.setElementType(XSD_QN);
types.addExtensibilityElement(schemaImpl);
-
}
- private Message addMessage(Element element, String msgName, String partName) {
+ private static Message addMessage(Definition def, Element element, String msgName, String partName, int nsSuffixCounter) {
String schemaNs = YADOMUtil
.getAttribute(element, "targetNamespace", "");
addSchema(def.getTypes(), element);
if (def.getNamespace(schemaNs) == null) {
def.addNamespace("ns" + nsSuffixCounter, schemaNs);
- nsSuffixCounter++;
}
// add request message
Node node = YADOMUtil.getNode(element, "/schema/element");
@@ -179,15 +167,14 @@
return msg;
}
- private PortType addPortType(String serviceName, Message inMessage,
- Message outMessage, Message faultMessage) {
+ private static PortType addPortType(Definition def, final ESBServiceEndpointInfo serviceInfo,
+ Message inMessage, Message outMessage, Message faultMessage) {
// add port type
PortType portType = def.createPortType();
- portType.setQName(new QName(def.getTargetNamespace(), serviceName
- + "PortType"));
+ portType.setQName(new QName(def.getTargetNamespace(), serviceInfo.getPortName())) ;
Operation op = def.createOperation();
op.setUndefined(false);
- op.setName(serviceName);
+ op.setName(serviceInfo.getOperationName());
if (inMessage != null) {
Input in = def.createInput();
in.setMessage(inMessage);
@@ -213,26 +200,24 @@
return portType;
}
- private Binding addBinding(String serviceName, PortType portType) {
+ private static Binding addBinding(Definition def, final ESBServiceEndpointInfo serviceInfo, PortType portType) {
// add binding
Binding binding = def.createBinding();
binding.setUndefined(false);
binding.setPortType(portType);
- binding.setQName(new QName(def.getTargetNamespace(), serviceName
- + "Binding"));
+ binding.setQName(new QName(def.getTargetNamespace(), serviceInfo.getBindingName())) ;
SOAPBindingImpl soapBinding = new SOAPBindingImpl();
-
soapBinding.setStyle("document");
soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
binding.addExtensibilityElement(soapBinding);
BindingOperation bop = def.createBindingOperation();
- bop.setName(serviceName);
+ bop.setName(serviceInfo.getOperationName());
Operation op = (Operation) portType.getOperations().get(0);
bop.setOperation(op);
if (op.getInput() != null) {
- BindingInput binput = def.createBindingInput();
+ BindingInput binput = def.createBindingInput();
bop.setBindingInput(binput);
SOAPBodyImpl soapBody = new SOAPBodyImpl();
soapBody.setUse("literal");
@@ -261,27 +246,39 @@
}
- private void addService(String serviceName, Binding binding) {
+ private static void addService(Definition def, final ESBServiceEndpointInfo serviceInfo, Binding binding) {
// create service
javax.wsdl.Service service = def.createService();
- service.setQName(new QName(def.getTargetNamespace(), serviceName
- + "Service"));
+ service.setQName(new QName(def.getTargetNamespace(), serviceInfo.getServiceName()));
javax.wsdl.Port port = def.createPort();
port.setBinding(binding);
- port.setName(serviceName + "Port");
+ port.setName(serviceInfo.getPortName());
SOAPAddressImpl soapAddress = new SOAPAddressImpl();
- soapAddress.setLocationURI("http://change_this_URI");
+ soapAddress.setLocationURI("http://change_this_URI/"+serviceInfo.getServletPath());
port.addExtensibilityElement(soapAddress);
service.addPort(port);
def.addService(service);
}
- public Service getServiceConfig() {
- return svcConfig;
+ private synchronized static WSDLFactory getWSDLFactory()
+ throws ConfigurationException
+ {
+ if (wsdlFactory == null)
+ {
+ try
+ {
+ wsdlFactory = AccessController.doPrivileged(new PrivilegedExceptionAction<WSDLFactory>() {
+ public WSDLFactory run() throws WSDLException
+ {
+ return WSDLFactory.newInstance();
+ }
+ }) ;
+ }
+ catch (final PrivilegedActionException pae)
+ {
+ throw new ConfigurationException("Failed to instantiate the WSDL factory", pae.getCause()) ;
+ }
+ }
+ return wsdlFactory ;
}
-
- public String getWSDL() {
- return wsdl;
- }
-
}
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBServiceEndpointInfo.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -19,123 +19,123 @@
*/
package org.jboss.internal.soa.esb.webservice;
-import java.util.concurrent.ConcurrentHashMap;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
-import javax.xml.namespace.QName;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.MepType;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionsDocument.Actions;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
-import org.apache.xmlbeans.impl.common.NameUtil;
-import org.jboss.deployment.DeploymentInfo;
-
public class ESBServiceEndpointInfo {
- private ConcurrentHashMap<String, Object> properties = new ConcurrentHashMap<String, Object>();
- private Class<?> epClass;
- private String svcCat;
- private String svcName;
- private String wsdl;
- private String targetNS;
- private DeploymentInfo deploymentInfo;
- private boolean isOneway;
- public ESBServiceEndpointInfo(String serviceCategory, String serviceName) {
- svcCat = serviceCategory;
- svcName = serviceName;
- }
-
+ private static final String DEFAULT_ENCODING ;
- public void setWSDL(String value) {
- wsdl = value;
+ private final String requestName ;
+ private final String responseName ;
+ private final String faultName ;
+ private final String bindingName ;
+ private final String serviceName ;
+ private final String portName ;
+ private final String operationName ;
+ private final String servletName ;
+ private final String servletPath ;
+ private final String wsdlFileName ;
+ private final String className ;
+ private final String namespace ;
+ private final boolean isOneWay ;
+
+ public ESBServiceEndpointInfo(final Service service)
+ throws UnsupportedEncodingException {
+ final String name = service.getName() ;
+ requestName = name + "Req" ;
+ responseName = name + "Res" ;
+ faultName = name + "Fault" ;
+ bindingName = name + "Binding" ;
+ serviceName = name + "Service" ;
+ portName = name + "PortType" ;
+ operationName = name + "Op" ;
+ final String serviceCategory = service.getCategory().replace('/', '_') ;
+ final String serviceCategoryLower = serviceCategory.toLowerCase() ;
+ final String serviceName = service.getName().replace('/', '_') ;
+ final String serviceNameLower = serviceName.toLowerCase() ;
+ servletName = serviceCategory + "_" + serviceName ;
+ servletPath = "/" + serviceCategory + "/" + serviceName ;
+ wsdlFileName = "WEB-INF/wsdl/" + serviceCategoryLower + "_" + serviceNameLower + ".wsdl" ;
+ className = "org.jboss.internal.soa.esb.webservice.impl." + serviceCategoryLower + "." + serviceNameLower + ".Implementation" ;
+ namespace = "http://soa.jboss.org/" + URLEncoder.encode(service.getCategory(), DEFAULT_ENCODING) ;
+
+ final Actions actions = service.getActions() ;
+ if (actions != null)
+ {
+ isOneWay = MepType.ONE_WAY.equals(actions.getMep()) ;
+ }
+ else
+ {
+ isOneWay = false ;
+ }
}
- public String getWSDL() {
- return wsdl;
+ public String getRequestName() {
+ return requestName ;
}
-
- public void setEndpointClass(Class<?> clz) {
- epClass = clz;
+
+ public String getResponseName() {
+ return responseName ;
}
-
- public Class<?> getEndpointClass() {
- return epClass;
+
+ public String getFaultName() {
+ return faultName ;
}
-
- public Object getProperty(String key) {
- return properties.get(key);
- }
-
- public void setProperty(String key, Object obj) {
- properties.put(key, obj);
- }
-
- public String getServiceCategory() {
- return svcCat;
- }
- public void setServiceCategory(String value) {
- svcCat = value;
+ public String getBindingName() {
+ return bindingName ;
}
public String getServiceName() {
- return svcName;
+ return serviceName ;
}
- public void setServiceName(String value) {
- svcName = value;
+ public String getPortName() {
+ return portName ;
}
- public String getEndpointName() {
- return this.getServiceCategory() + "." + this.getServiceName();
+ public String getOperationName() {
+ return operationName ;
}
- public String getWSEndpointClassName() {
- return NameUtil.getClassNameFromQName(new QName(getTargetNamesapce(), svcName));
+ public String getServletName() {
+ return servletName ;
}
- public void setTargetNamespace(String value) {
- targetNS = value;
+ public String getServletPath() {
+ return servletPath ;
}
- public String getTargetNamesapce() {
- if (targetNS == null) {
- return "http://soa.jboss.org/" + this.svcCat.toLowerCase();
- }
- return targetNS;
- }
-
public String getWSDLFileName() {
- return svcCat.toLowerCase() + "-" + svcName.toLowerCase() + ".wsdl";
+ return wsdlFileName ;
}
- public String getWarName() {
- return svcCat.toLowerCase() + "-" + svcName.toLowerCase() + ".war";
+ public String getClassName() {
+ return className ;
}
- public String getWarContextRoot() {
- return svcCat.toLowerCase() + "-" + svcName.toLowerCase();
+ public String getNamespace() {
+ return namespace ;
}
-
- public String getWSDLServiceName() {
- return svcName + "Service";
+ public boolean isOneWay() {
+ return isOneWay ;
}
- public String getWSDLPortName() {
- return svcName + "Port";
+ static
+ {
+ DEFAULT_ENCODING = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run()
+ {
+ return System.getProperty("file.encoding");
+ }
+ }) ;
}
-
- public void setDeploymentInfo(DeploymentInfo di) {
- this.deploymentInfo = di;
- }
-
- public DeploymentInfo getDeploymentInfo() {
- return deploymentInfo;
- }
-
- public void setOneway(boolean value) {
- isOneway = value;
- }
-
- public boolean isOneWay() {
- return isOneway;
- }
-
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGenerator.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -19,15 +19,10 @@
*/
package org.jboss.internal.soa.esb.webservice;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-
import javassist.ClassPool;
import javassist.CtClass;
-import javassist.CtField;
-import javassist.CtMethod;
-import javassist.CtNewMethod;
+import javassist.CtConstructor;
+import javassist.LoaderClassPath;
import javassist.NotFoundException;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ConstPool;
@@ -36,27 +31,47 @@
import javassist.bytecode.annotation.EnumMemberValue;
import javassist.bytecode.annotation.StringMemberValue;
-import org.antlr.stringtemplate.StringTemplate;
-import org.apache.commons.io.IOUtils;
-import org.jboss.soa.esb.util.ClassUtil;
-
public class JAXWSProviderClassGenerator {
- public CtClass generate(ESBServiceEndpointInfo epInfo)
+ private final ClassPool pool ;
+ private final CtClass oneWaySuperClass ;
+ private final CtClass requestResponseSuperClass ;
+
+ public JAXWSProviderClassGenerator()
throws WebServicePublishException {
- ClassPool pool = ClassPool.getDefault();
- CtClass seiClass = null;
+ pool = new ClassPool() ;
+ final ClassLoader tccl = Thread.currentThread().getContextClassLoader() ;
+ if (tccl != null)
+ {
+ pool.appendClassPath(new LoaderClassPath(tccl)) ;
+ }
+ pool.appendClassPath(new LoaderClassPath(JAXWSProviderClassGenerator.class.getClassLoader())) ;
try {
- seiClass = pool.get(epInfo.getWSEndpointClassName());
- } catch (NotFoundException e1) {
- // do nothing
+ oneWaySuperClass = pool.get(OneWayBaseWebService.class.getName());
+ requestResponseSuperClass = pool.get(RequestResponseBaseWebService.class.getName()) ;
+ } catch (final NotFoundException nfe) {
+ throw new WebServicePublishException("Failed to obtain superclasses", nfe) ;
}
- if (seiClass != null) {
- return seiClass;
- } else {
- seiClass = pool.makeClass(epInfo.getWSEndpointClassName());
- }
+ }
+
+ public byte[] generate(final String category, final String service, final ESBServiceEndpointInfo epInfo)
+ throws WebServicePublishException {
+ try {
+ pool.get(epInfo.getClassName());
+ throw new WebServicePublishException("Duplicate class within context: " + epInfo.getClassName()) ;
+ } catch (final NotFoundException nfe) {} // ignore
+
+ final CtClass seiClass = pool.makeClass(epInfo.getClassName());
try {
+ if (epInfo.isOneWay())
+ {
+ seiClass.setSuperclass(oneWaySuperClass) ;
+ }
+ else
+ {
+ seiClass.setSuperclass(requestResponseSuperClass) ;
+ }
+
CtClass providerClass = pool.get("javax.xml.ws.Provider");
seiClass.setInterfaces(new CtClass[] { providerClass });
@@ -66,17 +81,17 @@
Annotation annotation = new Annotation(
"javax.xml.ws.WebServiceProvider", constantPool);
StringMemberValue strValue1 = new StringMemberValue(constantPool);
- strValue1.setValue("/WEB-INF/wsdl/" + epInfo.getWSDLFileName());
+ strValue1.setValue(epInfo.getWSDLFileName());
annotation.addMemberValue("wsdlLocation", strValue1);
StringMemberValue strValue2 = new StringMemberValue(constantPool);
- strValue2.setValue(epInfo.getWSDLServiceName());
+ strValue2.setValue(epInfo.getServiceName());
annotation.addMemberValue("serviceName", strValue2);
StringMemberValue strValue3 = new StringMemberValue(constantPool);
- strValue3.setValue(epInfo.getWSDLPortName());
+ strValue3.setValue(epInfo.getPortName());
annotation.addMemberValue("portName", strValue3);
StringMemberValue strValue4 = new StringMemberValue(constantPool);
- strValue4.setValue(epInfo.getTargetNamesapce());
+ strValue4.setValue(epInfo.getNamespace());
annotation.addMemberValue("targetNamespace", strValue4);
attribute.addAnnotation(annotation);
@@ -90,53 +105,23 @@
attribute.addAnnotation(annotation2);
seiClass.getClassFile().addAttribute(attribute);
- CtClass invokerCtClass = pool.get("org.jboss.soa.esb.client.ServiceInvoker");
- String filedStr = "new org.jboss.soa.esb.client.ServiceInvoker(\""
- + epInfo.getServiceCategory() + "\","
- + "\"" + epInfo.getServiceName() + "\");";
- CtField.Initializer init = CtField.Initializer.byExpr(filedStr);
- CtField invokerCtField = new CtField(invokerCtClass, "serviceInvoker", seiClass);
- seiClass.addField(invokerCtField, init);
- CtMethod m = CtNewMethod.make("public Object invoke(Object obj) "
- + getMethodBody(epInfo), seiClass);
- seiClass.addMethod(m);
+ final String constructorStr = "super(\"" + category + "\"," + "\"" + service + "\");";
+ CtConstructor defaultConstructor = new CtConstructor(null, seiClass) ;
+ defaultConstructor.setBody(constructorStr) ;
+ seiClass.addConstructor(defaultConstructor) ;
+
// add generics for class
SignatureAttribute signatureAttribute = new SignatureAttribute(
seiClass.getClassFile().getConstPool(),
"Ljava/lang/Object;Ljavax/xml/ws/Provider<Ljavax/xml/soap/SOAPMessage;>;");
seiClass.getClassFile().addAttribute(signatureAttribute);
+
+ return seiClass.toBytecode();
} catch (Exception e) {
throw new WebServicePublishException(
"Failed to generate jaxws dispatch class for ESB service",
e);
}
-
- return seiClass;
}
-
- public String getMethodBody(ESBServiceEndpointInfo epInfo)
- throws IOException {
-
- InputStream in = ClassUtil.getResourceAsStream(
- "jaxwsprovider-methodbody.template", getClass());
- StringWriter strWriter = new StringWriter();
-
- IOUtils.copy(in, strWriter);
-
- StringTemplate template = new StringTemplate(strWriter.toString());
- if (epInfo.isOneWay()) {
- template.setAttribute("InvokeMethod", "serviceInvoker.deliverAsync(msg)");
- template.setAttribute("Result", "javax.xml.soap.MessageFactory.newInstance().createMessage()");
- template.setAttribute("ReturnFaultMsg", "e.printStackTrace();");
- } else {
- template.setAttribute("InvokeMethod", "msg = serviceInvoker.deliverSync(msg, (long)30000)");
- //TODO: when the ESB actions mep is request-response
- template.setAttribute("Result", "request");
- template.setAttribute("ReturnFaultMsg", "return faultMsg;");
- }
-
- return template.toString();
-
- }
}
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGenerator.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,332 +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.ArrayList;
-import java.util.List;
-
-import javassist.CannotCompileException;
-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.system.server.ServerConfigLocator;
-import org.jboss.util.file.JarUtils;
-
-public class JBossWSDeploymentGenerator {
- private Logger logger = Logger.getLogger(getClass());
-
- private final String earName = "esb-generated";
- protected List<File> warFileList = new ArrayList<File>();
- protected List<File> earFileList = new ArrayList<File>();
- protected List<ESBServiceEndpointInfo> endpointInfos;
- protected File tempDeployDir = null;
-
- public JBossWSDeploymentGenerator(List<ESBServiceEndpointInfo> endpoints) {
- this(endpoints, ServerConfigLocator.locate().getServerTempDeployDir());
- }
-
- public JBossWSDeploymentGenerator(List<ESBServiceEndpointInfo> endpoints, File tmpDir) {
- endpointInfos = endpoints;;
- tempDeployDir = tmpDir;
- }
-
-
- private File generateEar() throws WebServicePublishException {
- File earFile = null;
- try {
- addFileToEar(generateEarAppXml());
- File earTmp = File.createTempFile("tmp", earName + ".ear",
- tempDeployDir);
- earTmp.delete();
- earTmp.mkdirs();
- File earDir = new File(earTmp.getPath() + File.separator + "contents");
- 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);
- }
- for (ESBServiceEndpointInfo epInfo : endpointInfos) {
- File warFile = generateWar(epInfo);
- FileUtils.copyFileToDirectory(warFile, earDir);
- }
- String earFileName = earName + ".ear";
- earFile = new File(earTmp + File.separator + earFileName);
- earFile.createNewFile();
- FileOutputStream fout = new FileOutputStream(earFile);
- JarUtils.jar(fout, earDir.listFiles());
- fout.close();
- } catch (IOException e) {
- throw new WebServicePublishException("Failed to generate ear file for publishing the esb service", e);
- }
-
- return earFile;
-
- }
-
- private File generateWar(ESBServiceEndpointInfo endpointInfo) throws WebServicePublishException {
- File warFile = null;
- try {
- addFileToWar(generateWebXml(endpointInfo));
- addFileToWar(generateWSDLFile(endpointInfo));
- addFileToWar(generateJbossWebXml(endpointInfo));
- File warTmp = File.createTempFile("tmp", endpointInfo.getWarName(), tempDeployDir);
- warTmp.delete();
- warTmp.mkdirs();
- File warDir = new File(warTmp.getPath() + File.separator + "contents");
- 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());
- warFile = new File(warTmp + File.separator + endpointInfo.getWarName());
- 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());
- }
- } catch (IOException e) {
- throw new WebServicePublishException("Failed to generate webservice war file", e);
- } catch (CannotCompileException e) {
- throw new WebServicePublishException("Failed to generate Jaxws provider class", e);
- }
- return warFile;
- }
-
- // Directly deploy the generated webservice war file in esb server
- public void deployWar(File esbFile) throws WebServicePublishException {
- File deployDir = esbFile.getParentFile();
- for (ESBServiceEndpointInfo endpointInfo : this.endpointInfos) {
- File wsWar;
- try {
- wsWar = generateWar(endpointInfo);
- } catch (Exception e1) {
- throw new WebServicePublishException(
- "Failed to generate war file for Endpoint "
- + endpointInfo.getEndpointName(), e1);
- }
-
- 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 generated 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 {
- List<File> warFiles = new ArrayList<File>();
-
- for (ESBServiceEndpointInfo endpoint : endpointInfos) {
- try {
- warFiles.add(generateWar(endpoint));
- } catch (Exception e1) {
- throw new WebServicePublishException(
- "Failed to generate war file for Endpoint "
- + endpoint.getEndpointName(), e1);
- }
- }
- if (esbFile.exists() && esbFile.isFile()) {
- try {
- FileInputStream fin = new FileInputStream(esbFile);
- File tmpDir = File.createTempFile("tmp", esbFile.getName(),
- tempDeployDir);
- tmpDir.delete();
- tmpDir.mkdirs();
- JarUtils.unjar(fin, tmpDir);
- for (File warFile : warFiles) {
- 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 {
- for (File warFile : warFiles) {
- 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) {
- throw new WebServicePublishException(
- "Failed to Generate ear file for esb service " + esbFile.getName(), e1);
- }
-
- if (esbFile.exists() && esbFile.isFile()) {
- try {
- FileInputStream fin = new FileInputStream(esbFile);
- File tmpDir = File.createTempFile("tmp", esbFile.getName(),
- tempDeployDir);
- 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(ESBServiceEndpointInfo endpointInfo)
- 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", earName);
- template.setAttribute("Endpoints", endpointInfos);
- File appXml = new File("META-INF/application.xml");
- FileUtils.writeStringToFile(appXml, template.toString());
- return appXml;
- }
-
- private File generateJbossWebXml(ESBServiceEndpointInfo endpointInfo)
- 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(ESBServiceEndpointInfo endpointInfo)
- 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/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/JBossWSWebServicePublisher.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,30 +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.util.List;
-
-public class JBossWSWebServicePublisher implements WebServicePublisher {
- public void publish(List<ESBServiceEndpointInfo> endpoints, File esbService) throws WebServicePublishException {
- JBossWSDeploymentGenerator warGenerator = new JBossWSDeploymentGenerator(endpoints);
- warGenerator.injectWarToESBArchive(esbService);
- }
-}
Added: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java (rev 0)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -0,0 +1,79 @@
+/*
+* 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.internal.soa.esb.webservice;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.couriers.FaultMessageException;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+/**
+ * This is the base class for a OneWay SOAP message
+ * @author kevin
+ */
+public class OneWayBaseWebService
+{
+ private static final QName SERVER_FAULT_QN = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server") ;
+ private final ServiceInvoker serviceInvoker ;
+
+ protected OneWayBaseWebService(final String category, final String name)
+ throws MessageDeliverException
+ {
+ serviceInvoker = new ServiceInvoker(category, name) ;
+ }
+
+ public Object invoke(final Object obj)
+ throws SOAPException
+ {
+ final SOAPMessage request = (SOAPMessage)obj;
+ try
+ {
+ final Message msg = MessageFactory.getInstance().getMessage() ;
+ final ByteArrayOutputStream byteStream = new ByteArrayOutputStream() ;
+ request.writeTo(byteStream) ;
+ msg.getBody().add(byteStream.toString()) ;
+ byteStream.close() ;
+ serviceInvoker.deliverAsync(msg) ;
+ }
+ catch (final Exception ex)
+ {
+ SOAPMessage faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
+ if (ex instanceof FaultMessageException)
+ {
+ //cast to user defined soap fault message
+ }
+ else
+ {
+ faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, ex.getMessage());
+ }
+ ex.printStackTrace();
+ }
+ return javax.xml.soap.MessageFactory.newInstance().createMessage() ;
+ }
+}
Property changes on: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/OneWayBaseWebService.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java (rev 0)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -0,0 +1,83 @@
+/*
+* 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.internal.soa.esb.webservice;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.couriers.FaultMessageException;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+
+/**
+ * This is the base class for a RequestResponse SOAP message
+ * @author kevin
+ */
+public class RequestResponseBaseWebService
+{
+ private static final QName SERVER_FAULT_QN = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server") ;
+ private final ServiceInvoker serviceInvoker ;
+
+ protected RequestResponseBaseWebService(final String category, final String name)
+ throws MessageDeliverException
+ {
+ serviceInvoker = new ServiceInvoker(category, name) ;
+ }
+
+ public Object invoke(final Object obj)
+ throws SOAPException
+ {
+ final SOAPMessage request = (SOAPMessage)obj;
+ try
+ {
+ final Message msg = MessageFactory.getInstance().getMessage() ;
+ final ByteArrayOutputStream byteStream = new ByteArrayOutputStream() ;
+ request.writeTo(byteStream) ;
+ msg.getBody().add(byteStream.toString()) ;
+ byteStream.close() ;
+ final Message response = serviceInvoker.deliverSync(msg, (long)30000) ;
+// template.setAttribute("InvokeMethod", "");
+// //TODO: when the ESB actions mep is request-response
+// template.setAttribute("Result", "request");
+// template.setAttribute("ReturnFaultMsg", "return faultMsg;");
+ }
+ catch (final Exception ex)
+ {
+ SOAPMessage faultMsg = javax.xml.soap.MessageFactory.newInstance().createMessage() ;
+ if (ex instanceof FaultMessageException)
+ {
+ //cast to user defined soap fault message
+ }
+ else
+ {
+ faultMsg.getSOAPBody().addFault(SERVER_FAULT_QN, ex.getMessage());
+ }
+ return faultMsg ;
+ }
+ return request;
+ }
+}
Property changes on: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/RequestResponseBaseWebService.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServicePublisher.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServicePublisher.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/WebServicePublisher.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,27 +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.util.List;
-
-public interface WebServicePublisher {
- void publish(List<ESBServiceEndpointInfo> endpoints, File esbService) throws WebServicePublishException;
-}
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/app-xml.template 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,16 +0,0 @@
-<?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>
- $Endpoints:{ endpoint |
- <web>
- <web-uri>$endpoint.warName$</web-uri>
- <context-root>$endpoint.warContextRoot$</context-root>
- </web>
- }$
- </module>
-</application>
-
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jbossweb-xml.template
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jbossweb-xml.template 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/jbossweb-xml.template 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,5 +0,0 @@
-<jboss-web>
-<depends>
-jboss.esb:deployment=$ESBArtifact$
-</depends>
-</jboss-web>
\ No newline at end of file
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/web-xml.template
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/web-xml.template 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/internal/soa/esb/webservice/web-xml.template 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
- <servlet>
- <servlet-name>$ServiceName$</servlet-name>
- <servlet-class>$EndpointClassName$</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>$ServiceName$</servlet-name>
- <url-pattern>/$Category$/$ServiceName$</url-pattern>
- </servlet-mapping>
-</web-app>
\ No newline at end of file
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/Configuration.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -23,29 +23,18 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.InputStream;
import java.io.StringReader;
import java.net.URL;
import java.util.List;
-
import javax.management.ObjectName;
import javax.xml.transform.stream.StreamSource;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
-import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
-import org.jboss.internal.soa.esb.webservice.JBossWSWebServicePublisher;
-import org.jboss.internal.soa.esb.webservice.WebServicePublishException;
-import org.jboss.internal.soa.esb.webservice.WebServicePublisher;
-import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.LifecycleUtil;
import org.jboss.soa.esb.listeners.ListenerTagNames;
-import org.jboss.soa.esb.listeners.config.xbeanmodel.MepType;
-import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycle;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
import org.jboss.soa.esb.util.ClassUtil;
@@ -62,7 +51,6 @@
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
{
@@ -85,10 +73,14 @@
}
public static ManagedLifecycleController create(String configXml) {
- return create (configXml, null, null);
+ return create (configXml, null);
}
- public static ManagedLifecycleController create(String configXml, DeploymentInfo di, ObjectName serviceName)
+// public static ManagedLifecycleController create(String configXml, ObjectName serviceName) {
+// return create (configXml, null, null);
+// }
+
+ public static ManagedLifecycleController create(String configXml, ObjectName serviceName)
{
InputStream validationInputStream = ClassUtil.getResourceAsStream(JBOSSESB_XSD, Configuration.class);
//if this fails try using the
@@ -116,9 +108,6 @@
listenerConfig.setAttribute(ListenerTagNames.DEPLOYMENT_NAME_TAG,
serviceName.getKeyProperty(ListenerTagNames.DEPLOYMENT_NAME_TAG));
}
-
- File esbFile = new File(di.url.getFile());
-
List<ManagedLifecycle> instances = LifecycleUtil.getListeners(listenerConfig);
byte[] gatewayBytes = gatewayXml.toByteArray();
@@ -133,40 +122,7 @@
// In parallel, create a map of the contract publication info...
ServicePublisher.addServicePublishers(controller, generator.getModel());
- //publish esb service as a webService
- List<ESBServiceEndpointInfo> endpoints = new java.util.ArrayList<ESBServiceEndpointInfo>();
- for (Service service : generator.getModel().getServices()) {
- if (service.getActions().getInXsd() != null) {
- ESBContractGenerator contractGen = new ESBContractGenerator(
- service);
- try {
- contractGen.generateWSDL();
- } catch (ConfigurationException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
-
- ESBServiceEndpointInfo endpoint = new ESBServiceEndpointInfo(
- service.getCategory(), service.getName());
- endpoint.setWSDL(contractGen.getWSDL());
- endpoints.add(endpoint);
- MepType.Enum mep = service.getActions().getMep();
- if (mep != null && mep.equals(MepType.ONE_WAY)) {
- endpoint.setOneway(true);
- }
-
- endpoint.setDeploymentInfo(di);
- }
- }
- if (endpoints.size() > 0) {
- genratedWSWar = true;
- WebServicePublisher esbServicePublisher = new JBossWSWebServicePublisher();
- try {
- esbServicePublisher.publish(endpoints, esbFile);
- } catch (WebServicePublishException e) {
- throw new RuntimeException(
- "Failed to publish web services for esb :" + di.shortName);
- }
- }
+ // KEV add WS service publishers here
return controller;
}
else
@@ -180,11 +136,4 @@
throw new RuntimeException(e);
}
}
-
-
-
- public static boolean genratedWSWar() {
- return genratedWSWar;
- }
-
}
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -21,30 +21,36 @@
*/
package org.jboss.soa.esb.listeners.config;
+import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URL;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.SubDeployer;
import org.jboss.deployment.SubDeployerSupport;
import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.internal.soa.esb.webservice.ESBContractGenerator;
+import org.jboss.internal.soa.esb.webservice.ESBServiceEndpointInfo;
+import org.jboss.internal.soa.esb.webservice.JAXWSProviderClassGenerator;
import org.jboss.logging.Logger;
import org.jboss.metadata.MetaData;
import org.jboss.metadata.XmlFileLoader;
@@ -52,14 +58,18 @@
import org.jboss.mx.util.MBeanProxyExt;
import org.jboss.mx.util.ObjectNameConverter;
import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbossesbDocument;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionDocument.Action;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ActionsDocument.Actions;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.JbossesbDocument.Jbossesb;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
+import org.jboss.soa.esb.listeners.config.xbeanmodel.ServicesDocument.Services;
import org.jboss.soa.esb.util.ClassUtil;
-import org.jboss.soa.esb.util.XPathNamespaceContext;
import org.jboss.system.ServiceControllerMBean;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.system.server.ServerConfigLocator;
import org.jboss.web.AbstractWebContainer;
import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
/**
* comment
@@ -74,7 +84,9 @@
private ServiceControllerMBean serviceController;
private Properties actionArtifactProperties;
- private static boolean redployed = false;
+ private final File esbWarFiles ;
+ private final Set<String> esbNames = new HashSet<String>() ;
+
private static final String PREFIX_CANONICAL_NAME = "jboss.esb:deployment=" ;
private static final String ESB_ARTIFACT_NAME = "jbossesb.esb" ;
@@ -87,8 +99,11 @@
{
setSuffixes(new String[]{".esb"});
setRelativeOrder(1000); // before old EJB 2.1 deployer
+ final ServerConfig config = ServerConfigLocator.locate();
+ esbWarFiles = new File(config.getServerTempDir(), "esbwarfiles") ;
+ esbWarFiles.mkdirs() ;
}
-
+
public static boolean hasFile(DeploymentInfo di, String filePath)
{
String urlStr = di.url.getFile();
@@ -223,6 +238,55 @@
in.close();
}
}
+
+ final URL document = getDocumentUrl(di);
+
+ if (document == null)
+ {
+ throw new DeploymentException("Unable to find document url of META-INF/jboss-esb.xml in: "
+ + di.url);
+ }
+ 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();
+ }
+
+ final Set<ObjectName> deps = new HashSet<ObjectName>();
+ final Jbossesb jbossEsb = getJbossEsb(jbossEsbXml) ;
+ addActionDependencies(di.shortName, jbossEsb, deps) ;
+
+ JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(jbossEsbXml, di.shortName);
+
+ final String deploymentName = getDeploymentName(deployment) ;
+ di.context.put(JBoss4ESBDeploymentMetaData.class, new JBoss4ESBDeploymentMetaData(deployment, deploymentName, deps)) ;
+ // invoke super-class initialization
+ super.init(di);
+ // create webservice WAR
+ final ClassLoader origCL = Thread.currentThread().getContextClassLoader() ;
+ final File warFile ;
+ try
+ {
+ Thread.currentThread().setContextClassLoader(di.localCl) ;
+ warFile = createWebserviceWars(di.shortName, jbossEsb, deploymentName) ;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(origCL) ;
+ }
+ if (warFile != null)
+ {
+ final URL warFileURL = warFile.toURL() ;
+ deployUrl(di, warFileURL, warFile.getName()) ;
+ }
}
catch (Exception e)
{
@@ -232,24 +296,15 @@
}
throw new DeploymentException("failed to initialize", e);
}
-
- // invoke super-class initialization
- super.init(di);
}
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>();
+ final JBoss4ESBDeploymentMetaData metaData = (JBoss4ESBDeploymentMetaData)di.context.get(JBoss4ESBDeploymentMetaData.class) ;
+ final Set<ObjectName> deps = metaData.getDependencies() ;
InputStream in = di.localCl.getResourceAsStream("META-INF/deployment.xml");
if (in != null)
{
@@ -317,34 +372,16 @@
}
}
- 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;
+ String name = PREFIX_CANONICAL_NAME + metaData.getDeploymentName();
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);
+ throw new DeploymentException("Duplicate registration for " + name) ;
}
+
+ final JBoss4ESBDeployment deployment = metaData.getDeployment() ;
+ deployment.setClassloader(di.ucl);
server.registerMBean(deployment, on);
di.deployedObject = on;
log.debug("Deploying: " + di.url);
@@ -359,44 +396,42 @@
super.create(di);
}
+ private Jbossesb getJbossEsb(final String configuration)
+ throws DeploymentException
+ {
+ try
+ {
+ final StringReader sr = new StringReader(configuration) ;
+ return JbossesbDocument.Factory.parse(sr).getJbossesb() ;
+ }
+ catch (final Exception ex)
+ {
+ throw new DeploymentException("Failed to parse jboss-esb.xml", ex) ;
+ }
+ }
+
private void addActionDependencies(final String deploymentName,
- final String configuration, final Set<ObjectName> deps)
- throws XPathExpressionException, DeploymentException, MalformedObjectNameException
+ final Jbossesb jbossEsb, final Set<ObjectName> deps)
+ throws 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() ;
-
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 Services services = jbossEsb.getServices() ;
+ if (services != null)
{
final Set<String> actionClasses = new HashSet<String>() ;
- for(int count = 0 ; count < numActions ; count++)
+
+ for(final Service service : services.getServiceList())
{
- final Node actionNode = actionList.item(count) ;
- if (!(actionNode instanceof Element))
+ final Actions actions = service.getActions() ;
+ if (actions != null)
{
- log.warn("Action node is not an element: " + actionNode) ;
+ for (final Action action: actions.getActionList())
+ {
+ actionClasses.add(action.getClass1()) ;
+ }
}
- else
- {
- final Element actionElement = (Element)actionNode ;
- final String actionClass = actionElement.getAttribute("class") ;
- actionClasses.add(actionClass) ;
- }
}
final int numActionClasses = actionClasses.size() ;
@@ -423,6 +458,104 @@
}
}
}
+
+ private File createWebserviceWars(final String esbName, final Jbossesb jbossEsb, final String deploymentName)
+ throws DeploymentException
+ {
+ final Services services = jbossEsb.getServices() ;
+ if (services != null)
+ {
+ final List<Service> endpointServices = new ArrayList<Service>() ;
+ for(final Service service : jbossEsb.getServices().getServiceList())
+ {
+ final Actions actions = service.getActions() ;
+ if (actions != null)
+ {
+ final String inXsd = actions.getInXsd() ;
+ if (inXsd != null)
+ {
+ endpointServices.add(service) ;
+ }
+ }
+ }
+
+ if (endpointServices.size() > 0)
+ {
+ final StringWriter servletDefinition = new StringWriter() ;
+ final StringWriter servletMapping = new StringWriter() ;
+
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
+ final ZipOutputStream zos = new ZipOutputStream(baos) ;
+ zos.setComment("ESB war file for exposing webservices: " + esbName) ;
+ try
+ {
+ final JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator() ;
+
+ addFile(zos, "WEB-INF/jboss-web.xml", "<jboss-web><depends>" + PREFIX_CANONICAL_NAME + deploymentName + "</depends></jboss-web>") ;
+ for(Service service: endpointServices)
+ {
+ final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(service) ;
+ final String wsdl = ESBContractGenerator.generateWSDL(service, serviceInfo) ;
+ addFile(zos, serviceInfo.getWSDLFileName(), wsdl) ;
+
+ final byte[] wsClass = generator.generate(service.getCategory(),
+ service.getName(), serviceInfo) ;
+ final String wsClassName = serviceInfo.getClassName().replace('.', '/') + ".class" ;
+ addFile(zos, "WEB-INF/classes/" + wsClassName, wsClass) ;
+
+ servletDefinition.append("<servlet><servlet-name>") ;
+ servletDefinition.append(serviceInfo.getServletName()) ;
+ servletDefinition.append("</servlet-name><servlet-class>") ;
+ servletDefinition.append(serviceInfo.getClassName()) ;
+ servletDefinition.append("</servlet-class></servlet>") ;
+
+ servletMapping.append("<servlet-mapping><servlet-name>") ;
+ servletMapping.append(serviceInfo.getServletName()) ;
+ servletMapping.append("</servlet-name><url-pattern>") ;
+ servletMapping.append(serviceInfo.getServletPath()) ;
+ servletMapping.append("</url-pattern></servlet-mapping>") ;
+ }
+
+ final StringWriter webXml = new StringWriter() ;
+ webXml.append("<web-app xmlns=\"http://java.sun.com/xml/ns/j2ee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"") ;
+ webXml.append(" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\" version=\"2.4\">") ;
+ webXml.append(servletDefinition.getBuffer()) ;
+ webXml.append(servletMapping.getBuffer()) ;
+ webXml.append("</web-app>") ;
+
+ addFile(zos, "WEB-INF/web.xml", webXml.toString()) ;
+ zos.close() ;
+
+ final File warFile = getESBWarFile(deploymentName, esbName, true) ;
+
+ final FileOutputStream fos = new FileOutputStream(warFile) ;
+ fos.write(baos.toByteArray()) ;
+ fos.close() ;
+ return warFile ;
+ }
+ catch (final Exception ex)
+ {
+ throw new DeploymentException("Failed to create webservice artifact", ex) ;
+ }
+ }
+ }
+ return null ;
+ }
+
+ private void addFile(final ZipOutputStream zos, final String filename, final String contents)
+ throws IOException
+ {
+ addFile(zos, filename, contents.getBytes()) ;
+ }
+
+ private void addFile(final ZipOutputStream zos, final String filename, final byte[] contents)
+ throws IOException
+ {
+ final ZipEntry entry = new ZipEntry(filename) ;
+ zos.putNextEntry(entry) ;
+ zos.write(contents) ;
+ zos.closeEntry() ;
+ }
public synchronized void start(DeploymentInfo di)
throws DeploymentException
@@ -430,19 +563,6 @@
try
{
serviceController.start(di.deployedObject);
- //Notifying the MainDeployer to redeploy is not the ideal way
- //Because the MainDeployer sets the "LastModifed" after excute start(),
- //Any change for ESB archive during deployment can not
- //be detected by DeploymentScanner. How can we notify the DeploymentScanner the update for this esb
- //Is there some listener mechanism for it?
- if (Configuration.genratedWSWar() && !redployed) {
- log.debug("Redployed " + di.shortName);
- redployed = true;
- mainDeployer.redeploy(di);
- } else {
- //reset redployed to false
- redployed = false;
- }
}
catch (Exception e)
{
@@ -482,6 +602,18 @@
public void destroy(DeploymentInfo di)
throws DeploymentException
{
+ final JBoss4ESBDeploymentMetaData metaData = (JBoss4ESBDeploymentMetaData)di.context.get(JBoss4ESBDeploymentMetaData.class) ;
+ if (metaData != null)
+ {
+ final String deploymentName = metaData.getDeploymentName() ;
+ final File warFile = getESBWarFile(deploymentName, di.shortName, false) ;
+ if (warFile != null)
+ {
+ warFile.delete();
+ warFile.getParentFile().delete() ;
+ }
+ removeDeploymentName(deploymentName) ;
+ }
if (di.deployedObject != null)
{
try
@@ -497,4 +629,37 @@
}
super.destroy(di);
}
+
+ private File getESBWarFile(final String deploymentName, final String esbName, final boolean createDir)
+ {
+ final File esbDir = new File(esbWarFiles, deploymentName) ;
+ if (!esbDir.exists())
+ {
+ if (!createDir)
+ {
+ return null ;
+ }
+ esbDir.mkdir() ;
+ }
+
+ final int lastSeparator = esbName.lastIndexOf('.') ;
+ final String warFileName = ((lastSeparator >= 0) ? esbName.substring(0, lastSeparator) : esbName) + ".war" ;
+
+ return new File(esbDir, warFileName) ;
+ }
+
+ private synchronized String getDeploymentName(final JBoss4ESBDeployment deployment)
+ {
+ final String deploymentName = deployment.getDeploymentName() ;
+ if (esbNames.add(deploymentName))
+ {
+ return deploymentName ;
+ }
+ return deploymentName + ",uid=" + System.identityHashCode(deployment) ;
+ }
+
+ private synchronized void removeDeploymentName(final String deploymentName)
+ {
+ esbNames.remove(deploymentName) ;
+ }
}
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployment.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -21,7 +21,6 @@
*/
package org.jboss.soa.esb.listeners.config;
-import org.jboss.deployment.DeploymentInfo;
import org.jboss.soa.esb.lifecycle.LifecycleResourceManager;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController;
import org.jboss.system.ServiceMBeanSupport;
@@ -38,14 +37,12 @@
private final String deploymentName ;
private ManagedLifecycleController controller;
private ClassLoader classloader;
- private DeploymentInfo deploymentInfo;
- public JBoss4ESBDeployment(String jbossEsbXml, final DeploymentInfo di)
+ public JBoss4ESBDeployment(String jbossEsbXml, final String deploymentName)
{
this.jbossEsbXml = jbossEsbXml;
- this.deploymentName = di.shortName ;
- deploymentInfo = di;
+ this.deploymentName = deploymentName ;
}
public String getJbossEsbXml()
@@ -68,6 +65,11 @@
{
return controller;
}
+
+ public String getDeploymentName()
+ {
+ return deploymentName ;
+ }
@Override
public void createService()
@@ -81,8 +83,8 @@
try
{
Thread.currentThread().setContextClassLoader(classloader);
- LifecycleResourceManager.getSingleton().associateDeployment(deploymentName);
- controller = Configuration.create(jbossEsbXml, deploymentInfo, serviceName);
+ LifecycleResourceManager.getSingleton().associateDeployment(deploymentName) ;
+ controller = Configuration.create(jbossEsbXml, serviceName);
controller.start();
}
finally
Added: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeploymentMetaData.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeploymentMetaData.java (rev 0)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeploymentMetaData.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -0,0 +1,61 @@
+/*
+* 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.util.Set;
+
+import javax.management.ObjectName;
+
+/**
+ * Meta Data used for ESB deployments
+ *
+ * @author <a href="kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class JBoss4ESBDeploymentMetaData
+{
+ private final JBoss4ESBDeployment deployment ;
+ private final String deploymentName ;
+ private final Set<ObjectName> dependencies ;
+
+ public JBoss4ESBDeploymentMetaData(final JBoss4ESBDeployment deployment, final String deploymentName,
+ final Set<ObjectName> dependencies)
+ {
+ this.deployment = deployment ;
+ this.deploymentName = deploymentName ;
+ this.dependencies = dependencies ;
+ }
+
+ public JBoss4ESBDeployment getDeployment()
+ {
+ return deployment ;
+ }
+
+ public String getDeploymentName()
+ {
+ return deploymentName ;
+ }
+
+ public Set<ObjectName> getDependencies()
+ {
+ return dependencies ;
+ }
+}
Property changes on: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeploymentMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/src/org/jboss/soa/esb/listeners/config/ServicePublisher.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -114,11 +114,6 @@
servicePublishers.put(controller, publishers);
}
-
- public static List<ServicePublisher> getServicePublisher(ManagedLifecycleController controller) {
- return servicePublishers.get(controller);
- }
-
/**
* Get the full list of publishers registered against all active {@link ManagedLifecycleController}
* instances.
Modified: labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/ESBContractGeneratorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/ESBContractGeneratorUnitTest.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/ESBContractGeneratorUnitTest.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -29,13 +29,13 @@
import javax.wsdl.Definition;
import javax.wsdl.factory.WSDLFactory;
+import junit.framework.TestCase;
+
import org.jboss.soa.esb.listeners.config.Generator;
import org.jboss.soa.esb.listeners.config.xbeanmodel.ServiceDocument.Service;
import org.jboss.soa.esb.util.FileUtil;
import org.xml.sax.InputSource;
-import junit.framework.TestCase;
-
public class ESBContractGeneratorUnitTest extends TestCase {
public void testGenerateWSDL() throws Exception {
URL url = getClass().getResource("./jbossesb_config_06.xml");
@@ -44,10 +44,10 @@
ByteArrayOutputStream gatewayXml = new ByteArrayOutputStream();
Generator generator = new Generator(new ByteArrayInputStream(configBytes), listenerXml, gatewayXml);
generator.generate();
- List<Service> serivces = generator.getModel().getServices();
- ESBContractGenerator contractGen = new ESBContractGenerator(serivces.get(0));
- contractGen.generateWSDL();
- String wsdl = contractGen.getWSDL();
+ List<Service> services = generator.getModel().getServices();
+ final Service service = services.get(0) ;
+ final ESBServiceEndpointInfo endpointInfo = new ESBServiceEndpointInfo(service) ;
+ String wsdl = ESBContractGenerator.generateWSDL(service, endpointInfo);
java.io.StringReader strReader = new java.io.StringReader(wsdl);
InputSource inputSource = new InputSource(strReader);
Definition def = WSDLFactory.newInstance().newWSDLReader().readWSDL("file://tmp.wsdl", inputSource);
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGeneratorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGeneratorUnitTest.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JAXWSProviderClassGeneratorUnitTest.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,57 +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.IOException;
-
-import javassist.CtClass;
-
-import junit.framework.TestCase;
-
-public class JAXWSProviderClassGeneratorUnitTest extends TestCase {
- public void testGenerator() throws Exception {
- JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator();
- ESBServiceEndpointInfo epInfo = new ESBServiceEndpointInfo("test", "MyTest");
- String currentDir = getClass().getResource(".").getFile();
-
- CtClass ctClass = generator.generate(epInfo);
- ctClass.writeFile(currentDir);
-
- File generatedClass = new File(currentDir + "/org/jboss/soa/test/MyTest.class");
- assertTrue("the jaxws disptach provider class is not generated", generatedClass.exists());
-
- }
-
- public void testStringTemplate() {
- JAXWSProviderClassGenerator generator = new JAXWSProviderClassGenerator();
- ESBServiceEndpointInfo epInfo = new ESBServiceEndpointInfo("test", "MyTest");
- try {
- System.out.println(generator.getMethodBody(epInfo));
- assertTrue("The arrtibute in template is not repalced correctly", generator.getMethodBody(epInfo).indexOf("deliverSync") > -1);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
-
-
-}
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/JBossWSDeploymentGeneratorUnitTest.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -1,73 +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.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.jboss.deployment.DeploymentInfo;
-
-
-import junit.framework.TestCase;
-
-public class JBossWSDeploymentGeneratorUnitTest extends TestCase {
-
- public void testInjetWar() throws Exception {
- URL url = getClass().getResource("webservice_test.esb");
- File file = new File(url.getFile());
- ESBServiceEndpointInfo endpointInfo1 = new ESBServiceEndpointInfo("jboss", "test1");
- endpointInfo1.setTargetNamespace("http://soa.jboss.org");
-
- ESBServiceEndpointInfo endpointInfo2 = new ESBServiceEndpointInfo("jboss", "test2");
- endpointInfo2.setTargetNamespace("http://soa.jboss.org");
-
-
- List<ESBServiceEndpointInfo> endpoints = new java.util.ArrayList<ESBServiceEndpointInfo>();
- DeploymentInfo di = new DeploymentInfo(getClass().getResource("webservice_test.esb"), null, null);
- endpointInfo1.setDeploymentInfo(di);
- endpointInfo2.setDeploymentInfo(di);
- endpoints.add(endpointInfo1);
- endpoints.add(endpointInfo2);
-
- String tmpDir = System.getProperty("java.io.tmpdir");
- JBossWSDeploymentGenerator generator = new JBossWSDeploymentGenerator(endpoints, new File(tmpDir));
- generator.injectWarToESBArchive(file);
-
- JarInputStream jarInput = new JarInputStream(new java.io.FileInputStream(file));
- JarEntry jarEntry = null;
- boolean war1Generated = false;
- boolean war2Generated = false;
- while ((jarEntry = jarInput.getNextJarEntry()) != null) {
- if (jarEntry.getName().equalsIgnoreCase("jboss-test1.war")) {
- war1Generated = true;
- }
- if (jarEntry.getName().equalsIgnoreCase("jboss-test2.war")) {
- war2Generated = true;
- }
- }
-
- assertTrue("The jboss-test1.war does not generated in esb archive", war1Generated);
- assertTrue("The jboss-test1.war does not generated in esb archive", war2Generated);
- }
-
-}
Modified: labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/jbossesb_config_06.xml
===================================================================
--- labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/jbossesb_config_06.xml 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/jbossesb_config_06.xml 2008-07-02 22:59:28 UTC (rev 20890)
@@ -6,7 +6,7 @@
description="Hello World" invmScope="GLOBAL">>
<actions
inXsd="/org/jboss/internal/soa/esb/webservice/request.xsd"
- outXsd="/org/jboss/internal/soa/esb/webservice/request.xsd"
+ outXsd="/org/jboss/internal/soa/esb/webservice/response.xsd"
faultXsd="/org/jboss/internal/soa/esb/webservice/fault.xsd">
<action name="action2"
class="org.jboss.soa.esb.actions.SystemPrintln">
Deleted: labs/jbossesb/workspace/kevin/product/rosetta/tests/src/org/jboss/internal/soa/esb/webservice/webservice_test.esb
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbm-queue-service.xml 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbm-queue-service.xml 2008-07-02 22:59:28 UTC (rev 20890)
@@ -6,4 +6,10 @@
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb_reply"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
</server>
Modified: labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbmq-queue-service.xml 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/jbmq-queue-service.xml 2008-07-02 22:59:28 UTC (rev 20890)
@@ -6,4 +6,10 @@
jboss.mq:service=DestinationManager
</depends>
</mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_helloworld_pub_service_Request_esb_reply">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
</server>
Modified: labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SOAPTest.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SOAPTest.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/samples/quickstarts/helloworld_pub_service/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SOAPTest.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -32,7 +32,7 @@
+ "<soapenv:Header/><soapenv:Body><cus:customerName>JBOSS</cus:customerName></soapenv:Body></soapenv:Envelope>";
HttpClient client = new HttpClient();
PostMethod postMethod = new PostMethod(
- "http://127.0.0.1:8080/Quickstart_helloworld_pub_service_esb/ESBServiceSample/HelloWorldPubService");
+ "http://127.0.0.1:8080/Quickstart_helloworld_pub_service/ESBServiceSample/HelloWorldPubService");
StringRequestEntity requestEntity = new StringRequestEntity(request);
postMethod.setRequestEntity(requestEntity);
Modified: labs/jbossesb/workspace/kevin/product/services/soap/build.xml
===================================================================
--- labs/jbossesb/workspace/kevin/product/services/soap/build.xml 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/services/soap/build.xml 2008-07-02 22:59:28 UTC (rev 20890)
@@ -12,7 +12,7 @@
<fileset dir="../../lib/ext" includes="jboss-jaxb-intros.jar"/>
<!-- StAX jars ... -->
- <fileset dir="../../lib/ext" includes="xbean.jar stax-api-1.0.1.jar xstream-1.2.2.jar wstx-lgpl-3.2.1.jar ognl-2.6.9.jar"/>
+ <fileset dir="../../lib/ext" includes="xbean.jar stax-api-1.0.1.jar xstream-1.2.2.jar wstx-lgpl-3.2.1.jar ognl-2.6.9.jar servlet-api-2.3.jar"/>
<!-- Adding the Smooks jars... -->
<fileset dir="../smooks/lib/ext" includes="*.jar"/>
Deleted: labs/jbossesb/workspace/kevin/product/services/soap/lib/ext/build-time/servlet-api-2.3.jar
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/kevin/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
===================================================================
--- labs/jbossesb/workspace/kevin/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java 2008-07-02 22:59:28 UTC (rev 20890)
@@ -22,6 +22,7 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
import org.jboss.internal.soa.esb.publish.ContractInfo;
+import org.jboss.internal.soa.esb.publish.ServletContractPublisher;
import org.jboss.internal.soa.esb.util.StreamUtils;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.addressing.EPR;
@@ -50,7 +51,7 @@
* Contract publisher for a Webservice endpoint.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public class WebserviceContractPublisher implements ActionContractPublisher {
+public class WebserviceContractPublisher implements ActionContractPublisher, ServletContractPublisher {
private static Logger logger = Logger.getLogger(WebserviceContractPublisher.class);
private String endpointName;
Modified: labs/jbossesb/workspace/kevin/product/tools/console/contract-web/src/main/webapp/contract.jsp
===================================================================
--- labs/jbossesb/workspace/kevin/product/tools/console/contract-web/src/main/webapp/contract.jsp 2008-07-02 21:44:19 UTC (rev 20889)
+++ labs/jbossesb/workspace/kevin/product/tools/console/contract-web/src/main/webapp/contract.jsp 2008-07-02 22:59:28 UTC (rev 20890)
@@ -7,8 +7,8 @@
<%@ page import="org.jboss.soa.esb.addressing.EPR" %>
<%@ page import="java.net.URI" %>
<%@ page import="org.jboss.internal.soa.esb.publish.ContractInfo" %>
-<%@ page import="org.jboss.soa.esb.actions.soap.WebserviceContractPublisher" %>
<%@ page import="org.jboss.internal.soa.esb.publish.ContractPublisher" %>
+<%@ page import="org.jboss.internal.soa.esb.publish.ServletContractPublisher" %>
<%
List publishers = ServicePublisher.getServicePublishers();
Registry registry = RegistryFactory.getRegistry();
@@ -46,8 +46,8 @@
if (protocol.equalsIgnoreCase(targetProtocol)) {
ContractPublisher contractPublisher = publisher.getContractPublisher();
- if(contractPublisher instanceof WebserviceContractPublisher) {
- contractInfo = ((WebserviceContractPublisher)contractPublisher).getContractInfo(epr, request);
+ if(contractPublisher instanceof ServletContractPublisher) {
+ contractInfo = ((ServletContractPublisher)contractPublisher).getContractInfo(epr, request);
} else {
contractInfo = contractPublisher.getContractInfo(epr);
}
More information about the jboss-svn-commits
mailing list