org.archive.crawler.settings
Class CrawlerSettings

java.lang.Object
  extended by org.archive.crawler.settings.CrawlerSettings

public class CrawlerSettings
extends java.lang.Object

Class representing a settings file. More precisely it represents a collection of settings valid in a particular scope. The scope is either the global settings, or the settings to be used for a particular domain or host. For scopes other than global, the instance will only contain those settings that are different from the global. In the default implementation this is a one to one mapping from a file to an instance of this class, but in other implementations the information in an instance of this class might be stored in a different way (for example in a RDBMS).

Author:
John Erik Halse

Constructor Summary
CrawlerSettings(SettingsHandler handler, java.lang.String scope)
          Constructs a new CrawlerSettings object.
CrawlerSettings(SettingsHandler handler, java.lang.String scope, java.lang.String refinement)
          Constructs a new CrawlerSettings object which is a refinement of another settings object.
 
Method Summary
protected  DataContainer addComplexType(ComplexType type)
           
 void addRefinement(Refinement refinement)
          Add a refinement to this settings object.
protected  void addTopLevelModule(ModuleType module)
           
 java.lang.String getAudience()
          Get the audience/customer/recipient of the crawl job product from this CrawlerSettings object.
protected  DataContainer getData(ComplexType complex)
           
protected  DataContainer getData(java.lang.String absoluteName)
           
 java.lang.String getDescription()
          Get the description of this CrawlerSettings object.
 java.util.Date getLastSavedTime()
          Get the time when this CrawlerSettings was last saved to persistent storage.
 ModuleType getModule(java.lang.String name)
           
 java.lang.String getName()
          Get the name of this CrawlerSettings object.
 java.lang.String getOperator()
          Get the name of operator of this crawl from this CrawlerSettings object.
 java.lang.String getOrganization()
          Get the name of the organization running this crawl from this CrawlerSettings object.
 CrawlerSettings getParent()
          Get the parent of this CrawlerSettings object.
 CrawlerSettings getParent(UURI uri)
          Get the parent of this CrawlerSettings object.
 Refinement getRefinement(java.lang.String reference)
          Get a refinement with a given reference.
 java.lang.String getScope()
          Get the scope of this CrawlerSettings object.
 SettingsHandler getSettingsHandler()
          Get the SettingHandler this CrawlerSettings object belongs to.
protected  ModuleType getTopLevelModule(java.lang.String name)
           
 boolean hasRefinements()
          Returns true if this settings object has refinements attached to it.
 boolean isRefinement()
          Returns true if this settings object is a refinement.
 java.util.ListIterator refinementsIterator()
          Get an ListIterator over the refinements for this settings object.
 boolean removeRefinement(java.lang.String reference)
          Remove a refinement from this settings object.
 void setAudience(java.lang.String name)
          Set the recipient/customer for the crawl job product.
 void setDescription(java.lang.String string)
          Set the description of this CrawlerSettings object.
protected  void setLastSavedTime(java.util.Date lastSaved)
          Set the time when this CrawlerSettings was last saved to persistent storage.
 void setName(java.lang.String string)
          Set the name of this CrawlerSettings object.
 void setOperator(java.lang.String name)
          Set the operator of this crawl job.
 void setOrganization(java.lang.String name)
          Set the name of the organization who is running this crawl.
 void setRefinement(boolean isRefinement)
          Mark this settings object as an refinement.
protected  java.util.Iterator topLevelModules()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrawlerSettings

public CrawlerSettings(SettingsHandler handler,
                       java.lang.String scope)
Constructs a new CrawlerSettings object. Application code should not call the constructor directly, but use the methods in SettingsHandler instead.

Parameters:
handler - The SettingsHandler this object belongs to.
scope - The scope of this settings object (ie. host or domain).
See Also:
SettingsHandler.getSettings(String), SettingsHandler.getSettingsObject(String)

CrawlerSettings

public CrawlerSettings(SettingsHandler handler,
                       java.lang.String scope,
                       java.lang.String refinement)
Constructs a new CrawlerSettings object which is a refinement of another settings object. Application code should not call the constructor directly, but use the methods in SettingsHandler instead.

Parameters:
handler - The SettingsHandler this object belongs to.
scope - The scope of this settings object (ie. host or domain).
refinement - the name or reference to the refinement.
See Also:
SettingsHandler.getSettings(String), SettingsHandler.getSettingsObject(String)
Method Detail

getDescription

