]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Make OSGiBoot compatible with JDK 1.4
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 26 Jun 2009 09:36:13 +0000 (09:36 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 26 Jun 2009 09:36:13 +0000 (09:36 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2588 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/Activator.java
runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/OsgiBoot.java

index 5d70b769a49694a7a400335373303d7c3716252e..d3dc59ff62e74fe2537f2a6f3db2447e6856f8e8 100644 (file)
@@ -1,31 +1,18 @@
 package org.argeo.slc.osgiboot;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
 
 public class Activator implements BundleActivator {
-       
+
        public void start(BundleContext bundleContext) throws Exception {
                try {
-                       info("SLC OSGi bootstrap starting...");
+                       OsgiBoot.info("SLC OSGi bootstrap starting...");
                        OsgiBoot osgiBoot = new OsgiBoot(bundleContext);
-                       
-                       osgiBoot.installUrls( osgiBoot.getBundlesUrls());
-
-                       osgiBoot.installUrls( osgiBoot.getLocationsUrls());
-
-//                     installUrls(bundleContext, getMavenUrls());
-
+                       osgiBoot.installUrls(osgiBoot.getBundlesUrls());
+                       osgiBoot.installUrls(osgiBoot.getLocationsUrls());
                        osgiBoot.startBundles();
-
-                       info("SLC OSGi bootstrap completed");
+                       OsgiBoot.info("SLC OSGi bootstrap completed");
                } catch (Exception e) {
                        e.printStackTrace();
                        throw e;
@@ -34,162 +21,4 @@ public class Activator implements BundleActivator {
 
        public void stop(BundleContext context) throws Exception {
        }
-
-/*
-       protected List<String> getMavenUrls() throws Exception {
-               String baseUrl = "reference:file:" + System.getProperty("user.home")
-                               + "/.m2/repository/";
-               String config = getProperty(PROP_SLC_MAVEN_DEPENDENCY_FILE);
-               if (config == null)
-                       return new ArrayList<String>();
-
-               List<MavenFile> mavenFiles = new ArrayList<MavenFile>();
-               BufferedReader in = new BufferedReader(new FileReader(config));
-               String line = null;
-               while ((line = in.readLine()) != null) {
-                       try {
-                               line = line.trim();
-                               if (line.equals("")
-                                               || line
-                                                               .startsWith("The following files have been resolved:"))
-                                       continue;// skip
-
-                               mavenFiles.add(convert(line));
-                       } catch (Exception e) {
-                               warn("Could not load line " + line);
-                       }
-               }
-
-               return asUrls(baseUrl, mavenFiles);
-       }
-*/
-/*
-       protected static List<String> asUrls(String baseUrl,
-                       List<MavenFile> mavenFiles) {
-               List<String> urls = new ArrayList<String>();
-               for (MavenFile mf : mavenFiles)
-                       urls.add(convertToUrl(baseUrl, mf));
-               return urls;
-       }
-
-       protected static String convertToUrl(String baseUrl, MavenFile mf) {
-               return baseUrl + mf.getGroupId().replace('.', '/') + '/'
-                               + mf.getArtifactId() + '/' + mf.getVersion() + '/'
-                               + mf.getArtifactId() + '-' + mf.getVersion() + '.'
-                               + mf.getType();
-       }
-
-       protected static MavenFile convert(String str) {
-               StringTokenizer st = new StringTokenizer(str, ":");
-               MavenFile component = new MavenFile();
-               component.setGroupId(st.nextToken());
-               component.setArtifactId(st.nextToken());
-               component.setType(st.nextToken());
-               component.setVersion(st.nextToken());
-               component.setScope(st.nextToken());
-               return component;
-       }
-*//*
-       protected static String getProperty(String name, String defaultValue) {
-               final String value;
-               if (defaultValue != null)
-                       value = System.getProperty(name, defaultValue);
-               else
-                       value = System.getProperty(name);
-
-               if (value == null || value.equals(""))
-                       return null;
-               else
-                       return value;
-       }
-
-       protected static String getProperty(String name) {
-               return getProperty(name, null);
-       }
-*/
-       private static void info(Object obj) {
-               System.out.println("# INFO " + obj);
-       }
-/*
-       private static void debug(Object obj) {
-               if (debug)
-                       System.out.println("# DBUG " + obj);
-       }
-
-       private static void warn(Object obj) {
-               System.out.println("# WARN " + obj);
-               // if (System.getProperty("os.name").contains("Windows"))
-               // System.out.println("# WARN " + obj);
-               // else
-               // System.err.println("# WARN " + obj);
-       }
-*//*
-       static class MavenFile {
-               private String groupId;
-               private String artifactId;
-               private String version;
-               private String type;
-               private String classifier;
-               private String scope;
-
-               public String getScope() {
-                       return scope;
-               }
-
-               public void setScope(String scope) {
-                       this.scope = scope;
-               }
-
-               private String distributionId;
-
-               public String getDistributionId() {
-                       return distributionId;
-               }
-
-               public void setDistributionId(String distributionId) {
-                       this.distributionId = distributionId;
-               }
-
-               public String getGroupId() {
-                       return groupId;
-               }
-
-               public void setGroupId(String groupId) {
-                       this.groupId = groupId;
-               }
-
-               public String getArtifactId() {
-                       return artifactId;
-               }
-
-               public void setArtifactId(String artifactId) {
-                       this.artifactId = artifactId;
-               }
-
-               public String getVersion() {
-                       return version;
-               }
-
-               public void setVersion(String version) {
-                       this.version = version;
-               }
-
-               public String getType() {
-                       return type;
-               }
-
-               public void setType(String type) {
-                       this.type = type;
-               }
-
-               public String getClassifier() {
-                       return classifier;
-               }
-
-               public void setClassifier(String classifier) {
-                       this.classifier = classifier;
-               }
-
-       }
-*/
 }
index 3709e1a752c348635873d9def6fadd1e6e3ff286..2c6d1434ab58fbe4aeb579f083f44c1249878792 100644 (file)
@@ -266,13 +266,13 @@ public class OsgiBoot {
                return (basePath + '/' + relativePath).replace('/', File.separatorChar);
        }
 
-       protected void info(Object obj) {
-               System.out.println("# INFO " + obj);
+       protected static void info(Object obj) {
+               System.out.println("#OSGiBOOT# " + obj);
        }
 
        protected void debug(Object obj) {
                if (debug)
-                       System.out.println("# DBUG " + obj);
+                       System.out.println("#OSGiBOOT DEBUG# " + obj);
        }
 
        protected void warn(Object obj) {