X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.osgiboot%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fosgiboot%2FActivator.java;h=c4b06be060168721426524ea2a2f046cee4c54d1;hb=4810532845c8a54c04a850c7db3a9fe00e8ebc6a;hp=7b02c785ab3db7f719be98039e63869411c5dc0f;hpb=d95951ffda520440eea45647d0d672382e6d8171;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/Activator.java b/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/Activator.java index 7b02c785a..c4b06be06 100644 --- a/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/Activator.java +++ b/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/Activator.java @@ -24,17 +24,25 @@ public class Activator implements BundleActivator { public final static String PROP_SLC_OSGI_LOCATIONS = "slc.osgi.locations"; public final static String PROP_SLC_MAVEN_DEPENDENCY_FILE = "slc.maven.dependencyFile"; - private static Boolean debug = true; + private static Boolean debug = false; public void start(BundleContext bundleContext) throws Exception { - installUrls(bundleContext, getDevLocationsUrls()); + try { + info("SLC OSGi bootstrap starting..."); + installUrls(bundleContext, getDevLocationsUrls()); - installUrls(bundleContext, getLocationsUrls()); + installUrls(bundleContext, getLocationsUrls()); - List urls = getMavenUrls(); - installUrls(bundleContext, urls); + List urls = getMavenUrls(); + installUrls(bundleContext, urls); - startBundles(bundleContext); + startBundles(bundleContext); + + info("SLC OSGi bootstrap completed"); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } } public void stop(BundleContext context) throws Exception { @@ -49,12 +57,14 @@ public class Activator implements BundleActivator { if (installedBundles.containsKey(url)) { Bundle bundle = installedBundles.get(url); // bundle.update(); - info("Bundle " + bundle.getSymbolicName() - + " already installed from " + url); + if (debug) + debug("Bundle " + bundle.getSymbolicName() + + " already installed from " + url); } else { Bundle bundle = bundleContext.installBundle(url); - info("Installed bundle " + bundle.getSymbolicName() - + " from " + url); + if (debug) + debug("Installed bundle " + bundle.getSymbolicName() + + " from " + url); } } catch (BundleException e) { warn("Could not install bundle from " + url + ": " @@ -123,8 +133,16 @@ public class Activator implements BundleActivator { String base, String currentPath, String pattern) { if (currentPath == null) { // Init - File[] files = new File(base.replace('/', File.separatorChar)) - .listFiles(); + File baseDir = new File(base.replace('/', File.separatorChar)); + File[] files = baseDir.listFiles(); + + if (files == null) { + warn("Base dir " + baseDir + " has no children, exists=" + + baseDir.exists() + ", isDirectory=" + + baseDir.isDirectory()); + return; + } + for (File file : files) if (file.isDirectory()) match(matcher, matched, base, file.getName(), pattern); @@ -152,8 +170,10 @@ public class Activator implements BundleActivator { match(matcher, matched, base, newCurrentPath, pattern); } else { - debug(newCurrentPath - + " does not start match with " + pattern); + if (debug) + debug(newCurrentPath + + " does not start match with " + + pattern); } } @@ -181,7 +201,7 @@ public class Activator implements BundleActivator { mavenFiles.add(convert(line)); } catch (Exception e) { - System.err.println("Could not load line " + line); + warn("Could not load line " + line); } } @@ -260,15 +280,16 @@ public class Activator implements BundleActivator { } private static void info(Object obj) { - System.out.println("#INFO " + obj); + System.out.println("# INFO " + obj); } private static void debug(Object obj) { - System.out.println("#DBUG " + obj); + if (debug) + System.out.println("# DBUG " + obj); } private static void warn(Object obj) { - System.err.println("#WARN " + obj); + System.err.println("# WARN " + obj); } static class MavenFile {