[jboss-svn-commits] JBL Code SVN: r23322 - in labs/jbossesb/workspace/skeagh: api/routing and 16 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 6 08:14:55 EDT 2008
Author: beve
Date: 2008-10-06 08:14:55 -0400 (Mon, 06 Oct 2008)
New Revision: 23322
Added:
labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/JmsClient.java
labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jndi.properties
labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/log4j.xml
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/log4j.xml
Modified:
labs/jbossesb/workspace/skeagh/api/routing/osgi.bnd
labs/jbossesb/workspace/skeagh/commons/osgi.bnd
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/xml/XsdDOMValidator.java
labs/jbossesb/workspace/skeagh/examples/helloworld/README.TXT
labs/jbossesb/workspace/skeagh/examples/helloworld/osgi.bnd
labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml
labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java
labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jboss-esb.xml
labs/jbossesb/workspace/skeagh/examples/helloworld/src/test/resources/log4j.xml
labs/jbossesb/workspace/skeagh/examples/pom.xml
labs/jbossesb/workspace/skeagh/pom.xml
labs/jbossesb/workspace/skeagh/routing/jms/osgi.bnd
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java
labs/jbossesb/workspace/skeagh/runtime/osgi.bnd
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DefaultConfigurationDigester.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties
Log:
Updated osgi configurations.
Updated helloworld example so that is now runs(note that this will be an exception about the internal topic not being bound)
Modified: labs/jbossesb/workspace/skeagh/api/routing/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/api/routing/osgi.bnd 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/api/routing/osgi.bnd 2008-10-06 12:14:55 UTC (rev 23322)
@@ -2,4 +2,4 @@
# Use this file to add customized Bnd instructions for the bundle
#-----------------------------------------------------------------
-Export-Package: org.jboss.esb.routing.*
+Export-Package: org.jboss.esb.routing.*;include:="InboundRouter,MessageDispatcher,OutboundRouter,RoutingException"
Modified: labs/jbossesb/workspace/skeagh/commons/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/osgi.bnd 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/commons/osgi.bnd 2008-10-06 12:14:55 UTC (rev 23322)
@@ -3,11 +3,12 @@
#-----------------------------------------------------------------
Export-Package: org.jboss.esb.classpath,\
-org.jboss.esb.jms,\
+org.jboss.esb.jms;include:="AbstractMessageHandler,AbstractMessageListener,JMSSession,MessageSender,MockMessageListener,StreamMessageInputStream",\
org.jboss.esb.lifecycle,\
org.jboss.esb.properties,\
org.jboss.esb.util,\
org.jboss.esb.xml
+#Fragment-Host: jboss.jbossesb.jbossesb-rt
DynamicImport-Package: *
Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -23,6 +23,9 @@
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+
+import org.apache.log4j.Logger;
+
import java.util.Properties;
/**
@@ -32,6 +35,7 @@
*/
public abstract class JNDIUtil
{
+ private static Logger log = Logger.getLogger(JNDIUtil.class);
/**
* Private default constructor.
*/
@@ -51,19 +55,33 @@
public static Context getNamingContext(final Properties jndiProperties) throws JMSException
{
Context context;
-
+ /*
+ * Storing the context classloader which will be reset after usage.
+ * This was needed to force our current impl to work nicely with OSGi.
+ * TODO: Revisit and update when our OSGi strategy has been set/Dan
+ */
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
try
{
- context = new InitialContext(jndiProperties);
+ Thread.currentThread().setContextClassLoader(JNDIUtil.class.getClassLoader());
+ try
+ {
+ context = jndiProperties.isEmpty() ? new InitialContext() : new InitialContext(jndiProperties);
+ }
+ catch (NamingException e)
+ {
+ log.error("NamingException while try to create initialContext. jndiProperties are " + jndiProperties, e);
+ throw new JMSException("Failed to load InitialContext: " + jndiProperties);
+ }
+ if (context == null)
+ {
+ throw new JMSException("Failed to create JNDI context. Check that '" + Context.PROVIDER_URL + "', '" + Context.INITIAL_CONTEXT_FACTORY + "', '" + Context.URL_PKG_PREFIXES + "' are correctly configured in the supplied JNDI properties.");
+ }
}
- catch (NamingException e)
+ finally
{
- throw new JMSException("Failed to load InitialContext: " + jndiProperties);
+ Thread.currentThread().setContextClassLoader(loader);
}
- if (context == null)
- {
- throw new JMSException("Failed to create JNDI context. Check that '" + Context.PROVIDER_URL + "', '" + Context.INITIAL_CONTEXT_FACTORY + "', '" + Context.URL_PKG_PREFIXES + "' are correctly configured in the supplied JNDI properties.");
- }
return context;
}
Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/xml/XsdDOMValidator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/xml/XsdDOMValidator.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/xml/XsdDOMValidator.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -140,6 +140,37 @@
}
/**
+ * Duplicate of validate but takes a class that is the caller that should
+ * be used to retrieve the xsd.
+ * This was added to force our current impl to work with OSGi
+ *
+ * TODO: Revist this solution and remove duplicated code after our
+ * OSGi strategy is set. /Dan
+ *
+ * @param caller - the class that should be used for searching the classpath
+ * @throws SAXException Validation error.
+ * @throws java.io.IOException Error reading the XSD Sources.
+ */
+ public final void validate(final Class<?> caller) throws SAXException, IOException
+ {
+ // Using the namespace URI list, create the XSD Source array used to
+ // create the merged Schema instance...
+ Source[] xsdSources = new Source[namespaces.size()];
+ for (int i = 0; i < namespaces.size(); i++)
+ {
+ xsdSources[i] = getNamespaceSource(namespaces.get(i), caller);
+ }
+
+ // Create the merged Schema instance and from that, create the Validator instance...
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = schemaFactory.newSchema(xsdSources);
+ Validator validator = schema.newValidator();
+
+ // Validate the document...
+ validator.validate(new DOMSource(document));
+ }
+
+ /**
* Get the default namespace associated with the supplied element.
*
* @param element The element to be checked.
@@ -186,4 +217,29 @@
return new StreamSource(xsdStream);
}
+
+ /**
+ * Duplicate of getNamespaceSource with the addition of the ability to specify
+ * a caller class. This class will be used to for searching the classpath
+ *
+ * TODO: Revist this solution and remove duplicated code after our
+ * OSGi strategy is set. /Dan
+ *
+ * @param namespace The namespace URI.
+ * @param caller - the class that should be used for searching the classpath
+ * @return The XSD Schema Source.
+ * @throws SAXException Unable to get XSD Schema Source.
+ */
+ private Source getNamespaceSource(final URI namespace, final Class<?> caller) throws SAXException
+ {
+ String resourcePath = "/META-INF" + namespace.getPath();
+ InputStream xsdStream = ClassUtil.getResourceAsStream(resourcePath, caller);
+
+ if (xsdStream == null)
+ {
+ throw new SAXException("Failed to locate XSD resource '" + resourcePath + "' on classpath. Namespace: '" + namespace + "'.");
+ }
+
+ return new StreamSource(xsdStream);
+ }
}
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/README.TXT
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/README.TXT 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/README.TXT 2008-10-06 12:14:55 UTC (rev 23322)
@@ -10,6 +10,9 @@
2. Maven 2.x (http://maven.apache.org/download.html)
Running:
- 1. run "mvn activemq:run".
+ 1. run "mvn activemq:run". This starts the JMS Provider.
2. Open a new console window ("Window 2")
- 3. run "mvn clean install pax:provision"
+ 3. run "mvn clean install pax:provision". This starts the OSGi container and deploy the ESB.
+ 4. Open a new console window ("Window 3")
+ 3. run "mvn exec:java". This publishes a JMS Message to the JMS Queue that will trigger the ESB process.
+
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/osgi.bnd 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/osgi.bnd 2008-10-06 12:14:55 UTC (rev 23322)
@@ -1,11 +1,11 @@
#-----------------------------------------------------------------
# Use this file to add customized Bnd instructions for the bundle
#-----------------------------------------------------------------
-Export-Package: org.jboss.esb.examples.*
-Import-Package: *;resolution:=optional
+Export-Package: org.jboss.esb.examples.*,org.apache.activemq.*, org.apache.log4j.*, javax.jms.*
+Import-Package: *;resolution:=optional,*
Bundle-Activator: org.jboss.esb.examples.helloworld.HelloworldActivator
-Embed-Dependency: log4j;scope=compile|runtime, activemq-core;scope=compile|runtime, jms;scope=compile|runtime, mx4j;scope=compile|runtime, mx4j-tools
+Embed-Dependency: log4j;scope=compile|runtime, activemq-core;scope=compile|runtime, jms;scope=compile|runtime, mx4j;scope=compile|runtime, mx4j-tools, backport-util-concurrent, commons-logging, geronimo-j2ee-management_1.1_spec
Embed-Transitive: true
DynamicImport-Package: *
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -4,7 +4,7 @@
<parent>
<groupId>jboss.jbossesb</groupId>
<artifactId>examples</artifactId>
- <version>5.0-SNAPSHOT</version>
+ <version>${jboss.esb.version}</version>
</parent>
<name>JBoss ESB - Helloworld Example</name>
<groupId>jboss.jbossesb</groupId>
@@ -14,7 +14,7 @@
<packaging>bundle</packaging>
<properties>
- <felix.log.level>4</felix.log.level>
+ <felix.log.level>1</felix.log.level><!-- 4=debug -->
</properties>
<build>
@@ -28,6 +28,18 @@
<fork>false</fork>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <configuration>
+ <executable>java</executable>
+ <mainClass>org.jboss.esb.examples.JmsClient</mainClass>
+ <arguments>
+ <argument>jbossesb.TestQueue</argument>
+ <argument>Message payload text...</argument>
+ </arguments>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -62,32 +74,36 @@
<artifactId>mx4j-tools</artifactId>
<version>3.0.1</version>
</dependency>
-
- <dependency>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-routing-jms</artifactId>
- <version>5.0-SNAPSHOT</version>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
+ <version>1.0-M1</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-routing-jms</artifactId>
+ <version>${jboss.esb.version}</version>
</dependency>
-
- <dependency>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-api-service</artifactId>
- <version>5.0-SNAPSHOT</version>
- </dependency>
-
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-api-service</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
<dependency>
<groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-api-routing</artifactId>
- <version>5.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>jboss.jbossesb</groupId>
<artifactId>jbossesb-commons</artifactId>
- <version>5.0-SNAPSHOT</version>
- </dependency>
-
+ <version>${jboss.esb.version}</version>
+ </dependency>
</dependencies>
-
</project>
Added: labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/JmsClient.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/JmsClient.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/JmsClient.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -0,0 +1,141 @@
+/*
+ * 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.esb.examples;
+
+import java.util.Arrays;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * Client that post a message to a JMS destination.
+ * <p/>
+ * Usage:
+ * java org.jboss.esb.examples.JmsClient destination "Message content goes here"
+ *
+ * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
+ *
+ */
+public final class JmsClient
+{
+ /**
+ * Private constructor.
+ */
+ private JmsClient()
+ {
+ }
+
+ /**
+ * Main method.
+ *
+ * @param args - the arguments from the command line. See class javadoc for usage
+ */
+ public static void main(final String... args)
+ {
+ if (args.length != 2)
+ {
+ printUsage();
+ System.exit(-1);
+ }
+
+ final String destinationName = args[0];
+ final String payload = args[1];
+
+ try
+ {
+ sendMessage(payload, destinationName);
+ }
+ catch (final JMSException e)
+ {
+ e.printStackTrace();
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ *
+ * @param payload - the payload to send
+ * @param destinationName - the jms destination to send to
+ * @throws JMSException - is a JMS exception is thrown
+ * @throws NamingException - if a JNDI lookup failes
+ */
+ private static void sendMessage(final String payload, final String destinationName) throws JMSException, NamingException
+ {
+ QueueConnection qConnection = null;
+ QueueSession qSession = null;
+ try
+ {
+ System.out.println("Sending payload [" + payload + "] to [" + destinationName + "]");
+
+ final InitialContext ctx = new InitialContext();
+
+ QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
+ qConnection = factory.createQueueConnection();
+ qConnection.start();
+
+ qSession = qConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ final TextMessage textMessage = qSession.createTextMessage(payload);
+
+ MessageProducer producer = qSession.createProducer((Destination)ctx.lookup(destinationName));
+ producer.send(textMessage);
+ }
+ finally
+ {
+ if (qSession != null)
+ {
+ qSession.close();
+ }
+ if (qConnection != null)
+ {
+ qConnection.close();
+ }
+ }
+ }
+
+ /**
+ * Simple prints the usage of this class.
+ *
+ * @param args - the arguments that were passed from the command line
+ */
+ private static void printUsage(final String... args)
+ {
+ System.err.println("*****************************************************************************");
+ System.err.println("Usage: ");
+ System.err.println("java org.jboss.esb.examples.JmsClient destination \"Message content goes here\"");
+ System.err.println("");
+ System.err.println("Arguments provided:");
+ System.err.println(Arrays.asList(args));
+ System.err.println("*****************************************************************************");
+ }
+
+}
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/java/org/jboss/esb/examples/helloworld/MyTestService.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -34,6 +34,7 @@
public Message process(Message message) throws ServiceException
{
+ System.out.println("MyTestService message payload : " + message.getPayload());
MyTestService.message = message;
return message;
}
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jboss-esb.xml 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jboss-esb.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -1,9 +1,9 @@
<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<routing>
- <inRouters serviceCategory="service-cat" serviceName="service-a">
+ <inRouters serviceCategory="examples" serviceName="helloworld">
<inRouter name="inrouter1" class="org.jboss.esb.jms.JmsInboundRouter">
- <property name="java.naming.provider.url">tcp://localhost:61717</property>
+ <property name="java.naming.provider.url">tcp://danbev-laptop:61717</property>
<property name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</property>
<property name="jmsDestination">jbossesb.TestQueue</property>
<property name="queue.jbossesb.TestQueue">jbossesb.TestQueue</property>
Added: labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jndi.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jndi.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/jndi.properties 2008-10-06 12:14:55 UTC (rev 23322)
@@ -0,0 +1,17 @@
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:61717
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.jbossesb.TestQueue = jbossesb.TestQueue
+
+
+queue.jbossesb.jms.bus = jbossesb.jms.bus
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+topic.jbossesb.deployment.coordintation.topic = jbossesb.deployment.coordintation.topic
Added: labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/src/main/resources/log4j.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | 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">
+ <param name="Target" value="System.out"/>
+
+ <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>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.milyn">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.quartz">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.jboss.esb">
+ <priority value="debug"/>
+ </category>
+
+ <category name="org.jboss.esb.examples.helloworld">
+ <priority value="info"/>
+ </category>
+
+ <category name="org.apache.activemq">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
+
Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/src/test/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/src/test/resources/log4j.xml 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/src/test/resources/log4j.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -31,7 +31,7 @@
<!-- Limit categories -->
<category name="org.milyn">
- <priority value="info"/>
+ <priority value="error"/>
</category>
<category name="org.quartz">
Modified: labs/jbossesb/workspace/skeagh/examples/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/pom.xml 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/examples/pom.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -6,13 +6,13 @@
<parent>
<groupId>jboss.jbossesb</groupId>
<artifactId>jbossesb</artifactId>
- <version>5.0-SNAPSHOT</version>
+ <version>5.0-SNAPSHOT</version>
</parent>
<groupId>jboss.jbossesb</groupId>
<artifactId>examples</artifactId>
<packaging>pom</packaging>
- <version>5.0-SNAPSHOT</version>
+ <version>${jboss.esb.version}</version>
<name>JBoss ESB Examples Modules (Base POM)</name>
@@ -26,15 +26,8 @@
<dependency>
<groupId>jboss.jbossesb</groupId>
<artifactId>jbossesb-rt</artifactId>
- <version>5.0-SNAPSHOT</version>
+ <version>${jboss.esb.version}</version>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-testutil</artifactId>
- <version>5.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
</dependencies>
-
</project>
Modified: labs/jbossesb/workspace/skeagh/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/pom.xml 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/pom.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -26,7 +26,7 @@
<module>api</module>
<module>runtime</module>
<module>routing</module>
- <!-- module>examples</module -->
+ <module>examples</module>
</modules>
<dependencies>
Modified: labs/jbossesb/workspace/skeagh/routing/jms/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/osgi.bnd 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/routing/jms/osgi.bnd 2008-10-06 12:14:55 UTC (rev 23322)
@@ -5,3 +5,4 @@
Export-Package: org.jboss.esb.jms.*
Import-Package: *;resolution:=optional
+DynamicImport-Package: *
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -20,25 +20,25 @@
*/
package org.jboss.esb.jms;
+import static org.jboss.esb.jms.JmsConstants.CONNECTION_FACTORY;
+
+import java.util.Properties;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.naming.Context;
+
import org.apache.log4j.Logger;
import org.jboss.esb.annotations.Initialize;
import org.jboss.esb.annotations.Property;
-import org.jboss.esb.annotations.Property.Use;
import org.jboss.esb.annotations.Uninitialize;
-import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.annotations.Property.Use;
import org.jboss.esb.context.InvocationContext;
-import static org.jboss.esb.jms.JmsConstants.CONNECTION_FACTORY;
import org.jboss.esb.message.Message;
import org.jboss.esb.routing.InboundRouter;
import org.jboss.esb.routing.MessageDispatcher;
import org.jboss.esb.routing.RoutingException;
-import org.jboss.esb.service.ServiceName;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.naming.Context;
-import java.util.Properties;
-
/**
* Inbound router for JMS.
* <br><br>
@@ -77,26 +77,8 @@
private MessageDispatcher dispatcher;
/**
- * Deployment context.
+ * JMS destination name. The destination that this router listenes to.
*/
- @SuppressWarnings("unused")
- private DeploymentContext deploymentContext;
-
- /**
- * The name of this object ('name' attribute from config).
- */
- @SuppressWarnings("unused")
- private String objectName;
-
- /**
- * The service name of this service.
- */
- @SuppressWarnings("unused")
- private ServiceName serviceName;
-
- /**
- * JMS destination name.
- */
@Property(use = Use.REQUIRED, name = "jmsDestination")
private String destination;
@@ -107,7 +89,7 @@
private final Properties jmsProperties = getDefaultProperties();
/**
- * Should JMSHeaders and user properties be extrated from the JMS Message.
+ * Should JMSHeaders and user properties be extracted from the JMS Message.
*/
@Property(use = Use.OPTIONAL, defaultVal = "true")
private boolean extractProperties;
@@ -116,6 +98,7 @@
* The JMS Session on which the listener is created.
*/
private JMSSession jmsSession;
+
/**
* JmsMessageListener that takes care of the JMS connection.
*/
@@ -129,10 +112,8 @@
@Initialize
public final void initialize() throws JMSException
{
- log.debug("JMSProperties : " + jmsProperties + "," + destination);
-
// add this class as a JMS message listener...
- Destination jmsDestination = AbstractMessageHandler.lookupDestination(destination, jmsProperties);
+ final Destination jmsDestination = AbstractMessageHandler.lookupDestination(destination, jmsProperties);
jmsSession = new JMSSession(jmsDestination.getClass(), jmsProperties);
jmsSession.connect();
try
@@ -172,7 +153,6 @@
jmsSession.close();
}
}
-
}
/**
@@ -226,9 +206,7 @@
final Properties defaults = new Properties();
// Defaults for JNDI lookup
defaults.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
- defaults.put(Context.URL_PKG_PREFIXES, "org.jboss.naming,org.jnp.interfaces");
defaults.put(Context.PROVIDER_URL, "jnp://localhost:1099");
- defaults.put(CONNECTION_FACTORY, "ConnectionFactory");
return defaults;
}
@@ -270,15 +248,16 @@
{
try
{
- Message esbMessage = JmsInformationExtractor.extractPayload(jmsMessage);
+ final Message esbMessage = JmsInformationExtractor.extractPayload(jmsMessage);
+ log.info(esbMessage);
final InvocationContext context = new InvocationContext();
if (extractProperties)
{
- Properties properties = JmsInformationExtractor.extractJmsProperties(jmsMessage);
- context.setContextObject(JmsConstants.PROPERTIES, properties);
+ context.setContextObject(JmsConstants.PROPERTIES, JmsInformationExtractor.extractJmsProperties(jmsMessage));
log.debug(context.getContextObject(JmsConstants.PROPERTIES));
}
+
dispatcher.dispatch(esbMessage, context);
}
catch (RoutingException e)
@@ -292,5 +271,4 @@
}
}
}
-
}
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/JmsInboundRouterTest.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -34,6 +34,7 @@
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.Properties;
+import java.util.concurrent.TimeUnit;
/**
* Test for {@link JmsInboundRouter}.
@@ -68,7 +69,7 @@
runtime.deploy();
try
{
- Thread.sleep(3000);
+ TimeUnit.SECONDS.sleep(3);
sendMessage(messageContent, DESTINATION_NAME);
}
finally
@@ -89,7 +90,7 @@
runtime.deploy();
try
{
- Thread.sleep(3000);
+ TimeUnit.SECONDS.sleep(3);
sendMessage(messageContent, DESTINATION_NAME);
}
finally
Modified: labs/jbossesb/workspace/skeagh/runtime/osgi.bnd
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/osgi.bnd 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/runtime/osgi.bnd 2008-10-06 12:14:55 UTC (rev 23322)
@@ -5,17 +5,16 @@
org.jboss.esb.dispatch.*,\
org.jboss.esb.failure.*,\
org.jboss.esb.federate.*,\
-org.jboss.esb.history.*,\
org.jboss.esb.routing.*,\
+org.jboss.esb.history.*,\
org.jboss.esb.schedule.*,\
org.jboss.esb.serialization.*,\
org.jboss.esb.test.*,\
-org.apache.log4j.*
Import-Package: *;resolution:=optional
-Embed-Dependency: *;scope=compile|runtime;artifactId=!xercesImpl|jbossesb-api-service|jbossesb-api-routing|jbossesb-commons;inline=false
+Embed-Dependency: *;scope=compile|runtime;artifactId=!xercesImpl|jbossesb-api-service|jbossesb-api-routing|jbossesb-commons|log4j;inline=false
Embed-Transitive: true
-DynamicImport-Package: *
+DynamicImport-Package: org.jboss.esb.examples.*, *
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DefaultConfigurationDigester.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DefaultConfigurationDigester.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DefaultConfigurationDigester.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -116,7 +116,12 @@
}
try
{
- validator.validate();
+ /*
+ * Modified to use this class as the caller to force this to work
+ * as an osgi bundle.
+ * TODO: revisit this and our osgi strategy as a whole.
+ */
+ validator.validate(getClass());
} catch (IOException e)
{
throw new DeploymentException("Error reading configuration schemas.", e);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java 2008-10-06 12:14:55 UTC (rev 23322)
@@ -182,19 +182,33 @@
private static Smooks getSmooksInstance(final Element element) throws IOException, SAXException
{
Smooks smooks = new Smooks();
- Set<URI> namespaces = new LinkedHashSet<URI>();
+ /*
+ * Storing the context classloader which will be reset after usage.
+ * This was needed to force our current impl to work nicely with OSGi.
+ * TODO: Revisit and update when our OSGi strategy has been set/Dan
+ */
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(DigestUtil.class.getClassLoader());
+ Set<URI> namespaces = new LinkedHashSet<URI>();
- XMLParseUtils.gatherElementNamespaces(element, namespaces);
+ XMLParseUtils.gatherElementNamespaces(element, namespaces);
- for (URI namespace : namespaces)
- {
- SmooksResourceConfigurationList configList = getNamespaceConfig(namespace);
+ for (URI namespace : namespaces)
+ {
+ SmooksResourceConfigurationList configList = getNamespaceConfig(namespace);
- if (configList != null)
- {
- smooks.getApplicationContext().getStore().addSmooksResourceConfigurationList(configList);
+ if (configList != null)
+ {
+ smooks.getApplicationContext().getStore().addSmooksResourceConfigurationList(configList);
+ }
}
}
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(loader);
+ }
return smooks;
}
@@ -219,19 +233,8 @@
String resPathString = "/META-INF" + namespace.getPath() + "-smooks.xml";
File resPath = new File(resPathString);
String baseURI = resPath.getParent().replace('\\', '/');
- ClassLoader orgClassLoader = Thread.currentThread().getContextClassLoader();
- InputStream configStream = null;
- try
- {
- Thread.currentThread().setContextClassLoader(DigestUtil.class.getClassLoader());
- configStream = ClassUtil.getResourceAsStream(resPathString, DigestUtil.class);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(orgClassLoader);
- }
+ InputStream configStream = ClassUtil.getResourceAsStream(resPathString, DigestUtil.class);
-
if (configStream != null)
{
try
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties 2008-10-06 12:00:01 UTC (rev 23321)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties 2008-10-06 12:14:55 UTC (rev 23322)
@@ -7,9 +7,11 @@
##########################################################################################
# JNDI Settings...
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jnp.interfaces,org.jnp.interfaces
+#java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+#java.naming.provider.url=jnp://localhost:1099
+#java.naming.factory.url.pkgs=org.jnp.interfaces,org.jnp.interfaces
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:61717
# Bus Queues and Topics...
deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/log4j.xml 2008-10-06 12:14:55 UTC (rev 23322)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | 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">
+ <param name="Target" value="System.out"/>
+
+ <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>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.milyn">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.quartz">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.jboss">
+ <priority value="error"/>
+ </category>
+
+ <category name="org.apache.activemq">
+ <priority value="ERROR"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
+
More information about the jboss-svn-commits
mailing list