[jboss-svn-commits] JBL Code SVN: r25712 - in labs/jbossesb/branches/JBESB_4_4_GA_FP/product: rosetta/src/org/jboss/soa/esb/listeners/config and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Mar 18 12:35:29 EDT 2009
Author: tfennelly
Date: 2009-03-18 12:35:29 -0400 (Wed, 18 Mar 2009)
New Revision: 25712
Added:
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-jboss-web.xml
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/etc/schemas/xml/jbossesb-1.1.0.xsd
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/build.xml
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jboss-esb.xml
labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/readme.txt
Log:
https://jira.jboss.org/jira/browse/JBESB-2472
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/etc/schemas/xml/jbossesb-1.1.0.xsd
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/etc/schemas/xml/jbossesb-1.1.0.xsd 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/etc/schemas/xml/jbossesb-1.1.0.xsd 2009-03-18 16:35:29 UTC (rev 25712)
@@ -1706,6 +1706,13 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
+ <xsd:attribute name="jbossWebXml" type="xsd:string" use="optional">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ jboss-web.xml file for additional for jboss specific settings.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/JBoss4ESBDeployer.java 2009-03-18 16:35:29 UTC (rev 25712)
@@ -493,22 +493,22 @@
{
final Service service = webserviceInfo.getService() ;
- // Copy all schemas to the wsdl directory to support imports.
- final File esbArchive = new File(di.watch.getFile());
- final Map<String, String> schemasMap = JBoss4ESBDeployer.getSchemas(esbArchive);
- final String wsdlDir = "WEB-INF/wsdl/" + service.getCategory().replace('/', '_') + "/";
- for (Entry<String, String> schemaEntry : schemasMap.entrySet())
- {
- try
- {
- addFile(zos, wsdlDir + schemaEntry.getKey(), schemaEntry.getValue()) ;
- log.debug("Added schema " + wsdlDir + schemaEntry.getKey());
- }
- catch (final ZipException e)
- {
- log.debug(e.getMessage(), e);
- }
- }
+ // Copy all schemas to the wsdl directory to support imports.
+ final File esbArchive = new File(di.watch.getFile());
+ final Map<String, String> schemasMap = JBoss4ESBDeployer.getSchemas(esbArchive);
+ final String wsdlDir = "WEB-INF/wsdl/" + service.getCategory().replace('/', '_') + "/";
+ for (Entry<String, String> schemaEntry : schemasMap.entrySet())
+ {
+ try
+ {
+ addFile(zos, wsdlDir + schemaEntry.getKey(), schemaEntry.getValue()) ;
+ log.debug("Added schema " + wsdlDir + schemaEntry.getKey());
+ }
+ catch (final ZipException e)
+ {
+ log.debug(e.getMessage(), e);
+ }
+ }
final ESBServiceEndpointInfo serviceInfo = new ESBServiceEndpointInfo(webserviceInfo) ;
final String wsdl = ESBContractGenerator.generateWSDL(webserviceInfo, serviceInfo) ;
@@ -758,18 +758,19 @@
super.stop(di);
}
- public void destroy(DeploymentInfo di)
- throws DeploymentException
+ public void destroy(DeploymentInfo di) throws DeploymentException
{
final JBoss4ESBDeploymentMetaData metaData = (JBoss4ESBDeploymentMetaData)di.context.get(JBoss4ESBDeploymentMetaData.class) ;
for(File subDeployment : getSubDeployments(di)) {
try {
if(subDeployment.exists()) {
- subDeployment.delete();
+ if(!subDeployment.delete()) {
+ log.debug("Failed to delete sub deployment '" + subDeployment.getAbsolutePath() + "'.");
+ }
}
} catch (Exception e) {
- log.warn("Failed to delete deployment file '" + subDeployment.getAbsolutePath() + "'. Exception: " + e.getMessage());
+ log.debug("Failed to delete deployment file '" + subDeployment.getAbsolutePath() + "'. Exception: " + e.getMessage());
}
}
@@ -833,7 +834,7 @@
File file = new File(deploymentDir, archiveName);
if(file.exists()) {
- throw new ConfigurationException("Cannot deploy '" + archiveName + "'. Already exists.");
+ log.debug("Deployment archive '" + archiveName + "' already exists. Overwriting!!");
}
return file;
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/config/mappers110/HttpListenerMapper.java 2009-03-18 16:35:29 UTC (rev 25712)
@@ -58,6 +58,7 @@
if(listener.getIsGateway()) {
String webXml = bus.getWebXml();
+ String jbossWebXml = bus.getJbossWebXml();
String urlPattern = listener.getUrlPattern();
listenerNode.setAttribute("gatewayClass", HttpGatewayDeploymentFactory.class.getName());
@@ -66,6 +67,9 @@
if(webXml != null) {
listenerNode.setAttribute("webXml", webXml);
}
+ if(jbossWebXml != null) {
+ listenerNode.setAttribute("jbossWebXml", jbossWebXml);
+ }
listenerNode.setAttribute("urlPattern", urlPattern);
} else {
throw new ConfigurationException("Invalid <http-listener> config [" + listener.getName() +"]. <http-listener> is currently only supported as a gateway listener.");
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/HttpGatewayDeploymentFactory.java 2009-03-18 16:35:29 UTC (rev 25712)
@@ -23,7 +23,6 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.Configurable;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.util.DeploymentArchive;
import org.jboss.soa.esb.util.ClassUtil;
@@ -34,6 +33,7 @@
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
+import org.apache.log4j.Logger;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
@@ -47,6 +47,8 @@
*/
public class HttpGatewayDeploymentFactory implements BusDeploymentFactory {
+ private static Logger logger = Logger.getLogger(HttpGatewayDeploymentFactory.class);
+
private String busName;
private List<ConfigTree> listeners;
@@ -84,7 +86,7 @@
// If the user defined an extension web.xml. We need to merge it with the generated (base)
// web.xml...
- String userWebXML = getUserWebXML();
+ String userWebXML = getFile("webXml");
if(userWebXML != null) {
try {
baseWebXML = merge(baseWebXML, userWebXML);
@@ -97,6 +99,11 @@
DeploymentArchive war = new DeploymentArchive(busName + ".war");
try {
war.addEntry("WEB-INF/web.xml", new ByteArrayInputStream(baseWebXML.getBytes("UTF-8")));
+
+ String jbossWebXml = getFile("jbossWebXml");
+ if(jbossWebXml != null) {
+ war.addEntry("WEB-INF/jboss-web.xml", new ByteArrayInputStream(jbossWebXml.getBytes("UTF-8")));
+ }
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unexpected character encoding exception.", e);
}
@@ -120,24 +127,29 @@
}
}
- private String getUserWebXML() throws ConfigurationException {
- String userWebXML = listeners.get(0).getAttribute("webXml");
+ private String getFile(String specifierAttribute) throws ConfigurationException {
+ String fileName = listeners.get(0).getAttribute(specifierAttribute);
- // The user is allowed to define an extension web.xml. This is merged with the
- // generated (base) web.xml later...
- if(userWebXML != null) {
- InputStream webXmlStream = ClassUtil.getResourceAsStream(userWebXML, HttpGatewayDeploymentFactory.class);
- if(webXmlStream != null) {
+ if(fileName != null) {
+ InputStream inputStream = ClassUtil.getResourceAsStream(fileName, HttpGatewayDeploymentFactory.class);
+ if(inputStream != null) {
try {
- userWebXML = StreamUtils.readStreamString(webXmlStream, "UTF-8");
+ return StreamUtils.readStreamString(inputStream, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unexpected exception.", e);
+ } finally {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ logger.debug("Failed to close stream to resource '" + fileName + "'.", e);
+ }
}
} else {
- throw new ConfigurationException("Failed to locate user web.xml file '" + userWebXML + "'.");
+ throw new ConfigurationException("Failed to locate '" + specifierAttribute + "' file '" + fileName + "'.");
}
}
- return userWebXML;
+
+ return null;
}
private String merge(String baseWebXML, String userWebXML) throws SAXException {
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/build.xml 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/build.xml 2009-03-18 16:35:29 UTC (rev 25712)
@@ -5,7 +5,7 @@
${line.separator}
</description>
- <property name="additional.deploys" value="sales-web.xml" />
+ <property name="additional.deploys" value="sales-web.xml,sales-jboss-web.xml" />
<!-- Import the base Ant build script... -->
<import file="../conf/base-build.xml"/>
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jboss-esb.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jboss-esb.xml 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/jboss-esb.xml 2009-03-18 16:35:29 UTC (rev 25712)
@@ -5,7 +5,7 @@
<providers>
<http-provider name="http">
<http-bus busid="ordermgt" />
- <http-bus busid="sales" webXml="/sales-web.xml"/>
+ <http-bus busid="sales" webXml="/sales-web.xml" jbossWebXml="/sales-jboss-web.xml"/>
</http-provider>
</providers>
@@ -13,7 +13,8 @@
<service category="OrderManagement" name="Incoming" description="" invmScope="GLOBAL">
<listeners>
- <!-- Receives: http://<host>:<port>/ordermgt/in/* and returns some details of the request -->
+ <!-- Receives: http://<host>:<port>/ordermgt/in/* and returns some details of the
+ request as the response (mep="RequestResponse"). -->
<http-listener name="1" busidref="ordermgt" urlPattern="/in/*" is-gateway="true" />
</listeners>
<actions mep="RequestResponse">
@@ -23,7 +24,8 @@
<service category="OrderManagement" name="Outgoing" description="" invmScope="GLOBAL">
<listeners>
- <!-- Receives: http://<host>:<port>/ordermgt/out/* and returns an empty response -->
+ <!-- Receives: http://<host>:<port>/ordermgt/out/* and returns an empty
+ response (mep="OneWay") -->
<http-listener name="2" busidref="ordermgt" urlPattern="/out/*" is-gateway="true" />
</listeners>
<actions mep="OneWay">
@@ -33,9 +35,11 @@
<service category="Sales" name="List" description="" invmScope="GLOBAL">
<listeners>
- <!-- Receives: http://<host>:<port>/sales/close/* but will be forced to
+ <!-- Receives: http://<host>:<port>/sales-portal/close/* but will be forced to
authenticate because the "sales" bus has basic auth configured
- through the "sales-web.xml" -->
+ through the "sales-web.xml". Also note that the web context
+ has been modified via the configured jboss-web.xml
+ (jbossWebXml="/sales-jboss-web.xml") -->
<http-listener name="3" busidref="sales" urlPattern="/close/*" is-gateway="true" />
</listeners>
<actions mep="RequestResponse">
Modified: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/readme.txt
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/readme.txt 2009-03-18 16:30:25 UTC (rev 25711)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/readme.txt 2009-03-18 16:35:29 UTC (rev 25712)
@@ -19,7 +19,7 @@
b) http://localhost:8080/ordermgt/out/ - Will be routed to the OrderManagement:Outgoing
service. Will return an empty response as this service is configured with a
"OneWay" mep.
- c) http://localhost:8080/sales/close/ - Will be forced to authenticate the request because
+ c) http://localhost:8080/sales-portal/close/ - Will be forced to authenticate the request because
the "sales" bus provider has configured a user web.xml (sales-web.xml), which has BASIC
Auth configured.
3. In this folder ("Window1"), type 'ant undeploy'.
Added: labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-jboss-web.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-jboss-web.xml (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_FP/product/samples/quickstarts/http_gateway/sales-jboss-web.xml 2009-03-18 16:35:29 UTC (rev 25712)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<jboss-web>
+ <context-root>/sales-portal</context-root>
+</jboss-web>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list