|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.pangaea.metadataportal.harvester.MetadataDocument
public class MetadataDocument
This class holds all information harvested and provides methods for IndexBuilder to create
a Lucene Document instance from it.
| Nested Class Summary | |
|---|---|
class |
MetadataDocument.XMLConverter
This class handles the transformation from any source to the "official" metadata format and can even validate it |
| Field Summary | |
|---|---|
protected Date |
datestamp
|
protected boolean |
deleted
|
protected SingleIndexConfig |
iconfig
The index configuration. |
protected String |
identifier
|
| Constructor Summary | |
|---|---|
MetadataDocument(SingleIndexConfig iconfig)
Constructor, that creates an empty instance for the supplied index configuration. |
|
| Method Summary | |
|---|---|
protected void |
addDefaultField(org.apache.lucene.document.Document ldoc)
Helper method that adds the default field to the given Lucene Document instance. |
protected void |
addField(org.apache.lucene.document.Document ldoc,
FieldConfig f,
String val)
Helper method to add a field in the correct format to given Lucene Document. |
protected void |
addFields(org.apache.lucene.document.Document ldoc)
Helper method that adds all fields to the given Lucene Document instance. |
protected void |
addSystemVariables(Map<QName,Object> vars)
Helper method to register all standard variables for the XPath/Templates evaluation. |
protected org.apache.lucene.document.Document |
createEmptyDocument()
Helper method that generates an empty Lucene Document instance. |
static MetadataDocument |
createInstanceFromLucene(SingleIndexConfig iconf,
org.apache.lucene.document.Document ldoc)
This static method "harvests" a stored Lucene Document from index for re-parsing. |
protected NodeList |
evaluateTemplate(ExpressionConfig expr)
Helper method to evaluate a template. |
protected String |
evaluateTemplateAsXHTML(FieldConfig expr)
Helper method to evaluate a template and return result as XHTML. |
MetadataDocument.XMLConverter |
getConverter()
Returns a converter instance that does transformation and validation according to index config. |
Date |
getDatestamp()
|
Document |
getFinalDOM()
Returns XML contents as DOM tree. |
String |
getIdentifier()
|
org.apache.lucene.document.Document |
getLuceneDocument()
Converts this instance to a Lucene Document. |
String |
getXML()
Returns XML contents as String (a cache is used). |
boolean |
isDeleted()
Returns deletion status. |
void |
loadFromLucene(org.apache.lucene.document.Document ldoc)
"Harvests" a stored Lucene Document from index for re-parsing. |
protected void |
processDocumentBoost(org.apache.lucene.document.Document ldoc)
Helper method that evaluates the document boost for the Lucene Document instance. |
protected boolean |
processFilters()
Helper method that evaluates all filters. |
protected void |
processXPathVariables()
Helper method to process all user supplied variables for the XPath/Templates evaluation. |
void |
setDatestamp(Date datestamp)
Set the datestamp (last modification time of document file). |
void |
setDeleted(boolean deleted)
Marks a harvested document as deleted. |
void |
setFinalDOM(Document dom)
Sets XML final (transformed) xml contents as DOM tree. |
void |
setIdentifier(String identifier)
Set the document identifier. |
String |
toString()
|
protected void |
walkNodeTexts(StringBuilder sb,
Node n,
boolean topLevel)
Helper method to walk through a DOM tree node (n) and collect strings. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean deleted
setDeleted(boolean)protected Date datestamp
setDatestamp(java.util.Date)protected String identifier
setIdentifier(java.lang.String)protected SingleIndexConfig iconfig
| Constructor Detail |
|---|
public MetadataDocument(SingleIndexConfig iconfig)
Rebuilder and createInstanceFromLucene(de.pangaea.metadataportal.config.SingleIndexConfig, org.apache.lucene.document.Document).
| Method Detail |
|---|
public static final MetadataDocument createInstanceFromLucene(SingleIndexConfig iconf,
org.apache.lucene.document.Document ldoc)
throws Exception
Document from index for re-parsing.
The class name for the correct MetadataDocument class extension is read from
field IndexConstants.FIELDNAME_MDOC_IMPL.
When the correct instance is created, it sets the SingleIndexConfig and calls loadFromLucene(org.apache.lucene.document.Document).
This method is used by the Rebuilder.
MetadataDocument
Exception
public void loadFromLucene(org.apache.lucene.document.Document ldoc)
throws Exception
Document from index for re-parsing.
Extracts XML blob, identifier and datestamp from Document.
Stored fields are not restored. They are regenerated by re-executing all
XPath and Templates.
SingleIndexConfig is used for index specific conversions.
Exception
public String getXML()
throws Exception
Exceptionpublic void setFinalDOM(Document dom)
public Document getFinalDOM()
public MetadataDocument.XMLConverter getConverter()
public void setDeleted(boolean deleted)
public boolean isDeleted()
setDeleted(boolean)public void setDatestamp(Date datestamp)
public Date getDatestamp()
setDatestamp(java.util.Date)public void setIdentifier(String identifier)
public String getIdentifier()
setIdentifier(java.lang.String)public String toString()
toString in class Object
public org.apache.lucene.document.Document getLuceneDocument()
throws Exception
Document.
Document or null, if doc was deleted.
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
IllegalStateException - if index configuration is unknown
protected org.apache.lucene.document.Document createEmptyDocument()
throws Exception
Document instance.
The standard fields are set to the doc properties (identifier, datestamp)
Document or null, if doc was deleted.
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
IllegalStateException - if identifier is empty.
protected void addDefaultField(org.apache.lucene.document.Document ldoc)
throws Exception
Document instance.
This method executes the XPath for the default field.
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
protected void addFields(org.apache.lucene.document.Document ldoc)
throws Exception
Document instance.
This method executes all XPath/Templates and converts the results.
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
protected void processDocumentBoost(org.apache.lucene.document.Document ldoc)
throws Exception
Document instance.
This method executes the XPath and converts the results to a float (default is 1.0f).
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
protected boolean processFilters()
throws Exception
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).protected void addSystemVariables(Map<QName,Object> vars)
MetadataDocument implementation.
The variables must be registered in the supplied Map.
protected final void processXPathVariables()
throws Exception
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
protected NodeList evaluateTemplate(ExpressionConfig expr)
throws TransformerException
For internal use only!
TransformerException
protected String evaluateTemplateAsXHTML(FieldConfig expr)
throws TransformerException,
IOException
For internal use only!
TransformerException
IOException
protected void walkNodeTexts(StringBuilder sb,
Node n,
boolean topLevel)
For internal use only!
protected void addField(org.apache.lucene.document.Document ldoc,
FieldConfig f,
String val)
throws Exception
Document.
The format is defined by the FieldConfig. The value is given as string.
For internal use only!
Exception - if an exception occurs during transformation (various types of exceptions can be thrown).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||