org.deepfs.fs
Class DeepFS

java.lang.Object
  extended by org.deepfs.fs.DeepFS
All Implemented Interfaces:
DataText

public final class DeepFS
extends Object
implements DataText

DeepFS: The XQuery Filesystem. Database-side implementation of DeepFS.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Alexander Holupirek, Christian Gruen, Hannes Schwarz, Bastian Lemke

Field Summary
static byte[] ATIME
          Time of last access token.
 int atimeID
          Index References.
static byte[] BACKINGSTORE
          Backing store attribute.
 int backingstoreID
          Index backing store.
static byte[] CONTENT
          Content token.
 int contentID
          Index References.
static byte[] CTIME
          Time of creation token.
 int ctimeID
          Index References.
static byte[] DEEPFS
          DeepFS token.
 int deepfsID
          Index References.
static byte[] DIR
          Directory token.
 int dirID
          Index References.
static byte[] FILE
          File token.
 int fileID
          Index References.
static byte[] FSML
          FSML token.
 int fsmlID
          Index References.
static byte[] GID
          Group ID token.
 int gidID
          Index References.
static byte[] MODE
          File mode attribute.
 int modeID
          Index References.
static byte[] MOUNTPOINT
          Mount point attribute.
 int mountpointID
          Index mount point.
static byte[] MTIME
          Time of last modification token.
 int mtimeID
          Index References.
static byte[] NAME
          Name attribute token.
 int nameID
          Index References.
static byte[] NLINK
          Number of links token.
 int nlinkID
          Index References.
static byte[] NOTMOUNTED
          Negative mount point attribute.
static byte[] OFFSET
          Offset attribute.
static String S_ATIME
          Time of last access.
static String S_BACKINGSTORE
          backingstore path.
static String S_CONTENT
          Content tag in fs namespace.
static String S_CTIME
          Time of creation.
static String S_DEEPFS
          Name of the root node for a file system.
static String S_DIR
          Directory tag in fs namespace.
static String S_FILE
          File tag in fs namespace.
static String S_FSML
          Name of the root node for a fsml document.
static String S_MTIME
          Time of last modification.
static String S_NAME
          file/dir name.
static String S_SIZE
          file/dir size.
static String S_SUFFIX
          File suffix.
static String S_TEXT_CONTENT
          Text content tag in fs namespace.
static String S_XML_CONTENT
          XML content tag in fs namespace.
static byte[] SIZE
          Size attribute token.
 int sizeID
          Index References.
static byte[] SUFFIX
          Suffix attribute.
 int suffixID
          Index References.
static byte[] TEXT_CONTENT
          Text content token.
static byte[] UID
          User ID token.
 int uidID
          Index References.
 
Fields inherited from interface org.basex.data.DataText
ATT, ATT1, ATT2, COM1, COM2, COMM, DATAATV, DATAFTX, DATAINFO, DATASWL, DATATBL, DATATMP, DATATXT, DBATTS, DBATVIDX, DBBCK, DBCHOP, DBDEEPFS, DBENC, DBENTITY, DBFNAME, DBFSIZE, DBFTCS, DBFTDC, DBFTST, DBFTXIDX, DBHGHT, DBLID, DBMNT, DBNDOCS, DBNS, DBPATH, DBPERM, DBPTHIDX, DBSCMAX, DBSCMIN, DBSCTYPE, DBSIZE, DBSTR, DBTAGS, DBTIME, DBTXTIDX, DBUTD, DBWCIDX, DOC, DOCDECL, DOCTYPE, E_AMP, E_CR, E_GT, E_LT, E_NL, E_QU, E_TAB, ELEM1, ELEM2, ELEM3, ELEM4, IDBSTR, ISTORAGE, KIND, NODE, PATH, PI, PI1, PI2, RESULT, RESULTS, STORAGE, SYSTEM, TABLEATS, TABLECON, TABLEDIST, TABLEID, TABLEKINDS, TABLEKND, TABLENS, TABLEPRE, TABLEPREF, TABLESIZE, TABLEURI, TEXT
 
