[jboss-svn-commits] JBL Code SVN: r22990 - in labs/jbossesb/workspace/skeagh: routing/jms/src/test/resources/META-INF/jbossesb/jms and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Sep 22 10:57:59 EDT 2008
Author: tfennelly
Date: 2008-09-22 10:57:59 -0400 (Mon, 22 Sep 2008)
New Revision: 22990
Added:
labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/jms/
labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/jms/default.properties
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/default.properties
Removed:
labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/busconfig/
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/busconfig/
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/busconfig/
Modified:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/PropertiesUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
Log:
Moved some of the configs around
Added: labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/jms/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/jms/default.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/jms/default.properties 2008-09-22 14:57:59 UTC (rev 22990)
@@ -0,0 +1,20 @@
+###########################################################################################
+# Default JMS bus config for testing.
+#
+# Using ActiveMQ because it's so easy to embed. Apparently JBM v2.0 will also be
+# easy to embed. We might be able to switch to that then!!
+##########################################################################################
+
+# JNDI Settings...
+# NOTE: The JNDI settings in this config file must be the same as those
+# set in the JMSTestRunner class!!
+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
+deployment.bus.queue=jbossesb.jms.bus
+
+# ActiveMQ Queue and Topic deployments...
+topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+queue.jbossesb.jms.bus=jbossesb.jms.bus
Property changes on: labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/jms/default.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-22 14:51:07 UTC (rev 22989)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-22 14:57:59 UTC (rev 22990)
@@ -24,11 +24,13 @@
import org.jboss.esb.annotations.Uninitialize;
import org.jboss.esb.classpath.ClassUtil;
import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.deploy.config.ConfigUtil;
import org.jboss.esb.deploy.config.DeploymentUnit;
import org.jboss.esb.deploy.config.InboundRouterConfig;
import org.jboss.esb.deploy.config.OutboundRouterConfig;
import org.jboss.esb.deploy.config.PropertiesUtil;
import org.jboss.esb.deploy.config.ServiceConfig;
+import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
import org.jboss.esb.dispatch.LocalDispatcher;
import org.jboss.esb.federate.DeploymentCoordinator;
import org.jboss.esb.federate.bus.BusDispatcher;
@@ -37,12 +39,15 @@
import org.jboss.esb.federate.bus.BusRoutingContext;
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.properties.ApplicationProperties;
+import org.jboss.esb.properties.PropertiesIterator;
import org.jboss.esb.schedule.JobScheduler;
import org.jboss.esb.schedule.SimpleSchedule;
import org.jboss.esb.service.Service;
import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
+import java.io.InputStream;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -203,6 +208,7 @@
/**
* Get the DeploymentRumtime instance associated with the supplied
* DeploymentContext.
+ *
* @param deploymentContext The deployment context.
* @return The Deployment Runtime.
*/
@@ -266,10 +272,65 @@
* <p/>
* An example of a "pre-installed" deployment unit would be for a
* Dead Letter service.
+ *
+ * @throw DeploymentException Error processing one of the pre-installed
+ * deployment units.
*/
- private void addPreinstalledDeploymentUnits()
+ private void addPreinstalledDeploymentUnits() throws DeploymentException
{
-
+ try
+ {
+ new PropertiesIterator(deploymentProperties)
+ {
+ DefaultConfigurationDigester digester = new DefaultConfigurationDigester();
+
+ public void processEntry(String unitName, String unitPath) throws DeploymentException
+ {
+ String deploymentCheckPath = "preinstalled/" + ConfigUtil.urlEncode(deploymentName) + "/" + unitPath;
+ String defaultCheckPath = "preinstalled/" + unitPath;
+
+ // Try for a deployment specific configuration...
+ InputStream configStream = ConfigUtil.getConfigStream(deploymentCheckPath);
+ if(configStream != null)
+ {
+ try
+ {
+ add(digester.digest(configStream));
+ return;
+ }
+ catch (IOException e)
+ {
+ throw new DeploymentException("Error processing pre-installed DeploymentUnit '" + deploymentCheckPath + "'.", e);
+ }
+ }
+
+ // Try for a default configuration...
+ configStream = ConfigUtil.getConfigStream(defaultCheckPath);
+ if(configStream != null)
+ {
+ try
+ {
+ add(digester.digest(configStream));
+ return;
+ }
+ catch (IOException e)
+ {
+ throw new DeploymentException("Error processing pre-installed DeploymentUnit '" + deploymentCheckPath + "'.", e);
+ }
+ }
+
+ throw new DeploymentException("Unable to find pre-installed DeploymentUnit '" + unitName + "=" + unitPath + "'.");
+ }
+ }.iterate("unit.");
+ }
+ catch (DeploymentException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Unexpected exception.", e);
+ }
}
/**
@@ -579,6 +640,7 @@
/**
* Create the BusRouting context for the this deployment.
+ *
* @return The Routing context.
*/
public final BusRoutingContext createRoutingContext()
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java 2008-09-22 14:51:07 UTC (rev 22989)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/ConfigUtil.java 2008-09-22 14:57:59 UTC (rev 22990)
@@ -26,6 +26,8 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
/**
* Configuration utilities.
@@ -34,6 +36,10 @@
public abstract class ConfigUtil
{
/**
+ * File dir name for ESB configs.
+ */
+ public static final String BUSCONFIG_FILE_DIR = "busconfig/";
+ /**
* Classpath dir name for ESB configs.
*/
static final String ESBCONFIG_CP_DIR = "/META-INF/jbossesb/";
@@ -50,8 +56,8 @@
* <p/>
* Checks in the following order:
* <ol>
- * <li>File: "<configPath>"</li>
- * <li>Classpath: "/META-INF/busconfig/<configPath>"</li>
+ * <li>File: "busconfig/<configPath>"</li>
+ * <li>Classpath: "/META-INF/jbossesb/<configPath>"</li>
* </ol>
*
* @param configPath The configuration file path.
@@ -60,11 +66,11 @@
*/
public static InputStream getConfigStream(final String configPath) throws DeploymentException
{
- String fileCheckPath = configPath;
+ String fileCheckPath = BUSCONFIG_FILE_DIR + configPath;
String cpCheckPath = ESBCONFIG_CP_DIR + configPath;
InputStream configStream;
- // 1st: Check for a deployment specific config on the local file system...
+ // 1st: Check for a config on the local file system...
File checkFile = new File(fileCheckPath);
if (checkFile.exists() && !checkFile.isDirectory())
{
@@ -78,7 +84,25 @@
}
}
- // 2nd: Check for a deployment specific config on the classpath...
+ // 2nd: Check for a config on the classpath...
return ClassUtil.getResourceAsStream(cpCheckPath, ConfigUtil.class);
}
+
+ /**
+ * URL encode the supplied string.
+ *
+ * @param string The String.
+ * @return The URL encoded string.
+ */
+ public static String urlEncode(final String string)
+ {
+ try
+ {
+ return URLEncoder.encode(string, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new RuntimeException("Unexpected runtime exception. Character encoding 'UTF-8' not supported on runtime VM.");
+ }
+ }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/PropertiesUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/PropertiesUtil.java 2008-09-22 14:51:07 UTC (rev 22989)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/PropertiesUtil.java 2008-09-22 14:57:59 UTC (rev 22990)
@@ -25,8 +25,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
/**
* Deployment properties configuration utility methods.
@@ -43,10 +41,6 @@
* Logger.
*/
private static Logger logger = Logger.getLogger(PropertiesUtil.class);
- /**
- * File dir name for ESB configs.
- */
- private static final String BUSCONFIG_FILE_DIR = "busconfig/";
/**
* Private constructor.
@@ -61,9 +55,9 @@
* Checks in the following order:
* <ol>
* <li>File: "busconfig/<protocol>/default.properties"</li>
- * <li>Classpath: "/META-INF/jbossesb/busconfig/<protocol>/default.properties"</li>
+ * <li>Classpath: "/META-INF/jbossesb/<protocol>/default.properties"</li>
* <li>File: "busconfig/<protocol>/<deploymentName>.properties"</li>
- * <li>Classpath: "/META-INF/jbossesb/busconfig/<protocol>/<deploymentName>.properties"</li>
+ * <li>Classpath: "/META-INF/jbossesb/<protocol>/<deploymentName>.properties"</li>
* </ol>
* The default configuration is overlayed with the deployment specific configuration.
* <p/>
@@ -77,8 +71,8 @@
*/
public static ApplicationProperties getBusConfig(final String protocol, final String deploymentName) throws DeploymentException
{
- String defaultCheckPath = BUSCONFIG_FILE_DIR + protocol + "/" + "default.properties";
- String deploymentCheckPath = BUSCONFIG_FILE_DIR + protocol + "/" + urlEncode(deploymentName) + ".properties";
+ String defaultCheckPath = protocol + "/" + "default.properties";
+ String deploymentCheckPath = protocol + "/" + ConfigUtil.urlEncode(deploymentName) + ".properties";
ApplicationProperties properties;
ApplicationProperties deploymentProperties;
@@ -105,9 +99,9 @@
* <p/>
* Checks in the following order:
* <ol>
- * <li>File: "jbossesb-default.properties"</li>
+ * <li>File: "busconfig/jbossesb-default.properties"</li>
* <li>Classpath: "/META-INF/jbossesb/jbossesb-default.properties"</li>
- * <li>File: "<deploymentName>.properties"</li>
+ * <li>File: "busconfig/<deploymentName>.properties"</li>
* <li>Classpath: "/META-INF/jbossesb/<deploymentName>.properties"</li>
* </ol>
* The default configuration is overlayed with the deployment specific configuration.
@@ -121,7 +115,7 @@
public static ApplicationProperties getDeploymentConfig(final String deploymentName) throws DeploymentException
{
String defaultCheckPath = "jbossesb-default.properties";
- String deploymentCheckPath = urlEncode(deploymentName) + ".properties";
+ String deploymentCheckPath = ConfigUtil.urlEncode(deploymentName) + ".properties";
ApplicationProperties properties;
ApplicationProperties deploymentProperties;
@@ -148,8 +142,8 @@
* <p/>
* Checks in the following order:
* <ol>
- * <li>File: "<configPath>"</li>
- * <li>Classpath: "/META-INF/busconfig/<configPath>"</li>
+ * <li>File: "busconfig/<configPath>"</li>
+ * <li>Classpath: "/META-INF/jbossesb/<configPath>"</li>
* </ol>
*
* @param configPath The configuration file path.
@@ -175,22 +169,4 @@
return null;
}
-
- /**
- * URL encode the supplied string.
- *
- * @param string The String.
- * @return The URL encoded string.
- */
- private static String urlEncode(final String string)
- {
- try
- {
- return URLEncoder.encode(string, "UTF-8");
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException("Unexpected runtime exception. Character encoding 'UTF-8' not supported on runtime VM.");
- }
- }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-22 14:51:07 UTC (rev 22989)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-22 14:57:59 UTC (rev 22990)
@@ -13,4 +13,7 @@
coordinator.heartbeat.frequency=5000
# Buses to be deployed...
-bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
\ No newline at end of file
+bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
+
+# Pre-installed deployment units...
+# unit.deadletter=deadletter.xml
\ No newline at end of file
Added: 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 (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties 2008-09-22 14:57:59 UTC (rev 22990)
@@ -0,0 +1,16 @@
+###########################################################################################
+# Default JMS bus config.
+#
+# NOTE: To add a deployment specific configuration, see the Javadocs for the
+# PropertiesUtil class (getBusConfig method).
+#
+##########################################################################################
+
+# 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
+
+# Bus Queues and Topics...
+deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+deployment.bus.queue=jbossesb.jms.bus
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jms/default.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/default.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/default.properties 2008-09-22 14:57:59 UTC (rev 22990)
@@ -0,0 +1,20 @@
+###########################################################################################
+# Default JMS bus config for testing.
+#
+# Using ActiveMQ because it's so easy to embed. Apparently JBM v2.0 will also be
+# easy to embed. We might be able to switch to that then!!
+##########################################################################################
+
+# JNDI Settings...
+# NOTE: The JNDI settings in this config file must be the same as those
+# set in the JMSTestRunner class!!
+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
+deployment.bus.queue=jbossesb.jms.bus
+
+# ActiveMQ Queue and Topic deployments...
+topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+queue.jbossesb.jms.bus=jbossesb.jms.bus
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/default.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list