Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.basex.build.fs
Class FSParser

    java.lang.Object
      org.basex.build.Parser
          org.basex.build.fs.FSParser

All Implemented Interfaces:
  FSVisitor

    public final class FSParser

extends Parser
implements FSVisitor

Imports/shreds/parses a file hierarchy into a BaseX database. The overall process of importing a file hierarchy can be described as follows:

1. The import is invoked by the `Create` command and its `Create` fs() function. To import on the command line type: `$ create fs [dbname] [path]`
2. This class `FSParser` instantiates the needed components for the import process in its `parse(Builder)` method. The components are:
   1. the file hierarchy traversal engine (`FSWalker` and
   2. as many visitors (`FSVisitor`) as needed to receive events during the traversal. In this case this class `FSParser` also implements the interface `FSVisitor` and as such is the essential one to shred/import the file hierarchy into an XML hierarchy.

Author:
  DBIS Group, U Konstanz 2007, ISC license, Alexander Holupirek
See Also:
  `FSWalker`, `FSVisitor`

Field Summary

Fields inherited from class org.basex.build.Parser
`file`

Constructor Summary
`FSParser(java.lang.String path)` Constructor.

Method Summary
`void` | `parse(Builder build)` Main entry point for the import of a file hierarchy to BaseX.
`double` | `percent()` Returns a value from 0 to 1, representing the current progress.
`void` | `postEvent()` Invoked when directory is left.
`void` | `postTraversal(boolean docClose)` Invoked after the traversal.
`void` | `preEvent(java.io.File dir)` Invoked before directory is entered.
`void` | `preTraversal(java.lang.String path, boolean docOpen)` Invoked before traversal starts.
`void` | `regfileEvent(java.io.File f)` Invoked when a regular file is visited.
`void` | `symlinkEvent(java.io.File link)` Invoked when a symbolic link is visited.
`java.lang.String` | `title()` Returns a compact description of the current progress.
`java.lang.String` | `toString()` Returns detailed progress information.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FSParser

    public FSParser(java.lang.String path)

  Constructor.

  Parameters:
    `path` - the traversal starts from (enter "/" or leave empty to parse all partitions (C:, D: ...) on Windows)

Method Detail

### parse

    public void parse(Builder build)
               throws java.io.IOException

  Main entry point for the import of a file hierarchy to BaseX. Instantiates fht engine and visitors, and starts the traversal.

  Specified by:
    `parse` in class `Parser`
  Parameters:
    `build` - instance passed by `Create` fs().
  Throws:
    `java.io.IOException` - I/O exception

### percent

    public double percent()

  Description copied from class: `Parser`
  Returns a value from 0 to 1, representing the current progress.

  Specified by:
    `percent` in class `Parser`
  Returns:
    progress information

### postEvent

    public void postEvent()
                   throws java.io.IOException

  Invoked when directory is left.

  Specified by:
    `postEvent` in interface `FSVisitor`
  Throws:
    `java.io.IOException` - I/O exception

### postTraversal

    public void postTraversal(boolean docClose)
                       throws java.io.IOException

  Invoked after the traversal.

  Specified by:
    `postTraversal` in interface `FSVisitor`
  Parameters:
    `docClose` - indicates if the document is to be closed.
  Throws:
    `java.io.IOException` - I/O exception

### preEvent

    public void preEvent(java.io.File dir)
                  throws java.io.IOException

  Invoked before directory is entered.

  Specified by:
    `preEvent` in interface `FSVisitor`
  Parameters:
    `dir` - name
  Throws:
    `java.io.IOException` - I/O exception

### preTraversal

    public void preTraversal(java.lang.String path,
                             boolean docOpen)
                      throws java.io.IOException

  Invoked before traversal starts. If more than one file hierarchy is to be imported (for example 'Import all...' on Windows gets C:, D: ...), you have to indicate the very first traversal to construct a document node.

  Specified by:
    `preTraversal` in interface `FSVisitor`
  Parameters:
    `path` - the traversal starts from.
    `docOpen` - indicates if this is also the beginning of the document.
  Throws:
    `java.io.IOException` - I/O exception

### regfileEvent

    public void regfileEvent(java.io.File f)
                      throws java.io.IOException

  Invoked when a regular file is visited.

  Specified by:
    `regfileEvent` in interface `FSVisitor`
  Parameters:
    `f` - name
  Throws:
    `java.io.IOException` - I/O exception

### symlinkEvent

    public void symlinkEvent(java.io.File link)

  Invoked when a symbolic link is visited.

  Specified by:
    `symlinkEvent` in interface `FSVisitor`
  Parameters:
    `link` - to be visited.

### title

    public java.lang.String title()

  Description copied from class: `Parser`
  Returns a compact description of the current progress.

  Specified by:
    `title` in class `Parser`
  Returns:
    progress information

### toString

    public java.lang.String toString()

  Description copied from class: `Parser`
  Returns detailed progress information.

  Specified by:
    `toString` in class `Parser`
  Returns:
    position info

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD