|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.core.Proc
org.basex.core.Command
public abstract class Command
This class provides the architecture for all internal command implementations. It evaluates queries that are sent by the GUI, the client or the standalone version.
Field Summary | |
---|---|
java.lang.String[] |
args
Command arguments. |
protected Context |
context
Database context. |
protected org.xml.sax.InputSource |
in
Optional input source. |
protected MainProp |
mprop
Main properties. |
protected PrintOutput |
out
Output stream. |
protected Performance |
perf
Performance measurements. |
protected Prop |
prop
Database properties. |
Fields inherited from class org.basex.core.Proc |
---|
listen, updating |
Constructor Summary | |
---|---|
protected |
Command(Perm p,
boolean d,
java.lang.String... arg)
Constructor. |
protected |
Command(Perm p,
java.lang.String... arg)
Constructor for commands requiring no opened database. |
Method Summary | ||
---|---|---|
protected void |
build(CmdBuilder cb)
Builds a string representation from the command. |
|
protected static boolean |
close(Context ctx,
java.lang.String db)
Closes the specified database if it is currently opened and only pinned once. |
|
protected boolean |
databases(StringList db,
int a)
Adds the names of the database that has been addressed by the argument index. |
|
protected boolean |
error(java.lang.String msg,
java.lang.Object... ext)
Adds the error message to the message buffer info . |
|
java.lang.String |
execute(Context ctx)
Executes the command and returns the result as string. |
|
void |
execute(Context ctx,
java.io.OutputStream os)
Executes the command and prints the result to the specified output stream. |
|
protected
|
getOption(java.lang.Class<E> typ)
Returns the specified command option. |
|
protected static
|
getOption(java.lang.String s,
java.lang.Class<E> typ)
Returns the specified command option. |
|
java.lang.String |
info()
Returns command information. |
|
protected boolean |
info(java.lang.String str,
java.lang.Object... ext)
Adds information on command execution. |
|
boolean |
newData(Context ctx)
Closes an open data reference and returns true if this command will change
the Context.data reference. |
|
Result |
result()
Returns the result set, generated by a query command. |
|
protected abstract boolean |
run()
Executes the command and serializes the result (internal call). |
|
boolean |
run(Context ctx)
Runs the command without permission, data and concurrency checks. |
|
boolean |
run(Context ctx,
java.io.OutputStream os)
Runs the command without permission, data and concurrency checks. |
|
void |
setInput(org.xml.sax.InputSource is)
Attaches an input source. |
|
void |
setInput(java.io.InputStream is)
Attaches an input stream. |
|
boolean |
stoppable()
Returns true if this command can be stopped. |
|
boolean |
supportsProg()
Returns true if this command returns a progress value. |
|
java.lang.String |
toString()
|
|
boolean |
updated(Context ctx)
Checks if the command has updated any data. |
|
boolean |
updating(Context ctx)
Checks if the command performs updates/write operations. |
Methods inherited from class org.basex.core.Proc |
---|
abort, checkStop, databases, det, detail, listen, proc, prog, progress, registered, registered, startTimeout, stop, stopTimeout, tit, title |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final java.lang.String[] args
protected Performance perf
protected Context context
protected PrintOutput out
protected org.xml.sax.InputSource in
protected Prop prop
protected MainProp mprop
Constructor Detail |
---|
protected Command(Perm p, java.lang.String... arg)
p
- required permissionarg
- argumentsprotected Command(Perm p, boolean d, java.lang.String... arg)
p
- required permissiond
- requires opened databasearg
- argumentsMethod Detail |
---|
public final void execute(Context ctx, java.io.OutputStream os) throws BaseXException
BaseXException
is thrown.
ctx
- database contextos
- output stream reference
BaseXException
- command exceptionpublic final java.lang.String execute(Context ctx) throws BaseXException
BaseXException
is thrown.
ctx
- database context
BaseXException
- command exceptionpublic void setInput(java.io.InputStream is)
is
- input streampublic void setInput(org.xml.sax.InputSource is)
is
- input sourcepublic final boolean run(Context ctx)
ctx
- database context
public final java.lang.String info()
public Result result()
Prop.CACHEQUERY
is set, and can only be called once.
public boolean updating(Context ctx)
ctx
- database context
public boolean updated(Context ctx)
ctx
- database context
public boolean newData(Context ctx)
true
if this command will change
the Context.data
reference. This method is required by the progress dialog
in the frontend.
ctx
- database context
public boolean supportsProg()
public boolean stoppable()
public final java.lang.String toString()
toString
in class java.lang.Object
protected abstract boolean run() throws java.io.IOException
java.io.IOException
- I/O exceptionprotected void build(CmdBuilder cb)
cb
- command builderprotected final boolean error(java.lang.String msg, java.lang.Object... ext)
info
.
msg
- error messageext
- error extension
false
protected final boolean info(java.lang.String str, java.lang.Object... ext)
str
- information to be addedext
- extended info
true
protected final <E extends java.lang.Enum<E>> E getOption(java.lang.Class<E> typ)
E
- token typetyp
- options enumeration
protected final boolean databases(StringList db, int a)
db
- databasesa
- argument index
false
if database cannot be determined due to glob syntaxprotected static <E extends java.lang.Enum<E>> E getOption(java.lang.String s, java.lang.Class<E> typ)
E
- token types
- string to be foundtyp
- options enumeration
protected static boolean close(Context ctx, java.lang.String db)
ctx
- database contextdb
- database to be closed
public boolean run(Context ctx, java.io.OutputStream os)
ctx
- database contextos
- output stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |