[jboss-svn-commits] JBL Code SVN: r22545 - labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 9 09:45:21 EDT 2008
Author: tfennelly
Date: 2008-09-09 09:45:21 -0400 (Tue, 09 Sep 2008)
New Revision: 22545
Modified:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
Log:
Added ability to override bus default.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-09 13:34:25 UTC (rev 22544)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-09 13:45:21 UTC (rev 22545)
@@ -121,7 +121,7 @@
throw new DeploymentException("Failed to read local bus deployment configuration", e);
}
- if(localBusProperties != null)
+ if (localBusProperties != null)
{
connectCoordinationListener(localBusProperties);
if (coordinationListener != null && coordinationListener.isConnected())
@@ -214,14 +214,15 @@
{
String firstCheckPath = "busconfig/" + protocol + "/" + deploymentName + ".properties";
String secondCheckPath = "/META-INF/jbossesb/" + firstCheckPath;
- String thirdCheckPath = "/META-INF/jbossesb/busconfig/" + protocol + "/" + "default.properties";
+ String thirdCheckPath = "busconfig/" + protocol + "/" + "default.properties";
+ String fourthCheckPath = "/META-INF/jbossesb/busconfig/" + protocol + "/" + "default.properties";
InputStream configStream;
// 1st: Check for a deployment specific config on the local file system...
- File firstCheckFile = new File(firstCheckPath);
- if (firstCheckFile.exists() && !firstCheckFile.isDirectory())
+ File checkFile = new File(firstCheckPath);
+ if (checkFile.exists() && !checkFile.isDirectory())
{
- return readConfig(new FileInputStream(firstCheckFile));
+ return readConfig(new FileInputStream(checkFile));
}
// 2nd: Check for a deployment specific config on the classpath...
@@ -231,17 +232,25 @@
return readConfig(configStream);
}
- // 3rd: Check for a the default config on the classpath...
- configStream = ClassUtil.getResourceAsStream(thirdCheckPath, DeploymentCoordinator.class);
+ // 3rd: Check for the default config on the local file system...
+ checkFile = new File(thirdCheckPath);
+ if (checkFile.exists() && !checkFile.isDirectory())
+ {
+ return readConfig(new FileInputStream(checkFile));
+ }
+
+ // 4th: Check for the default config on the classpath...
+ configStream = ClassUtil.getResourceAsStream(fourthCheckPath, DeploymentCoordinator.class);
if (configStream != null)
{
return readConfig(configStream);
}
logger.debug("Unable to find JBoss ESB Bus configuration for protocol '" + protocol + "', deployment '" + deploymentName + "'. Tried:\n" +
- "\t1. File: " + firstCheckPath + "\n" +
- "\t2. Classpath: " + secondCheckPath + "\n" +
- "\t3. Classpath: " + thirdCheckPath);
+ "\t1. File: " + firstCheckPath + "\n" +
+ "\t2. Classpath: " + secondCheckPath + "\n" +
+ "\t3. File: " + thirdCheckPath + "\n" +
+ "\t4. Classpath: " + fourthCheckPath);
return null;
}
@@ -255,9 +264,16 @@
*/
private static Properties readConfig(InputStream configStream) throws IOException
{
- ApplicationProperties properties = new ApplicationProperties();
- properties.load(configStream);
- return properties;
+ try
+ {
+ ApplicationProperties properties = new ApplicationProperties();
+ properties.load(configStream);
+ return properties;
+ }
+ finally
+ {
+ configStream.close();
+ }
}
/**
More information about the jboss-svn-commits
mailing list