+ // Load from dev bundles
+ Map devBundleUrls = getDevBundleUrls(config);
+ Iterator devBundles = devBundleUrls.keySet().iterator();
+ while (devBundles.hasNext()) {
+ try {
+ String bundleName = (String) devBundles.next();
+ String url = (String) devBundleUrls.get(bundleName);
+ Bundle bundle = context.installBundle(url);
+ installBundleNames.add(bundle.getSymbolicName());
+ info("Installed as dev bundle " + url);
+ } catch (Exception e) {
+ bundleInstallWarn(e.getMessage());
+ }
+ }
+
+ // Load from distribution
+ String slcHome = config.getProperty(PROP_SLC_HOME);
+ if (slcHome != null) {
+ File libDir = new File(slcHome + File.separator + "lib");
+ File[] bundleFiles = libDir.listFiles();
+ for (int i = 0; i < bundleFiles.length; i++) {
+ try {
+ String url = "reference:file:"
+ + bundleFiles[i].getCanonicalPath();
+ Bundle bundle = context.installBundle(url);
+ installBundleNames.add(bundle.getSymbolicName());
+ info("INFO: Installed from SLC home " + url);
+ } catch (Exception e) {
+ bundleInstallWarn(e.getMessage());
+ }
+
+ }
+ }
+
+ // Start bundles
+ String bundleStart = config.getProperty(PROP_SLC_OSGI_START,
+ "org.springframework.osgi.extender,org.argeo.slc.detached");
+
+ if (bundleStart.trim().equals("*")) {
+ for (int i = 0; i < installBundleNames.size(); i++) {
+ String bundleSymbolicName = installBundleNames.get(i)
+ .toString();
+ try {
+ startBundle(context, bundleSymbolicName);
+ } catch (Exception e) {
+ bundleInstallWarn(e.getMessage());
+ }
+ }
+ } else {
+ StringTokenizer stBundleStart = new StringTokenizer(bundleStart,
+ ",");
+ while (stBundleStart.hasMoreTokens()) {
+ String bundleSymbolicName = stBundleStart.nextToken();
+ startBundle(context, bundleSymbolicName);
+ }
+ }