/*
   *  (non-Javadoc)
   * @see org.knopflerfish.eclipse.core.IFrameworkDefinition#getMainLibrary(java.io.File)
   */
  public IOsgiLibrary getMainLibrary(File dir) {
    File root = getRootDir(dir);
    if (root == null) return null;

    File file = new File(root, PATH_MAINLIB);
    OsgiLibrary mainLib = null;
    try {
      mainLib = new OsgiLibrary(file);
      File src = new File(root, PATH_MAINLIB_SRC);
      if (src.exists()) {
        mainLib.setSource(src.getAbsolutePath());
      }
    } catch (IOException e) {
    }

    return mainLib;
  }
  /*
   *  (non-Javadoc)
   * @see org.knopflerfish.eclipse.core.IFrameworkDefinition#getRuntimeLibraries(java.io.File)
   */
  public IOsgiLibrary[] getRuntimeLibraries(File dir) {
    ArrayList libraries = new ArrayList();

    File root = getRootDir(dir);
    if (root == null) return null;

    for (int i = 0; i < PATH_RUNTIME_LIBRARIES.length; i++) {
      File libFile = new File(root, PATH_RUNTIME_LIBRARIES[i]);
      if (libFile.exists() && libFile.isFile()) {
        try {
          OsgiLibrary library = new OsgiLibrary(libFile);
          File src = new File(root, PATH_MAINLIB_SRC);
          if (src.exists()) {
            library.setSource(src.getAbsolutePath());
          }
          libraries.add(library);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }

    return (IOsgiLibrary[]) libraries.toArray(new IOsgiLibrary[libraries.size()]);
  }