You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2009/04/23 22:48:50 UTC
svn commit: r768048 -
/struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java
Author: musachy
Date: Thu Apr 23 20:48:49 2009
New Revision: 768048
URL: http://svn.apache.org/viewvc?rev=768048&view=rev
Log:
fix runlevels loading
Modified:
struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java
Modified: struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java?rev=768048&r1=768047&r2=768048&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java (original)
+++ struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java Thu Apr 23 20:48:49 2009
@@ -152,17 +152,17 @@
configProps.put(AutoActivator.AUTO_START_PROP + ".1", StringUtils.join(bundleJarsLevel1, " "));
//get a list of directories under /bundles with numeric names (the runlevel)
- List<String> runLevels = getRunLevelDirs("bundles");
+ Map<String, String> runLevels = getRunLevelDirs("bundles");
if (runLevels.isEmpty()) {
//there are no run level dirs, search for bundles in that dir
List<String> bundles = getBundlesInDir("bundles");
if (!bundles.isEmpty())
configProps.put(AutoActivator.AUTO_START_PROP + ".2", StringUtils.join(bundles, " "));
} else {
- for (String runLevel : runLevels) {
+ for (String runLevel : runLevels.keySet()) {
if ("1".endsWith(runLevel))
throw new StrutsException("Run level dirs must be greater than 1. Run level 1 is reserved for the Felix bundles");
- List<String> bundles = getBundlesInDir(runLevel);
+ List<String> bundles = getBundlesInDir(runLevels.get(runLevel));
configProps.put(AutoActivator.AUTO_START_PROP + "." + runLevel, StringUtils.join(bundles, " "));
}
}
@@ -171,8 +171,8 @@
/**
* Return a list of directories under a directory whose name is a number
*/
- protected List<String> getRunLevelDirs(String dir) {
- List<String> dirs = new ArrayList<String>();
+ protected Map<String, String> getRunLevelDirs(String dir) {
+ Map<String, String> dirs = new HashMap<String, String>();
try {
ResourceFinder finder = new ResourceFinder();
URL url = finder.find("bundles");
@@ -193,7 +193,7 @@
if (runLevelDirs != null && runLevelDirs.length > 0) {
//add all the dirs to the list
for (String runLevel : runLevelDirs)
- dirs.add(StringUtils.chomp(dir, "/") + "/" + runLevel);
+ dirs.put(runLevel, StringUtils.chomp(dir, "/") + "/" + runLevel);
} else if (LOG.isDebugEnabled()) {
LOG.debug("No bundles found under the [#0] directory", dir);