/*
   * 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;
  }