Package org.fao.geonet.kernel.harvest.harvester

Examples of org.fao.geonet.kernel.harvest.harvester.HarvestError


        XmlRequest t = req.getTransport();
    try {
      t.setUrl(new URL(params.url));
        } catch (MalformedURLException e1) {
            HarvestError harvestError = new HarvestError(e1, log);
            harvestError.setDescription(harvestError.getDescription() + " " + params.url);
            errors.add(harvestError);
            throw new AbortExecutionException(e1);
        }

    if (params.useAccount) {
            t.setCredentials(params.username, params.password);
        }

    //--- set the proxy info if necessary
    Lib.net.setupProxy(context, t);

    //--- perform all searches

    Set<RecordInfo> records = new HashSet<RecordInfo>();

        for (Search s : params.getSearches()) {
            try {
                records.addAll(search(req, s));
            } catch (Exception e) {
                log.error("Unknown error trying to harvest");
                log.error(e.getMessage());
                e.printStackTrace();
                errors.add(new HarvestError(e, log));
            } catch (Throwable e) {
                log.fatal("Something unknown and terrible happened while harvesting");
                log.fatal(e.getMessage());
                e.printStackTrace();
                errors.add(new HarvestError(e, log));
            }
        }

        if (params.isSearchEmpty()) {
            try {
                log.debug("Doing an empty search");
                records.addAll(search(req, Search.createEmptySearch()));
            } catch(Exception e) {
                log.error("Unknown error trying to harvest");
                log.error(e.getMessage());
                e.printStackTrace();
                errors.add(new HarvestError(e, log));
            } catch(Throwable e) {
                log.fatal("Something unknown and terrible happened while harvesting");
                log.fatal(e.getMessage());
                e.printStackTrace();
                errors.add(new HarvestError(e, log));
            }
        }

    log.info("Total records processed in all searches :"+ records.size());
View Full Code Here


      return records;
    }
    catch(NoRecordsMatchException e)
    {
      log.warning("No records were matched: " + e.getMessage());
      this.errors.add(new HarvestError(e, log));
      return records;
    }

    catch(Exception e)
    {
      log.warning("Raised exception when searching : "+ e);
      log.warning(Util.getStackTrace(e));
            this.errors.add(new HarvestError(e, log));
      throw new OperationAbortedEx("Raised exception when searching", e);
    }
  }
View Full Code Here

      }
    }

    catch(JDOMException e)
    {
            HarvestError harvestError = new HarvestError(e, log);
            harvestError.setDescription("Skipping metadata with bad XML format. Remote id : "+ ri.id);
            harvestError.printLog(log);
            this.errors.add(harvestError);
      result.badFormat++;
    }

    catch(Exception e)
    {
            HarvestError harvestError = new HarvestError(e, log);
            harvestError.setDescription("Raised exception while getting metadata file : "+ e);
            this.errors.add(harvestError);
            harvestError.printLog(log);
      result.unretrievable++;
    }

    //--- we don't raise any exception here. Just try to go on
    return null;
View Full Code Here

    {
      return Xml.transform(md, styleSheet);
    }
    catch (Exception e)
    {
            HarvestError harvestError = new HarvestError(e, log);
            harvestError.setDescription("Cannot convert oai_dc to dublin core : "+ e);
            this.errors.add(harvestError);
            harvestError.printLog(log);
      return null;
    }
  }
View Full Code Here

      dataMan.validate(schema, md);
      return true;
    }
    catch (Exception e)
    {
            HarvestError harvestError = new HarvestError(e, log);
            this.errors.add(harvestError);
      return false;
    }
  }
View Full Code Here

   
    log.info("Parsing query :\n" + params.query);
    try {
      wfsQuery = Xml.loadString(params.query, false);
    } catch (JDOMException e) {
            errors.add(new HarvestError(e, log));
      throw new BadParameterEx("GetFeature Query failed to parse\n", params.query);
    }

    //--- harvest metadata and subtemplates from fragments using generic fragment harvester
    FragmentHarvester fragmentHarvester = new FragmentHarvester(log, context, getFragmentHarvesterParams());
View Full Code Here

            } else {
              result.locallyRemoved ++;
            }
          }
        } catch(CacheException e) {
                HarvestError error = new HarvestError(e, log);
                this.errors.add(error);
        } catch (Exception e) {
                HarvestError error = new HarvestError(e, log);
                this.errors.add(error);
            }
    }
   
    if (result.subtemplatesRemoved + result.locallyRemoved > 0)  {
View Full Code Here

                records.addAll(search(request, s));
            } catch (Exception t) {
                log.error("Unknown error trying to harvest");
                log.error(t.getMessage());
                t.printStackTrace();
                errors.add(new HarvestError(t, log));
            } catch (Throwable t) {
                log.fatal("Something unknown and terrible happened while harvesting");
                log.fatal(t.getMessage());
                t.printStackTrace();
                errors.add(new HarvestError(t, log));
            }
        }

        if (params.isSearchEmpty()) {
            try {
                log.debug("Doing an empty search");
                records.addAll(search(request, Search.createEmptySearch()));
            } catch(Exception t) {
                log.error("Unknown error trying to harvest");
                log.error(t.getMessage());
                t.printStackTrace();
                errors.add(new HarvestError(t, log));
            } catch(Throwable t) {
                log.fatal("Something unknown and terrible happened while harvesting");
                log.fatal(t.getMessage());
                t.printStackTrace();
                errors.add(new HarvestError(t, log));
            }
        }

    log.info("Total records processed in all searches :"+ records.size());
View Full Code Here

                log.debug("Sent request " + request.getSentData());
                log.debug("Search results:\n" + Xml.getString(response));
            }
            return response;
        } catch (BadSoapResponseEx e) {
            errors.add(new HarvestError(e, log));
            throw new OperationAbortedEx("Raised exception when searching: "
                    + e.getMessage(), e);
        } catch (BadXmlResponseEx e) {
            errors.add(new HarvestError(e, log));
            throw new OperationAbortedEx("Raised exception when searching: "
                    + e.getMessage(), e);
        } catch (IOException e) {
            errors.add(new HarvestError(e, log));
            throw new OperationAbortedEx("Raised exception when searching: "
                    + e.getMessage(), e);
        }
    }
View Full Code Here

      if (log.isDebugEnabled())
        log.debug("getRecordInfo: adding "+identif+" with modification date "+modified);
      return new RecordInfo(identif, modified);
        } catch (UnsupportedEncodingException e) {
            HarvestError harvestError = new HarvestError(e, log);
            harvestError.setDescription(harvestError.getDescription() + "\n record: " + Xml.getString(record));
            errors.add(harvestError);
        } catch (ParseException e) {
            HarvestError harvestError = new HarvestError(e, log);
            harvestError.setDescription(harvestError.getDescription() + "\n record: " + Xml.getString(record));
            errors.add(new HarvestError(e, log));
        }

    // we get here if we couldn't get the UUID or date modified
    return null;
View Full Code Here

TOP

Related Classes of org.fao.geonet.kernel.harvest.harvester.HarvestError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.