Constructor Summary
DeepFS(Context c)
          Constructor.
DeepFS(Data d)
          Constructor.
DeepFS(String dbname, String mountpoint)
          Constructor for DeepShell and java only test cases (no mount).
 
Method Summary
static Atts atts(File f, boolean root)
          Constructs attributes for file and directory tags.
 void close()
          Closes the fuse instance.
 int create(String path, int mode)
          Creates a new regular file.
 Context getContext()
          Getter for actual context.
static byte[] getSuffix(String name)
          Extracts file name suffix.
 boolean isDir(int pre)
          Checks if this node is a directory.
 boolean isFile(int pre)
          Checks if this node is a file.
 boolean isFSnode(int pre)
          Checks if this node is a file, directory, fsml or deepfs node.
 void launch(int pre)
          Opens the file which is defined by the specified pre value.
 int mkdir(String path, int mode)
          Creates a new directory.
 byte[] name(int pre)
          Returns the name of a file.
 byte[] path(int pre, boolean backing)
          Returns the absolute file path.
 byte[][] readdir(String path)
          Reads directory entries.
 int rmdir(String path)
          Removes directory.
 byte[] size(int pre)
          Returns the size of a file.
 DeepStat stat(String path)
          Resolves filesystem pathname and fill stat information.
 void umount()
          Called when filesystem is unmounted.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_FSML

public static final String S_FSML
Name of the root node for a fsml document.


S_DEEPFS

public static final String S_DEEPFS
Name of the root node for a file system.


S_FILE

public static final String S_FILE
File tag in fs namespace.


S_DIR

public static final String S_DIR
Directory tag in fs namespace.


S_XML_CONTENT

public static final String S_XML_CONTENT
XML content tag in fs namespace.


S_TEXT_CONTENT

public static final String S_TEXT_CONTENT
Text content tag in fs namespace.


S_CONTENT

public static final String S_CONTENT
Content tag in fs namespace.


S_NAME

public static final String S_NAME
file/dir name.

See Also:
Constant Field Values

S_BACKINGSTORE

public static final String S_BACKINGSTORE
backingstore path.

See Also:
Constant Field Values

S_SUFFIX

public static final String S_SUFFIX
File suffix.

See Also:
Constant Field Values

S_SIZE

public static final String S_SIZE
file/dir size.

See Also:
Constant Field Values

S_ATIME

public static final String S_ATIME
Time of last access.

See Also:
Constant Field Values

S_CTIME

public static final String S_CTIME
Time of creation.

See Also:
Constant Field Values

S_MTIME

public static final String S_MTIME
Time of last modification.

See Also:
Constant Field Values

FSML

public static final byte[] FSML
FSML token.


DEEPFS

public static final byte[] DEEPFS
DeepFS token.


DIR

public static final byte[] DIR
Directory token.


FILE

public static final byte[] FILE
File token.


CONTENT

public static final byte[] CONTENT
Content token.


TEXT_CONTENT

public static final byte[] TEXT_CONTENT
Text content token.


NAME

public static final byte[] NAME
Name attribute token.


SIZE

public static final byte[] SIZE
Size attribute token.


MTIME

public static final byte[] MTIME
Time of last modification token.


SUFFIX

public static final byte[] SUFFIX
Suffix attribute.


ATIME

public static final byte[] ATIME
Time of last access token.


CTIME

public static final byte[] CTIME
Time of creation token.


NLINK

public static final byte[] NLINK
Number of links token.


UID

public static final byte[] UID
User ID token.


GID

public static final byte[] GID
Group ID token.


OFFSET

public static final byte[] OFFSET
Offset attribute.


MODE

public static final byte[] MODE
File mode attribute.


MOUNTPOINT

public static final byte[] MOUNTPOINT
Mount point attribute.


BACKINGSTORE

