public final static String PROP_SLC_OSGIBOOT_DEBUG = "slc.osgiboot.debug";
public final static String DEFAULT_BASE_URL = "reference:file:";
+ public final static String EXCLUDES_SVN_PATTERN = "**/.svn/**";
private Boolean debug = Boolean.parseBoolean(System.getProperty(
PROP_SLC_OSGIBOOT_DEBUG, "false"));
+ private boolean excludeSvn = true;
+
private final BundleContext bundleContext;
public OsgiBoot(BundleContext bundleContext) {
startBundles(bundlesToStart);
}
- public void startBundles(String bundlesToStart) throws Exception {
- if (bundlesToStart == null)
+ public void startBundles(String bundlesToStartStr) throws Exception {
+ if (bundlesToStartStr == null)
return;
- StringTokenizer st = new StringTokenizer(bundlesToStart, ",");
- Map<String, Bundle> bundles = getBundles();
+ StringTokenizer st = new StringTokenizer(bundlesToStartStr, ",");
+ List bundlesToStart = new ArrayList();
while (st.hasMoreTokens()) {
String name = st.nextToken().trim();
+ bundlesToStart.add(name);
+ }
+ startBundles(bundlesToStart);
+ }
+
+ public void startBundles(List bundlesToStart) throws Exception {
+ if (bundlesToStart.size() == 0)
+ return;
+
+ Map<String, Bundle> bundles = getBundles();
+ for (int i = 0; i < bundlesToStart.size(); i++) {
+ String name = bundlesToStart.get(i).toString();
Bundle bundle = bundles.get(name);
if (bundle != null)
try {
return urls;
bundleLocations = SystemPropertyUtils
.resolvePlaceholders(bundleLocations);
+ if (debug)
+ debug(PROP_SLC_OSGI_LOCATIONS + "=" + bundleLocations);
StringTokenizer st = new StringTokenizer(bundleLocations,
File.pathSeparator);
List<BundlesSet> bundlesSets = new ArrayList<BundlesSet>();
if (bundlePatterns == null)
return urls;
- // TODO: resolve placeholders
- info(PROP_SLC_OSGI_BUNDLES + "=" + bundlePatterns);
+ bundlePatterns = SystemPropertyUtils
+ .resolvePlaceholders(bundlePatterns);
+ if (debug)
+ debug(PROP_SLC_OSGI_BUNDLES + "=" + bundlePatterns
+ + " (excludeSvn=" + excludeSvn + ")");
StringTokenizer st = new StringTokenizer(bundlePatterns, ",");
while (st.hasMoreTokens()) {
}
}
} else {
- warn("Not a directory: " + newFullPath);
+ //warn("Not a directory: " + newFullPath);
}
}
}
return bundleContext;
}
- private class BundlesSet {
+ /** Whether to exclude Subversion directories (true by default) */
+ public boolean isExcludeSvn() {
+ return excludeSvn;
+ }
+
+ public void setExcludeSvn(boolean excludeSvn) {
+ this.excludeSvn = excludeSvn;
+ }
+
+ protected class BundlesSet {
private String baseUrl = "reference:file";// not used yet
private final String dir;
private List<String> includes = new ArrayList<String>();
System.err.println("Unkown bundles pattern type " + type);
}
}
+
+ if (excludeSvn && !excludes.contains(EXCLUDES_SVN_PATTERN)) {
+ excludes.add(EXCLUDES_SVN_PATTERN);
+ }
}
public String getDir() {