/*
- * Copyright (C) 2007-2012 Mathieu Baudier
+ * Copyright (C) 2007-2012 Argeo GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public void startBundles() {
// default and active start levels from System properties
Integer defaultStartLevel = new Integer(Integer.parseInt(OsgiBootUtils
- .getProperty(PROP_OSGI_BUNDLES_DEFAULTSTARTLEVEL)));
- Integer activeStartLevel = new Integer(
- OsgiBootUtils.getProperty(PROP_OSGI_STARTLEVEL));
+ .getProperty(PROP_OSGI_BUNDLES_DEFAULTSTARTLEVEL, "4")));
+ Integer activeStartLevel = new Integer(OsgiBootUtils.getProperty(
+ PROP_OSGI_STARTLEVEL, "6"));
SortedMap/* <Integer, List<String>> */startLevels = new TreeMap();
computeStartLevels(startLevels, System.getProperties(),
// monitors that all bundles are started
long beginMonitor = System.currentTimeMillis();
- boolean allStarted = false;
+ boolean allStarted = !(startedBundles.size() > 0);
List/* <String> */notStarted = new ArrayList();
- while (allStarted
- && (System.currentTimeMillis() - beginMonitor) > defaultTimeout) {
+ while (!allStarted
+ && (System.currentTimeMillis() - beginMonitor) < defaultTimeout) {
notStarted = new ArrayList();
+ allStarted = true;
for (int i = 0; i < startedBundles.size(); i++) {
Bundle bundle = (Bundle) startedBundles.get(i);
// TODO check behaviour of lazs bundles
int currentState = bundle.getState();
while (!(currentState == Bundle.RESOLVED || currentState == Bundle.ACTIVE)) {
long now = System.currentTimeMillis();
- if ((now - startBegin) > defaultTimeout)
+ if ((now - startBegin) > defaultTimeout * 10)
throw new Exception("Bundle " + bundle.getSymbolicName()
+ " was not RESOLVED or ACTIVE after "
+ (now - startBegin) + "ms (originalState="
/** Creates an URL from a location */
protected String locationToUrl(String baseUrl, String location) {
- int extInd = location.lastIndexOf('.');
- String ext = null;
- if (extInd > 0)
- ext = location.substring(extInd);
-
- if (baseUrl.startsWith("reference:") && ".jar".equals(ext))
- return "file:" + location;
- else
- return baseUrl + location;
+ // int extInd = location.lastIndexOf('.');
+ // String ext = null;
+ // if (extInd > 0)
+ // ext = location.substring(extInd);
+ //
+ // if (baseUrl.startsWith("reference:") && ".jar".equals(ext))
+ // return "file:" + location;
+ // else
+ return baseUrl + location;
}
/** Transforms a relative path in a full system path. */