org.basex.core
Class Context

java.lang.Object
  extended by org.basex.core.Context

public final class Context
extends Object

This class serves as a central database context. It references the currently opened database. Moreover, it provides references to the currently used, marked and copied node sets.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Field Summary
 Nodes copied
          Copied nodes.
 Nodes current
          Node context.
 Data data
          Data reference.
 int focused
          Focused node.
 Nodes marked
          Marked nodes.
 DataPool pool
          Database pool.
 Prop prop
          Database properties.
 IO query
          Current query file.
 Sessions sessions
          Client connections.
 User user
          User reference.
 Users users
          Users.
 
Constructor Summary
Context()
          Constructor.
Context(Context ctx)
          Constructor.
 
Method Summary
 void add(ServerProcess s)
          Adds the specified session.
 void close()
          Closes the database context.
 void closeDB()
          Removes the current database context.
 void delete(ServerProcess s)
          Removes the specified session.
 int[] doc()
          Returns all document nodes.
 void openDB(Data d)
          Sets the specified data instance as current database.
 boolean perm(int p, MetaData md)
          Checks if the current user has the specified permission.
 void pin(Data d)
          Adds the specified data reference to the pool.
 Data pin(String name)
          Pins the specified database.
 boolean pinned(String db)
          Checks if the specified database is pinned.
 boolean root()
          Returns true if the current node set contains all documents.
 boolean unpin(Data d)
          Unpins a data reference.
 void update()
          Updates references to the document nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessions

public final Sessions sessions
Client connections.


pool

public final DataPool pool
Database pool.


users

public final Users users
Users.


prop

public final Prop prop
Database properties.


user

public User user
User reference.


query

public IO query
Current query file.


data

public Data data
Data reference.


current

public Nodes current
Node context.


marked

public Nodes marked
Marked nodes.


copied

public Nodes copied
Copied nodes.


focused

public int focused
Focused node.

Constructor Detail

Context

public Context()
Constructor.


Context

public Context(Context ctx)
Constructor. user reference must be set after calling this.

Parameters:
ctx - parent context
Method Detail

close

public void close()
Closes the database context.


root

public boolean root()
Returns true if the current node set contains all documents.

Returns:
result of check

doc

public int[] doc()
Returns all document nodes.

Returns:
result of check

openDB

public void openDB(Data d)
Sets the specified data instance as current database.

Parameters:
d - data reference

closeDB

public void closeDB()
Removes the current database context.


update

public void update()
Updates references to the document nodes.


pin

public void pin(Data d)
Adds the specified data reference to the pool.

Parameters:
d - data reference

pin

public Data pin(String name)
Pins the specified database.

Parameters:
name - name of database
Returns:
data reference

unpin

public boolean unpin(Data d)
Unpins a data reference.

Parameters:
d - data reference
Returns:
true if reference was removed from the pool

pinned

public boolean pinned(String db)
Checks if the specified database is pinned.

Parameters:
db - name of database
Returns:
int use-status

add

public void add(ServerProcess s)
Adds the specified session.

Parameters:
s - session to be added

delete

public void delete(ServerProcess s)
Removes the specified session.

Parameters:
s - session to be removed

perm

public boolean perm(int p,
                    MetaData md)
Checks if the current user has the specified permission.

Parameters:
p - requested permission
md - optional meta data reference
Returns:
result of check