|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.basex.core.Progress
org.basex.build.Parser
org.basex.build.fs.NewFSParser
public final class NewFSParser
Imports/shreds/parses a file hierarchy into a database. The overall process of importing a file hierarchy can be described as follows:
CreateFS command. To import on the
command line type: $ create fs [path] [dbname]NewFSParser instantiates the parsers to extract
metadata and content from files.
| Nested Class Summary | |
|---|---|
static class |
NewFSParser.NS
All namespaces used in NewFSParser. |
| Field Summary | |
|---|---|
java.lang.String |
mountpoint
Path to FUSE mountpoint. |
java.lang.String |
mybackingpath
Path to root of the backing store for this import. |
static boolean |
VERBOSE
If true, verbose debug messages are created (e.g. for corrupt files). |
| Fields inherited from class org.basex.build.Parser |
|---|
doc, io, prop |
| Constructor Summary | |
|---|---|
NewFSParser(java.lang.String path,
Prop pr)
Constructor to parse single file nodes. |
|
NewFSParser(java.lang.String path,
java.lang.String mp,
java.lang.String bs,
Prop pr)
Constructor. |
|
| Method Summary | |
|---|---|
static boolean |
deleteDir(java.io.File dir)
Deletes a non-empty directory. |
java.lang.String |
det()
Returns short information on this process. |
void |
endContent()
Closes the last opened content element. |
void |
endXMLContent()
Closes the last opened XML content element. |
boolean |
isParseable(BufferedFileChannel f,
java.lang.String suffix)
Checks if a parser for the given suffix is available and the file is in the correct format. |
void |
metaEvent(Metadata m)
Generates the xml representation for a key-value pair and adds it to the current file element. |
void |
parse(Builder build)
Main entry point for the import of a file hierarchy. |
void |
parseFileFragment(BufferedFileChannel bfc,
java.lang.String title,
java.lang.String suffix)
Parses a fragment of a file, e.g. a picture inside an ID3 frame. |
void |
parseWithFallbackParser(BufferedFileChannel bfc,
boolean content)
Parses the file with the fallback parser. |
void |
parseXML()
Parses a xml file. |
double |
prog()
Returns progress information. |
static void |
register(java.lang.String suffix,
java.lang.Class<? extends AbstractParser> c)
Registers a parser implementation with the fs parser. |
static void |
registerFallback(java.lang.Class<? extends AbstractParser> c)
Registers a fallback parser implementation with the fs parser. |
void |
startContent(long offset,
long size)
Generates the xml representation for a new content element inside the current file or content node node. |
void |
startXMLContent(long offset,
long size)
Generates the xml representation for a new XML content element inside the current file or content node node. |
void |
textContent(long offset,
long size,
byte[] text,
boolean preserveSpace)
Adds a text element. |
void |
textContent(long offset,
long size,
java.lang.String text,
boolean preserveSpace)
Adds a text element. |
void |
textContent(long offset,
long size,
TokenBuilder text,
boolean preserveSpace)
Adds a text element. |
java.lang.String |
tit()
Returns short information on this process. |
| Methods inherited from class org.basex.build.Parser |
|---|
emptyParser, xmlParser |
| Methods inherited from class org.basex.core.Progress |
|---|
checkStop, detail, progress, progress, stop, title |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean VERBOSE
public final java.lang.String mountpoint
public final java.lang.String mybackingpath
| Constructor Detail |
|---|
public NewFSParser(java.lang.String path,
java.lang.String mp,
java.lang.String bs,
Prop pr)
path - the traversal starts frommp - mount point for fusebs - path to root of backing store for BLOBs on Windows systems. If
set to true, the path reference is ignoredpr - database properties
public NewFSParser(java.lang.String path,
Prop pr)
path - String to file node to parsepr - database properties| Method Detail |
|---|
public static void register(java.lang.String suffix,
java.lang.Class<? extends AbstractParser> c)
suffix - the suffix to register the parser implementation for.c - the parser implementation class.public static void registerFallback(java.lang.Class<? extends AbstractParser> c)
c - the parser implementation class.
public void parse(Builder build)
throws java.io.IOException
parse in class Parserbuild - instance passed by CreateFS.
java.io.IOException - I/O exception
public void parseFileFragment(BufferedFileChannel bfc,
java.lang.String title,
java.lang.String suffix)
throws java.io.IOException
Parses a fragment of a file, e.g. a picture inside an ID3 frame.
This method is intended to be called only from within a parser
implementation. The parser implementation must create a subchannel of its
BufferedFileChannel instance via
BufferedFileChannel.subChannel(int).
bfc - the BufferedFileChannel to read from.title - the title to set for the fragment. Set to null if
there is no title to set.suffix - the file suffix.
java.io.IOException - if any error occurs while reading from the file.
public void parseWithFallbackParser(BufferedFileChannel bfc,
boolean content)
throws java.io.IOException
Parses the file with the fallback parser.
This method is intended to be called from a parser implementation that failed to parse a file.
bfc - the BufferedFileChannel to read from.content - parses the content if true or the metadata otherwise.
java.io.IOException - if any error occurs while reading from the file.public java.lang.String tit()
Progress
tit in class Progresspublic java.lang.String det()
Progress
det in class Progresspublic double prog()
Progress
prog in class Progresspublic static boolean deleteDir(java.io.File dir)
dir - to be deleted.
public void metaEvent(Metadata m)
throws java.io.IOException
m - the Metadata object containing all metadata information.
java.io.IOException - if any error occurs while generating the xml code.
public void textContent(long offset,
long size,
java.lang.String text,
boolean preserveSpace)
throws java.io.IOException
offset - the absolute position of the first byte of the file fragment
represented by this content element inside the current file.size - the size of the content element.text - the text to add.preserveSpace - if true, the xml attribute xml:space is
set.
java.io.IOException - if any error occurs while reading from the file.
public void textContent(long offset,
long size,
byte[] text,
boolean preserveSpace)
throws java.io.IOException
offset - the absolute position of the first byte of the file fragment
represented by this content element inside the current file.size - the size of the content element.text - the text to add.preserveSpace - if true, the xml attribute xml:space is
set.
java.io.IOException - if any error occurs while reading from the file.
public void textContent(long offset,
long size,
TokenBuilder text,
boolean preserveSpace)
throws java.io.IOException
Adds a text element. If the position of the text content is unknown, the
offset should be set to -1. text must contain only valid
UTF-8 characters! Otherwise the generated XML document may be not
well-formed.
offset - the absolute position of the first byte of the file fragment
represented by this content element inside the current file.size - the size of the content element.text - the text to add.preserveSpace - if true, the xml attribute xml:space is
set.
java.io.IOException - if any error occurs while reading from the file.
public void startContent(long offset,
long size)
throws java.io.IOException
offset - the absolute position of the first byte of the file fragment
represented by this content element inside the current file.size - the size of the content element.
java.io.IOException - if any error occurs while reading from the file.
public void endContent()
throws java.io.IOException
java.io.IOException - if any error occurs while reading from the file.
public void startXMLContent(long offset,
long size)
throws java.io.IOException
offset - the absolute position of the first byte of the file fragment
represented by this content element inside the current file.size - the size of the content element.
java.io.IOException - if any error occurs while reading from the file.
public void endXMLContent()
throws java.io.IOException
java.io.IOException - if any error occurs while reading from the file.
public void parseXML()
throws java.io.IOException
java.io.IOException - if any error occurs while generating the xml code.
public boolean isParseable(BufferedFileChannel f,
java.lang.String suffix)
throws java.io.IOException
f - the BufferedFileChannel to check.suffix - the file suffix.
java.io.IOException - if any error occurs while reading from the file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||