public java.lang.String getDescription()
Get the description of this CrawlerSettings object.

Returns:
the description of this CrawlerSettings object.

getName

public java.lang.String getName()
Get the name of this CrawlerSettings object.

Returns:
the name of this CrawlerSettings object.

getOperator

public java.lang.String getOperator()
Get the name of operator of this crawl from this CrawlerSettings object.

Returns:
the name of this CrawlerSettings object.

getOrganization

public java.lang.String getOrganization()
Get the name of the organization running this crawl from this CrawlerSettings object.

Returns:
the name of the organization running this crawl.

getAudience

public java.lang.String getAudience()
Get the audience/customer/recipient of the crawl job product from this CrawlerSettings object.

Returns:
the audience/customer/recipient of the crawl job product.

getScope

public java.lang.String getScope()
Get the scope of this CrawlerSettings object.

Returns:
the scope of this CrawlerSettings object.

setDescription

public void setDescription(java.lang.String string)
Set the description of this CrawlerSettings object.

Parameters:
string - the description to be set for this CrawlerSettings object.

setOperator

public void setOperator(java.lang.String name)
Set the operator of this crawl job.

Parameters:
name - Operator running this crawl.

setOrganization

public void setOrganization(java.lang.String name)
Set the name of the organization who is running this crawl.

Parameters:
name - Name of organization running this crawl.

setAudience

public void setAudience(java.lang.String name)
Set the recipient/customer for the crawl job product.

Parameters:
name - Recipient of crawl job product.

setName

public void setName(java.lang.String string)
Set the name of this CrawlerSettings object.

Parameters:
string - the name to be set for this CrawlerSettings object.

getLastSavedTime

public java.util.Date getLastSavedTime()
Get the time when this CrawlerSettings was last saved to persistent storage.

Returns:
the time when this CrawlerSettings was last saved to persistent storage. Null if it has not been saved.

setLastSavedTime

protected void setLastSavedTime(java.util.Date lastSaved)
Set the time when this CrawlerSettings was last saved to persistent storage.

Parameters:
lastSaved - the time when this CrawlerSettings was last saved to persistent storage.

addTopLevelModule

protected void addTopLevelModule(ModuleType module)

addComplexType

protected DataContainer addComplexType(ComplexType type)

getData

protected DataContainer getData(ComplexType complex)

getData

protected DataContainer getData(java.lang.String absoluteName)

getTopLevelModule

protected ModuleType getTopLevelModule(java.lang.String name)

getModule

public ModuleType getModule(java.lang.String name)

topLevelModules

protected java.util.Iterator topLevelModules()

getParent

public CrawlerSettings getParent()
Get the parent of this CrawlerSettings object.

Returns:
the parent of this CrawlerSettings object.

getParent

public CrawlerSettings getParent(UURI uri)
Get the parent of this CrawlerSettings object. This method passes around a URI so that refinements could be checked.

Parameters:
uri - The uri for which parents of this object shoul be found.
Returns:
the parent of this CrawlerSettings object.

getSettingsHandler

public SettingsHandler getSettingsHandler()
Get the SettingHandler this CrawlerSettings object belongs to.

Returns:
the SettingHandler this CrawlerSettings object belongs to.

refinementsIterator

public java.util.ListIterator refinementsIterator()
Get an ListIterator over the refinements for this settings object.

Returns:
Returns an iterator over the refinements.

addRefinement

public void addRefinement(Refinement refinement)
Add a refinement to this settings object.

Parameters:
refinement - The refinements to set.

removeRefinement

public boolean removeRefinement(java.lang.String reference)
Remove a refinement from this settings object.

Parameters:
reference - the reference (name) to the refinement to be removed.
Returns:
true if something was removed, false if the refinement was not found.

getRefinement

public Refinement getRefinement(java.lang.String reference)
Get a refinement with a given reference.

Parameters:
reference - the reference (name) to the refinement to get.
Returns:
the refinement having the specified reference or null if no refinement matches it.

hasRefinements

public boolean hasRefinements()
Returns true if this settings object has refinements attached to it.

Returns:
true if this settings object has refinements attached to it.

isRefinement

public boolean isRefinement()
Returns true if this settings object is a refinement.

Returns:
true if this settings object is a refinement.

setRefinement

public void setRefinement(boolean isRefinement)
Mark this settings object as an refinement.

Parameters:
isRefinement - Set this to true if this settings object is a refinement.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.