public final class Context
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
Nodes |
copied
Copied nodes.
|
Datas |
datas
Database pool.
|
Events |
events
Event pool.
|
int |
focused
Focused node.
|
ClientListener |
listener
Client listener.
|
Nodes |
marked
Marked nodes.
|
MainProp |
mprop
Main properties.
|
Prop |
prop
Client-related properties.
|
Repo |
repo
Package repository.
|
Sessions |
sessions
Client connections.
|
User |
user
User reference.
|
Users |
users
Users.
|
| Constructor and Description |
|---|
Context()
Default constructor, which should only be called once in a project.
|
Context(Context ctx,
ClientListener cl)
Constructor, passing on the main context.
|
Context(java.util.HashMap<java.lang.String,java.lang.String> props)
Default constructor, which should only be called once in a project.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ClientListener s)
Adds the specified client session.
|
boolean |
client()
Returns
true if the current context belongs to a client user. |
void |
close()
Closes the database context.
|
void |
closeDB()
Resets the current database context.
|
Nodes |
current()
Returns the current node context.
|
void |
current(Nodes curr)
Sets the current node context.
|
Data |
data()
Returns the current data reference.
|
Databases |
databases()
Get list of currently available databases.
|
void |
delete(ClientListener s)
Removes the specified client session.
|
void |
openDB(Data d)
Sets the specified data instance as current database.
|
void |
openDB(Data d,
java.lang.String p)
Sets the specified data instance as current database and restricts
the context nodes to the given path.
|
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(java.lang.String name)
Pins and returns an existing data reference for the specified database, or
returns
null. |
boolean |
pinned(java.lang.String db)
Checks if the specified database is pinned.
|
void |
register(Progress pr)
Locks a writing process and starts the timeout.
|
boolean |
root()
Returns
true if the current node set contains all documents. |
void |
set(Nodes curr,
Nodes mark)
Sets the current context and marked node set and resets the focus.
|
boolean |
unpin(Data d)
Unpins a data reference.
|
void |
unregister(Progress pr)
Unlocks the process and stops the timeout.
|
void |
update()
Invalidates the current node set.
|
public final ClientListener listener
null in standalone/server mode.public final Prop prop
public final MainProp mprop
public final Sessions sessions
public final Events events
public final Datas datas
public final Users users
public final Repo repo
public User user
public Nodes marked
public Nodes copied
public int focused
public Context()
public Context(java.util.HashMap<java.lang.String,java.lang.String> props)
props - initial propertiespublic Context(Context ctx, ClientListener cl)
user reference must be set after calling this method.ctx - parent database contextcl - client listenerpublic void close()
public boolean client()
true if the current context belongs to a client user.public boolean root()
true if the current node set contains all documents.public Data data()
public Nodes current()
public void current(Nodes curr)
curr - node setpublic void openDB(Data d)
d - data referencepublic void openDB(Data d, java.lang.String p)
d - data referencep - database pathpublic void closeDB()
public void set(Nodes curr, Nodes mark)
curr - context setmark - marked nodespublic void update()
public void pin(Data d)
d - data referencepublic Data pin(java.lang.String name)
null.name - name of databasepublic boolean unpin(Data d)
d - data referencetrue if reference was removed from the poolpublic boolean pinned(java.lang.String db)
db - name of databasepublic void register(Progress pr)
pr - processpublic void unregister(Progress pr)
pr - processpublic void add(ClientListener s)
s - session to be addedpublic void delete(ClientListener s)
s - session to be removedpublic boolean perm(int p,
MetaData md)
p - requested permissionmd - optional meta data referencepublic Databases databases()