[jboss-svn-commits] JBL Code SVN: r22771 - in labs/jbossesb/workspace/skeagh/runtime/src: main/java/org/jboss/esb/deploy/config and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Sep 15 05:53:20 EDT 2008
Author: tfennelly
Date: 2008-09-15 05:53:19 -0400 (Mon, 15 Sep 2008)
New Revision: 22771
Added:
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
Removed:
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/default.properties
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/default.properties
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/PropertiesUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
Log:
Properties overlaying - deployment specific overlayed on defaults
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-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-15 09:53:19 UTC (rev 22771)
@@ -464,6 +464,10 @@
deploymentCoordinator.setScheduleResourceId(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_SCHEDULE_KEY);
deployObject(deploymentCoordinator, "DeploymentCoordinator", null);
}
+ catch (DeploymentException e)
+ {
+ throw e;
+ }
catch (Throwable t)
{
throw new DeploymentException("Unable to deploy DeploymentCoordinator.", t.getCause());
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-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/PropertiesUtil.java 2008-09-15 09:53:19 UTC (rev 22771)
@@ -68,11 +68,12 @@
* <p/>
* Checks in the following order:
* <ol>
- * <li>File: "busconfig/<protpcol>/<deploymentName>.properties"</li>
- * <li>Classpath: "/META-INF/busconfig/<protpcol>/<deploymentName>.properties"</li>
- * <li>File: "busconfig/<protpcol>/default.properties"</li>
- * <li>Classpath: "/META-INF/busconfig/<protpcol>/default.properties"</li>
+ * <li>File: "busconfig/<protocol>/default.properties"</li>
+ * <li>Classpath: "/META-INF/jbossesb/busconfig/<protocol>/default.properties"</li>
+ * <li>File: "busconfig/<protocol>/<deploymentName>.properties"</li>
+ * <li>Classpath: "/META-INF/jbossesb/busconfig/<protocol>/<deploymentName>.properties"</li>
* </ol>
+ * The default configuration is overlayed with the deployment specific configuration.
* <p/>
* <b><u>NOTE:</u></b> The protocol string is lowercased and the deployment name is URL encoded
* (application/x-www-form-urlencoded).
@@ -84,67 +85,70 @@
*/
public static ApplicationProperties getBusConfig(final String protocol, final String deploymentName) throws DeploymentException
{
- String firstCheckPath = BUSCONFIG_FILE_DIR + protocol + "/" + urlEncode(deploymentName) + ".properties";
- String secondCheckPath = BUSCONFIG_FILE_DIR + protocol + "/" + "default.properties";
-
+ String defaultCheckPath = BUSCONFIG_FILE_DIR + protocol + "/" + "default.properties";
+ String deploymentCheckPath = BUSCONFIG_FILE_DIR + protocol + "/" + urlEncode(deploymentName) + ".properties";
ApplicationProperties properties;
+ ApplicationProperties deploymentProperties;
- // First check for a deployment specific config ...
- properties = getConfig(firstCheckPath);
- if (properties != null)
+ // Get the default ...
+ properties = getConfig(defaultCheckPath);
+ if (properties == null)
{
- return properties;
+ throw new DeploymentException("Unable to find the default Bus configuration for protocol '" + protocol + "''.");
}
- // Then check for a default ...
- properties = getConfig(secondCheckPath);
- if (properties != null)
+ // Check for a deployment specific config ...
+ deploymentProperties = getConfig(deploymentCheckPath);
+ if (deploymentProperties != null)
{
- return properties;
+ // Overlay the deault properties with the deployment specific properties....
+ properties.putAll(deploymentProperties);
}
- logger.debug("Unable to find JBoss ESB Bus configuration for protocol '" + protocol + "', deployment '" + deploymentName + "'. Tried:\n"
- + "\t1. File: " + firstCheckPath + "\n"
- + "\t2. Classpath: " + ESBCONFIG_CP_DIR + firstCheckPath + "\n"
- + "\t3. File: " + secondCheckPath + "\n"
- + "\t4. Classpath: " + ESBCONFIG_CP_DIR + secondCheckPath);
-
- return null;
+ return properties;
}
/**
* Get the main Deployment properties.
- *
+ * <p/>
+ * Checks in the following order:
+ * <ol>
+ * <li>File: "jbossesb-default.properties"</li>
+ * <li>Classpath: "/META-INF/jbossesb/jbossesb-default.properties"</li>
+ * <li>File: "<deploymentName>.properties"</li>
+ * <li>Classpath: "/META-INF/jbossesb/<deploymentName>.properties"</li>
+ * </ol>
+ * The default configuration is overlayed with the deployment specific configuration.
+ * <p/>
+ * <b><u>NOTE:</u></b> The deployment name is URL encoded (application/x-www-form-urlencoded).
+ *
* @param deploymentName The deployment name.
* @return The main Deployment properties.
* @throws DeploymentException Error reading properties.
*/
public static ApplicationProperties getDeploymentConfig(final String deploymentName) throws DeploymentException
{
- String firstCheckPath = urlEncode(deploymentName) + ".properties";
- String secondCheckPath = "default.properties";
-
+ String defaultCheckPath = "jbossesb-default.properties";
+ String deploymentCheckPath = urlEncode(deploymentName) + ".properties";
ApplicationProperties properties;
+ ApplicationProperties deploymentProperties;
- // First check for a deployment specific config ...
- properties = getConfig(firstCheckPath);
- if (properties != null)
+ // Get the default ...
+ properties = getConfig(defaultCheckPath);
+ if (properties == null)
{
- return properties;
+ throw new DeploymentException("Unable to find the default JBoss ESB Deployment configuration '" + defaultCheckPath + "' for deployment '" + deploymentName + "'.");
}
- // Then check for a default ...
- properties = getConfig(secondCheckPath);
- if (properties != null)
+ // Check for a deployment specific config ...
+ deploymentProperties = getConfig(deploymentCheckPath);
+ if (deploymentProperties != null)
{
- return properties;
+ // Overlay the deault properties with the deployment specific properties....
+ properties.putAll(deploymentProperties);
}
- throw new DeploymentException("Unable to find JBoss ESB Deployment configuration for deployment '" + deploymentName + "'. Tried:\n"
- + "\t1. File: " + firstCheckPath + "\n"
- + "\t2. Classpath: " + ESBCONFIG_CP_DIR + firstCheckPath + "\n"
- + "\t3. File: " + secondCheckPath + "\n"
- + "\t4. Classpath: " + ESBCONFIG_CP_DIR + secondCheckPath);
+ return properties;
}
/**
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-15 09:53:19 UTC (rev 22771)
@@ -130,13 +130,17 @@
String propertyName = (String) configEntry.getKey();
if(propertyName.startsWith("bus."))
{
+ String busProtocol = propertyName.substring("bus.".length());
String busClassName = (String) configEntry.getValue();
+
try
{
Bus bus = Bus.Factory.newInstance(busClassName);
-
+ ApplicationProperties busProperties = PropertiesUtil.getBusConfig(busProtocol, runtime.getDeploymentName());
+
bus.setDeploymentName(runtime.getDeploymentName());
bus.setDeploymentId(runtime.getDeploymentId());
+ bus.setProperties(busProperties);
bus.connect();
if (bus.isConnected())
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java 2008-09-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java 2008-09-15 09:53:19 UTC (rev 22771)
@@ -23,6 +23,7 @@
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
import org.jboss.esb.federate.notify.NotificationListener;
+import org.jboss.esb.properties.ApplicationProperties;
import org.jboss.esb.routing.RoutingException;
/**
@@ -50,6 +51,13 @@
void setDeploymentId(String deploymentId);
/**
+ * Set the Bus properties.
+ *
+ * @param properties The Bus properties.
+ */
+ void setProperties(ApplicationProperties properties);
+
+ /**
* Connect the bus.
*
* @throws DeploymentException Connection exception.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-09-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-09-15 09:53:19 UTC (rev 22771)
@@ -21,7 +21,6 @@
import org.apache.log4j.Logger;
import org.jboss.esb.deploy.DeploymentException;
-import org.jboss.esb.deploy.config.PropertiesUtil;
import org.jboss.esb.federate.bus.Bus;
import org.jboss.esb.federate.bus.BusMessage;
import org.jboss.esb.federate.bus.BusMessageListener;
@@ -76,7 +75,7 @@
/**
* Bus Properties.
*/
- private ApplicationProperties busProperties;
+ private ApplicationProperties properties;
/**
* Deployment name.
*/
@@ -119,15 +118,6 @@
private MessageSender jmsBusSender;
/**
- * Get the Bus configuration properties.
- * @return The bus configuration properties.
- */
- public final ApplicationProperties getBusProperties()
- {
- return busProperties;
- }
-
- /**
* Set the deploymentName for the local deployment.
*
* @param deploymentName The deployment Name.
@@ -148,66 +138,86 @@
}
/**
+ * Set the Bus properties.
+ *
+ * @param properties The Bus properties.
+ */
+ public final void setProperties(final ApplicationProperties properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
+ * Get the Bus configuration properties.
+ *
+ * @return The bus configuration properties.
+ */
+ public final ApplicationProperties getProperties()
+ {
+ return properties;
+ }
+
+ /**
* Connect the bus.
+ *
* @throws DeploymentException Connection exception.
*/
public final void connect() throws DeploymentException
{
- if(deploymentName == null)
+ if (deploymentName == null)
{
throw new IllegalStateException("'deploymentName' not set on Bus.");
}
- else if(deploymentId == null)
+ else if (deploymentId == null)
{
throw new IllegalStateException("'deploymentId' not set on Bus.");
}
+ else if (properties == null)
+ {
+ throw new IllegalStateException("'properties' not set on Bus.");
+ }
- busProperties = PropertiesUtil.getBusConfig("jms", deploymentName);
+ connectJMSSessions(properties);
- if (busProperties != null)
+ if (topicSession != null && queueSession != null)
{
- connectJMSSessions(busProperties);
-
- if (topicSession != null && queueSession != null)
+ try
{
+ connectCoordinationListener(properties);
+ connectCoordintationSender(properties);
+ connectBusListener(properties);
+ connectBusSender(properties);
+ }
+ catch (DeploymentException e)
+ {
try
{
- connectCoordinationListener(busProperties);
- connectCoordintationSender(busProperties);
- connectBusListener(busProperties);
- connectBusSender(busProperties);
- }
- catch (DeploymentException e)
- {
- try
+ if (jmsCoordinationListener == null && jmsCoordinationSender == null && jmsBusListener == null && jmsBusSender == null)
{
- if(jmsCoordinationListener == null && jmsCoordinationSender == null && jmsBusListener == null && jmsBusSender == null)
+ if (!logger.isDebugEnabled())
{
- if(!logger.isDebugEnabled())
- {
- logger.info("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. Turn on deug logging for more details.");
- }
- else
- {
- logger.debug("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment.", e);
- }
+ logger.info("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. Turn on deug logging for more details.");
}
else
{
- throw e;
+ logger.debug("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment.", e);
}
}
- finally
+ else
{
- closeJMSSessions();
+ throw e;
}
}
- catch (Throwable t)
+ finally
{
closeJMSSessions();
- throw new DeploymentException("Failed to connect coordination listener", t);
}
}
+ catch (Throwable t)
+ {
+ closeJMSSessions();
+ throw new DeploymentException("Failed to connect coordination listener", t);
+ }
}
}
@@ -232,7 +242,7 @@
/**
* Send the supplied message to the specified deployment via the bus.
*
- * @param message The message.
+ * @param message The message.
* @param targetDeploymentId The target deployment ID.
* @throws RoutingException Error sending message onto the Bus.
*/
@@ -298,6 +308,7 @@
/**
* Is the bus connected.
+ *
* @return True if the bus is connected, otherwise false.
*/
public final boolean isConnected()
@@ -309,7 +320,8 @@
* Connect the deployment coordination listener.
*
* @param busProperties Bus configuration properties.
- * @throws org.jboss.esb.deploy.DeploymentException Failed to connect listener.
+ * @throws org.jboss.esb.deploy.DeploymentException
+ * Failed to connect listener.
*/
private void connectCoordinationListener(final Properties busProperties) throws DeploymentException
{
@@ -333,7 +345,8 @@
* Connect the deployment coordination sender.
*
* @param busProperties Bus configuration properties.
- * @throws org.jboss.esb.deploy.DeploymentException Failed to connect sender.
+ * @throws org.jboss.esb.deploy.DeploymentException
+ * Failed to connect sender.
*/
private void connectCoordintationSender(final Properties busProperties) throws DeploymentException
{
@@ -357,7 +370,8 @@
* Connect the {@link BusMessage} listener.
*
* @param busProperties Bus configuration properties.
- * @throws org.jboss.esb.deploy.DeploymentException Failed to connect listener.
+ * @throws org.jboss.esb.deploy.DeploymentException
+ * Failed to connect listener.
*/
private void connectBusListener(final Properties busProperties) throws DeploymentException
{
@@ -381,7 +395,8 @@
* Connect the {@link BusMessage} sender.
*
* @param busProperties Bus configuration properties.
- * @throws org.jboss.esb.deploy.DeploymentException Failed to connect sender.
+ * @throws org.jboss.esb.deploy.DeploymentException
+ * Failed to connect sender.
*/
private void connectBusSender(final Properties busProperties) throws DeploymentException
{
@@ -456,7 +471,7 @@
}
/**
- * Deployment Notification Listener.
+ * Deployment Coordination Bus Notification Listener.
*/
private class JMSCoordinationListener extends AbstractMessageListener
{
@@ -500,7 +515,7 @@
}
/**
- * JMS Bus message lsitener.
+ * JMS Bus message listener.
*/
private class JMSQueueMessageListener extends AbstractMessageListener
{
@@ -546,11 +561,12 @@
/**
* Set the deployment ID selector on the specified properties.
+ *
* @param jmsProperties JMS connection properties.
- * @param deploymentId Deployment ID.
+ * @param deploymentId Deployment ID.
* @return The new properties with the JMS Selector set.
*/
- private static Properties addDeploymentSelector(Properties jmsProperties, String deploymentId)
+ private static Properties addDeploymentSelector(final Properties jmsProperties, final String deploymentId)
{
Properties properties = (Properties) jmsProperties.clone();
properties.setProperty(AbstractMessageListener.MESSAGE_SELECTOR, DEPLOYMENT_ID + "='" + deploymentId + "'");
@@ -559,7 +575,8 @@
/**
* Close JMS Handler.
- * @param name The handler name.
+ *
+ * @param name The handler name.
* @param handler The handler.
*/
private void closeJMSHandler(final String name, final AbstractMessageHandler handler)
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/default.properties 2008-09-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/default.properties 2008-09-15 09:53:19 UTC (rev 22771)
@@ -1,9 +0,0 @@
-###########################################################################################
-# Default JMS ESB config.
-##########################################################################################
-
-# Coordination settings...
-coordinator.heartbeat.frequency=5000
-
-# Buses to be deployed...
-bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
\ No newline at end of file
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties (from rev 22770, labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/default.properties)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-15 09:53:19 UTC (rev 22771)
@@ -0,0 +1,9 @@
+###########################################################################################
+# Default JMS ESB config.
+##########################################################################################
+
+# Coordination settings...
+coordinator.heartbeat.frequency=5000
+
+# Buses to be deployed...
+bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/default.properties 2008-09-15 09:07:42 UTC (rev 22770)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/default.properties 2008-09-15 09:53:19 UTC (rev 22771)
@@ -1,9 +0,0 @@
-###########################################################################################
-# Default JMS ESB config.
-##########################################################################################
-
-# Coordination settings...
-coordinator.heartbeat.frequency=700
-
-# Buses to be deployed...
-bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
\ No newline at end of file
Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties (from rev 22770, labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/default.properties)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-15 09:53:19 UTC (rev 22771)
@@ -0,0 +1,9 @@
+###########################################################################################
+# Default JMS ESB config.
+##########################################################################################
+
+# Coordination settings...
+coordinator.heartbeat.frequency=700
+
+# Buses to be deployed...
+bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list