[jboss-svn-commits] JBL Code SVN: r12331 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/soa/esb and 25 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 5 06:38:46 EDT 2007
Author: tfennelly
Date: 2007-06-05 06:38:44 -0400 (Tue, 05 Jun 2007)
New Revision: 12331
Added:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockAction.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockListener.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/util/ClassUtilUnitTest.java
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res-csv2xml.xml
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksInstanceManager.java
labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-base-configs/
labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-base-configs/creators.xml
labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties
labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-01.xml
labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-02.xml
Removed:
labs/jbossesb/trunk/product/core/listeners/tests/src/device-profile.xml
labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst
labs/jbossesb/trunk/product/lib/ext/jbossws-core.jar
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml
labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst
labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst
labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl
Modified:
labs/jbossesb/trunk/product/core/listeners/build.xml
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
labs/jbossesb/trunk/product/core/listeners/tests/build.xml
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/ClassUtil.java
labs/jbossesb/trunk/product/docs/services/MessageTransformation.odt
labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml
labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml
labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbmq-queue-service.xml
labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
labs/jbossesb/trunk/product/tools/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java
Log:
Cleaned up how Smooks loads resources. Also added the following feature: http://jira.jboss.com/jira/browse/JBESB-603
Modified: labs/jbossesb/trunk/product/core/listeners/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/build.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/build.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -18,6 +18,7 @@
<path id="org.jboss.esb.listeners.base.classpath">
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="stax-api-1.0.1.jar,xalan.jar,xbean.jar"/>
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar"/>
+ <fileset dir="${org.jboss.esb.root.dir}/jbossws21/spi" includes="jbossws-spi.jar"/>
</path>
<path id="org.jboss.esb.listeners.default.classpath">
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -22,6 +22,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
+import java.util.Set;
import javax.management.ObjectName;
import javax.xml.soap.SOAPMessage;
@@ -33,9 +34,12 @@
import org.jboss.soa.esb.actions.ActionUtils;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
-import org.jboss.ws.server.ServiceEndpoint;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.BasicInvocationContext;
/**
* JBoss Webservices endpoint adapter.
@@ -67,20 +71,22 @@
* @throws ActionProcessingException
*/
public Message process(final Message message) throws ActionProcessingException {
- ServiceEndpoint sep = getServiceEndpoint(jbossws_endpoint);
+ Endpoint endpoint = getServiceEndpoint(jbossws_endpoint);
byte[] soapMessage;
- if(sep == null) {
+ if(endpoint == null) {
throw new ActionProcessingException("Unknown Service Endpoint '" + jbossws_endpoint + "'.");
}
soapMessage = getSOAPMessagePayload(message);
try {
messageTL.set(message);
- SOAPMessage resMessage = sep.handleRequest(null, null, new ByteArrayInputStream(soapMessage));
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ InvocationContext invocationContext = endpoint.getInvocationHandler().createInvocation().getInvocationContext();
ByteArrayOutputStream os = new ByteArrayOutputStream();
- resMessage.writeTo(os);
+ requestHandler.handleRequest(endpoint, new ByteArrayInputStream(soapMessage), os, invocationContext);
+
ActionUtils.setTaskObject(message, new String(os.toByteArray()).trim());
}
catch (Exception ex) {
@@ -122,15 +128,15 @@
* @param endpointName Service Endpoint name.
* @return The service endpoint, or null if the endpoint is not found.
*/
- protected static ServiceEndpoint getServiceEndpoint(String endpointName) {
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ protected static Endpoint getServiceEndpoint(String endpointName) {
+ EndpointRegistry registry = EndpointRegistryFactory.getEndpointRegistry();
+ Set<ObjectName> objectNames = registry.getEndpoints();
- for (ObjectName epObjectName : epManager.getServiceEndpoints()) {
- String endpoint = epObjectName.getKeyProperty("endpoint");
+ for (ObjectName objectName : objectNames) {
+ String endpoint = objectName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
if (endpoint != null && endpoint.equals(endpointName)) {
- return epManager.getServiceEndpointByID(epObjectName);
+ return registry.getEndpoint(objectName);
}
}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -35,7 +35,10 @@
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
-import org.jboss.ws.server.ServiceEndpoint;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.BasicInvocationContext;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -78,12 +81,14 @@
* @return WSDL Contract.
*/
public ContractInfo getContractInfo(EPR epr) {
- ServiceEndpoint endpoint = JBossWSAdapter.getServiceEndpoint(endpointName);
+ Endpoint endpoint = JBossWSAdapter.getServiceEndpoint(endpointName);
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ InvocationContext invocationContext = new BasicInvocationContext();
ByteArrayOutputStream wsdlStream = new ByteArrayOutputStream();
try {
// Generate the WSDL...
- endpoint.handleWSDLRequest(wsdlStream, new URL("http://x.y.z"), null);
+ requestHandler.handleWSDLRequest(endpoint, wsdlStream, invocationContext);
String wsdl = updateWsdl(new String(wsdlStream.toByteArray()), epr);
return new ContractInfo("text/xml", wsdl);
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -102,6 +102,7 @@
instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
ManagedLifecycleController controller = new ManagedLifecycleController(instances);
+ controller.setLifecycleListeners(generator.getModel().getLifecycleListeners());
// In parallel, create a map of the contract publication info...
ServicePublisher.addServicePublishers(controller, generator.getModel());
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -312,6 +312,7 @@
instances.addAll(LifecycleUtil.getGateways(mGatewayConfigFile)) ;
controller = new ManagedLifecycleController(instances) ;
+ controller.setLifecycleListeners(generator.getModel().getLifecycleListeners());
try
{
controller.start() ;
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -28,14 +28,18 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Properties;
import org.apache.log4j.Logger;
import org.apache.xmlbeans.XmlException;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
+import org.jboss.soa.esb.listeners.config.LifecycleListenerDocument.LifecycleListener;
import org.jboss.soa.esb.listeners.config.JbossesbDocument.Jbossesb;
import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.config.ServicesDocument.Services;
+import org.jboss.soa.esb.listeners.lifecycle.EsbLifecycleListener;
import org.w3c.dom.Document;
/**
@@ -197,7 +201,39 @@
this.jbossesb = xmlBeansDoc.getJbossesb();
}
- /**
+ /**
+ * Get the esb lifecycle listeners for this ESB instance.
+ * @return List of lifecycle listeners.
+ */
+ public List<EsbLifecycleListener> getLifecycleListeners() {
+ List<EsbLifecycleListener> listeners = new ArrayList<EsbLifecycleListener>();
+
+ if(jbossesb.getLifecycleListeners() != null) {
+ List<LifecycleListener> listenersConfigs = jbossesb.getLifecycleListeners().getLifecycleListenerList();
+
+ for(LifecycleListener listenerConfig : listenersConfigs) {
+ EsbLifecycleListener listener = EsbLifecycleListener.Factory.createInstance(listenerConfig.getClass1().getStringValue());
+ listener.setProperties(mapProperties(listenerConfig.getPropertyList()));
+ listeners.add(listener);
+ }
+ }
+
+ return listeners;
+ }
+
+ private Properties mapProperties(List<Property> propertyList) {
+ Properties properties = new Properties();
+
+ if(propertyList != null) {
+ for(Property property : propertyList) {
+ properties.setProperty(property.getName(), property.getValue());
+ }
+ }
+
+ return properties;
+ }
+
+ /**
* Get the list of ESB Gateway Listeners from the configuration.
* @return The list of ESB Gateway Listeners from the configuration.
*/
@@ -213,7 +249,7 @@
return getListeners(false);
}
- /**
+ /**
* Get the Service to which the supplied {@link Listener} configuration instance is bound.
* @param listener The listener instance (Gateway or ESB Aware).
* @return The Service to which the
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,71 @@
+/*
+ * 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.soa.esb.listeners.lifecycle;
+
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.jboss.soa.esb.util.ClassUtil;
+
+import java.util.Properties;
+
+/**
+ * ESB lifecycle listener definition.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface EsbLifecycleListener {
+
+ /**
+ * Set the properties of the listener.
+ * @param properties Listener properties.
+ */
+ public void setProperties(Properties properties);
+
+ /**
+ * On ESB instance startup and before listeners/gateways initialisation.
+ */
+ public void onEsbStartup();
+
+ // TODO: Add lifecycle methods around listener and gateway startup and destruction (.e. all listeners started/destroyed etc)??
+
+ /**
+ * On ESB instance startup and after listeners/gateways destruction.
+ */
+ public void onEsbShutdown();
+
+ /**
+ * Instance factory class.
+ */
+ public static class Factory {
+
+ public static EsbLifecycleListener createInstance(String className) {
+ try {
+ return (EsbLifecycleListener) ClassUtil.forName(className, Factory.class).newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'. Unable to find class on classpath.", e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'.", e);
+ } catch (InstantiationException e) {
+ throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'.", e);
+ } catch(ClassCastException e) {
+ throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'. Must be an instance of '" + EsbLifecycleListener.class.getName() + "'", e);
+ }
+ }
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -22,6 +22,7 @@
package org.jboss.soa.esb.listeners.lifecycle;
import java.util.Collection;
+import java.util.List;
import javax.jms.JMSException;
@@ -29,6 +30,7 @@
import org.jboss.soa.esb.couriers.CourierFactory;
import org.jboss.soa.esb.helpers.NamingContext;
import org.jboss.soa.esb.lifecycle.LifecycleIdentity;
+import org.apache.log4j.Logger;
/**
* Controller class to manage the lifecycles of a set of managed instances.
@@ -37,6 +39,9 @@
*/
public class ManagedLifecycleController
{
+
+ private static final Logger logger = Logger.getLogger(ManagedLifecycleController.class);
+
/**
* The managed lifecycle instances.
*/
@@ -45,8 +50,12 @@
* The lifecycle identity.
*/
private final String lifecycleIdentity ;
+ /**
+ * ESB instance lifecycle listeners.
+ */
+ private List<EsbLifecycleListener> lifecycleListeners;
- /**
+ /**
* Construct the controller to manage the specified managed lifecycle instances.
*
* @param lifecycles The managed lifecycle instances.
@@ -74,6 +83,9 @@
{
final LifecycleIdentity lifecycleIdentitySingleton = LifecycleIdentity.getSingleton() ;
final String currentIdentity = lifecycleIdentitySingleton.getThreadLifecycleIdentity() ;
+
+ onEsbStartup();
+
try
{
lifecycleIdentitySingleton.setThreadLifecycleIdentity(lifecycleIdentity) ;
@@ -86,7 +98,7 @@
}
}
- /**
+ /**
* Restart the lifecyles for the managed instances.
* <p/>
* The managed instances will be left in the destroyed state if an error occurs.
@@ -127,7 +139,7 @@
lifecycleIdentitySingleton.setThreadLifecycleIdentity(lifecycleIdentity) ;
stopInstances();
destroyInstances();
-
+
// Cleanup resources.
CourierFactory.releaseCouriers() ;
CourierFactory.destroyLifecycleIdentityMap(lifecycleIdentity) ;
@@ -144,6 +156,7 @@
finally
{
lifecycleIdentitySingleton.setThreadLifecycleIdentity(currentIdentity) ;
+ onEsbShutdown();
}
}
@@ -298,4 +311,29 @@
} // Ignore exception
}
}
+
+ public void setLifecycleListeners(List<EsbLifecycleListener> lifecycleListeners) {
+ this.lifecycleListeners = lifecycleListeners;
+ }
+
+ private void onEsbStartup() {
+ if(lifecycleListeners != null) {
+ for(EsbLifecycleListener lifecycleListener : lifecycleListeners) {
+ // Exceptions on startup are fatal...
+ lifecycleListener.onEsbStartup();
+ }
+ }
+ }
+
+ private void onEsbShutdown() {
+ if(lifecycleListeners != null) {
+ for(EsbLifecycleListener lifecycleListener : lifecycleListeners) {
+ try {
+ lifecycleListener.onEsbShutdown();
+ } catch(Throwable t) {
+ logger.error("Error on 'onEsbShutdown' for lifecycle listener '" + lifecycleListener.getClass().getName() + "'.", t);
+ }
+ }
+ }
+ }
}
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockAction.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockAction.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockAction.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,40 @@
+/*
+ * 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.soa.esb.mock;
+
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * Mock action implementation.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockAction extends AbstractActionPipelineProcessor {
+
+ public MockAction(ConfigTree config) {
+ }
+
+ public Message process(final Message message) throws ActionProcessingException {
+ return message;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockAction.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockListener.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockListener.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,55 @@
+/*
+ * 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.soa.esb.mock;
+
+import org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle;
+import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.ConfigurationException;
+
+/**
+ * Mock listener implementation.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockListener extends AbstractManagedLifecycle {
+
+ public MockListener(ConfigTree config) throws ConfigurationException {
+ super(config);
+ }
+
+ protected void doInitialise() throws ManagedLifecycleException {
+ }
+
+ protected void doStart() throws ManagedLifecycleException {
+ }
+
+ protected void doStop() throws ManagedLifecycleException {
+ // Some form of concurrency issue here. We need something like this sleep to stop the controller locking up...
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void doDestroy() throws ManagedLifecycleException {
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/mock/MockListener.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/core/listeners/tests/build.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/build.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/tests/build.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -32,6 +32,7 @@
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="jaxr-api*.jar,scout*.jar,juddi*.jar"/>
<fileset dir="${org.jboss.esb.ext.lib.dir}" includes="*.jar" excludes="jboss-messaging-client.jar,jboss-remoting.jar"/>
<fileset dir="${org.jboss.esb.ftp.lib.dir}" includes="*.jar"/>
+ <fileset dir="${org.jboss.esb.root.dir}/jbossws21/spi" includes="jbossws-spi.jar"/>
<pathelement location="${org.jboss.esb.module.classes.root.dir}/rosetta"/>
<pathelement location="${org.jboss.esb.module.classes.root.dir}/services"/>
<pathelement location="${gendir}/classes"/>
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/device-profile.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/device-profile.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/device-profile.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE device-profiles PUBLIC "-//MILYN//DTD TINAK 1.0//EN" "http://www.milyn.org/dtd/device-profile-1.0.dtd">
-
-<device-profiles>
- <device-profile name="type:Acme-Order-XML" list="profile1,profile2"/>
- <device-profile name="from:Acme" list="profile23,profile24"/>
- <device-profile name="to:AcmePartner" list="profile55,profile56"/>
-
- <device-profile name="profile1" list="A"/>
- <device-profile name="profile2" list="B"/>
- <device-profile name="profile23" list="C"/>
- <device-profile name="profile24" list="D"/>
- <device-profile name="profile55" list="E"/>
- <device-profile name="profile56" list="E"/>
-</device-profiles>
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,52 @@
+/*
+ * 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.soa.esb.listeners.lifecycle;
+
+import junit.framework.TestCase;
+import org.jboss.soa.esb.listeners.config.Configuration;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.services.registry.MockRegistry;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class EsbLifecycleListenerUnitTest extends TestCase {
+
+ protected void setUp() throws Exception {
+ MockRegistry.install();
+ }
+
+ protected void tearDown() throws Exception {
+ MockRegistry.uninstall();
+ }
+
+ public void test() throws ManagedLifecycleException {
+ String config = new String(StreamUtils.readStream(getClass().getResourceAsStream("config-01.xml")));
+ ManagedLifecycleController controller = Configuration.create(config);
+
+ controller.start();
+ assertTrue(MockEsbLifecycleListener.onEsbStartupCalled);
+ assertNotNull(MockEsbLifecycleListener.properties);
+ assertEquals("vala", MockEsbLifecycleListener.properties.getProperty("prop1"));
+ assertTrue(!MockEsbLifecycleListener.onEsbShutdownCalled);
+ controller.stop();
+ assertTrue(MockEsbLifecycleListener.onEsbShutdownCalled);
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,44 @@
+/*
+ * 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.soa.esb.listeners.lifecycle;
+
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockEsbLifecycleListener implements EsbLifecycleListener {
+
+ public static Properties properties;
+ public static boolean onEsbStartupCalled = false;
+ public static boolean onEsbShutdownCalled = false;
+
+ public void setProperties(Properties properties) {
+ MockEsbLifecycleListener.properties = properties;
+ }
+
+ public void onEsbStartup() {
+ onEsbStartupCalled = true;
+ }
+
+ public void onEsbShutdown() {
+ onEsbShutdownCalled = true;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml (rev 0)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,36 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
+
+ <lifecycle-listeners>
+ <lifecycle-listener class="org.jboss.soa.esb.listeners.lifecycle.MockEsbLifecycleListener">
+ <property name="prop1" value="vala" />
+ </lifecycle-listener>
+ </lifecycle-listeners>
+
+ <providers>
+ <provider name="provider">
+ <property name="protocol" value="jms" />
+ <bus busid="bus">
+ <property name="destination-type" value="topic" />
+ <property name="destination-name" value="queue/B" />
+ </bus>
+ </provider>
+ </providers>
+
+ <services>
+ <service category="ServiceCat" name="ServiceName" description="Test Service">
+
+ <listeners>
+ <listener name="listener" busidref="bus" is-gateway="true">
+ <property name="gatewayClass" value="org.jboss.soa.esb.mock.MockListener" />
+ </listener>
+ <listener name="listener" busidref="bus" />
+ </listeners>
+
+ <actions>
+ <action name="action" class="org.jboss.soa.esb.mock.MockAction" />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/smooks-cdr.lst 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1 +0,0 @@
-classpath:/smooks-test.cdrl
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -6,6 +6,7 @@
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.util.Util;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
/*
* JBoss, Home of Professional Open Source
@@ -69,10 +70,12 @@
public void add (String name, Object value)
{
- if ((name == null) || (value == null))
- throw new IllegalArgumentException();
-
- if (value instanceof Serializable)
+ AssertArgument.isNotNull(value, "value");
+ if (name == null) {
+ name = Body.DEFAULT_LOCATION;
+ }
+
+ if (value instanceof Serializable)
{
synchronized (_objects)
{
@@ -90,6 +93,9 @@
public Object get (String name)
{
+ if (name == null) {
+ name = Body.DEFAULT_LOCATION;
+ }
synchronized (_objects)
{
return _objects.get(name);
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/BodyImpl.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -6,6 +6,7 @@
import org.jboss.internal.soa.esb.message.format.xml.marshal.MarshalUnmarshalManager;
import org.jboss.internal.soa.esb.thirdparty.Base64;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
import org.jboss.soa.esb.MarshalException;
import org.jboss.soa.esb.UnmarshalException;
import org.jboss.soa.esb.message.Body;
@@ -65,8 +66,10 @@
public void add(String name, Object value)
{
- if ((name == null) || (value == null))
- throw new IllegalArgumentException();
+ AssertArgument.isNotNull(value, "value");
+ if (name == null) {
+ name = Body.DEFAULT_LOCATION;
+ }
synchronized (_objects)
{
@@ -81,6 +84,9 @@
public Object get(String name)
{
+ if (name == null) {
+ name = Body.DEFAULT_LOCATION;
+ }
synchronized (_objects)
{
return _objects.get(name);
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -79,9 +79,10 @@
* Add the specified Object to the body.
*
* @param name
- * the name of the object. MUST be unique within this body.
+ * The name of the object. MUST be unique within this body. If null,
+ * the object will be stored under the {@link Body#DEFAULT_LOCATION default name}.
* @param value
- * the Object to add.
+ * The Object to add.
*/
public void add(String name, Object value);
@@ -99,7 +100,8 @@
* Get the specified Object, or <code>null</code> if not present.
*
* @param name
- * the name of the Object to retrieve.
+ * the name of the Object to retrieve. If null,
+ * the object will be looked for under the {@link Body#DEFAULT_LOCATION default name}.
* @return the Object.
*/
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/ClassUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/ClassUtil.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/util/ClassUtil.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -21,7 +21,21 @@
*/
package org.jboss.soa.esb.util;
+import org.apache.log4j.Logger;
+
import java.io.InputStream;
+import java.io.IOException;
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
/**
* Utility methods to aid in class/resource loading.
@@ -30,6 +44,8 @@
*/
public class ClassUtil
{
+ private static Logger logger = Logger.getLogger(ClassUtil.class);
+
/**
* Load the specified class.
* @param className The name of the class to load.
@@ -125,4 +141,93 @@
public static String getPath(Package packageObj) {
return "/" + packageObj.getName().replace('.', '/');
}
+
+ public static List<String> getResourceList(String regex, Class caller) {
+ ClasspathResourceFilter filter = new ClasspathResourceFilter(regex);
+ ClassLoader classLoader;
+
+ classLoader = Thread.currentThread().getContextClassLoader();
+ if(classLoader instanceof URLClassLoader) {
+ filter.filter((URLClassLoader) classLoader);
+ }
+ classLoader = caller.getClassLoader();
+ if(classLoader instanceof URLClassLoader) {
+ filter.filter((URLClassLoader) classLoader);
+ }
+
+ return filter.getResourceList();
+ }
+
+ private static class ClasspathResourceFilter {
+
+ private List<String> resourceList = new ArrayList<String>();
+ private Pattern pattern;
+
+ private ClasspathResourceFilter(String regex) {
+ pattern = Pattern.compile(regex);
+ }
+
+ private void filter(URLClassLoader classLoader) {
+ URL[] cpUrls = classLoader.getURLs();
+
+ for (int i = 0; i < cpUrls.length; i++) {
+ try {
+ File file = new File(cpUrls[i].toURI());
+ if(file.isDirectory()) {
+ searchClasspathDirTree(file, "");
+ } else {
+ searchArchive(file);
+ }
+ } catch (URISyntaxException e) {
+ logger.warn("Error searching classpath resource URL '" + cpUrls[i] + "' for resource '" + pattern.pattern() + "': " + e.getMessage());
+ } catch (IOException e) {
+ logger.warn("Error searching classpath resource URL '" + cpUrls[i] + "' for resource '" + pattern.pattern() + "': " + e.getMessage());
+ }
+ }
+ }
+
+ private void searchClasspathDirTree(File rootDir, String subDir) {
+ File currentDir = new File(rootDir, subDir);
+ File[] contents = currentDir.listFiles();
+
+ for(File file: contents) {
+ if(file.isDirectory()) {
+ String subSubDir = subDir + "/" + file.getName();
+ searchClasspathDirTree(rootDir, subSubDir);
+ } else {
+ String resClasspathPath = file.toURI().toString().substring(rootDir.toURI().toString().length() - 1);
+ if(isToBeAdded(resClasspathPath)) {
+ resourceList.add(resClasspathPath);
+ }
+ }
+ }
+ }
+
+ private void searchArchive(File archiveFile) throws IOException {
+ ZipFile zip = new ZipFile(archiveFile);
+ Enumeration<? extends ZipEntry> entries = zip.entries();
+
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ String resClasspathPath = "/" + entry.getName();
+ if(isToBeAdded(resClasspathPath)) {
+ resourceList.add(resClasspathPath);
+ }
+ }
+ }
+
+ private boolean isToBeAdded(String resClasspathPath) {
+ if(resourceList.contains(resClasspathPath)) {
+ // Already in the list e.g. same resource in different archives...
+ return false;
+ }
+
+ Matcher matcher = pattern.matcher(resClasspathPath);
+ return matcher.matches();
+ }
+
+ private List<String> getResourceList() {
+ return resourceList;
+ }
+ }
}
Added: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/util/ClassUtilUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/util/ClassUtilUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/util/ClassUtilUnitTest.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,39 @@
+/*
+ * 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.soa.esb.util;
+
+import junit.framework.TestCase;
+
+import java.util.List;
+
+/**
+ * ClassUtil tests.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ClassUtilUnitTest extends TestCase {
+
+ public void test_getResourceList() {
+ List<String> resources;
+
+ resources = ClassUtil.getResourceList("/org/apache/log4j/jmx/Abstract.*", ClassUtilUnitTest.class);
+ assertEquals(1, resources.size());
+ assertTrue(resources.contains("/org/apache/log4j/jmx/AbstractDynamicMBean.class"));
+ }
+}
Property changes on: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/util/ClassUtilUnitTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/docs/services/MessageTransformation.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-06-05 10:38:44 UTC (rev 12331)
@@ -6,872 +6,896 @@
targetNamespace="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
elementFormDefault="qualified">
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- Document root + some basic types.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ Document root + some basic types.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="jbossesb">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The jbossesb configuration for a single instance.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:providers" minOccurs="0" maxOccurs="1"/>
- <xsd:element ref="jesb:services" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="parameterReloadSecs" use="optional" default="180"/>
- </xsd:complexType>
- </xsd:element>
+ <xsd:element name="jbossesb">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The jbossesb configuration for a single instance.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:lifecycle-listeners" minOccurs="0" />
+ <xsd:element ref="jesb:providers" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="jesb:services" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="parameterReloadSecs" use="optional" default="180"/>
+ </xsd:complexType>
+ </xsd:element>
- <xsd:element name="property">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A simple name-value pair.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="xsd:anyType">
- <xsd:attribute name="name" use="required" type="xsd:string"/>
- <xsd:attribute name="value" type="xsd:string"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ <xsd:element name="property">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A simple name-value pair.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="xsd:anyType">
+ <xsd:attribute name="name" use="required" type="xsd:string"/>
+ <xsd:attribute name="value" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- Provider and Bus base types.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="lifecycle-listeners">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">ESB instance lifecycle listeners.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:lifecycle-listener" minOccurs="1" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
- <xsd:element name="providers">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A container for the providers referenced in the jbossesb config file
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:provider" maxOccurs="unbounded" minOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:complexType name="provider">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A provider of a bus. So for instance you can have a jms-provider (JBossMQ)
- or an ftp-provider.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element ref="jesb:bus" maxOccurs="unbounded" minOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string"/>
- </xsd:complexType>
- <xsd:element name="provider" type="jesb:provider"/>
+ <xsd:element name="lifecycle-listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">ESB instance lifecycle listener.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
- <xsd:complexType name="bus">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A bus (also called "channel" by others) is a means by which Services
- communicate with each other (JMS, FTP, HTTP, etc).
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="busid" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">An id such that this bus can be referenced by Service listn.
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ Provider and Bus base types.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+
+ <xsd:element name="providers">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A container for the providers referenced in the jbossesb config file
</xsd:documentation>
- <xsd:appinfo>
- </xsd:appinfo>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- <xsd:element name="bus" type="jesb:bus"/>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:provider" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="provider">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A provider of a bus. So for instance you can have a jms-provider (JBossMQ)
+ or an ftp-provider.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="jesb:bus" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:element name="provider" type="jesb:provider"/>
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- Service and Action types.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
-
- <xsd:element name="services">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A container for services.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:service" minOccurs="1" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="service">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A service has listener or gateways and a list of actions.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:listeners" minOccurs="1" maxOccurs="1"/>
- <xsd:element ref="jesb:actions" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="category" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The service category which will be used to store a reference to
- this service in the registry.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="name" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The service name which will be used to store a reference to this
- service in the registry.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="description" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The service description which stored with this service in the
- registry, so that the purpose of this service can be understood by a human.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="actions">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A container for actions belonging to this service.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:action" minOccurs="1" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="action">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">An action which will act on the message when it is received by the service.
- Actions can be chained. Hence you can specify a list of actions. Action are 'pluggable' and can be
- custom code, however
- JBossESB comes with a list of predefined actions.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
+ <xsd:complexType name="bus">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A bus (also called "channel" by others) is a means by which Services
+ communicate with each other (JMS, FTP, HTTP, etc).
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
<xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string">
+ </xsd:sequence>
+ <xsd:attribute name="busid" use="required" type="xsd:string">
<xsd:annotation>
- <xsd:documentation xml:lang="en">The logical name of the action.</xsd:documentation>
+ <xsd:documentation xml:lang="en">An id such that this bus can be referenced by Service listn.
+ </xsd:documentation>
+ <xsd:appinfo>
+ </xsd:appinfo>
</xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="class" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The full classname of the java class in which this action is
- defined.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="process" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The name of the method on the action that needs to be called when
- the message is received.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
+ </xsd:attribute>
+ </xsd:complexType>
+ <xsd:element name="bus" type="jesb:bus"/>
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- Listener base types.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ Service and Action types.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="listeners">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A container for all listener for a service.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:listener" maxOccurs="unbounded" minOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:complexType name="listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A listener is a listener or a gateway. The listener defines to which bus
- the service is listening. The service can simultaneniously listen to multiple buses.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The logical name of the listener.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="busidref" use="optional" type="xsd:string" default="$not-defined$">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A reference to an existing bus, as defined in the 'buses' section of
- this jbossesb config.
+ <xsd:element name="services">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A container for services.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:service" minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="service">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A service has listener or gateways and a list of actions.
</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="maxThreads" use="optional" type="xsd:int" default="1">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The number of threads which will be started for this listener.
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:listeners" minOccurs="1" maxOccurs="1"/>
+ <xsd:element ref="jesb:actions" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="category" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The service category which will be used to store a reference to
+ this service in the registry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="name" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The service name which will be used to store a reference to this
+ service in the registry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="description" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The service description which stored with this service in the
+ registry, so that the purpose of this service can be understood by a human.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="actions">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A container for actions belonging to this service.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:action" minOccurs="1" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="action">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">An action which will act on the message when it is received by the service.
+ Actions can be chained. Hence you can specify a list of actions. Action are 'pluggable' and can be
+ custom code, however
+ JBossESB comes with a list of predefined actions.
</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="is-gateway" use="optional" type="xsd:boolean" default="false">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">true if the listener is a gateway. A gateway is an ESB-Unware listener,
- while a
- listener is ESB-aware and as such expects jbossesb formatted messages.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- <xsd:element name="listener" type="jesb:listener"/>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The logical name of the action.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="class" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The full classname of the java class in which this action is
+ defined.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="process" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The name of the method on the action that needs to be called when
+ the message is received.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
- <!-- JCA Types -->
- <xsd:element name="activation-config">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">Activation configuration for jca bus or listener.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:property" maxOccurs="unbounded" minOccurs="1"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="jca-gateway" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific gateway using JCA inflow.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener">
- <xsd:sequence>
- <xsd:element ref="jesb:activation-config" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
- <xsd:attribute name="adapter" use="required" type="xsd:string"/>
- <xsd:attribute name="endpointClass" use="required" type="xsd:string"/>
- <xsd:attribute name="messagingType" use="optional" type="xsd:string"/>
- <xsd:attribute name="jcaBridge" use="optional" type="xsd:string"/>
- <xsd:attribute name="transacted" use="optional" type="xsd:string"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ Listener base types.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- JMS Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
-
- <xsd:element name="jms-message-filter">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A JMS filter can add information to a Queue, or Topic. For example you
- can defined a message-selector. However, you can also push the queue name and type into this
- filter given you did not already specify them in the jms-bus.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:attribute name="dest-name" use="required" type="xsd:string">
+ <xsd:element name="listeners">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A container for all listener for a service.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:listener" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:complexType name="listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A listener is a listener or a gateway. The listener defines to which bus
+ the service is listening. The service can simultaneniously listen to multiple buses.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string">
<xsd:annotation>
- <xsd:documentation xml:lang="en">Name of the Queue of Topic.</xsd:documentation>
+ <xsd:documentation xml:lang="en">The logical name of the listener.</xsd:documentation>
</xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="dest-type" use="required">
+ </xsd:attribute>
+ <xsd:attribute name="busidref" use="optional" type="xsd:string" default="$not-defined$">
<xsd:annotation>
- <xsd:documentation xml:lang="en">A Queue delivers a message once, a topic broadcasts a message to
- all registered listeners.
- </xsd:documentation>
+ <xsd:documentation xml:lang="en">A reference to an existing bus, as defined in the 'buses' section of
+ this jbossesb config.
+ </xsd:documentation>
</xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="QUEUE"/>
- <xsd:enumeration value="TOPIC"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="selector" type="xsd:string">
+ </xsd:attribute>
+ <xsd:attribute name="maxThreads" use="optional" type="xsd:int" default="1">
<xsd:annotation>
- <xsd:documentation xml:lang="en">A message-selector allows multiple listeners to register with the
- same queue/topic, but
- they will filter on this message-selector.
- </xsd:documentation>
+ <xsd:documentation xml:lang="en">The number of threads which will be started for this listener.
+ </xsd:documentation>
</xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="jms-bus" substitutionGroup="jesb:bus">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A JMS-Bus is a specific instance of a bus using the JMS protocol.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:bus">
- <xsd:sequence>
- <xsd:element ref="jesb:jms-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="jms-provider" substitutionGroup="jesb:provider">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific instance of a provider, providing JMS.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:provider">
- <xsd:attribute name="connection-factory" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The connection-factory used to lookup queues/topics in a
- naming directory (JNDI)
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="jndi-context-factory" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The context factory class the JBossESB will use to do
- naming lookups.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="jndi-pkg-prefix" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The pkg-prefix which will be used to do naming lookups. It
- is left empty by default.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="jndi-URL" type="xsd:anyURI">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The URL used to do naming lookups.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="jms-listener" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific listener using the jms protocol.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener">
- <xsd:sequence>
- <xsd:element ref="jesb:jms-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
-
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- FS Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="fs-message-filter">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A FS filter.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:attribute name="directory" use="required" type="xsd:string">
+ </xsd:attribute>
+ <xsd:attribute name="is-gateway" use="optional" type="xsd:boolean" default="false">
<xsd:annotation>
- <xsd:documentation xml:lang="en">The file share that is monitored for incoming new files.
- </xsd:documentation>
+ <xsd:documentation xml:lang="en">true if the listener is a gateway. A gateway is an ESB-Unware listener,
+ while a
+ listener is ESB-aware and as such expects jbossesb formatted messages.
+ </xsd:documentation>
</xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="input-suffix" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix used to filter files targeted for comsumption by
- the ESB (note: add the dot, so something like '.esbIn').
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="work-suffix" use="optional" type="xsd:string" default=".esbInProcess">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix used while the file is being process, so that
- another thread or process won't pick it up too.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, the file will be deleted after it is processed. Note that
- in that case post-directory and post-suffix have no effect.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-directory" use="optional" type="xsd:string" default="processed">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file share to which the file will be moved after it is
- processed by the ESB
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-suffix" use="optional" type="xsd:string" default=".esbDone">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after it is
- processed.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, the file will be deleted if an error occurs during
- processing. Note that in that case error-directory and error-suffix have no effect.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-directory" use="optional" type="xsd:string" default="processed">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file share to which the file will be moved after when an error
- occurs during processing.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-suffix" use="optional" type="xsd:string" default=".esbERROR">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after an error
- occurs during processing.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="fs-bus" substitutionGroup="jesb:bus">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A Fs-Bus is a specific instance of a bus using the File protocol.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:bus">
- <xsd:sequence>
- <xsd:element ref="jesb:fs-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="fs-provider" substitutionGroup="jesb:provider">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific instance of a provider, providing a file system (local fileshare
- or NAS).
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:provider"/>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="fs-listener" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific listener using the file protocol.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener">
- <xsd:sequence>
- <xsd:element ref="jesb:fs-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The frequency with which this listener polls fs in seconds.
- Defaults to 10 seconds.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:integer">
- <xsd:minExclusive value="0"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ </xsd:attribute>
+ </xsd:complexType>
+ <xsd:element name="listener" type="jesb:listener"/>
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- FTP Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="ftp-message-filter">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A FTP filter.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:attribute name="directory" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The ftp directory that is monitored for incoming new files.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="username" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The username used to access the ftp server</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="password" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The password used to access the ftp server.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="input-suffix" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix used to filter files targeted for comsumption by
- the ESB (note: add the dot, so something like '.esbIn').
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="work-suffix" use="optional" type="xsd:string" default=".esbInProcess">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix used while the file is being process, so that
- another thread or process won't pick it up too.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, the file will be deleted after it is processed. Note that
- in that case post-directory and post-suffix have no effect.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-directory" use="optional" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after it is
- processed by the ESB
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-suffix" use="optional" type="xsd:string" default=".esbDone">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after it is
- processed.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, the file will be deleted if an error occurs during
- processing. Note that in that case error-directory and error-suffix have no effect.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-directory" use="optional" type="xsd:string" default="processed">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after when an
- error occurs during processing.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-suffix" use="optional" type="xsd:string" default=".esbERROR">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after an error
- occurs during processing.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="passive" use="optional" type="xsd:boolean">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">This is an ftp server setting which may vary per session.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="protocol" use="optional" default="ftp">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The protocol, can be sftp (SSH File Transfer Protocol), ftps (FTP
- over SLL) and ftp (to which it defaults).
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="ftp"/>
- <xsd:enumeration value="ftps"/>
- <xsd:enumeration value="sftp"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="certificate-url" use="optional" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The url to a certificate, which can be needed for secure protocols
- (sftp and ftps).
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ftp-bus" substitutionGroup="jesb:bus">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A FTP-Bus is a specific instance of a bus using the FTP protocol.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:bus">
- <xsd:sequence>
- <xsd:element ref="jesb:ftp-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ftp-provider" substitutionGroup="jesb:provider">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific instance of a provider, providing a ftp service.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:provider">
- <xsd:attribute name="hostname" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The ftp hostname, as it can be resolved by DNS.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ftp-listener" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific listener using the ftp protocol.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener">
- <xsd:sequence>
- <xsd:element ref="jesb:ftp-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The frequency with which this listener polls ftp server in
- seconds. Defaults to 10 seconds.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:integer">
- <xsd:minExclusive value="0"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ <!-- JCA Types -->
+ <xsd:element name="activation-config">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">Activation configuration for jca bus or listener.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="jesb:property" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jca-gateway" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific gateway using JCA inflow.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:sequence>
+ <xsd:element ref="jesb:activation-config" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="adapter" use="required" type="xsd:string"/>
+ <xsd:attribute name="endpointClass" use="required" type="xsd:string"/>
+ <xsd:attribute name="messagingType" use="optional" type="xsd:string"/>
+ <xsd:attribute name="jcaBridge" use="optional" type="xsd:string"/>
+ <xsd:attribute name="transacted" use="optional" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- SQL Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="sql-message-filter">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A SQL filter.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:attribute name="tablename" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The table in which esb message are stored.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="message-id-column" use="optional" type="xsd:string" default="message_id">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A unique key (PK) in the table.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="message-column" use="optional" type="xsd:string" default="message">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The field that holds the serialized message.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="status-column" use="optional" type="xsd:string" default="status">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">This column contents ('P', 'W', 'E' or 'D') indicates if the row is
- pending (P), in process (W), in error(E) or done (D) if postDelete and/or errorDelete are 'true'
- rows might be deleted
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="insert-timestamp-column" use="optional" type="xsd:string" default="insert_timestamp">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">Holds the timestamp when the record was inserted.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, records will be deleted after processing.((e.g. no rows
- with a 'D' for done, in column defined in 'status_column')
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">If true, records in error will be deleted after attempted picked up
- for processing.(e.g. no rows with a 'E' for error, in column defined in 'status_column')
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="sql-bus" substitutionGroup="jesb:bus">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A SQL-Bus is a specific instance of a bus using the SQL protocol.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:bus">
- <xsd:sequence>
- <xsd:element ref="jesb:sql-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="sql-provider" substitutionGroup="jesb:provider">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific instance of a provider, providing a db service.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:provider">
- <xsd:attribute name="url" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The url needed to connect to the db.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="driver" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The driver needed to connect to the db.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="username" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The username used to access the database.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- <xsd:attribute name="password" use="optional" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The password used to access the database.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="sql-listener" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">A specific listener using the ftp protocol.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener">
- <xsd:sequence>
- <xsd:element ref="jesb:sql-message-filter" maxOccurs="1" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The frequency with which this listener polls the db in
- seconds. Defaults to 10 seconds.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:integer">
- <xsd:minExclusive value="0"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ JMS Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- JBoss Remoting Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="jbr-bus" substitutionGroup="jesb:bus">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">JBoss Remoting Bus</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:bus">
- <xsd:attribute name="port" use="required" type="xsd:int">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">JBoss Remoting Server listen port.</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="jbr-provider" substitutionGroup="jesb:provider">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">JBoss Remoting Provider.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:provider">
- <xsd:attribute name="protocol" use="required">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">Jboss Remoting Listener/Server protocol.
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="http"/>
- <xsd:enumeration value="socket"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="host" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">JBoss Remoting Server bind address. When not specified,
- defaults to InetAddress.getLocalHost().getHostName().
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="jbr-listener" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">JBoss Remoting Listener.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener"/>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ <xsd:element name="jms-message-filter">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A JMS filter can add information to a Queue, or Topic. For example you
+ can defined a message-selector. However, you can also push the queue name and type into this
+ filter given you did not already specify them in the jms-bus.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:attribute name="dest-name" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">Name of the Queue of Topic.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="dest-type" use="required">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A Queue delivers a message once, a topic broadcasts a message to
+ all registered listeners.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="QUEUE"/>
+ <xsd:enumeration value="TOPIC"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="selector" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A message-selector allows multiple listeners to register with the
+ same queue/topic, but
+ they will filter on this message-selector.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jms-bus" substitutionGroup="jesb:bus">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A JMS-Bus is a specific instance of a bus using the JMS protocol.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:bus">
+ <xsd:sequence>
+ <xsd:element ref="jesb:jms-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jms-provider" substitutionGroup="jesb:provider">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific instance of a provider, providing JMS.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:provider">
+ <xsd:attribute name="connection-factory" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The connection-factory used to lookup queues/topics in a
+ naming directory (JNDI)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="jndi-context-factory" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The context factory class the JBossESB will use to do
+ naming lookups.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="jndi-pkg-prefix" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The pkg-prefix which will be used to do naming lookups. It
+ is left empty by default.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="jndi-URL" type="xsd:anyURI">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The URL used to do naming lookups.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jms-listener" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific listener using the jms protocol.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:sequence>
+ <xsd:element ref="jesb:jms-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
- <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
- Groovy Gateway Type Implementations.
- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
- <xsd:element name="groovy-listener" substitutionGroup="jesb:listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">Groovy Listener.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="jesb:listener">
- <xsd:attribute name="script" use="required" type="xsd:string">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">The path (classpath) to the Groovy Gateway script. Or, the
- alias for the pre-packaged Groovy Gateway script.
- </xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ FS Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="fs-message-filter">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A FS filter.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:attribute name="directory" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file share that is monitored for incoming new files.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="input-suffix" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix used to filter files targeted for comsumption by
+ the ESB (note: add the dot, so something like '.esbIn').
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="work-suffix" use="optional" type="xsd:string" default=".esbInProcess">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix used while the file is being process, so that
+ another thread or process won't pick it up too.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the file will be deleted after it is processed. Note that
+ in that case post-directory and post-suffix have no effect.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-directory" use="optional" type="xsd:string" default="processed">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file share to which the file will be moved after it is
+ processed by the ESB
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-suffix" use="optional" type="xsd:string" default=".esbDone">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after it is
+ processed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the file will be deleted if an error occurs during
+ processing. Note that in that case error-directory and error-suffix have no effect.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-directory" use="optional" type="xsd:string" default="processed">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file share to which the file will be moved after when an error
+ occurs during processing.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-suffix" use="optional" type="xsd:string" default=".esbERROR">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after an error
+ occurs during processing.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="fs-bus" substitutionGroup="jesb:bus">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A Fs-Bus is a specific instance of a bus using the File protocol.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:bus">
+ <xsd:sequence>
+ <xsd:element ref="jesb:fs-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="fs-provider" substitutionGroup="jesb:provider">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific instance of a provider, providing a file system (local fileshare
+ or NAS).
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:provider"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="fs-listener" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific listener using the file protocol.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:sequence>
+ <xsd:element ref="jesb:fs-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The frequency with which this listener polls fs in seconds.
+ Defaults to 10 seconds.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:integer">
+ <xsd:minExclusive value="0"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ FTP Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="ftp-message-filter">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A FTP filter.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:attribute name="directory" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp directory that is monitored for incoming new files.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="username" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The username used to access the ftp server</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="password" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The password used to access the ftp server.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="input-suffix" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix used to filter files targeted for comsumption by
+ the ESB (note: add the dot, so something like '.esbIn').
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="work-suffix" use="optional" type="xsd:string" default=".esbInProcess">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix used while the file is being process, so that
+ another thread or process won't pick it up too.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the file will be deleted after it is processed. Note that
+ in that case post-directory and post-suffix have no effect.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-directory" use="optional" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after it is
+ processed by the ESB
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-suffix" use="optional" type="xsd:string" default=".esbDone">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after it is
+ processed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, the file will be deleted if an error occurs during
+ processing. Note that in that case error-directory and error-suffix have no effect.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-directory" use="optional" type="xsd:string" default="processed">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp directory to which the file will be moved after when an
+ error occurs during processing.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-suffix" use="optional" type="xsd:string" default=".esbERROR">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The file suffix which will be added to the file name after an error
+ occurs during processing.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="passive" use="optional" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">This is an ftp server setting which may vary per session.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="protocol" use="optional" default="ftp">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The protocol, can be sftp (SSH File Transfer Protocol), ftps (FTP
+ over SLL) and ftp (to which it defaults).
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="ftp"/>
+ <xsd:enumeration value="ftps"/>
+ <xsd:enumeration value="sftp"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="certificate-url" use="optional" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The url to a certificate, which can be needed for secure protocols
+ (sftp and ftps).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ftp-bus" substitutionGroup="jesb:bus">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A FTP-Bus is a specific instance of a bus using the FTP protocol.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:bus">
+ <xsd:sequence>
+ <xsd:element ref="jesb:ftp-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ftp-provider" substitutionGroup="jesb:provider">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific instance of a provider, providing a ftp service.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:provider">
+ <xsd:attribute name="hostname" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The ftp hostname, as it can be resolved by DNS.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="ftp-listener" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific listener using the ftp protocol.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:sequence>
+ <xsd:element ref="jesb:ftp-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The frequency with which this listener polls ftp server in
+ seconds. Defaults to 10 seconds.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:integer">
+ <xsd:minExclusive value="0"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ SQL Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="sql-message-filter">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A SQL filter.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:attribute name="tablename" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The table in which esb message are stored.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="message-id-column" use="optional" type="xsd:string" default="message_id">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A unique key (PK) in the table.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="message-column" use="optional" type="xsd:string" default="message">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The field that holds the serialized message.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="status-column" use="optional" type="xsd:string" default="status">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">This column contents ('P', 'W', 'E' or 'D') indicates if the row is
+ pending (P), in process (W), in error(E) or done (D) if postDelete and/or errorDelete are 'true'
+ rows might be deleted
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="insert-timestamp-column" use="optional" type="xsd:string" default="insert_timestamp">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">Holds the timestamp when the record was inserted.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="post-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, records will be deleted after processing.((e.g. no rows
+ with a 'D' for done, in column defined in 'status_column')
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="error-delete" use="optional" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">If true, records in error will be deleted after attempted picked up
+ for processing.(e.g. no rows with a 'E' for error, in column defined in 'status_column')
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="sql-bus" substitutionGroup="jesb:bus">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A SQL-Bus is a specific instance of a bus using the SQL protocol.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:bus">
+ <xsd:sequence>
+ <xsd:element ref="jesb:sql-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="sql-provider" substitutionGroup="jesb:provider">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific instance of a provider, providing a db service.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:provider">
+ <xsd:attribute name="url" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The url needed to connect to the db.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="driver" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The driver needed to connect to the db.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="username" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The username used to access the database.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="password" use="optional" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The password used to access the database.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="sql-listener" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">A specific listener using the ftp protocol.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:sequence>
+ <xsd:element ref="jesb:sql-message-filter" maxOccurs="1" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="poll-frequency-seconds" use="optional" default="10">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The frequency with which this listener polls the db in
+ seconds. Defaults to 10 seconds.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:integer">
+ <xsd:minExclusive value="0"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ JBoss Remoting Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="jbr-bus" substitutionGroup="jesb:bus">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">JBoss Remoting Bus</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:bus">
+ <xsd:attribute name="port" use="required" type="xsd:int">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">JBoss Remoting Server listen port.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jbr-provider" substitutionGroup="jesb:provider">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">JBoss Remoting Provider.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:provider">
+ <xsd:attribute name="protocol" use="required">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">Jboss Remoting Listener/Server protocol.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NMTOKEN">
+ <xsd:enumeration value="http"/>
+ <xsd:enumeration value="socket"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="host" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">JBoss Remoting Server bind address. When not specified,
+ defaults to InetAddress.getLocalHost().getHostName().
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="jbr-listener" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">JBoss Remoting Listener.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
+ Groovy Gateway Type Implementations.
+ 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
+ <xsd:element name="groovy-listener" substitutionGroup="jesb:listener">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">Groovy Listener.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="jesb:listener">
+ <xsd:attribute name="script" use="required" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">The path (classpath) to the Groovy Gateway script. Or, the
+ alias for the pre-packaged Groovy Gateway script.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+
</xsd:schema>
Deleted: labs/jbossesb/trunk/product/lib/ext/jbossws-core.jar
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -198,7 +198,7 @@
<fileset dir="${build.dir}" includes="deployment.xml"/>
<fileset dir="${build.dir}" includes="META-INF/**" />
<fileset dir="${basedir}/src" excludes="**/*.java" /> <!-- Please leave the src dir in here! -->
- <fileset dir="${basedir}" includes="jbm-queue-service.xml"/>
+ <fileset dir="${basedir}" includes="jbmq-queue-service.xml"/>
<fileset dir="${basedir}" includes="${additional.deploys}" excludes="build/**" />
<fileset dir="${basedir}/lib" includes="*.jar"/>
</jar>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/build.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -5,7 +5,7 @@
${line.separator}
</description>
- <property name="additional.deploys" value="smooks-cdr.lst,smooks-res.xml" />
+ <property name="additional.deploys" value="smooks-res-*.xml" />
<!-- Import the base Ant build script... -->
<import file="../conf/base-build.xml"/>
Added: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbmq-queue-service.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jms.destination:service=Queue,name=quickstart_transform_CSV2XML_gw">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jms.destination:service=Queue,name=quickstart_transform_CSV2XML_esb">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jbmq-queue-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/jboss-esb.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -34,9 +34,8 @@
</action>
<action name="transform-from-csv" class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
- <property name="from" value="order-list" />
+ <property name="resource-config" value="/smooks-res-csv2xml.xml" />
<property name="from-type" value="text/csv:order-list" />
- <property name="to" value="smooks-order-xml" />
<property name="to-type" value="text/xml:smooks-order-xml" />
</action>
@@ -45,9 +44,8 @@
</action>
<action name="transform-smooksXml-to-canonicalXml" class="org.jboss.soa.esb.actions.converters.SmooksTransformer">
- <property name="from" value="smooks-order-list" />
+ <property name="resource-config" value="/smooks-res-csv2xml.xml" />
<property name="from-type" value="text/xml:smooks-order-xml" />
- <property name="to" value="canonical-order-xml" />
<property name="to-type" value="text/xml:canonical-order-xml" />
</action>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-cdr.lst 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,16 +0,0 @@
-########################################################################################################
-# Uncomment out to load config from local XML file
-########################################################################################################
-/smooks-res.xml
-/org/milyn/templating/templating-cdu-creators-0.1.cdrl
-
-########################################################################################################
-# Uncomment out to load config from the
-# ESB Administration Console.
-#
-# You must "import" smooks-res.xml into the console in order to view and manipulate the
-# transformations in this sample. You will also need to register the "Message Exchange Participants"
-# "A" and "B" as well as their supported message contracts "text/xml:messageAtA" and
-# "text/xml:messageAtB" respectively.
-########################################################################################################
-#http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
Copied: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res-csv2xml.xml (from rev 12265, labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res-csv2xml.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res-csv2xml.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,56 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <resource-config target-profile="from-type:text/csv:order-list AND to-type:text/xml:smooks-order-xml" selector="org.xml.sax.driver">
+ <resource>org.milyn.csv.CSVParser</resource>
+ <param name="fields" type="string-list">
+ orderId,
+ orderDate,
+ statusCode,
+ netAmount,
+ totalAmount,
+ tax,
+ userName,
+ firstName,
+ lastName,
+ state,
+ orderLine1Position,
+ orderLine1Quantity,
+ orderLine1ProductId,
+ orderLine1ProductTitle,
+ orderLine1ProductPrice,
+ orderLine2Position,
+ orderLine2Quantity,
+ orderLine2ProductId,
+ orderLine2ProductTitle,
+ orderLine2ProductPrice
+ </param>
+ </resource-config>
+
+ <resource-config target-profile="from-type:text/xml:smooks-order-xml AND to-type:text/xml:canonical-order-xml" selector="csv-set">
+ <resource type="xsl">
+ <![CDATA[
+ <xsl:for-each select="csv-record">
+ <Order orderId="{orderId}"
+ orderDate="{orderDate}"
+ statusCode="{statusCode}"
+ netAmount="{netAmount}"
+ totalAmount="{totalAmount}"
+ tax="{tax}" >
+ <Customer userName="{userName}" firstName="{firstName}" lastName="{lastName}" state="{state}" />
+ <OrderLines>
+ <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
+ <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
+ </OrderLine>
+ <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
+ <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
+ </OrderLine>
+ </OrderLines>
+ </Order>
+ </xsl:for-each>
+ ]]>
+ </resource>
+ <param name="is-xslt-templatelet">true</param>
+ </resource-config>
+
+</smooks-resource-list>
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/samples/quickstarts/transform_CSV2XML/smooks-res.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,56 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
- <resource-config target-profile="from-type:text/csv:order-list AND to-type:text/xml:smooks-order-xml" selector="org.xml.sax.driver">
- <resource>org.milyn.csv.CSVParser</resource>
- <param name="fields" type="string-list">
- orderId,
- orderDate,
- statusCode,
- netAmount,
- totalAmount,
- tax,
- userName,
- firstName,
- lastName,
- state,
- orderLine1Position,
- orderLine1Quantity,
- orderLine1ProductId,
- orderLine1ProductTitle,
- orderLine1ProductPrice,
- orderLine2Position,
- orderLine2Quantity,
- orderLine2ProductId,
- orderLine2ProductTitle,
- orderLine2ProductPrice
- </param>
- </resource-config>
-
- <resource-config target-profile="from-type:text/xml:smooks-order-xml AND to-type:text/xml:canonical-order-xml" selector="csv-set">
- <resource type="xsl">
- <![CDATA[
- <xsl:for-each select="csv-record">
- <Order orderId="{orderId}"
- orderDate="{orderDate}"
- statusCode="{statusCode}"
- netAmount="{netAmount}"
- totalAmount="{totalAmount}"
- tax="{tax}" >
- <Customer userName="{userName}" firstName="{firstName}" lastName="{lastName}" state="{state}" />
- <OrderLines>
- <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
- <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
- </OrderLine>
- <OrderLine posistion="{orderLine1Position}" quantity="{orderLine1Quantity}">
- <Product productId="{orderLine1ProductId}" title="{orderLine1Title}" price="{orderLine1Price}"/>
- </OrderLine>
- </OrderLines>
- </Order>
- </xsl:for-each>
- ]]>
- </resource>
- <param name="is-xslt-templatelet">true</param>
- </resource-config>
-
-</smooks-resource-list>
Added: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.converters;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.util.ClassUtil;
+
+import java.util.Properties;
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * Smooks-dot-esb configuration properties.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+class SmooksConfiguration extends Properties {
+
+ private static final Logger logger = Logger.getLogger(SmooksConfiguration.class);
+ public static final String SMOOKS_ESB_PROPERTIES = "/smooks.esb.properties";
+
+ SmooksConfiguration() {
+ InputStream configStream = ClassUtil.getResourceAsStream(SMOOKS_ESB_PROPERTIES, SmooksConfiguration.class);
+
+ if(configStream == null) {
+ logger.warn("Smooks.esb configuration file '" + SMOOKS_ESB_PROPERTIES + "' not found on classpath.");
+ } else {
+ try {
+ load(configStream);
+ } catch (IOException e) {
+ logger.warn("Error loading Smooks.esb configuration file '" + SMOOKS_ESB_PROPERTIES + "'.", e);
+ } finally {
+ try {
+ configStream.close();
+ } catch (IOException e) {
+ logger.warn("Error closing stream for Smooks.esb configuration file '" + SMOOKS_ESB_PROPERTIES + "'.", e);
+ }
+ }
+ }
+ }
+}
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,66 @@
+/*
+ * 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.soa.esb.actions.converters;
+
+import org.jboss.soa.esb.listeners.lifecycle.EsbLifecycleListener;
+import org.apache.log4j.Logger;
+
+import java.util.Properties;
+
+/**
+ * Smooks ESBLifecycleListener.
+ * <p/>
+ * Manages lifecycle around the centralised Console configuration and its associated
+ * shared Smooks instance (available through {@link #getGlobalSmooksInstanceManager()}).
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SmooksESBLifecycleListener implements EsbLifecycleListener {
+
+ private static Logger logger = Logger.getLogger(SmooksESBLifecycleListener.class);
+ private static SmooksInstanceManager globalSmooksInstanceManager;
+ private static final String CONSOLE_URL = "console.url";
+
+ public void setProperties(Properties properties) {
+ }
+
+ public void onEsbStartup() {
+ Properties smooksEsbConfig = new SmooksConfiguration();
+ String resourceConfig = smooksEsbConfig.getProperty(CONSOLE_URL);
+
+ if(resourceConfig != null) {
+ globalSmooksInstanceManager = new SmooksInstanceManager("Console", resourceConfig);
+ logger.info("Centralized Smooks Instance (Console Based) started.");
+ } else {
+ logger.info("Centralized Smooks Instance (Console Based) instance not started. See the '" + CONSOLE_URL + "' property in '" + SmooksConfiguration.SMOOKS_ESB_PROPERTIES + "'");
+ }
+ }
+
+ public void onEsbShutdown() {
+ if(globalSmooksInstanceManager != null) {
+ globalSmooksInstanceManager.close();
+ logger.info("Centralized Smooks Instance (Console Based) stopped.");
+ }
+ }
+
+ public static SmooksInstanceManager getGlobalSmooksInstanceManager() {
+ return globalSmooksInstanceManager;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksInstanceManager.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksInstanceManager.java (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksInstanceManager.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,356 @@
+/*
+ * 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.soa.esb.actions.converters;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.helpers.NamingContext;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.apache.log4j.Logger;
+import org.milyn.Smooks;
+import org.milyn.SmooksException;
+import org.milyn.resource.URIResourceLocator;
+import org.xml.sax.SAXException;
+
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.InitialContext;
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * Smooks instance manager.
+ * <p/>
+ * Manages configuration updates.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+class SmooksInstanceManager {
+
+ private static Logger logger = Logger.getLogger(SmooksInstanceManager.class);
+ private static String UPDATE_TOPIC_NAME = "update.notification.topic";
+ private SmooksConfiguration config = new SmooksConfiguration();
+ private String configurationSourceName;
+ private String configurationSourceURI;
+ private Smooks smooksInstance;
+ private ConfigurationUpdateListener configUpdateListener;
+
+ protected SmooksInstanceManager(String configurationSourceName, String configurationSourceURI) throws SmooksException {
+ AssertArgument.isNotNullAndNotEmpty(configurationSourceURI, "configurationSourceURI");
+ if(configurationSourceName != null) {
+ this.configurationSourceName = configurationSourceName;
+ } else {
+ // Just set the name to be the URI...
+ logger.warn("No 'configurationSourceName' specified for Smooks Configuration '" + configurationSourceURI + "'. Defaulting name to '" + configurationSourceURI + "'.");
+ this.configurationSourceName = configurationSourceURI;
+ }
+ this.configurationSourceURI = configurationSourceURI;
+
+ smooksInstance = createSmooksInstance();
+ configUpdateListener = new ConfigurationUpdateListener();
+ }
+
+ protected Smooks getSmooksInstance() {
+ return smooksInstance;
+ }
+
+ protected void close() {
+ configUpdateListener.close();
+ }
+
+ private Smooks createSmooksInstance() throws SmooksException{
+ InputStream configListStream;
+
+ try {
+ configListStream = (new URIResourceLocator()).getResource(configurationSourceURI);
+ } catch (IOException e) {
+ throw new SmooksException("Failed to locate Smooks resource [" + configurationSourceURI + "].", e);
+ }
+ if(configListStream == null) {
+ throw new SmooksException("Failed to locate Smooks resource [" + configurationSourceURI + "].");
+ }
+
+ try {
+ return new Smooks(configListStream);
+ } catch (SAXException e) {
+ throw new SmooksException("Invalid Smooks resource config '" + configurationSourceURI + "'.", e);
+ } catch (IOException e) {
+ throw new SmooksException("Error reading Smooks resource config '" + configurationSourceURI + "'.", e);
+ } finally {
+ try {
+ configListStream.close();
+ } catch (IOException e) {
+ logger.warn("Error closing Smooks resource config stream for resource '" + configurationSourceURI + "'.", e);
+ }
+ }
+ }
+
+ /**
+ * JMS Listener for receiving configuration update notifications.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ private class ConfigurationUpdateListener implements MessageListener {
+
+ private TopicConnection conn = null;
+ private TopicSession session = null;
+ private Topic topic = null;
+
+ /**
+ * Private constructor.
+ * <p/>
+ * Connects the listener to the topic.
+ */
+ private ConfigurationUpdateListener() {
+ try {
+ connect();
+ } catch(Throwable t) {
+ logger.error("Unexpected error while attempting to connect Transformation configuration Update Listener. Update listener not enabled!", t);
+ close();
+ return;
+ }
+ }
+
+ /**
+ * Receive a notification message.
+ */
+ public void onMessage(javax.jms.Message message) {
+ if(message instanceof TextMessage) {
+ try {
+ String updatedSourceName = ((TextMessage)message).getText();
+
+ if(updatedSourceName != null && updatedSourceName.equals(configurationSourceName)) {
+ logger.info("Transformation configuration update notification received for configuration source '" + configurationSourceName + "'. Resetting SmooksTransformer in order to force a configuration re-read.");
+ smooksInstance = createSmooksInstance();
+ }
+ } catch (JMSException e) {
+ logger.warn("Error reading Smooks Update Notification configuration source name from JMS message.", e);
+ return;
+ }
+ } else {
+ logger.info("Transformation configuration update notification received (global notification). Resetting SmooksTransformer in order to force a configuration re-read.");
+ smooksInstance = createSmooksInstance();
+ }
+ }
+
+ private ConnectionFactory getJmsConnectionFactory() throws ConfigurationException {
+ ConnectionFactory factory = null;
+ Context context;
+ String connectionFactoryRuntime = config.getProperty(ConnectionFactory.class.getName(), "ConnectionFactory");
+
+ context = getNamingContext();
+ try {
+ factory = (ConnectionFactory) context.lookup(connectionFactoryRuntime);
+ } catch (NamingException e) {
+ throw new ConfigurationException("JNDI lookup of JMS Connection Factory [" + connectionFactoryRuntime + "] failed.", e);
+ } catch (ClassCastException e) {
+ throw new ConfigurationException("JNDI lookup of JMS Connection Factory failed. Class [" + connectionFactoryRuntime + "] is not an instance of [" + ConnectionFactory.class.getName() + "].", e);
+ } finally {
+ if (context!=null) {
+ try {
+ context.close();
+ } catch (NamingException ne) {
+ logger.error("Failed to close Naming Context.", ne);
+ }
+ }
+ }
+
+ return factory;
+ }
+
+ private Context getNamingContext() throws ConfigurationException {
+ Context context;
+
+ try {
+ context = new InitialContext(config);
+ } catch (NamingException e) {
+ throw new ConfigurationException("Failed to load InitialContext: " + config);
+ }
+ if(context == null) {
+ throw new ConfigurationException("Failed to Server JNDI context. Check that '" + Context.PROVIDER_URL + "', '" + Context.INITIAL_CONTEXT_FACTORY + "', '" + Context.URL_PKG_PREFIXES + "' are correctly configured in " + SmooksConfiguration.SMOOKS_ESB_PROPERTIES + ".");
+ }
+
+ return context;
+ }
+
+ /**
+ * Connect to the configured topic.
+ */
+ private boolean connect() {
+ String notificationTopicName = config.getProperty(UPDATE_TOPIC_NAME, "topic/org.jboss.soa.esb.transformation.Update");
+ TopicConnectionFactory connectionFactory = null;
+
+ logger.debug("Attempting to connect Transformation Configuration Update Listener to update notification topic '" + notificationTopicName + "'.");
+
+ // Get the Topic ConnectionFactory...
+ try {
+ connectionFactory = (TopicConnectionFactory) getJmsConnectionFactory();
+ } catch (ConfigurationException e) {
+ logger.error("Lookup of the JMS ConnectionFactory failed for the Transformation configuration Update Listener. Update listener not enabled!", e);
+ return false;
+ } catch (ClassCastException e) {
+ logger.error("Invalid JMS ConnectionFactory config for the Transformation configuration Update Listener. ConnectionFactory doesn't implement " + TopicConnectionFactory.class.getName() + ". Update listener not enabled!", e);
+ return false;
+ }
+
+ // Create the topic connection...
+ try {
+ conn = connectionFactory.createTopicConnection();
+ } catch (JMSException e) {
+ logger.error("Failed to open JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
+ return false;
+ }
+
+ // Lookup the topic...
+ try {
+ Context context = getNamingContext();
+
+ topic = (Topic) context.lookup(notificationTopicName);
+ context.close();
+ } catch (ConfigurationException e) {
+ logger.error("Topic lookup failed for the Transformation configuration Update Listener. Topic name '" + notificationTopicName + "'. \n\t\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check properties '" + UPDATE_TOPIC_NAME + "' and '" + Context.PROVIDER_URL + "' in '" + SmooksConfiguration.SMOOKS_ESB_PROPERTIES + "'). \n\t\tUpdate listener not enabled!", e);
+ close();
+ return false;
+ } catch (NamingException e) {
+ logger.warn("Topic lookup failed for the Transformation configuration Update Listener. Topic name '" + notificationTopicName + "'. \n\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check properties '" + UPDATE_TOPIC_NAME + "' and '" + Context.PROVIDER_URL + "' in '" + SmooksConfiguration.SMOOKS_ESB_PROPERTIES + "'). \n\tUpdate listener not enabled!");
+ close();
+ return false;
+ }
+
+ // Create the TopicSession...
+ try {
+ session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
+ } catch (JMSException e) {
+ logger.error("TopicSession creation failed for the Transformation configuration Update Listener. Update listener not enabled!", e);
+ close();
+ return false;
+ }
+
+ // Start the connection...
+ try {
+ conn.start();
+ } catch (JMSException e) {
+ logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
+ close();
+ return false;
+ }
+
+ // Bind "this" listener to the topic...
+ try {
+ TopicSubscriber topicSubscriber = session.createSubscriber(topic);
+ topicSubscriber.setMessageListener(this);
+ } catch (JMSException e) {
+ logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
+ close();
+ return false;
+ }
+
+ // Listen for exceptions on the connection...
+ try {
+ conn.setExceptionListener(new ExceptionListener());
+ } catch (JMSException e) {
+ logger.error("Failed to attach an ExceptionListener for the Transformation configuration Update Listener. Update listener not enabled!", e);
+ close();
+ return false;
+ }
+
+ logger.info("Successfully connected update notification listener to nofification topic '" + notificationTopicName + "' for Smooks configuration source '" + configurationSourceName + "' (" + configurationSourceURI + ").");
+
+ return true;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ close();
+ super.finalize();
+ }
+
+ /**
+ * Close out the listener and all it's resources.
+ */
+ private void close() {
+ try {
+ if(conn != null) {
+ conn.stop();
+ logger.debug("Closing JMS Connection for update notification listener for Smooks configuration source '" + configurationSourceName + "'.");
+ }
+ } catch (Throwable e) {
+ logger.error("Failed to stop Update Listener JMS connection.", e);
+ conn = null;
+ }
+ try {
+ if(session != null) {
+ session.close();
+ logger.debug("Closing JMS Session for update notification listener for Smooks configuration source '" + configurationSourceName + "'.");
+ }
+ } catch (Throwable e) {
+ logger.error("Failed to close Update Listener JMS session.", e);
+ } finally {
+ session = null;
+ }
+ try {
+ if(conn != null) {
+ conn.close();
+ logger.debug("Closing JMS Topic for update notification listener for Smooks configuration source '" + configurationSourceName + "'.");
+ }
+ } catch (Throwable e) {
+ logger.error("Failed to close Update Listener JMS connection.", e);
+ } finally {
+ conn = null;
+ }
+ topic = null;
+ logger.debug("Update notification listener for Smooks configuration source '" + configurationSourceName + "' is now stopped!");
+ }
+
+ /**
+ * Exception Listener.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ private class ExceptionListener implements javax.jms.ExceptionListener {
+
+ /**
+ * We want this listener to handle only one exception.
+ * It will close all existing resources and create a new instance
+ * once it successfully reconnects.
+ */
+ private boolean hasHandledOneException = false;
+
+ /* (non-Javadoc)
+ * @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
+ */
+ public void onException(JMSException e) {
+ synchronized (ExceptionListener.class) {
+ if(!hasHandledOneException) {
+ logger.error("JMS Exception on Transformation Configuration Update Listener.", e);
+ close();
+ while(!connect()) {
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e1) {
+ logger.error("Interrupted during reconnect attempt. Aborting reconnect! Will need restart to reconnect.", e);
+ }
+ }
+ hasHandledOneException = true;
+ }
+ }
+ }
+ }
+ }
+
+}
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksInstanceManager.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -2,33 +2,16 @@
-import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
-import javax.jms.JMSException;
-import javax.jms.MessageListener;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicSession;
-import javax.jms.TopicSubscriber;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
import org.apache.log4j.Logger;
import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.util.ClassUtil;
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.actions.ActionPipelineProcessor;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.common.Configuration;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.helpers.KeyValuePair;
import org.jboss.soa.esb.message.Message;
@@ -51,7 +34,23 @@
* non binary message transformations.
*
* <h3>Action Configuration</h3>
- * This action is configured as follows:
+ * This action works in one of 2 ways:
+ * <ol>
+ * <li>Out of a Smooks resource configuration whose URL is specified directly on the action via the
+ * "resource-config" property. If no URI scheme ("http", "file" etc) is specified on the
+ * resource config, the resource is assumed to reside on the local classpath.
+ * </li>
+ * <li>Out of a centralised Smooks resource configuration datasource managed by the Transformation Admin Console.
+ * This datasource is configured in the smooks.esb deployment. See the "console.url" property in the
+ * "smooks.esb.properties" file.
+ * </li>
+ * </ol>
+ *
+ * If both of the above are specified, the action will use the locally specified config defined on the "resource-config"
+ * property. If neither are specified, an error will result.
+ *
+ * <p/>
+ * This transformer also supports Smooks profiles as follows:
* <pre>
* <action name="transformAB" class="<b>org.jboss.soa.esb.actions.converters.SmooksTransformer</b>">
* <property name="<b>from</b>" value="A" />
@@ -85,11 +84,11 @@
public class SmooksTransformer implements TransformationService, ActionPipelineProcessor {
+ /**
+ * Action config.
+ */
+ private ConfigTree actionConfig;
/**
- * Configuration section key.
- */
- public static final String CONFIGURATION_SECTION = "transformation";
- /**
* Key for storing/accessing any potential message Body bean HashMaps as populated
* by the Smooks Javabean Cartridge.
*/
@@ -99,7 +98,19 @@
* a bean hashs should be set as the message payload before exiting the process method.
*/
public static final String SET_BEANHASH_TO_PAYLOAD = "set-beanhash-to-payload";
-
+ /**
+ * Action config Smooks configuration key.
+ */
+ public static final String RESOURCE_CONFIG = "resource-config";
+ /**
+ * Config key for the message body location on which the input message is attached.
+ */
+ public static final String INPUT_LOCATION = "input-location";
+ /**
+ * Config key for the message body location on which the output message is attached.
+ */
+ public static final String OUTPUT_LOCATION = "output-location";
+
public static final String FROM = "from";
public static final String FROM_TYPE = "from-type";
public static final String TO = "to";
@@ -108,43 +119,28 @@
public static final String UPDATE_TOPIC="update-topic";
private static Logger logger = Logger.getLogger(SmooksTransformer.class);
- private Smooks smooks;
- private ConfigurationUpdateListener updateListener;
- private String smooksCdrlFile;
- private static String notificationTopic;
+ private SmooksInstanceManager smooksInstanceManager;
+ private String inputLocation;
+ private String outputLocation;
private String defaultMessageFromType;
private String defaultMessageFrom;
private String defaultMessageToType;
private String defaultMessageTo;
private boolean setPayloadToBeanHash = false;
- private List<KeyValuePair> properties;
/**
* Public constructor.
- * @param name Action name.
* @param propertiesTree Action Properties.
- * @throws ConfigurationException Action not properly configured.
- */
- public SmooksTransformer(String name, ConfigTree propertiesTree) throws ConfigurationException {
- this(propertiesTree);
- }
-
- /**
- * Public constructor.
- * @param propertiesTree Action Properties.
* @throws ConfigurationException
* @throws ConfigurationException Action not properly configured.
*/
public SmooksTransformer(ConfigTree propertiesTree) throws ConfigurationException {
- properties = propertiesTree.attributesAsList();
+ List<KeyValuePair> properties = propertiesTree.attributesAsList();
- // Get the smooks config file
- smooksCdrlFile = KeyValuePair.getValue(SMOOKS_CDRL_FILE, properties, "classpath:/smooks-cdr.lst");
-
- // Get the notification topic
- notificationTopic = KeyValuePair.getValue(UPDATE_TOPIC, properties,"topic/org.jboss.soa.esb.transformation.Update");
-
- // Get the message flow properties...
+ inputLocation = KeyValuePair.getValue(INPUT_LOCATION, properties);
+ outputLocation = KeyValuePair.getValue(OUTPUT_LOCATION, properties);
+
+ // Get the default message flow properties (can be overriden by the message properties)...
defaultMessageFromType = KeyValuePair.getValue(FROM_TYPE, properties);
if(defaultMessageFromType != null && defaultMessageFromType.trim().equals("")) {
throw new ConfigurationException("Empty '" + FROM_TYPE + "' config attribute supplied.");
@@ -161,13 +157,62 @@
if(defaultMessageTo != null && defaultMessageTo.trim().equals("")) {
throw new ConfigurationException("Empty '" + TO + "' config attribute supplied.");
}
-
- // Get the set-beanhash-to-payload property...
+
+ // Get the set-beanhash-to-payload property...
setPayloadToBeanHash = KeyValuePair.getBooleanValue(SET_BEANHASH_TO_PAYLOAD, properties, false);
-
- updateListener = new ConfigurationUpdateListener(this);
- }
+ actionConfig = propertiesTree;
+ }
+
+ /**
+ * Initialise the Smooks instance.
+ * @throws ActionLifecycleException Failed to load Smooks configurations.
+ */
+ public void initialise() throws ActionLifecycleException {
+ String resourceConfig = actionConfig.getAttribute(RESOURCE_CONFIG);
+
+ // If there's a Smooks resource config specified on the action config, this instance
+ // of the SmooksTransformer will use that configuration. Otherwise there needs to be a
+ // centralised (console based) config specified in the smooks.esb.properties. If not,
+ // we have an error!
+ if(resourceConfig != null) {
+ initialiseLocalSmooksInstanceManager(resourceConfig);
+ } else {
+ smooksInstanceManager = SmooksESBLifecycleListener.getGlobalSmooksInstanceManager();
+ }
+
+ if(smooksInstanceManager == null) {
+ throw new ActionLifecycleException("Invalid " + getClass().getSimpleName() + " action configuration. No 'resource-config' specified on the action and no centralised console config available (see smooks.esb.properties).");
+ }
+
+ logger.info("Smooks configurations are now loaded.");
+ }
+
+ private void initialiseLocalSmooksInstanceManager(String resourceConfig) {
+ String actionName = actionConfig.getAttribute("action");
+ SmooksConfiguration smooksEsbConfig = new SmooksConfiguration();
+ String baseConfigs = smooksEsbConfig.getProperty("smooks.base.configs", "creators.xml");
+ Smooks smooks;
+
+ smooksInstanceManager = new SmooksInstanceManager(actionName, resourceConfig);
+ smooks = smooksInstanceManager.getSmooksInstance();
+
+ String[] resources = baseConfigs.split(",");
+ if(logger.isDebugEnabled()) {
+ logger.debug("smooks-base-configs: " + Arrays.asList(resources));
+ }
+ for(String resource : resources) {
+ try {
+ SmooksUtil.registerResources(resource, ClassUtil.getResourceAsStream("/smooks-base-configs/" + resource.trim(), getClass()), smooks);
+ } catch(Throwable t) {
+ // ignore
+ }
+ }
+ }
+
+ public void destroy() throws ActionLifecycleException {
+ }
+
/* (non-Javadoc)
* @see org.jboss.soa.esb.services.transform.TransformationService#transform(org.jboss.soa.esb.message.Message)
*/
@@ -183,53 +228,71 @@
* @see org.jboss.soa.esb.actions.ActionProcessor#process(java.lang.Object)
*/
public Message process(Message message) throws ActionProcessingException {
- Object payload = ActionUtils.getTaskObject(message);
+ if(smooksInstanceManager == null) {
+ logger.warn("SmooksTransformer instance is decommisioned. Probably due to a bad action configuration. Not performing transformation on this message.");
+ return message;
+ }
+
+ Object payload = message.getBody().get(inputLocation);
+
+ if(payload == null) {
+ payload = ActionUtils.getTaskObject(message);
+ }
- try {
+ try {
if(payload instanceof byte[]) {
payload = new String((byte[])payload, "UTF-8");
}
-
- if(payload instanceof String) {
+
+ if(payload == null) {
+ logger.warn("Null message payload. Returning message unmodified.");
+ } else if(payload instanceof String) {
byte[] messageBytes = null;
String transformedMessage;
- String messageProfile;
-
- // Register the message useragent with Smooks (if not already registered)...
- messageProfile = registerMessageProfile(message);
-
+
messageBytes = ((String)payload).getBytes("UTF-8");
long start = System.currentTimeMillis();
- StandaloneExecutionContext request;
-
+ Smooks smooks = smooksInstanceManager.getSmooksInstance();
+ StandaloneExecutionContext executionContext;
+ String messageProfile;
+
+ // Register the message profile with Smooks (if there is one and it's not already registered)...
+ messageProfile = registerMessageProfile(message, smooks);
+
// Filter and Serialise...
- request = smooks.createExecutionContext( messageProfile );
- transformedMessage = SmooksUtil.filterAndSerialize( request, new ByteArrayInputStream( messageBytes), smooks );
+ if(messageProfile == null) {
+ // Not using profiles on this transformation.
+ executionContext = smooks.createExecutionContext();
+ } else {
+ executionContext = smooks.createExecutionContext(messageProfile);
+ }
+ transformedMessage = SmooksUtil.filterAndSerialize(executionContext, new ByteArrayInputStream( messageBytes), smooks);
// Javabean cartridge resources may have extract data from the message and populated some beans.
// Get them and stick them on the message - so they can be accessed by downstream actions...
- HashMap beanHash = BeanAccessor.getBeans(request);
+ HashMap beanHash = BeanAccessor.getBeans(executionContext);
if(beanHash != null) {
message.getBody().add(EXTRACTED_BEANS_HASH, beanHash);
}
if(logger.isDebugEnabled()) {
long timeTaken = System.currentTimeMillis() - start;
- logger.debug("Transformed message for useragent [" + messageProfile + "]. Time taken: "
+ logger.debug("Transformed message for profile [" + messageProfile + "]. Time taken: "
+ timeTaken + ". Message in:\n[" + payload.toString()+ "]. \nMessage out:\n[" + transformedMessage + "].");
}
-
- if(beanHash != null && setPayloadToBeanHash) {
- ActionUtils.setTaskObject(message, beanHash);
+
+ Object outputPayload;
+ if(beanHash != null && setPayloadToBeanHash) {
+ outputPayload = beanHash;
} else {
ActionUtils.setTaskObject(message, transformedMessage);
- message.getBody().setByteArray(transformedMessage.getBytes("UTF-8"));
+ outputPayload = transformedMessage;
}
- } else {
- String sClass = (null==payload) ? "<null>" : payload.getClass().getName();
- logger.warn("String message types only supported. Input message was ["
- + sClass + "]. Returning message untransformed.");
+
+ message.getBody().add(outputLocation, outputPayload);
+ } else {
+ logger.warn("Only java.lang.String payload types supported. Input message was of type [" + payload.getClass().getName() + "]. Returning message untransformed.");
}
} catch(Throwable thrown) {
thrown.printStackTrace();
@@ -245,11 +308,12 @@
/**
* Register the Message Exchange as a profile within Smooks.
* @param message The message.
- * @return The Smooks "profile" string that uniquely identifies the message flow associated
+ * @param smooks The Smooks instance.
+ * @return The Smooks "profile" string that uniquely identifies the message flow associated
* with the message.
* @throws ActionProcessingException Failed to register the message flow for the message.
*/
- private String registerMessageProfile(Message message) throws ActionProcessingException {
+ private String registerMessageProfile(Message message, Smooks smooks) throws ActionProcessingException {
String messageProfile;
String messageFromType;
String messageFrom;
@@ -264,25 +328,29 @@
messageFromType = (String)message.getProperties().getProperty(FROM_TYPE, defaultMessageFromType);
messageToType = (String)message.getProperties().getProperty(TO_TYPE, defaultMessageToType);
- // Construct the message useragent string for use with Smooks. This is basically the
+ // Construct the message profile string for use with Smooks. This is basically the
// name of the Message Exchange on which transformations are to be performed...
messageProfile = getMessageProfileString(messageFromType, messageFrom, messageToType, messageTo);
-
- // Register this message flow if it isn't already registered...
- try {
- ProfileStore profileStore = smooks.getApplicationContext().getProfileStore();
- profileStore.getProfileSet(messageProfile);
- } catch(UnknownProfileMemberException e) {
- String[] profiles = getMessageProfiles(messageFromType, messageFrom, messageToType, messageTo);
-
- synchronized (SmooksTransformer.class) {
- // Register the message flow within the Smooks context....
- logger.info("Registering JBoss ESB Message-Exchange as Smooks Profile: [" + messageProfile + "]. Profiles: [" + Arrays.asList(profiles) + "]");
- SmooksUtil.registerProfileSet(DefaultProfileSet.create( messageProfile, profiles ), smooks);
+
+ // If this transformation instance requires profiling, make sure the profile is registered on the
+ // Smooks instance.
+ if(messageProfile != null) {
+ // Register this message flow if it isn't already registered...
+ try {
+ ProfileStore profileStore = smooks.getApplicationContext().getProfileStore();
+ profileStore.getProfileSet(messageProfile);
+ } catch(UnknownProfileMemberException e) {
+ String[] profiles = getMessageProfiles(messageFromType, messageFrom, messageToType, messageTo);
+
+ synchronized (SmooksTransformer.class) {
+ // Register the message flow within the Smooks context....
+ logger.info("Registering JBoss ESB Message-Exchange as Smooks Profile: [" + messageProfile + "]. Profiles: [" + Arrays.asList(profiles) + "]");
+ SmooksUtil.registerProfileSet(DefaultProfileSet.create( messageProfile, profiles ), smooks);
+ }
}
}
- return messageProfile;
+ return messageProfile;
}
/**
@@ -342,8 +410,12 @@
if(messageTo != null) {
string.append(TO + ":" + messageTo);
}
-
- return string.toString();
+
+ if(string.length() == 0) {
+ return null;
+ }
+
+ return string.toString();
}
public void processException(final Message message, final Throwable th) {
@@ -351,269 +423,4 @@
public void processSuccess(final Message message) {
}
-
- /**
- * Initialise the SmooksStandalone instance.
- * <p/>
- * We may need to write a Smooks Container implementation specifically for JBossESB's needs. SmooksStandalone is
- * fine for a start though.
- * @throws ActionLifecycleException Failed to load Smooks configurations.
- */
- public void initialise() throws ActionLifecycleException {
-
- InputStream configListStream;
-
- try {
- configListStream = (new URIResourceLocator()).getResource(smooksCdrlFile);
- } catch (IOException e) {
- throw new ActionLifecycleException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "]. This resource must be made available at the specified URI.", e);
- }
- if(configListStream == null) {
- throw new ActionLifecycleException("Failed to locate Tranformation configuration list file [" + smooksCdrlFile + "]. This resource must be made available at the specified URI.");
- }
-
- // Initialise the local SmooksStandalone instance. This "local" reference is
- // used because we are using on the "global" smooks variable reference to controll
- // access to this synchronisation block ...
-// smooks = new SmooksStandalone("UTF-8");
- smooks = new Smooks();
-
- try {
- BufferedReader configReader = new BufferedReader(new InputStreamReader(configListStream));
- //String line=configReader.readLine();
- StandaloneExecutionContext context = smooks.createExecutionContext();
- context.getContext().getStore().load(configReader );
- } catch (Exception e) {
- e.printStackTrace();
- smooks = null;
- throw new ActionLifecycleException("Smooks configuration load failed.", e);
- } finally {
- try {
- configListStream.close();
- } catch (IOException e) {
- logger.error("Error while closing transformation list config stream [" + smooksCdrlFile + "].", e);
- }
- }
-
- logger.info("All Smooks configurations are now loaded.");
- }
-
- public void destroy() throws ActionLifecycleException {
- updateListener.close();
- }
-
- /**
- * Reset the transformer.
- * <p/>
- * Clears the internal static smooks instance.
- */
- public void reset() {
- Smooks instance = smooks;
-
- synchronized (SmooksTransformer.class) {
- if(smooks == instance) {
- smooks = null;
- }
- }
- }
-
- /**
- * JMS Listener for receiving configuration update notifications.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- private static class ConfigurationUpdateListener implements MessageListener {
-
- private TopicConnection conn = null;
- private TopicSession session = null;
- private Topic topic = null;
- private SmooksTransformer transformer;
-
- public ConfigurationUpdateListener(SmooksTransformer transformer) {
- this.transformer = transformer;
- }
-
- /**
- * Private constructor.
- * <p/>
- * Connects the listener to the topic.
- */
- private ConfigurationUpdateListener() {
- try {
- connect();
- } catch(Throwable t) {
- logger.error("Unexpected error while attempting to connect Transformation configuration Update Listener. Update listener not enabled!", t);
- close();
- return;
- }
- }
-
- /**
- * Receive a notification message.
- */
- public void onMessage(javax.jms.Message message) {
- // Reset the transformer instance so as to force a config reload.
- logger.info("Transformation configuration update notification received. Resetting SmooksTransformer in order to force a configuration re-read.");
- transformer.reset();
- }
-
- /**
- * Connect to the configured topic.
- */
- private boolean connect() {
- TopicConnectionFactory connectionFactory = null;
-
- logger.info("Attempting to connect Transformation configuration Update Listener to update notification topic.");
-
- // Get the Topic ConnectionFactory...
- try {
- connectionFactory = (TopicConnectionFactory) Configuration.getJmsConnectionFactory(CONFIGURATION_SECTION);
- } catch (ConfigurationException e) {
- logger.error("Lookup of the JMS ConnectionFactory failed for the Transformation configuration Update Listener. Update listener not enabled!", e);
- return false;
- } catch (ClassCastException e) {
- logger.error("Invalid JMS ConnectionFactory config for the Transformation configuration Update Listener. ConnectionFactory doesn't implement " + TopicConnectionFactory.class.getName() + ". Update listener not enabled!", e);
- return false;
- }
-
- // Create the topic connection...
- try {
- conn = connectionFactory.createTopicConnection();
- } catch (JMSException e) {
- logger.error("Failed to open JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
- return false;
- }
-
- // Lookup the topic...
- try {
- Context context = Configuration.getNamingContext(CONFIGURATION_SECTION);
- topic = (Topic) context.lookup(notificationTopic);
- context.close();
- } catch (ConfigurationException e) {
- logger.error("Topic lookup failed for the Transformation configuration Update Listener. Topic name '" + notificationTopic + "'. \n\t\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check configuration '" + Context.PROVIDER_URL + "' in config module/section '" + CONFIGURATION_SECTION + "'). \n\t\tUpdate listener not enabled!", e);
- close();
- return false;
- } catch (NamingException e) {
- logger.warn("Topic lookup failed for the Transformation configuration Update Listener. Topic name '" + notificationTopic + "'. \n\tThis JMS Topic may not be deployed, or this ESB instance may not be looking at the correct JMS provider (check configuration '" + Context.PROVIDER_URL + "' in config module/section '" + CONFIGURATION_SECTION + "'). \n\tUpdate listener not enabled!");
- close();
- return false;
- }
-
- // Create the TopicSession...
- try {
- session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
- } catch (JMSException e) {
- logger.error("TopicSession creation failed for the Transformation configuration Update Listener. Update listener not enabled!", e);
- close();
- return false;
- }
-
- // Start the connection...
- try {
- conn.start();
- } catch (JMSException e) {
- logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
- close();
- return false;
- }
-
- // Bind "this" listener to the topic...
- try {
- TopicSubscriber topicSubscriber = session.createSubscriber(topic);
- topicSubscriber.setMessageListener(this);
- } catch (JMSException e) {
- logger.error("Failed to start JMS TopicConnection for the Transformation configuration Update Listener. Update listener not enabled!", e);
- close();
- return false;
- }
-
- // Listen for exceptions on the connection...
- try {
- conn.setExceptionListener(new ExceptionListener());
- } catch (JMSException e) {
- logger.error("Failed to attach an ExceptionListener for the Transformation configuration Update Listener. Update listener not enabled!", e);
- close();
- return false;
- }
-
- logger.info("Transformation Configuration Update Listener started!");
-
- return true;
- }
-
- @Override
- protected void finalize() throws Throwable {
- close();
- super.finalize();
- }
-
- /**
- * Close out the listener and all it's resources.
- */
- private void close() {
- try {
- if(conn != null) {
- conn.stop();
- logger.info("Update Listener JMS TopicConnection stopped.");
- }
- } catch (Throwable e) {
- logger.error("Failed to stop Update Listener JMS connection.", e);
- conn = null;
- }
- try {
- if(session != null) {
- session.close();
- logger.info("Update Listener JMS TopicSession closed.");
- }
- } catch (Throwable e) {
- logger.error("Failed to close Update Listener JMS session.", e);
- } finally {
- session = null;
- }
- try {
- if(conn != null) {
- conn.close();
- logger.info("Update Listener JMS TopicConnection closed.");
- }
- } catch (Throwable e) {
- logger.error("Failed to close Update Listener JMS connection.", e);
- } finally {
- conn = null;
- }
- topic = null;
- }
-
- /**
- * Exception Listener.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- private class ExceptionListener implements javax.jms.ExceptionListener {
-
- /**
- * We want this listener to handle only one exception.
- * It will close all existing resources and create a new instance
- * once it successfully reconnects.
- */
- private boolean hasHandledOneException = false;
-
- /* (non-Javadoc)
- * @see javax.jms.ExceptionListener#onException(javax.jms.JMSException)
- */
- public void onException(JMSException e) {
- synchronized (ExceptionListener.class) {
- if(!hasHandledOneException) {
- logger.error("JMS Exception on Transformation Configuration Update Listener.", e);
- close();
- while(!connect()) {
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- logger.error("Interrupted during reconnect attempt. Aborting reconnect! Will need restart to reconnect.", e);
- }
- }
- hasHandledOneException = true;
- }
- }
- }
- }
- }
}
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/deployment.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbossesb-deployment>
- <depends>jms.destination:service=Topic,name=SmooksNotificationTopic</depends>
+ <depends>jms.destination:service=Topic,name=org.jboss.soa.esb.transformation.Update</depends>
</jbossesb-deployment>
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,6 +1,11 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
- <!--
+
+ <lifecycle-listeners>
+ <lifecycle-listener class="org.jboss.soa.esb.actions.converters.SmooksESBLifecycleListener" />
+ </lifecycle-listeners>
+
+ <!--
jbossesb internal services
-->
</jbossesb>
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbm-queue-service.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<server>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jms.destination:service=Topic,name=SmooksNotificationTopic"
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jms.destination:service=Topic,name=org.jboss.soa.esb.transformation.Update"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
</mbean>
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbmq-queue-service.xml 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/jbmq-queue-service.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<server>
- <mbean code="org.jboss.mq.server.jmx.Queue"
- name="jms.destination:service=Topic,name=SmooksNotificationTopic">
+ <mbean code="org.jboss.mq.server.jmx.Topic"
+ name="jms.destination:service=Topic,name=org.jboss.soa.esb.transformation.Update">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-base-configs/creators.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-base-configs/creators.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-base-configs/creators.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd" default-selector="cdu-creator">
+
+ <!--
+ All .st (*.st) resources will be treated as StringTemplate templates and
+ will be handled by the StringTemplateContentDeliveryUnitCreator.
+ -->
+ <resource-config>
+ <resource type="class">org.milyn.templating.stringtemplate.StringTemplateContentDeliveryUnitCreator</resource>
+ <param name="restype">st</param>
+ </resource-config>
+
+ <!--
+ All .xsl (*.xsl) resources will be treated as XSL templates and
+ will be handled by the XslContentDeliveryUnitCreator.
+ -->
+ <resource-config>
+ <resource type="class">org.milyn.templating.xslt.XslContentDeliveryUnitCreator</resource>
+ <param name="restype">xsl</param>
+ </resource-config>
+
+ <!--
+ Groovy Scripting Support.
+ -->
+ <resource-config>
+ <resource type="class">org.milyn.smooks.scripting.GroovyContentDeliveryUnitCreator</resource>
+ <param name="restype">groovy</param>
+ </resource-config>
+
+</smooks-resource-list>
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-base-configs/creators.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-cdr.lst 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,10 +0,0 @@
-####################################################
-# Lotpoad config from database
-####################################################
-#http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
-
-####################################################
-# Load config from local XML file
-####################################################
-#/smooks-res.xml
-#/org/milyn/templating/templating-cdu-creators-0.1.cdrl
Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,35 @@
+####################################################################################
+# Configure in the following property to enable config loading
+# from the Transformation Admin Console.
+####################################################################################
+#console.url=http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
+
+####################################################################################
+#
+# Base configurations. Added for all non-console based Smooks instances.
+# Value is comma-separated-list. All resources must be in the "smooks-base-configs"
+# folder of this .esb.
+#
+####################################################################################
+smooks.base.configs=creators.xml
+
+####################################################################################
+#
+# Context properties.
+#
+# Defaults to JBoss AS on localhost.
+#
+####################################################################################
+java.naming.provider.url=localhost
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=
+
+####################################################################################
+#
+# JMS properties.
+#
+# Provider defaults to JBoss MQ.
+#
+####################################################################################
+javax.jms.ConnectionFactory=ConnectionFactory
+update.notification.topic=topic/org.jboss.soa.esb.transformation.Update
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/java/org/jboss/soa/esb/actions/converters/SmooksTransformerUnitTest.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -23,7 +23,6 @@
package org.jboss.soa.esb.actions.converters;
-
import java.net.URISyntaxException;
import junit.framework.TestCase;
@@ -38,15 +37,16 @@
/**
* SmooksTransformer unit tests.
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
* @since Version 4.0
*/
public class SmooksTransformerUnitTest extends TestCase {
public void test_bad_config() {
- ConfigTree properties = new ConfigTree("name");
+ ConfigTree properties = new ConfigTree("name");
- properties.setAttribute(SmooksTransformer.SMOOKS_CDRL_FILE, "smooks-test-cdr.lst");
+ properties.setAttribute(SmooksTransformer.RESOURCE_CONFIG, "classpath:/smooks-conf-01.xml");
// Should get exceptions where message type configs are specified but empty...
properties.setAttribute(SmooksTransformer.FROM_TYPE, " ");
assertConfigException(properties, "Empty '" + SmooksTransformer.FROM_TYPE + "' config attribute supplied.");
@@ -54,72 +54,97 @@
properties.setAttribute(SmooksTransformer.TO_TYPE, " ");
assertConfigException(properties, "Empty '" + SmooksTransformer.TO_TYPE + "' config attribute supplied.");
}
-
+
public void test_trans() throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
String stringMessage;
String transRes;
-
+
// Very basic test! Just illustrates profile based resource selection.
// Read the smooks-test.cdrl config file in this package!!
// Initialise the acme order message...
stringMessage = "<a><ddd>value</ddd></a>";
-
+
// Transform the order message going to "AcmePartner1"...
transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner1", "Partner1-Order-XML");
assertEquals("<x><b>value</b></x>", transRes);
-
+
// Transform the order message going to "AcmePartner2"...
transRes = transform(stringMessage, "Acme-Order-XML", "Acme", "AcmePartner2", "Partner2-Order-XML");
assertEquals("<x><c>value</c></x>", transRes);
}
-
+
private String transform(String stringMessage, String fromType, String from, String to, String toType) throws ActionProcessingException, ConfigurationException, URISyntaxException, ActionLifecycleException {
- ConfigTree properties = new ConfigTree("name");
-
- properties.setAttribute(SmooksTransformer.SMOOKS_CDRL_FILE, "smooks-test-cdr.lst");
- // Set the message properties in order to trigger the appropriate transformations
- // on the message...
- properties.setAttribute(SmooksTransformer.FROM, from);
- properties.setAttribute(SmooksTransformer.FROM_TYPE, fromType);
- properties.setAttribute(SmooksTransformer.TO, to);
- properties.setAttribute(SmooksTransformer.TO_TYPE, toType);
-
- // The smooks-cdr.lst and device-profile.xml files are located in the root of the
- // test src folder. You need to look at these to see how this works...
+ ConfigTree properties = createConfig01(from, fromType, to, toType);
SmooksTransformer transformer = new SmooksTransformer(properties);
Message message;
transformer.initialise();
- // Perform the transformation by setting the payload on the task object.
- message = createNewMessage(fromType, from, to, toType);
+ // Perform the transformation by setting the payload on the task object...
+ message = MessageFactory.getInstance().getMessage();
+ message = MessageFactory.getInstance().getMessage();
ActionUtils.setTaskObject(message, stringMessage);
message = transformer.process(message);
String resultThroughTaskObj = (String) ActionUtils.getTaskObject(message);
- assertEquals(resultThroughTaskObj, new String(message.getBody().getByteArray()));
-
- // Perform the transformation by setting the payload on the body "contents".
+ assertEquals(resultThroughTaskObj, message.getBody().get());
+
+ // Perform the transformation by setting the payload on the body as bytes...
message = createNewMessage(fromType, from, to, toType);
message.getBody().setByteArray(stringMessage.getBytes());
message = transformer.process(message);
- assertEquals(resultThroughTaskObj, new String(message.getBody().getByteArray()));
-
+ assertEquals(resultThroughTaskObj, message.getBody().get());
+
+ // Perform the transformation by setting/getting the payload on the default body location...
+ message = MessageFactory.getInstance().getMessage();
+ message.getBody().add(stringMessage);
+ message = transformer.process(message);
+ assertEquals(resultThroughTaskObj, message.getBody().get());
+
+ // Perform the transformation by setting the payload input and output body locations...
+ properties.setAttribute(SmooksTransformer.INPUT_LOCATION, "input-loc1");
+ properties.setAttribute(SmooksTransformer.OUTPUT_LOCATION, "output-loc1");
+ transformer = new SmooksTransformer(properties);
+ transformer.initialise();
+ message = MessageFactory.getInstance().getMessage();
+ message.getBody().add("input-loc1", stringMessage);
+ message = transformer.process(message);
+ assertEquals(resultThroughTaskObj, message.getBody().get("output-loc1"));
+
return resultThroughTaskObj;
}
- private Message createNewMessage(String fromType, String from, String to, String toType) {
- Message message;
- message = MessageFactory.getInstance().getMessage();
+ private ConfigTree createConfig01(String from, String fromType, String to, String toType) {
+ ConfigTree properties = new ConfigTree("name");
+
+ properties.setAttribute(SmooksTransformer.RESOURCE_CONFIG, "classpath:/smooks-conf-01.xml");
+ // Set the message properties in order to trigger the appropriate transformations
+ // on the message...
+ properties.setAttribute(SmooksTransformer.FROM, from);
+ properties.setAttribute(SmooksTransformer.FROM_TYPE, fromType);
+ properties.setAttribute(SmooksTransformer.TO, to);
+ properties.setAttribute(SmooksTransformer.TO_TYPE, toType);
- return message;
- }
+ return properties;
+ }
+ private Message createNewMessage(String fromType, String from, String to, String toType) {
+ Message message;
+ message = MessageFactory.getInstance().getMessage();
+
+ message.getProperties().setProperty(SmooksTransformer.FROM_TYPE, fromType);
+ message.getProperties().setProperty(SmooksTransformer.FROM, from);
+ message.getProperties().setProperty(SmooksTransformer.TO_TYPE, toType);
+ message.getProperties().setProperty(SmooksTransformer.TO, to);
+
+ return message;
+ }
+
private void assertConfigException(ConfigTree properties, String expectedException) {
try {
- new SmooksTransformer("trans", properties);
+ new SmooksTransformer(properties);
fail("Expected ConfigurationException: [" + expectedException + "...]");
- } catch(ConfigurationException e) {
+ } catch (ConfigurationException e) {
assertTrue("Expected exception message to start with [" + expectedException + "]. Was [" + e.getMessage() + "]", e.getMessage().startsWith(expectedException));
}
}
Copied: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-01.xml (from rev 12265, labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl)
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-01.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-01.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <!--
+ "Acme-Order-XML" messages going from "Acme" to "AcmePartner1"
+ -->
+ <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner1-Order-XML AND to:AcmePartner1" selector="ddd">
+ <resource>org.milyn.cdres.trans.RenameElementTU</resource>
+ <param name="replacementElement">b</param>
+ </resource-config>
+
+ <!--
+ "Acme-Order-XML" messages going from "Acme" to "AcmePartner2"
+ -->
+ <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner2-Order-XML AND to:AcmePartner2" selector="ddd">
+ <resource>org.milyn.cdres.trans.RenameElementTU</resource>
+ <param name="replacementElement">c</param>
+ </resource-config>
+
+ <!--
+ "Acme-Order-XML" messages going from "Acme" to anywhere
+ -->
+ <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme" selector="a" >
+ <resource>org.milyn.cdres.trans.RenameElementTU</resource>
+ <param name="replacementElement">x</param>
+ </resource-config>
+
+</smooks-resource-list>
+
Added: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-02.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-02.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-02.xml 2007-06-05 10:38:44 UTC (rev 12331)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
+
+ <!--
+ "Acme-Order-XML" messages going from "Acme" to "AcmePartner1"
+ -->
+ <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner1-Order-XML AND to:AcmePartner1" selector="ddd">
+ <resource>org.milyn.cdres.trans.RenameElementTU</resource>
+ <param name="replacementElement">b</param>
+ </resource-config>
+
+ <!--
+ "Acme-Order-XML" messages going from "Acme" to "AcmePartner2"
+ -->
+ <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner2-Order-XML AND to:AcmePartner2" selector="ddd">
+ <resource>org.milyn.cdres.trans.RenameElementTU</resource>
+ <param name="replacementElement">c</param>
+ </resource-config>
+
+ <!--
+ "Acme-Order-XML" messages going from "Acme" to anywhere
+ -->
+ <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme" selector="a" >
+ <resource>org.milyn.cdres.trans.RenameElementTU</resource>
+ <param name="replacementElement">x</param>
+ </resource-config>
+
+</smooks-resource-list>
+
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-conf-02.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test-cdr.lst 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1 +0,0 @@
-classpath:/smooks-test.cdrl
Deleted: labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/services/smooks/src/test/resources/smooks-test.cdrl 2007-06-05 10:38:44 UTC (rev 12331)
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
-
- <!--
- "Acme-Order-XML" messages going from "Acme" to "AcmePartner1"
- -->
- <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner1-Order-XML AND to:AcmePartner1" selector="ddd">
- <resource>org.milyn.cdres.trans.RenameElementTU</resource>
- <param name="replacementElement">b</param>
- </resource-config>
-
- <!--
- "Acme-Order-XML" messages going from "Acme" to "AcmePartner2"
- -->
- <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme AND to-type:Partner2-Order-XML AND to:AcmePartner2" selector="ddd">
- <resource>org.milyn.cdres.trans.RenameElementTU</resource>
- <param name="replacementElement">c</param>
- </resource-config>
-
- <!--
- "Acme-Order-XML" messages going from "Acme" to anywhere
- -->
- <resource-config target-profile="from-type:Acme-Order-XML AND from:Acme" selector="a" >
- <resource>org.milyn.cdres.trans.RenameElementTU</resource>
- <param name="replacementElement">x</param>
- </resource-config>
-
-</smooks-resource-list>
-
Modified: labs/jbossesb/trunk/product/tools/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java
===================================================================
--- labs/jbossesb/trunk/product/tools/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java 2007-06-05 09:03:47 UTC (rev 12330)
+++ labs/jbossesb/trunk/product/tools/console/src/org/jboss/soa/esb/admin/console/UpdateNotifier.java 2007-06-05 10:38:44 UTC (rev 12331)
@@ -89,7 +89,7 @@
try {
TopicPublisher send = session.createPublisher(topic);
- TextMessage tm = session.createTextMessage("update"); // The contents of the message is irrelevant!
+ TextMessage tm = session.createTextMessage("Console");
send.publish(tm);
logger.info("Configuration Update notification sent successfully.");
More information about the jboss-svn-commits
mailing list