|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.harvester.datamodel.HarvestDefinition
public abstract class HarvestDefinition
This abstract class models the general properties of a harvest definition, i.e. object id , name, comments, and submission date
The specializing classes FullHarvest and PartielHarvest contains the specific properties and operations of snapshot harvestdefinitions and all other kinds of harvestdefinitions, respectively. Methods exist to generate jobs from this harvest definition.
Field Summary | |
---|---|
protected java.lang.String |
comments
|
protected long |
edition
Edition is used by the DAO to keep track of changes. |
protected java.lang.String |
harvestDefName
|
protected boolean |
isActive
Determines if the harvest definition is active and ready for scheduling. |
protected int |
numEvents
The number of times this event has already run. |
protected java.lang.Long |
oid
|
protected java.util.Date |
submissionDate
The time this harvest definition was first written. |
Constructor Summary | |
---|---|
HarvestDefinition()
|
Method Summary | |
---|---|
static FullHarvest |
createFullHarvest(java.lang.String harvestDefName,
java.lang.String comments,
java.lang.Long prevHarvestOid,
long maxCountObjects,
long maxBytes,
long maxJobRunningTime)
Create snapshot harvestdefinition. |
int |
createJobs()
Create Jobs from the configurations in this harvestdefinition and the current value of the limits in Settings. |
static PartialHarvest |
createPartialHarvest(java.util.List<DomainConfiguration> domainConfigurations,
Schedule schedule,
java.lang.String harvestDefName,
java.lang.String comments)
Create new instance of a PartialHavest configured according to the properties of the supplied DomainConfiguration. |
boolean |
equals(java.lang.Object o)
Tests whether some other object is "equal to" this HarvestDefinition. |
boolean |
getActive()
Returns the activation status. |
java.lang.String |
getComments()
Returns the comments for this harvest definition. |
abstract java.util.Iterator<DomainConfiguration> |
getDomainConfigurations()
Returns a iterator of domain configurations for this harvest definition. |
long |
getEdition()
Get the edition number. |
protected abstract long |
getMaxBytes()
Returns how many bytes to harvest per domain, or -1 for no limit. |
protected abstract long |
getMaxCountObjects()
Returns how many objects to harvest per domain, or 0 for no limit. |
java.lang.String |
getName()
Returns the name of the harvest definition. |
protected abstract Job |
getNewJob(DomainConfiguration cfg)
Get a new Job suited for this type of HarvestDefinition. |
int |
getNumEvents()
Get the number of times this harvest definition has been run so far. |
java.lang.Long |
getOid()
Return the object ID of this harvest definition. |
java.util.Date |
getSubmissionDate()
Returns the submission date. |
int |
hashCode()
Returns a hashcode of this object generated on fields oid, harvestDefName, and comments. |
(package private) boolean |
hasID()
Check if this harvestdefinition has an ID set yet (doesn't happen until the DBDAO persists it). |
abstract boolean |
isSnapShot()
Used to check if a harvestdefinition is a snapshot harvestdefinition. |
protected int |
makeJobs(java.util.Iterator<DomainConfiguration> cfglist)
Create new jobs from a collection of configurations. |
abstract boolean |
runNow(java.util.Date now)
Check if this harvest definition should be run, given the time now. |
void |
setActive(boolean active)
Set's activation status. |
void |
setComments(java.lang.String comments)
Set the comments for this harvest definition. |
void |
setEdition(long theEdition)
Set the edition number. |
(package private) void |
setNumEvents(int numEvents)
Set the number of times this harvest definition has been run so far. |
void |
setOid(java.lang.Long oid)
Set the object ID of this harvest definition. |
void |
setSubmissionDate(java.util.Date submissionDate)
Set the submission date. |
java.lang.String |
toString()
Return a human-readable string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Long oid
protected java.lang.String harvestDefName
protected java.util.Date submissionDate
protected java.lang.String comments
protected long edition
protected boolean isActive
protected int numEvents
Constructor Detail |
---|
public HarvestDefinition()
Method Detail |
---|
public static PartialHarvest createPartialHarvest(java.util.List<DomainConfiguration> domainConfigurations, Schedule schedule, java.lang.String harvestDefName, java.lang.String comments)
domainConfigurations
- a list of domain configurationsschedule
- the harvest definition scheduleharvestDefName
- the name of the harvest definitioncomments
- comments
public static FullHarvest createFullHarvest(java.lang.String harvestDefName, java.lang.String comments, java.lang.Long prevHarvestOid, long maxCountObjects, long maxBytes, long maxJobRunningTime)
harvestDefName
- the name of the harvest definitioncomments
- description of the harvestdefinitionprevHarvestOid
- an id of a previous harvest to use as
basis for this definition, ignored when null.maxCountObjects
- the maximum number of objects harvested from
any domainmaxBytes
- the maximum number of bytes harvested from
any domainmaxJobRunningTime
- The maximum running time for each job
public void setOid(java.lang.Long oid)
oid
- The oid
ArgumentNotValid
- if the oid is nullpublic java.lang.Long getOid()
boolean hasID()
public void setSubmissionDate(java.util.Date submissionDate)
submissionDate
- the time when the harvestdefinition was createdpublic java.util.Date getSubmissionDate()
public java.lang.String getName()
getName
in interface Named
public java.lang.String getComments()
getComments
in interface Named
public void setComments(java.lang.String comments)
comments
- A user-entered string.public long getEdition()
public void setEdition(long theEdition)
theEdition
- the new edition of the harvestdefinitionpublic int getNumEvents()
void setNumEvents(int numEvents)
numEvents
- The number.
ArgumentNotValid
- if numEvents is negativepublic void setActive(boolean active)
active
- new activation statuspublic boolean getActive()
public abstract java.util.Iterator<DomainConfiguration> getDomainConfigurations()
public int createJobs()
protected int makeJobs(java.util.Iterator<DomainConfiguration> cfglist)
cfglist
- the configurations to use to create the jobs
ArgumentNotValid
- if any of the parameters is null
or if the cfglist does not contain any
configurationsprotected abstract Job getNewJob(DomainConfiguration cfg)
cfg
- The configuration to use when creating the job
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
-
public int hashCode()
hashCode
in class java.lang.Object
public abstract boolean runNow(java.util.Date now)
now
- The current time
public abstract boolean isSnapShot()
protected abstract long getMaxCountObjects()
protected abstract long getMaxBytes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |