/* * InputStream must be closed * (non-Javadoc) * @see org.eclipse.equinox.simpleconfigurator.manipulator.SimpleConfiguratorManipulator#loadConfiguration(java.io.InputStream, java.net.URI) */ public BundleInfo[] loadConfiguration(InputStream stream, URI installArea) throws IOException { if (stream == null) return NULL_BUNDLEINFOS; List simpleBundles = SimpleConfiguratorUtils.readConfiguration(stream, installArea); // convert to FrameworkAdmin BundleInfo Type BundleInfo[] result = new BundleInfo[simpleBundles.size()]; int i = 0; for (Iterator iterator = simpleBundles.iterator(); iterator.hasNext(); ) { org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo simpleInfo = (org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo) iterator.next(); URI location = simpleInfo.getLocation(); if (!location.isAbsolute() && simpleInfo.getBaseLocation() != null) location = URIUtil.makeAbsolute(location, simpleInfo.getBaseLocation()); BundleInfo bundleInfo = new BundleInfo( simpleInfo.getSymbolicName(), simpleInfo.getVersion(), location, simpleInfo.getStartLevel(), simpleInfo.isMarkedAsStarted()); bundleInfo.setBaseLocation(simpleInfo.getBaseLocation()); result[i++] = bundleInfo; } return result; }
public static String createBundleInfoLine(BundleInfo bundleInfo, boolean oldStyle) { // symbolicName,version,location,startLevel,markedAsStarted StringBuffer buffer = new StringBuffer(); buffer.append(bundleInfo.getSymbolicName()); buffer.append(','); buffer.append(bundleInfo.getVersion()); buffer.append(','); buffer.append(createBundleLocation(bundleInfo.getLocation(), oldStyle)); buffer.append(','); buffer.append(bundleInfo.getStartLevel()); buffer.append(','); buffer.append(bundleInfo.isMarkedAsStarted()); return buffer.toString(); }