- public List getModulesUrls() {
- List urls = new ArrayList();
- String modulesUrlStr = OsgiBootUtils
- .getProperty(PROP_ARGEO_OSGI_MODULES_URL);
- if (modulesUrlStr == null)
- return urls;
-
- String baseUrl = OsgiBootUtils.getProperty(PROP_ARGEO_OSGI_BASE_URL);
-
- Map installedBundles = getBundlesBySymbolicName();
-
- BufferedReader reader = null;
- try {
- URL modulesUrl = new URL(modulesUrlStr);
- reader = new BufferedReader(new InputStreamReader(
- modulesUrl.openStream()));
- String line = null;
- while ((line = reader.readLine()) != null) {
- StringTokenizer st = new StringTokenizer(line,
- modulesUrlSeparator);
- String moduleName = st.nextToken();
- String moduleVersion = st.nextToken();
- String url = st.nextToken();
- if (baseUrl != null)
- url = baseUrl + url;
-
- if (installedBundles.containsKey(moduleName)) {
- Bundle bundle = (Bundle) installedBundles.get(moduleName);
- String bundleVersion = bundle.getHeaders()
- .get(Constants.BUNDLE_VERSION).toString();
- int comp = OsgiBootUtils.compareVersions(bundleVersion,
- moduleVersion);
- if (comp > 0) {
- OsgiBootUtils.warn("Installed version " + bundleVersion
- + " of bundle " + moduleName
- + " is newer than provided version "
- + moduleVersion);
- } else if (comp < 0) {
- urls.add(url);
- OsgiBootUtils.info("Updated bundle " + moduleName
- + " with version " + moduleVersion
- + " (old version was " + bundleVersion + ")");
- } else {
- // do nothing
- }
- } else {
- urls.add(url);
- }
- }
- } catch (Exception e1) {
- throw new RuntimeException("Cannot read url " + modulesUrlStr, e1);
- } finally {
- if (reader != null)
- try {
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return urls;
- }
+ // public List getModulesUrls() {
+ // List urls = new ArrayList();
+ // String modulesUrlStr = OsgiBootUtils
+ // .getProperty(PROP_ARGEO_OSGI_MODULES_URL);
+ // if (modulesUrlStr == null)
+ // return urls;
+ //
+ // String baseUrl = OsgiBootUtils.getProperty(PROP_ARGEO_OSGI_BASE_URL);
+ //
+ // Map installedBundles = getBundlesBySymbolicName();
+ //
+ // BufferedReader reader = null;
+ // try {
+ // URL modulesUrl = new URL(modulesUrlStr);
+ // reader = new BufferedReader(new InputStreamReader(
+ // modulesUrl.openStream()));
+ // String line = null;
+ // while ((line = reader.readLine()) != null) {
+ // StringTokenizer st = new StringTokenizer(line,
+ // modulesUrlSeparator);
+ // String moduleName = st.nextToken();
+ // String moduleVersion = st.nextToken();
+ // String url = st.nextToken();
+ // if (baseUrl != null)
+ // url = baseUrl + url;
+ //
+ // if (installedBundles.containsKey(moduleName)) {
+ // Bundle bundle = (Bundle) installedBundles.get(moduleName);
+ // String bundleVersion = bundle.getHeaders()
+ // .get(Constants.BUNDLE_VERSION).toString();
+ // int comp = OsgiBootUtils.compareVersions(bundleVersion,
+ // moduleVersion);
+ // if (comp > 0) {
+ // OsgiBootUtils.warn("Installed version " + bundleVersion
+ // + " of bundle " + moduleName
+ // + " is newer than provided version "
+ // + moduleVersion);
+ // } else if (comp < 0) {
+ // urls.add(url);
+ // OsgiBootUtils.info("Updated bundle " + moduleName
+ // + " with version " + moduleVersion
+ // + " (old version was " + bundleVersion + ")");
+ // } else {
+ // // do nothing
+ // }
+ // } else {
+ // urls.add(url);
+ // }
+ // }
+ // } catch (Exception e1) {
+ // throw new RuntimeException("Cannot read url " + modulesUrlStr, e1);
+ // } finally {
+ // if (reader != null)
+ // try {
+ // reader.close();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // }
+ // return urls;
+ // }