Class Load

java.lang.Object
com.github.oeuvres.alix.cli.Load
All Implemented Interfaces:
Callable<Integer>

public class Load extends Object implements Callable<Integer>
Load an XML/TEI corpus in a custom Lucene index for Alix.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
    Prefix for log lines.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    static void
    main(String[] args)
    Send index loading.
    static String
    Factor construction of old index name.
    static String
    Factor construction of temp index name.
    void
    parse(File propsFile)
    Parse properties to produce an alix lucene index
    void
    write(String name, Path path)
    Write documents to a lucene index.
    void
    writeSafe(File dstDir, String name)
    A logic to write safely an index in a temp directory before affecting a running index.
    void
    writeUnsafe(File dstdir, String name)
    Because a bug in Microsoft.Windows filesystem with Java, impossible to have the same safe indexation like for unix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • APP

      public static String APP
      Prefix for log lines.
  • Constructor Details

    • Load

      public Load()
      Default constructor.
  • Method Details

    • call

      public Integer call() throws Exception
      Specified by:
      call in interface Callable<Integer>
      Throws:
      Exception
    • parse

      public void parse(File propsFile) throws IOException, NoSuchFieldException
      Parse properties to produce an alix lucene index
      Parameters:
      propsFile - A properties file in XML format Properties.loadFromXML(java.io.InputStream).
      Throws:
      IOException - I/O file system error, or required files not found.
      NoSuchFieldException - Properties errors.
    • nameOld

      public static String nameOld(String name)
      Factor construction of old index name.
      Parameters:
      name - An index name.
      Returns:
      Name of an old index.
    • nameTmp

      public static String nameTmp(String name)
      Factor construction of temp index name.
      Parameters:
      name - An index name.
      Returns:
      Name of temp index.
    • write

      public void write(String name, Path path) throws Exception
      Write documents to a lucene index.
      Parameters:
      name - Name of the base.
      path - Path where to write the path index.
      Throws:
      Exception - Errors in the XML parsing.
    • writeSafe

      public void writeSafe(File dstDir, String name) throws Exception
      A logic to write safely an index in a temp directory before affecting a running index.
      Parameters:
      dstDir - Destination parent file directory.
      name - Name of the index to write.
      Throws:
      Exception - Errors during XML process and Lucene indexation.
    • writeUnsafe

      public void writeUnsafe(File dstdir, String name) throws Exception
      Because a bug in Microsoft.Windows filesystem with Java, impossible to have the same safe indexation like for unix.
      Parameters:
      dstdir - Parent destination file system directory.
      name - Name of a lucene index.
      Throws:
      Exception - XML or Lucene erros.
    • main

      public static void main(String[] args) throws Exception
      Send index loading.
      Parameters:
      args - Command line arguments.
      Throws:
      Exception - XML or Lucene errors.