Class MetaData

java.lang.Object
org.basex.data.MetaData

public final class MetaData extends Object
This class provides meta information on a database.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • dir

      public final IOFile dir
      Database directory. Set to null if database is in main memory.
    • name

      public String name
      Database name.
    • original

      public String original
      Path to initially imported resources.
    • inputsize

      public long inputsize
      Size of initially imported resources.
    • time

      public long time
      Database timestamp.
    • ndocs

      public int ndocs
      Number of stored XML documents.
    • textindex

      public boolean textindex
      Indicates if a text index exists.
    • attrindex

      public boolean attrindex
      Indicates if an attribute index exists.
    • tokenindex

      public boolean tokenindex
      Indicates if a token index exists.
    • ftindex

      public boolean ftindex
      Indicates if a full-text index exists.
    • updindex

      public boolean updindex
      Flag for activated automatic index update.
    • autooptimize

      public boolean autooptimize
      Flag for automatic index updating.
    • createtext

      public boolean createtext
      Indicates if the text index is to be recreated.
    • createattr

      public boolean createattr
      Indicates if the attribute index is to be recreated.
    • createtoken

      public boolean createtoken
      Indicates if the token index is to be recreated.
    • createft

      public boolean createft
      Indicates if the full-text index is to be recreated.
    • textinclude

      public String textinclude
      Text index: names to include.
    • attrinclude

      public String attrinclude
      Attribute index: names to include.
    • tokeninclude

      public String tokeninclude
      Token index: names to tokenize.
    • ftinclude

      public String ftinclude
      Full-text index: names to include.
    • stemming

      public boolean stemming
      Flag for full-text stemming.
    • casesens

      public boolean casesens
      Flag for full-text case sensitivity.
    • diacritics

      public boolean diacritics
      Flag for full-text diacritics removal.
    • stopwords

      public String stopwords
      Full-text stopword file.
    • maxcats

      public int maxcats
      Maximum number of categories.
    • maxlen

      public int maxlen
      Maximum length of index entries.
    • splitsize

      public int splitsize
      Split size for creating indexes.
    • language

      public Language language
      Language of full-text search index.
    • uptodate

      public boolean uptodate
      Indicates if index structures are out-dated.
    • corrupt

      public boolean corrupt
      Indicate if the database may be corrupt.
    • dirty

      public boolean dirty
      Dirty flag.
    • size

      public int size
      Number of nodes.
    • lastid

      public int lastid
      Last (highest) id assigned to a node. Can be -1 if database is empty.
  • Constructor Details

    • MetaData

      public MetaData(MainOptions options)
      Constructor for a main-memory database instance.
      Parameters:
      options - database options
    • MetaData

      public MetaData(String name, MainOptions options, StaticOptions sopts)
      Constructor.
      Parameters:
      name - name of the database
      options - database options
      sopts - static options
  • Method Details

    • normPath

      public static String normPath(String path)
      Normalizes a database path. Converts backslashes and removes duplicate and leading slashes. Returns null if the path contains invalid characters.
      Parameters:
      path - input path
      Returns:
      normalized path or null
    • file

      public static IOFile file(IOFile path, String name)
      Creates a database file.
      Parameters:
      path - database path
      name - filename
      Returns:
      database filename
    • oldindex

      public boolean oldindex()
      Returns true if the indexes need to be updated.
      Returns:
      result of check
    • dbSize

      public long dbSize()
      Returns the disk size of the database.
      Returns:
      database size
    • dbTime

      public long dbTime()
      Returns the disk timestamp of the database.
      Returns:
      database size
    • dbFile

      public IOFile dbFile(String filename)
      Returns a file instance for the specified database file. Should only be called if database is disk-based.
      Parameters:
      filename - filename
      Returns:
      database filename
    • binaryDir

      public IOFile binaryDir()
      Returns the binary directory.
      Returns:
      binary directory, or null if this is a main-memory database
    • updateFile

      public IOFile updateFile()
      Returns a file that indicates ongoing updates.
      Returns:
      updating file
    • binary

      public IOFile binary(String path)
      Returns a reference to the specified binary file.
      Parameters:
      path - internal file path
      Returns:
      path, or null if this is a main-memory database of if the resource path cannot be resolved (e.g. because it points to a parent directory).
    • drop

      public boolean drop(String pattern)
      Drops the specified database files. Should only be called if database is disk-based.
      Parameters:
      pattern - file pattern or null if all files are to be deleted
      Returns:
      result of check
    • read

      public void read() throws IOException
      Reads in all meta data.
      Throws:
      IOException - exception
    • index

      public boolean index(IndexType type)
      Returns if the specified index exists.
      Parameters:
      type - index type
      Returns:
      result of check
    • index

      public void index(IndexType type, boolean exists)
      Sets availability of the specified index.
      Parameters:
      type - index type
      exists - indicates if the index exists
    • names

      public String names(IndexType type)
      Returns the included names for the specified index type.
      Parameters:
      type - index type
      Returns:
      index
    • names

      public void names(IndexType type, MainOptions options)
      Assigns include names options to the specified index type.
      Parameters:
      type - index type
      options - main options
    • update

      public void update()
      Notifies the meta structures of an update and invalidates the indexes.
    • assign

      public void assign(Parser parser)
      Assigns parser information.
      Parameters:
      parser - parser