[jboss-svn-commits] JBL Code SVN: r24219 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/actions/validation and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 2 16:24:15 EST 2008
Author: beve
Date: 2008-12-02 16:24:15 -0500 (Tue, 02 Dec 2008)
New Revision: 24219
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/SchemaValidationAction.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/ValidationException.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/SchemaValidationActionUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test-invalid.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xml
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xsd
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/lib/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendEsbMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendJMSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xml
labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xsd
Log:
Work for https://jira.jboss.org/jira/browse/JBESB-2213 "Create SchemaValidationAction"
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/SchemaValidationAction.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/SchemaValidationAction.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/SchemaValidationAction.java 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,219 @@
+package org.jboss.soa.esb.actions.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.MessagePayloadProxy;
+import org.jboss.soa.esb.util.ClassUtil;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * An action that validates the passed-in message payload against the configured schema.
+ * The payload can be of either type byte[] or String.
+ *
+ * Example configuration:
+ * <pre>{@code
+ * <action name="validate" class="org.jboss.soa.esb.actions.validation.SchemaValidationAction">
+ * <property name="schema" value="/test.xsd"/>
+ * </action>
+ * }</pre>
+ * Optional properties:
+ * <lu>
+ * <li><i>schemaLanguage</i> the schema langauage to use. Defaults to "http://www.w3.org/2001/XMLSchema".</li>
+ * </lu>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SchemaValidationAction extends AbstractActionPipelineProcessor
+{
+ /**
+ * Logger.
+ */
+ final Logger log = Logger.getLogger(SchemaValidationAction.class);
+
+ /**
+ * Path to the xsd.
+ */
+ private String xsd;
+
+ /**
+ * Schema language.
+ */
+ private String schemaLanguage;
+
+ /**
+ * DocumentBuilderFactory.
+ */
+ private DocumentBuilderFactory docBuilderFactory;
+
+ /**
+ * The schema that will be used for validation.
+ */
+ private Schema schema;
+
+ /**
+ * The {@link MessagePayloadProxy}.
+ */
+ private MessagePayloadProxy payloadProxy;
+
+ /**
+ * Sole constructor that expects the config tree to have the attribute "schema"
+ *
+ * @param config The action configuration.
+ * @throws ConfigurationException
+ */
+ public SchemaValidationAction(final ConfigTree config) throws ConfigurationException
+ {
+ xsd = config.getRequiredAttribute("schema");
+ schemaLanguage = config.getAttribute("schemaLanguage", XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ payloadProxy = new MessagePayloadProxy(config);
+ docBuilderFactory = createDocumentBuilderFactory();
+ schema = createSchema(xsd);
+ }
+
+ /**
+ * Processes the messsage, extracting the payload and validating the xml against the
+ * configured schema.
+ *
+ * @param message The esb Message object.
+ * @return Message The esb Message unmodified.
+ *
+ * @throws ActionProcessingException If a exception occurs while trying to validate
+ *
+ */
+ public Message process(final Message message) throws ActionProcessingException
+ {
+ validate(extractXmlFromPayload(message));
+ return message;
+ }
+
+ private void validate(final String xml) throws ActionProcessingException
+ {
+ final DOMResult result = new DOMResult();
+ try
+ {
+ final Validator validator = schema.newValidator();
+ validator.validate(createDomSourceFromPayload(xml), result);
+ }
+ catch (final SAXException e)
+ {
+ final String errorMsg = "SAXExcption while trying to validate against schema '" + xsd + "'";
+ log.error(errorMsg, e);
+ throw new ValidationException(errorMsg, e, result);
+ }
+ catch (IOException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ }
+
+ private String extractXmlFromPayload(final Message message) throws ActionProcessingException
+ {
+ Object payload;
+ try
+ {
+ payload = payloadProxy.getPayload(message);
+ }
+ catch (final MessageDeliverException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+
+ if (payload instanceof byte[])
+ {
+ return new String((byte[]) payload);
+ }
+ else if (payload instanceof String)
+ {
+ return (String) payload;
+ }
+ else
+ {
+ throw new ActionProcessingException("Message payload must be either a byte[] or a String. The payload type was '" + payload.getClass().getName() + "'");
+ }
+ }
+
+ /**
+ * Returns a DOMSource from the passed in xml String.
+ *
+ * @param xml The xml payload.
+ * @return DOMSource The {@link DOMSource} representation of the passed in xml.
+ *
+ * @throws ActionProcessingException If an exception occurs while trying to create the DOMSource.
+ */
+ private DOMSource createDomSourceFromPayload(final String xml) throws ActionProcessingException
+ {
+ try
+ {
+ final DocumentBuilder parser = docBuilderFactory.newDocumentBuilder();
+ final Document document = parser.parse(new ByteArrayInputStream(xml.getBytes()));
+ return new DOMSource(document);
+ }
+ catch (final ParserConfigurationException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ catch (final SAXException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ catch (final IOException e)
+ {
+ throw new ActionProcessingException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Creates a Validator instance which will be used for schema validation.
+ *
+ * @param xsd The schema to validate against.
+ * @return Validator The Validator instance.
+ *
+ * @throws ConfigurationException Is an exception is thrown while trying to create the schema.
+ */
+ private Schema createSchema(final String xsd) throws ConfigurationException
+ {
+ final SchemaFactory schemafactory = SchemaFactory.newInstance(schemaLanguage);
+ try
+ {
+ return schemafactory.newSchema(new StreamSource(ClassUtil.getResourceAsStream(xsd, getClass())));
+ }
+ catch (final SAXException e)
+ {
+ throw new ConfigurationException("Could not create a validator for schema '" + xsd + "'", e);
+ }
+ }
+
+ /**
+ * Creates a DocumentBuilderFactory that is namespace aware.
+ *
+ * @return {@link DocumentBuilderFactory} that is namespace aware.
+ */
+ private DocumentBuilderFactory createDocumentBuilderFactory()
+ {
+ final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+ return docBuilderFactory;
+ }
+}
Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/ValidationException.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/ValidationException.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/validation/ValidationException.java 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,31 @@
+package org.jboss.soa.esb.actions.validation;
+
+import javax.xml.transform.dom.DOMResult;
+
+import org.jboss.soa.esb.actions.ActionProcessingException;
+
+/**
+ * Validation exception extends ActionProcessingExcption and
+ * adds a constructor that takes a {@link DOMResult}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ */
+public class ValidationException extends ActionProcessingException
+{
+ private static final long serialVersionUID = 1L;
+
+ private DOMResult domResult;
+
+ public ValidationException(final String message, final Throwable cause, final DOMResult domResult)
+ {
+ super(message, cause);
+ this.domResult = domResult;
+ }
+
+ public DOMResult getDomResult()
+ {
+ return domResult;
+ }
+
+
+}
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/SchemaValidationActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/SchemaValidationActionUnitTest.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/SchemaValidationActionUnitTest.java 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.validation;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import javax.xml.transform.dom.DOMResult;
+import junit.framework.JUnit4TestAdapter;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.junit.Test;
+
+
+/**
+ * Unit test for {@link SchemaValidationAction}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class SchemaValidationActionUnitTest
+{
+ private String xsdFileName = "test.xsd";
+
+ @Test
+ public void process() throws ActionProcessingException, ConfigurationException, UnsupportedEncodingException
+ {
+ process("test.xml");
+ }
+
+ @Test
+ public void processInvalidXml() throws ActionProcessingException, ConfigurationException, UnsupportedEncodingException
+ {
+ try
+ {
+ process("test-invalid.xml");
+ }
+ catch (final Exception e)
+ {
+ assertTrue(e instanceof ValidationException);
+ ValidationException validationException = (ValidationException) e;
+ DOMResult domResult = validationException.getDomResult();
+ assertNotNull(domResult);
+ }
+ }
+
+ private void process(final String xmlFileName) throws ConfigurationException, ActionProcessingException
+ {
+ final ConfigTree config = createConfiguration(xsdFileName);
+ final SchemaValidationAction action = new SchemaValidationAction(config);
+ final Message message = MessageFactory.getInstance().getMessage();
+ final byte[] xml = StreamUtils.readStream(getClass().getResourceAsStream(xmlFileName));
+ message.getBody().add(xml);
+
+ action.process(message);
+ }
+
+ private ConfigTree createConfiguration(final String xsdPath)
+ {
+ final ConfigTree config = new ConfigTree("junittest");
+ config.setAttribute("schema", xsdPath);
+ return config;
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(SchemaValidationActionUnitTest.class);
+ }
+}
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test-invalid.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test-invalid.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test-invalid.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<shiporder orderid="889923" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shiporder.xsd">
+ <orderperson>John Smith</orderperson>
+ <shipto>
+ <name>Ola Nordmann</name>
+ <address>Langgt 23</address>
+ <city>4000 Stavanger</city>
+ <country>Norway</country>
+ </shipto>
+ <item>
+ <title>Empire Burlesque</title>
+ <note>Special Edition</note>
+ <quantity>-1</quantity>
+ <price>10.90</price>
+ </item>
+ <item>
+ <title>Hide your heart</title>
+ <quantity>1</quantity>
+ <price>9.90</price>
+ </item>
+</shiporder>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xml (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<shiporder orderid="889923" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shiporder.xsd">
+ <orderperson>John Smith</orderperson>
+ <shipto>
+ <name>Ola Nordmann</name>
+ <address>Langgt 23</address>
+ <city>4000 Stavanger</city>
+ <country>Norway</country>
+ </shipto>
+ <item>
+ <title>Empire Burlesque</title>
+ <note>Special Edition</note>
+ <quantity>1</quantity>
+ <price>10.90</price>
+ </item>
+ <item>
+ <title>Hide your heart</title>
+ <quantity>1</quantity>
+ <price>9.90</price>
+ </item>
+</shiporder>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xsd
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xsd (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/validation/test.xsd 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="shiporder">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="orderperson" type="xs:string" />
+ <xs:element name="shipto">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="address" type="xs:string" />
+ <xs:element name="city" type="xs:string" />
+ <xs:element name="country" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="xs:string" />
+ <xs:element name="note" type="xs:string" minOccurs="0" />
+ <xs:element name="quantity" type="xs:positiveInteger" />
+ <xs:element name="price" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="orderid" type="xs:string" use="required" />
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/build.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,45 @@
+<project name="Quickstart_schema_validation" default="run" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="test.xsd"/>
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+
+
+ <target name="runtest" depends="compile"
+ description="sends a JMS message to queue/quickstart_helloworld_Request_gw">
+ <echo>Runs Test JMS Sender</echo>
+ <loadfile property="payload">
+ <file file="test.xml"/>
+ </loadfile>
+ <echo>Going to send:</echo>
+ <echo>${payload}</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.schemavalidation.test.SendJMSMessage" failonerror="true">
+ <arg value="${payload}"/>
+ <classpath refid="exec-classpath"/>
+ </java>
+ </target>
+
+ <target name="sendesb" depends="compile"
+ description="Will send an esb Message">
+ <echo>Runs Test ESB Message Sender</echo>
+ <loadfile property="payload">
+ <file file="test.xml"/>
+ </loadfile>
+ <echo>Going to send:</echo>
+ <echo>${payload}</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.schemavalidation.test.SendEsbMessage" failonerror="true">
+ <arg value="ValidationServiceESB"/>
+ <arg value="ValidationListener"/>
+ <arg value="${payload}"/>
+ <classpath refid="exec-classpath"/>
+ </java>
+ </target>
+
+</project>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/deployment.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,4 @@
+<jbossesb-deployment>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_schemavalidation_Request_esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_schemavalidation_Request_gw</depends>
+</jbossesb-deployment>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbm-queue-service.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_schemavalidation_Request_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_schemavalidation_Request_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbmq-queue-service.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_schemavalidation_Request_esb">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_schemavalidation_Request_gw">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jboss-esb.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,39 @@
+<?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">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_schemavalidation_Request_gw" />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_schemavalidation_Request_esb"/>
+ </jms-bus>
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="ValidationServiceESB" name="ValidationListener" description="Hello World">
+ <listeners>
+ <jms-listener name="JMS-Gateway" busidref="quickstartGwChannel" is-gateway="true"/>
+ <jms-listener name="helloWorld" busidref="quickstartEsbChannel"/>
+ </listeners>
+ <actions mep="OneWay">
+
+ <action name="debug" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="printfull" value="false"/>
+ </action>
+
+ <action name="validate" class="org.jboss.soa.esb.actions.validation.SchemaValidationAction">
+ <property name="schema" value="/test.xsd"/>
+ </action>
+
+ <!-- The next action is for Continuous Integration testing -->
+ <action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+ </actions>
+ </service>
+
+ </services>
+
+</jbossesb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jbossesb-properties.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ <property name="jboss.esb.invm.scope.default" value="NONE"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/jndi.properties 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/juddi.properties 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/log4j.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A size based file rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="./listener.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="quickstart">
+ <priority value="DEBUG"/>
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/readme.txt 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,34 @@
+Overview:
+=========
+ The purpose of the schema_validation quickstart sample is to demonstrate
+ how the SchemaValidationAction can be used for validatin an xml payload
+ agains a schema.
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+ and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run standalone mode:
+=======================
+ 1. In a command terminal window in the quickstart folder type
+ 'ant deploy-jms-dests'.
+ 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
+ 3. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 4. Switch back to "Window1" to see the output from the ESB
+ 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
+ ("Window1"), type 'ant undeploy-jms-dests'.
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 3. Switch back to Application Server console to see the output from the ESB
+ 4. In this folder ("Window1"), type 'ant undeploy'.
+
+Things to try:
+=============
+ 1. Try to update the text.xml. Try specifying a negative value for the quantity
+ element. You can look the text.xsd to see the schema for the test.xml
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendEsbMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendEsbMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendEsbMessage.java 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.soa.esb.samples.quickstart.schemavalidation.test;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.client.ServiceInvoker;
+
+/**
+ * Standalone class with to send ESB messages to a 'known' [category,name].
+ * <p/> arg0 - service category
+ * <br/>arg1 - service name
+ * <br/>arg2 - Text of message to send
+ *
+ * @author <a href="mailto:schifest at heuristica.com.ar">schifest at heuristica.com.ar</a>
+ * @since Version 4.0
+ *
+ */
+public class SendEsbMessage
+{
+ public static void main(String args[]) throws Exception
+ {
+// Setting the ConnectionFactory such that it will use scout
+ System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
+
+ if (args.length < 3)
+ {
+ System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
+ }
+
+ Message esbMessage = MessageFactory.getInstance().getMessage();
+
+ esbMessage.getBody().add(args[2]);
+
+ new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
+
+ }
+
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/src/org/jboss/soa/esb/samples/quickstart/schemavalidation/test/SendJMSMessage.java 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,87 @@
+/*
+ * 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,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.schemavalidation.test;
+
+import java.util.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+
+ public void setupConnection() throws JMSException, NamingException
+ {
+ Properties properties1 = new Properties();
+ properties1.put(Context.INITIAL_CONTEXT_FACTORY,
+ "org.jnp.interfaces.NamingContextFactory");
+ properties1.put(Context.URL_PKG_PREFIXES,
+ "org.jboss.naming:org.jnp.interfaces");
+ properties1.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
+ InitialContext iniCtx = new InitialContext(properties1);
+
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/quickstart_schemavalidation_Request_gw");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+
+ send.send(tm);
+ send.close();
+ }
+
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ sm.sendAMessage(args[0]);
+ sm.stop();
+
+ }
+
+}
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xml 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<shiporder orderid="889923" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shiporder.xsd">
+ <orderperson>John Smith</orderperson>
+ <shipto>
+ <name>Ola Nordmann</name>
+ <address>Langgt 23</address>
+ <city>4000 Stavanger</city>
+ <country>Norway</country>
+ </shipto>
+ <item>
+ <title>Empire Burlesque</title>
+ <note>Special Edition</note>
+ <quantity>1</quantity>
+ <price>10.90</price>
+ </item>
+ <item>
+ <title>Hide your heart</title>
+ <quantity>1</quantity>
+ <price>9.90</price>
+ </item>
+</shiporder>
Added: labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xsd
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xsd (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/schema_validation/test.xsd 2008-12-02 21:24:15 UTC (rev 24219)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="shiporder">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="orderperson" type="xs:string" />
+ <xs:element name="shipto">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="address" type="xs:string" />
+ <xs:element name="city" type="xs:string" />
+ <xs:element name="country" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="xs:string" />
+ <xs:element name="note" type="xs:string" minOccurs="0" />
+ <xs:element name="quantity" type="xs:positiveInteger" />
+ <xs:element name="price" type="xs:decimal" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="orderid" type="xs:string" use="required" />
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
More information about the jboss-svn-commits
mailing list