/*
  * Iterate over the sites in the given configuration and remove the one which
  * has a url matching the given location.
  */
 public boolean removeSite(Configuration configuration, String location)
     throws IOException, URISyntaxException {
   File left = new File(new URI(location)).getCanonicalFile();
   List sites = configuration.getSites();
   for (Iterator iter = sites.iterator(); iter.hasNext(); ) {
     Site tempSite = (Site) iter.next();
     String siteURL = tempSite.getUrl();
     File right = new File(new URI(siteURL)).getCanonicalFile();
     if (left.equals(right)) {
       return configuration.removeSite(tempSite);
     }
   }
   return false;
 }
 /*
  * Assert that a feature with the given id exists in the configuration. If
  * a version is specified then match the version, otherwise any version will
  * do.
  */
 public void assertFeatureExists(
     String message, Configuration configuration, String id, String version) {
   List sites = configuration.getSites();
   assertNotNull(message, sites);
   boolean found = false;
   for (Iterator iter = sites.iterator(); iter.hasNext(); ) {
     Site site = (Site) iter.next();
     Feature[] features = site.getFeatures();
     for (int i = 0; features != null && i < features.length; i++) {
       if (id.equals(features[i].getId())) {
         if (version == null) found = true;
         else if (version.equals(features[i].getVersion())) found = true;
       }
     }
   }
   assertTrue(message, found);
 }
 /*
  * Create and return a new site object with the given parameters.
  */
 public Site createSite(
     String policy, boolean enabled, boolean updateable, String uri, String[] plugins) {
   Site result = new Site();
   result.setPolicy(policy);
   result.setEnabled(enabled);
   result.setUpdateable(updateable);
   result.setUrl(uri);
   if (plugins != null) for (int i = 0; i < plugins.length; i++) result.addPlugin(plugins[i]);
   return result;
 }
Beispiel #4
0
  /** @author user */
  public ParseKUKU() {
    enumName = "KUKU";
    regexs =
        new String[] {
          "(?s).*kukudm.com(?s).*", "(?s).*socomic.com(?s).*", "(?s).*socomic.net(?s).*"
        };
    parserName = this.getClass().getName();
    downloadBefore = true;
    siteID = Site.formString("KUKU");
    siteName = "kuku";
    indexName = Common.getStoredFileName(SetUp.getTempDirectory(), "index_kuku_parse_", "html");
    indexEncodeName =
        Common.getStoredFileName(SetUp.getTempDirectory(), "index_kuku_encode_parse_", "html");

    baseURL = "http://n.kukudm.com/";
  }