org.basex.data
Class MetaData

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

public final class MetaData
extends java.lang.Object

This class provides meta information on a database.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 boolean attrindex
          Indicates if a attribute index exists.
 boolean casesens
          Flag for full-text case sensitivity.
 boolean chop
          Flag for whitespace chopping.
 boolean corrupt
          Flag to indicate possible corruption.
 boolean createattr
          Indicates if attribute index is to be recreated.
 boolean createftxt
          Indicates if full-text index is to be recreated.
 boolean createtext
          Indicates if text index is to be recreated.
 boolean diacritics
          Flag for full-text diacritics removal.
 boolean dirty
          Dirty flag.
 java.lang.String encoding
          Encoding of original document.
 long filesize
          Size of original document.
 boolean ftxtindex
          Indicates if a full-text index exists.
 Language language
          Language of full-text search index.
 int lastid
          Last (highest) id assigned to a node.
 int maxcats
          Maximum number of categories.
 int maxlen
          Maximum token length.
 java.lang.String name
          Database name.
 int ndocs
          Number of stored documents.
 java.lang.String original
          Path to original document.
 IOFile path
          Database path.
 Prop prop
          Properties.
 int size
          Table size.
 boolean stemming
          Flag for full-text stemming.
 java.lang.String stopwords
          Full-text stopword file.
 boolean textindex
          Indicates if a text index exists.
 long time
          Timestamp of original document.
 boolean updindex
          Flag for activated automatic index update.
 boolean uptodate
          Flag for out-of-date index structures.
 Users users
          Database users.
 
Constructor Summary
MetaData(Prop pr)
          Constructor, specifying the database properties.
MetaData(java.lang.String db, Context ctx)
          Constructor, specifying the database name and context.
 
Method Summary
 IOFile binaries()
          Returns the binary directory.
 IOFile binary(java.lang.String pth)
          Returns the specified binary file, or null if the resource path cannot be resolved (e.g.
 IOFile dbfile(java.lang.String fn)
          Returns a file instance for the specified database file.
 long dbsize()
          Returns the disk size of the database.
 long dbtime()
          Returns the disk timestamp of the database.
 boolean drop(java.lang.String pat)
          Drops the specified database files.
static IOFile file(IOFile path, java.lang.String fn)
          Creates a database file.
static java.lang.String normPath(java.lang.String path)
          Normalizes a database path.
 boolean oldindex()
          Returns true if the indexes need to be updated.
 void read()
          Reads in all meta data.
 void read(DataInput in)
          Reads in meta data from the specified stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

public final IOFile path
Database path. Set to null if database is in main memory.


prop

public final Prop prop
Properties.


name

public volatile java.lang.String name
Database name.


users

public volatile Users users
Database users.


encoding

public volatile java.lang.String encoding
Encoding of original document.


original

public volatile java.lang.String original
Path to original document.


filesize

public volatile long filesize
Size of original document.


ndocs

public volatile int ndocs
Number of stored documents.


time

public volatile long time
Timestamp of original document.


chop

public volatile boolean chop
Flag for whitespace chopping.


updindex

public volatile boolean updindex
Flag for activated automatic index update.


textindex

public volatile boolean textindex
Indicates if a text index exists.


attrindex

public volatile boolean attrindex
Indicates if a attribute index exists.


ftxtindex

public volatile boolean ftxtindex
Indicates if a full-text index exists.


createtext

public volatile boolean createtext
Indicates if text index is to be recreated.


createattr

public volatile boolean createattr
Indicates if attribute index is to be recreated.


createftxt

public volatile boolean createftxt
Indicates if full-text index is to be recreated.


stemming

public volatile boolean stemming
Flag for full-text stemming.


casesens

public volatile boolean casesens
Flag for full-text case sensitivity.


diacritics

public volatile boolean diacritics
Flag for full-text diacritics removal.


stopwords

public volatile java.lang.String stopwords
Full-text stopword file.


maxcats

public volatile int maxcats
Maximum number of categories.


maxlen

public volatile int maxlen
Maximum token length.


language

public volatile Language language
Language of full-text search index.


uptodate

public volatile boolean uptodate
Flag for out-of-date index structures. Will be removed as soon as all indexes support updates.


corrupt

public volatile boolean corrupt
Flag to indicate possible corruption.


dirty

public volatile boolean dirty
Dirty flag.


size

public volatile int size
Table size.


lastid

public volatile int lastid
Last (highest) id assigned to a node.

Constructor Detail

MetaData

public MetaData(Prop pr)
Constructor, specifying the database properties.

Parameters:
pr - database properties

MetaData

public MetaData(java.lang.String db,
                Context ctx)
Constructor, specifying the database name and context.

Parameters:
db - name of the database
ctx - database context
Method Detail

normPath

public static java.lang.String normPath(java.lang.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,
                          java.lang.String fn)
Creates a database file.

Parameters:
path - database path
fn - 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(java.lang.String fn)
Returns a file instance for the specified database file. Should only be called if database is disk-based.

Parameters:
fn - filename
Returns:
database filename

binaries

public IOFile binaries()
Returns the binary directory.

Returns:
binary directory

binary

public IOFile binary(java.lang.String pth)
Returns the specified binary file, or null if the resource path cannot be resolved (e.g. if it points to a parent directory).

Parameters:
pth - internal file path
Returns:
binary directory

drop

public boolean drop(java.lang.String pat)
Drops the specified database files. Should only be called if database is disk-based.

Parameters:
pat - file pattern, or null if all files are to be deleted
Returns:
result of check

read

public void read()
          throws java.io.IOException
Reads in all meta data.

Throws:
java.io.IOException - exception

read

public void read(DataInput in)
          throws java.io.IOException
Reads in meta data from the specified stream.

Parameters:
in - input stream
Throws:
java.io.IOException - I/O exception