public static final byte[] BACKINGSTORE
Backing store attribute.


NOTMOUNTED

public static final byte[] NOTMOUNTED
Negative mount point attribute.


fsmlID

public int fsmlID
Index References.


deepfsID

public int deepfsID
Index References.


fileID

public int fileID
Index References.


dirID

public int dirID
Index References.


modeID

public int modeID
Index References.


mountpointID

public int mountpointID
Index mount point.


backingstoreID

public int backingstoreID
Index backing store.


sizeID

public int sizeID
Index References.


nameID

public int nameID
Index References.


suffixID

public int suffixID
Index References.


mtimeID

public int mtimeID
Index References.


ctimeID

public int ctimeID
Index References.


atimeID

public int atimeID
Index References.


nlinkID

public int nlinkID
Index References.


uidID

public int uidID
Index References.


gidID

public int gidID
Index References.


contentID

public int contentID
Index References.

Constructor Detail

DeepFS

public DeepFS(String dbname,
              String mountpoint)
Constructor for DeepShell and java only test cases (no mount).

Parameters:
dbname - name of (initially empty) database
mountpoint - of DeepFS database

DeepFS

public DeepFS(Data d)
Constructor.

Parameters:
d - data reference

DeepFS

public DeepFS(Context c)
Constructor.

Parameters:
c - existing context
Method Detail

getSuffix

public static byte[] getSuffix(String name)
Extracts file name suffix.

Parameters:
name - of the file
Returns:
suffix or EMPTY token

atts

public static Atts atts(File f,
                        boolean root)
Constructs attributes for file and directory tags.

Parameters:
f - file name
root - if true, attributes for a filesystem root node are created instead of attributes for a simple directory
Returns:
attributes as byte[][]

isFile

public boolean isFile(int pre)
Checks if this node is a file.

Parameters:
pre - pre value
Returns:
true if this node is a file, false otherwise

isDir

public boolean isDir(int pre)
Checks if this node is a directory.

Parameters:
pre - pre value
Returns:
true if this node is a directory, false otherwise

isFSnode

public boolean isFSnode(int pre)
Checks if this node is a file, directory, fsml or deepfs node.

Parameters:
pre - pre value
Returns:
true if this node is a deepfs node, false otherwise

stat

public DeepStat stat(String path)
Resolves filesystem pathname and fill stat information. For root access ('/') return default access. Note we store the pre value as inode.

Parameters:
path - to file
Returns:
file attributes or null

readdir

public byte[][] readdir(String path)
Reads directory entries.

Parameters:
path - directory to be listed
Returns:
directory entries, null on failure

umount

public void umount()
Called when filesystem is unmounted.


getContext

public Context getContext()
Getter for actual context.

Returns:
context

rmdir

public int rmdir(String path)
Removes directory.

Parameters:
path - to directory to be removed
Returns:
zero on success, -1 on failure

close

public void close()
           throws IOException
Closes the fuse instance.

Throws:
IOException - I/O exception

path

public byte[] path(int pre,
                   boolean backing)
Returns the absolute file path.

Parameters:
pre - pre value
backing - whether to return backing path or mountpath
Returns:
file path

name

public byte[] name(int pre)
Returns the name of a file.

Parameters:
pre - pre value
Returns:
file name

size

public byte[] size(int pre)
Returns the size of a file.

Parameters:
pre - pre value
Returns:
file size

launch

public void launch(int pre)
            throws IOException
Opens the file which is defined by the specified pre value.

Parameters:
pre - pre value
Throws:
IOException - thrown if no default application to launch exists

mkdir

public int mkdir(String path,
                 int mode)
Creates a new directory.

Parameters:
path - to directory to be created
mode - of directory
Returns:
id of the newly created directory or -1 on failure

create

public int create(String path,
                  int mode)
Creates a new regular file.

Parameters:
path - to the file to be created
mode - of regular file
Returns:
id of the newly created file or -1 on failure