{
   ApplicationContext appCtx = ApplicationContext.getInstance();
   ApplicationConfiguration appCfg = appCtx.getConfiguration();
   for (Map.Entry<String, ProtocolFactory> e : appCfg.getProtocolFactories().entrySet()) {
     protocols.put(e.getKey(), e.getValue().newProtocol());
   }
 }
  /**
   * Prints all records.
   *
   * @param records records to print
   * @param more <code>true</code> if more info will be printed after that section
   */
  @Override
  protected void printRecords(IFeedRecords records, boolean more) {
    int numberOfHits = records.getOpenSearchProperties().getNumberOfHits();
    int counter = 0;

    this.dcatSchemas =
        ApplicationContext.getInstance()
            .getConfiguration()
            .getCatalogConfiguration()
            .getDcatSchemas();
    LOGGER.info("Beginning processing " + numberOfHits + " DCAT records...");
    for (int i = 0; i < records.size(); i++) {
      IFeedRecord record = records.get(i);
      Envelope envelope = record.getEnvelope();
      printRecord(record, envelope, i < records.size() - 1);

      if ((++counter) % 1000 == 0) {
        LOGGER.info(
            "Processed "
                + counter
                + "/"
                + numberOfHits
                + " DCAT records ("
                + (100 * counter) / numberOfHits
                + "%)");
      }
    }
  }
  /**
   * Creates instance of editor.
   *
   * @param harvestRepository repository to be edited
   */
  public HarvestEditor(HrRecord harvestRepository) {
    _harvestRepository = harvestRepository;
    protocols.put(harvestRepository.getProtocol().getKind(), harvestRepository.getProtocol());

    ApplicationContext appCtx = ApplicationContext.getInstance();
    ApplicationConfiguration appCfg = appCtx.getConfiguration();

    String sArcgisDotComAllowed =
        appCfg
            .getCatalogConfiguration()
            .getParameters()
            .getValue("webharvester.agp2agp.arcgisDotCom.allowed");
    this.arcgisDotComAllowed = Val.chkBool(sArcgisDotComAllowed, false);

    String sCrossAllowed =
        appCfg
            .getCatalogConfiguration()
            .getParameters()
            .getValue("webharvester.agp2agp.sameDomain.allowed");
    this.crossAllowed = Val.chkBool(sCrossAllowed, false);
  }
Exemple #4
0
 /**
  * Check a string to see if it matches an email address. <br>
  * The check is against a regular expression defined within gpt.xml: <br>
  * /gptConfig/mail/@emailAddressRegexp
  *
  * @param s the string to check
  * @return true if the string matches an email address
  */
 public static boolean chkEmail(String s) {
   if (s == null) {
     return false;
   } else {
     // String exp = "(\\w+)(\\.\\w+)*@(\\w+\\.)(\\w+)(\\.\\w+)*";
     String exp =
         ApplicationContext.getInstance()
             .getConfiguration()
             .getMailConfiguration()
             .getEmailAddressRegexp();
     if ((exp != null) && (exp.length() > 0)) {
       return s.matches(exp);
     } else {
       return true;
     }
   }
 }