|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.archive.crawler.settings.SettingsHandler org.archive.crawler.settings.XMLSettingsHandler
public class XMLSettingsHandler
A SettingsHandler which uses XML files as persistent storage.
Field Summary | |
---|---|
protected static java.lang.String |
XML_ATTRIBUTE_CLASS
|
protected static java.lang.String |
XML_ATTRIBUTE_FROM
|
protected static java.lang.String |
XML_ATTRIBUTE_NAME
|
protected static java.lang.String |
XML_ATTRIBUTE_TO
|
protected static java.lang.String |
XML_ELEMENT_AUDIENCE
|
protected static java.lang.String |
XML_ELEMENT_CONTENTMATCHES
|
protected static java.lang.String |
XML_ELEMENT_CONTROLLER
|
protected static java.lang.String |
XML_ELEMENT_DATE
|
protected static java.lang.String |
XML_ELEMENT_DESCRIPTION
|
protected static java.lang.String |
XML_ELEMENT_LIMITS
|
protected static java.lang.String |
XML_ELEMENT_META
|
protected static java.lang.String |
XML_ELEMENT_NAME
|
protected static java.lang.String |
XML_ELEMENT_NEW_OBJECT
|
protected static java.lang.String |
XML_ELEMENT_OBJECT
|
protected static java.lang.String |
XML_ELEMENT_OPERATOR
|
protected static java.lang.String |
XML_ELEMENT_ORGANIZATION
|
protected static java.lang.String |
XML_ELEMENT_PORTNUMBER
|
protected static java.lang.String |
XML_ELEMENT_REFERENCE
|
protected static java.lang.String |
XML_ELEMENT_REFINEMENT
|
protected static java.lang.String |
XML_ELEMENT_REFINEMENTLIST
|
protected static java.lang.String |
XML_ELEMENT_TIMESPAN
|
protected static java.lang.String |
XML_ELEMENT_URIMATCHES
|
protected static java.lang.String |
XML_ROOT_HOST_SETTINGS
|
protected static java.lang.String |
XML_ROOT_ORDER
|
protected static java.lang.String |
XML_ROOT_REFINEMENT
|
protected static java.lang.String |
XML_SCHEMA
|
Fields inherited from class org.archive.crawler.settings.SettingsHandler |
---|
BOOLEAN, DOUBLE, DOUBLE_LIST, FLOAT, FLOAT_LIST, INTEGER, INTEGER_LIST, LONG, LONG_LIST, MAP, OBJECT, STRING, STRING_LIST, TEXT, threadContextSettingsHandler, TIMESTAMP |
Constructor Summary | |
---|---|
XMLSettingsHandler(java.io.File orderFile)
Create a new XMLSettingsHandler object. |
Method Summary | |
---|---|
void |
copySettings(java.io.File newOrderFileName,
java.lang.String newSettingsDirectory)
Creates a replica of the settings file structure in another directory (fully recursive, includes all per host settings). |
void |
deleteSettingsObject(CrawlerSettings settings)
Delete a settings object from persistent storage. |
java.util.Collection |
getDomainOverrides(java.lang.String rootDomain)
Will return a Collection of strings with domains that contain 'per' domain overrides (or their subdomains contain them). |
java.util.List<java.lang.String> |
getListOfAllFiles()
Creates and returns a List of all files comprising the current settings framework. |
java.io.File |
getOrderFile()
Get the File object pointing to the order file. |
java.io.File |
getPathRelativeToWorkingDirectory(java.lang.String path)
Transforms a relative path so that it is relative to the location of the order file. |
void |
initialize()
Initialize the SettingsHandler. |
void |
initialize(java.io.File source)
Initialize the SettingsHandler from a source. |
protected CrawlerSettings |
readSettingsObject(CrawlerSettings settings)
Read the CrawlerSettings object from persistent storage. |
protected CrawlerSettings |
readSettingsObject(CrawlerSettings settings,
java.io.File f)
Read the CrawlerSettings object from a specific file. |
protected java.io.File |
settingsToFilename(CrawlerSettings settings)
Resolves the filename for a settings object into a file path. |
static java.lang.String |
toResourcePath(java.io.File f)
Convert a File to a path that might be resolved from classpath/JAR resource sources. |
void |
writeSettingsObject(CrawlerSettings settings)
Write the CrawlerSettings object to persistent storage. |
void |
writeSettingsObject(CrawlerSettings settings,
java.io.File filename)
Write a CrawlerSettings object to a specified file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String XML_SCHEMA
protected static final java.lang.String XML_ROOT_ORDER
protected static final java.lang.String XML_ROOT_HOST_SETTINGS
protected static final java.lang.String XML_ROOT_REFINEMENT
protected static final java.lang.String XML_ELEMENT_CONTROLLER
protected static final java.lang.String XML_ELEMENT_META
protected static final java.lang.String XML_ELEMENT_NAME
protected static final java.lang.String XML_ELEMENT_DESCRIPTION
protected static final java.lang.String XML_ELEMENT_OPERATOR
protected static final java.lang.String XML_ELEMENT_ORGANIZATION
protected static final java.lang.String XML_ELEMENT_AUDIENCE
protected static final java.lang.String XML_ELEMENT_DATE
protected static final java.lang.String XML_ELEMENT_REFINEMENTLIST
protected static final java.lang.String XML_ELEMENT_REFINEMENT
protected static final java.lang.String XML_ELEMENT_REFERENCE
protected static final java.lang.String XML_ELEMENT_LIMITS
protected static final java.lang.String XML_ELEMENT_TIMESPAN
protected static final java.lang.String XML_ELEMENT_PORTNUMBER
protected static final java.lang.String XML_ELEMENT_URIMATCHES
protected static final java.lang.String XML_ELEMENT_CONTENTMATCHES
protected static final java.lang.String XML_ELEMENT_OBJECT
protected static final java.lang.String XML_ELEMENT_NEW_OBJECT
protected static final java.lang.String XML_ATTRIBUTE_NAME
protected static final java.lang.String XML_ATTRIBUTE_CLASS
protected static final java.lang.String XML_ATTRIBUTE_FROM
protected static final java.lang.String XML_ATTRIBUTE_TO
Constructor Detail |
---|
public XMLSettingsHandler(java.io.File orderFile) throws javax.management.InvalidAttributeValueException
orderFile
- where the order file is located.
javax.management.InvalidAttributeValueException
Method Detail |
---|
public void initialize()
initialize
in class SettingsHandler
public void initialize(java.io.File source)
source
- the order file to initialize from.protected final java.io.File settingsToFilename(CrawlerSettings settings)
settings
- the settings object to get file path for.
public final void writeSettingsObject(CrawlerSettings settings)
SettingsHandler
writeSettingsObject
in class SettingsHandler
settings
- the settings object to write.public final void writeSettingsObject(CrawlerSettings settings, java.io.File filename)
writeSettingsObject(CrawlerSettings)
except that it uses the submitted File object instead of trying to
resolve where the file should be written.
settings
- the settings object to be serialized.filename
- the file to which the settings object should be written.protected final CrawlerSettings readSettingsObject(CrawlerSettings settings, java.io.File f)
settings
- the settings object to be updated with data from the
persistent storage.f
- the file to read from.
public static java.lang.String toResourcePath(java.io.File f)
f
- File
protected final CrawlerSettings readSettingsObject(CrawlerSettings settings)
SettingsHandler
readSettingsObject
in class SettingsHandler
settings
- the settings object to be updated with data from the
persistent storage.
public java.io.File getOrderFile()
File
object pointing to the order file.
public void copySettings(java.io.File newOrderFileName, java.lang.String newSettingsDirectory) throws java.io.IOException
newOrderFileName
- where the new order file should be saved.newSettingsDirectory
- the top level directory of the per host/domain
settings files.
java.io.IOException
public java.io.File getPathRelativeToWorkingDirectory(java.lang.String path)
The location of it's order file is always considered as the 'working' directory for any given settings.
getPathRelativeToWorkingDirectory
in class SettingsHandler
path
- A relative path to a file (or directory)
public java.util.Collection getDomainOverrides(java.lang.String rootDomain)
SettingsHandler
getDomainOverrides
in class SettingsHandler
rootDomain
- The domain to get domain overrides for. Examples:
'org', 'archive.org', 'crawler.archive.org' etc.
public void deleteSettingsObject(CrawlerSettings settings)
deleteSettingsObject
in class SettingsHandler
settings
- the settings object to delete.public java.util.List<java.lang.String> getListOfAllFiles()
SettingsHandler
The List contains the absolute String path of each file.
The list should contain any configurable files, including such files as seed file and any other files use by the various settings modules.
Implementations of the SettingsHandler that do not use files for permanent storage should return an empty list.
getListOfAllFiles
in class SettingsHandler
List
of framework files.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |