/**
   * @return Returns a list of all classes accepted by the following three filter methods:
   *     <ol>
   *       <li>{@link #acceptBundle(Bundle)}
   *       <li>{@link #acceptClassName(Bundle, String)}
   *       <li>{@link #acceptClass(Bundle, Class)}
   *     </ol>
   */
  public List<Class<?>> collectAllJUnitTestClasses() {
    boolean dev = Platform.inDevelopmentMode();
    if (dev) {
      System.out.println(
          "In -dev mode: only the test(s) marked with @DevTestMarker are run as a convenience (all tests if no such annotation is found)");
    }
    List<Class<?>> junitTestClasses = new ArrayList<Class<?>>();
    List<Class<?>> devClasses = new ArrayList<Class<?>>();
    for (Bundle bundle : Activator.getDefault().getBundle().getBundleContext().getBundles()) {
      // check if bundle is searched for tests
      if (!acceptBundle(bundle)) {
        continue;
      }

      String[] classNames;
      try {
        BundleBrowser bundleBrowser = new BundleBrowser(bundle.getSymbolicName(), "");
        classNames = bundleBrowser.getClasses(false, true);
      } catch (Exception e1) {
        System.err.println(e1);
        continue;
      }
      // filter
      for (String className : classNames) {
        // fast pre-check
        if (!acceptClassName(bundle, className)) {
          continue;
        }
        try {
          Class<?> c = BundleInspector.getHostBundle(bundle).loadClass(className);
          if (acceptClass(bundle, c)) {
            // add it
            if (dev && c.getAnnotation(DevTestMarker.class) != null) {
              devClasses.add(c);
            }
            junitTestClasses.add(c);
          }
        } catch (Throwable t) {
          // nop
        }
      }
    }
    if (!devClasses.isEmpty()) {
      sortTestClasses(devClasses);
      return devClasses;
    }
    sortTestClasses(junitTestClasses);
    return junitTestClasses;
  }
  public PostgisService2 createService(URL id, Map<String, Serializable> params) {
    try {
      if (getFactory() == null || !getFactory().isAvailable()) {
        return null; // factory not available
      }
      if (!getFactory().canProcess(params)) {
        return null; // the factory cannot use these parameters
      }
    } catch (Exception unexpected) {
      if (Platform.inDevelopmentMode()) {
        // this should never happen
        PostgisPlugin.log(
            "PostGISExtension canProcess errored out with: " + unexpected, unexpected);
      }
      return null; // the factory cannot really use these parameters
    }
    if (reasonForFailure(params) != null) {
      return null;
    }
    Map<String, Serializable> params2 = params;

    ensurePortIsInt(params2);

    try {
      URL finalID = DIALECT.toURL(params2);
      Pair<Map<String, Serializable>, String> split = processParams(params2);
      if (split.getRight() != null) {
        return null;
      }

      return new PostgisService2(finalID, split.getLeft());
    } catch (MalformedURLException e) {
      PostgisPlugin.log("Unable to construct proper service URL.", e); // $NON-NLS-1$
      return null;
    }
  }
 /** Initializes system properties */
 static {
   fgIsDev = Platform.inDevelopmentMode();
   if (fgIsDev) {
     fgDevPropertiesURL = System.getProperty("osgi.dev"); // $NON-NLS-1$
   }
 }