org.fao.geonet.kernel.harvest.harvester
Class AbstractHarvester

java.lang.Object
  extended by org.fao.geonet.kernel.harvest.harvester.AbstractHarvester
Direct Known Subclasses:
CswHarvester, Geonet20Harvester, GeonetHarvester, OaiPmhHarvester, WebDavHarvester, Z3950Harvester

public abstract class AbstractHarvester
extends java.lang.Object


Field Summary
protected  jeeves.server.context.ServiceContext context
           
protected  DataManager dataMan
           
protected  SettingManager settingMan
           
 
Constructor Summary
AbstractHarvester()
           
 
Method Summary
 void add(jeeves.resources.dbms.Dbms dbms, org.jdom.Element node)
           
protected  void add(org.jdom.Element el, java.lang.String name, int value)
           
 void addHarvestInfo(org.jdom.Element info, java.lang.String id, java.lang.String uuid)
          Adds harvesting information to each metadata element.
 void addInfo(org.jdom.Element node)
          Adds harvesting result information to each harvesting entry
static AbstractHarvester create(java.lang.String type, jeeves.server.context.ServiceContext context, SettingManager sm, DataManager dm)
           
 void destroy(jeeves.resources.dbms.Dbms dbms)
          Called when the harvesting entry is removed from the system.
protected abstract  java.lang.String doAdd(jeeves.resources.dbms.Dbms dbms, org.jdom.Element node)
           
protected abstract  void doAddInfo(org.jdom.Element node)
           
protected abstract  void doDestroy(jeeves.resources.dbms.Dbms dbms)
           
protected abstract  void doHarvest(jeeves.interfaces.Logger l, jeeves.server.resources.ResourceManager rm)
           
protected abstract  void doInit(org.jdom.Element entry)
           
protected abstract  void doUpdate(jeeves.resources.dbms.Dbms dbms, java.lang.String id, org.jdom.Element node)
           
 java.lang.String getID()
           
abstract  AbstractParams getParams()
           
abstract  java.lang.String getType()
           
 void init(org.jdom.Element node)
           
 Common.OperResult run()
           
protected  void setValue(java.util.Map<java.lang.String,java.lang.Object> values, java.lang.String path, org.jdom.Element el, java.lang.String name)
           
 Common.OperResult start(jeeves.resources.dbms.Dbms dbms)
           
static void staticInit(jeeves.server.context.ServiceContext context)
           
 Common.OperResult stop(jeeves.resources.dbms.Dbms dbms)
           
protected  void storeCategories(jeeves.resources.dbms.Dbms dbms, AbstractParams params, java.lang.String path)
          Override this method with an empty body to avoid categories storage
protected  void storeNode(jeeves.resources.dbms.Dbms dbms, AbstractParams params, java.lang.String path)
           
protected  void storeNodeExtra(jeeves.resources.dbms.Dbms dbms, AbstractParams params, java.lang.String path, java.lang.String siteId, java.lang.String optionsId)
          Override this method to store harvesting node's specific settings
