Package org.fao.geonet.kernel.harvest

Examples of org.fao.geonet.kernel.harvest.HarvestManager


//    }

         */

        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        HarvestManager hm = gc.getBean(HarvestManager.class);
        String uuid = hm.addHarvesterReturnUUID(node);
        node.setAttribute("uuid", uuid);
        node.addContent(new Element("info"));
        AbstractHarvester harvester = hm.getHarvester(uuid);
        String id = harvester.getID();
        node.setAttribute("id", id);

        if(Log.isDebugEnabled(Geonet.CSW_HARVEST))
            Log.debug(Geonet.CSW_HARVEST, "** CSW Harvest createHarvestNode returns:\n" + Xml.getString(node));
View Full Code Here


  //---
  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception {
    GeonetContext  gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    HarvestManager hm = gc.getBean(HarvestManager.class);

    // Add current user as harvester owner
        String id = hm.addHarvesterReturnId(params, context.getUserSession().getUserId());

    return new Element(Jeeves.Elem.RESPONSE).addContent(new Element("id").setText(id));
  }
View Full Code Here

  //--------------------------------------------------------------------------

  public static Element exec(Element params, ServiceContext context, Job job) throws Exception
  {
    GeonetContext  gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    HarvestManager hm = gc.getBean(HarvestManager.class);

    @SuppressWarnings("unchecked")
        List<Element> paramList = params.getChildren();

    Element response = new Element(Jeeves.Elem.RESPONSE);
View Full Code Here

  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    HarvestManager hm = gc.getBean(HarvestManager.class);

    String id = params.getChildText("id");

    // Invoke: synchronous "run" of harvester
    Common.OperResult result = hm.invoke(id);

    // Construct result
    return new Element(Jeeves.Elem.RESPONSE)
        .addContent(new Element("id").setText(id).setAttribute(new Attribute("status", result.toString())));
  }
View Full Code Here

     * @return
     * @throws Exception
     */
  public Element exec(Element params, ServiceContext context) throws Exception {
    GeonetContext  gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    HarvestManager hm = gc.getBean(HarvestManager.class);

    // Add current user has harvester owner
        hm.update(params, context.getUserSession().getUserId());

    String id = params.getAttributeValue("id");

    return new Element(Jeeves.Elem.RESPONSE).addContent(new Element("id").setText(id));
  }
View Full Code Here

  public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception
  {

    GeonetContext  gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    DataManager    dm = gc.getBean(DataManager.class);
    HarvestManager hm = gc.getBean(HarvestManager.class);

    String id = Utils.getIdentifierFromParameters(params, context);

    String rat = Util.getParam(params, Params.RATING);
    String ip  = context.getIpAddress();

    int iLocalId = Integer.parseInt(id);
    if (!dm.existsMetadata(iLocalId))
      throw new IllegalArgumentException("Metadata not found --> " + id);

    if (ip == null)
      ip = "???.???.???.???";

    if (!Lib.type.isInteger(rat))
      throw new BadParameterEx(Params.RATING, rat);

    int rating = Integer.parseInt(rat);

    if (rating < 1 || rating > 5)
      throw new BadParameterEx(Params.RATING, rat);

    String harvUuid = getHarvestingUuid(context, id);

    // look up value of localrating/enable
    SettingManager settingManager = gc.getBean(SettingManager.class);
    boolean localRating = settingManager.getValueAsBool("system/localrating/enable", false);
   
    if (localRating || harvUuid == null)
      //--- metadata is local, just rate it
      rating = dm.rateMetadata(Integer.valueOf(id), ip, rating);
    else
    {
      //--- the metadata is harvested, is type=geonetwork?

      AbstractHarvester ah = hm.getHarvester(harvUuid);

      if (ah.getType().equals(GeonetHarvester.TYPE)) {
        String uuid = dm.getMetadataUuid(id);
        rating = setRemoteRating(context, (GeonetParams) ah.getParams(), uuid, rating);
      } else {
View Full Code Here

            public void run() {
                try {
                    boolean readOnly = gc.isReadOnly();
                    logger.debug("DBHeartBeat: GN is read-only ? " + readOnly);
                    boolean canWrite = checkDBWrite();
                    HarvestManager hm = gc.getBean(HarvestManager.class);
                    if (readOnly && canWrite) {
                        logger.warning("GeoNetwork can write to the database, switching to read-write mode");
                        readOnly = false;
                        gc.setReadOnly(readOnly);
                        hm.setReadOnly(readOnly);
                    } else if (!readOnly && !canWrite) {
                        logger.warning("GeoNetwork can not write to the database, switching to read-only mode");
                        readOnly = true;
                        gc.setReadOnly(readOnly);
                        hm.setReadOnly(readOnly);
                    } else {
                        if (readOnly) {
                            logger.info("GeoNetwork remains in read-only mode");
                        } else {
                            logger.debug("GeoNetwork remains in read-write mode");
View Full Code Here

TOP

Related Classes of org.fao.geonet.kernel.harvest.HarvestManager

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.