mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
fix runlevels loading
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@768048 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -152,17 +152,17 @@ public class FelixOsgiHost implements OsgiHost {
|
||||
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 @@ public class FelixOsgiHost implements OsgiHost {
|
||||
/**
|
||||
* 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 @@ public class FelixOsgiHost implements OsgiHost {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user