protected  void storePrivileges(jeeves.resources.dbms.Dbms dbms, AbstractParams params, java.lang.String path)
          Override this method with an empty body to avoid privileges storage
 void update(jeeves.resources.dbms.Dbms dbms, org.jdom.Element node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected jeeves.server.context.ServiceContext context

settingMan

protected SettingManager settingMan

dataMan

protected DataManager dataMan
Constructor Detail

AbstractHarvester

public AbstractHarvester()
Method Detail

staticInit

public static void staticInit(jeeves.server.context.ServiceContext context)
                       throws java.lang.Exception
Throws:
java.lang.Exception

create

public static AbstractHarvester create(java.lang.String type,
                                       jeeves.server.context.ServiceContext context,
                                       SettingManager sm,
                                       DataManager dm)
                                throws jeeves.exceptions.BadParameterEx,
                                       jeeves.exceptions.OperationAbortedEx
Throws:
jeeves.exceptions.BadParameterEx
jeeves.exceptions.OperationAbortedEx

add

public void add(jeeves.resources.dbms.Dbms dbms,
                org.jdom.Element node)
         throws jeeves.exceptions.BadInputEx,
                java.sql.SQLException
Throws:
jeeves.exceptions.BadInputEx
java.sql.SQLException

init

public void init(org.jdom.Element node)
          throws jeeves.exceptions.BadInputEx
Throws:
jeeves.exceptions.BadInputEx

destroy

public void destroy(jeeves.resources.dbms.Dbms dbms)
             throws java.lang.Exception
Called when the harvesting entry is removed from the system. It is used to remove harvested metadata.

Throws:
java.lang.Exception

start

public Common.OperResult start(jeeves.resources.dbms.Dbms dbms)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

stop

public Common.OperResult stop(jeeves.resources.dbms.Dbms dbms)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

run

public Common.OperResult run()

update

public void update(jeeves.resources.dbms.Dbms dbms,
                   org.jdom.Element node)
            throws jeeves.exceptions.BadInputEx,
                   java.sql.SQLException
Throws:
jeeves.exceptions.BadInputEx
java.sql.SQLException

getID

public java.lang.String getID()

addInfo

public void addInfo(org.jdom.Element node)
Adds harvesting result information to each harvesting entry


addHarvestInfo

public void addHarvestInfo(org.jdom.Element info,
                           java.lang.String id,
                           java.lang.String uuid)
Adds harvesting information to each metadata element. Some sites can generate url for thumbnails


getType

public abstract java.lang.String getType()

getParams

public abstract AbstractParams getParams()

doInit

protected abstract void doInit(org.jdom.Element entry)
                        throws jeeves.exceptions.BadInputEx
Throws:
jeeves.exceptions.BadInputEx

doDestroy

protected abstract void doDestroy(jeeves.resources.dbms.Dbms dbms)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

doAdd

protected abstract java.lang.String doAdd(jeeves.resources.dbms.Dbms dbms,
                                          org.jdom.Element node)
                                   throws jeeves.exceptions.BadInputEx,
                                          java.sql.SQLException
Throws:
jeeves.exceptions.BadInputEx
java.sql.SQLException

doUpdate

protected abstract void doUpdate(jeeves.resources.dbms.Dbms dbms,
                                 java.lang.String id,
                                 org.jdom.Element node)
                          throws jeeves.exceptions.BadInputEx,
                                 java.sql.SQLException
Throws:
jeeves.exceptions.BadInputEx
java.sql.SQLException

doAddInfo

protected abstract void doAddInfo(org.jdom.Element node)

doHarvest

protected abstract void doHarvest(jeeves.interfaces.Logger l,
                                  jeeves.server.resources.ResourceManager rm)
                           throws java.lang.Exception
Throws:
java.lang.Exception

storeNode

protected void storeNode(jeeves.resources.dbms.Dbms dbms,
                         AbstractParams params,
                         java.lang.String path)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException

storePrivileges

protected void storePrivileges(jeeves.resources.dbms.Dbms dbms,
                               AbstractParams params,
                               java.lang.String path)
                        throws java.sql.SQLException
Override this method with an empty body to avoid privileges storage

Throws:
java.sql.SQLException

storeCategories

protected void storeCategories(jeeves.resources.dbms.Dbms dbms,
                               AbstractParams params,
                               java.lang.String path)
                        throws java.sql.SQLException
Override this method with an empty body to avoid categories storage

Throws:
java.sql.SQLException

storeNodeExtra

protected void storeNodeExtra(jeeves.resources.dbms.Dbms dbms,
                              AbstractParams params,
                              java.lang.String path,
                              java.lang.String siteId,
                              java.lang.String optionsId)
                       throws java.sql.SQLException
Override this method to store harvesting node's specific settings

Throws:
java.sql.SQLException

setValue

protected void setValue(java.util.Map<java.lang.String,java.lang.Object> values,
                        java.lang.String path,
                        org.jdom.Element el,
                        java.lang.String name)

add

protected void add(org.jdom.Element el,
                   java.lang.String name,
                   int value)