org.basex.core
Class Proc

java.lang.Object
  extended by org.basex.core.Progress
      extended by org.basex.core.Proc
Direct Known Subclasses:
Add, AInfo, AlterUser, Check, Close, CreateColl, CreateDB, CreateFS, CreateIndex, CreateMAB, CreateUser, Cs, Delete, DropDB, DropIndex, DropUser, Exit, Export, Find, Grant, Help, InfoTable, Kill, List, Mount, Open, Optimize, Password, Run, Set, ShowDatabases, ShowSessions, ShowUsers, XQuery

public abstract class Proc
extends Progress

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.

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

Field Summary
static int DATAREF
          Commands flag: data reference needed.
 int flags
          Flags for controlling process evaluation.
static int STANDARD
          Commands flag: standard.
 
Constructor Summary
Proc(int f, String... a)
          Constructor.
 
Method Summary
 boolean exec(Context ctx)
          Executes the process and returns a success flag.
 boolean exec(Context ctx, OutputStream out)
          Executes the process, prints the result to the specified output stream and returns a success flag.
 void execute(Context ctx)
          Executes the process.
 void execute(Context ctx, OutputStream out)
          Executes the process and serializes textual results to the specified output stream.
 String info()
          Returns process information or error message.
 Result result()
          Returns the result set, generated by the last query.
 String toString()
          Returns a string representation of the process.
 boolean updating(Context ctx)
          Returns if the process performs updates.
 
Methods inherited from class org.basex.core.Progress
abort, checkStop, det, detail, prog, progress, progress, stop, tit, title
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STANDARD

public static final int STANDARD
Commands flag: standard.

See Also:
Constant Field Values

DATAREF

public static final int DATAREF
Commands flag: data reference needed.

See Also:
Constant Field Values

flags

public final int flags
Flags for controlling process evaluation.

Constructor Detail

Proc

public Proc(int f,
            String... a)
Constructor.

Parameters:
f - command flags
a - arguments
Method Detail

execute

public void execute(Context ctx,
                    OutputStream out)
             throws BaseXException
Executes the process and serializes textual results to the specified output stream. If an exception occurs, a BaseXException is thrown.

Parameters:
ctx - database context
out - output stream reference
Throws:
BaseXException - process exception

execute

public void execute(Context ctx)
             throws BaseXException
Executes the process. execute(Context, OutputStream) should be called if textual results are expected. If an exception occurs, a BaseXException is thrown.

Parameters:
ctx - database context
Throws:
BaseXException - process exception

exec

public final boolean exec(Context ctx,
                          OutputStream out)
Executes the process, prints the result to the specified output stream and returns a success flag.

Parameters:
ctx - database context
out - output stream
Returns:
success flag. The info() method returns information on a potential exception

exec

public final boolean exec(Context ctx)
Executes the process and returns a success flag. exec(Context, OutputStream) should be called to retrieve textual results.

Parameters:
ctx - database context
Returns:
success flag. The info() method returns information on a potential exception

info

public final String info()
Returns process information or error message.

Returns:
info string

result

public final Result result()
Returns the result set, generated by the last query. Must only be called if Prop.CACHEQUERY is set.

Returns:
result set

updating

public boolean updating(Context ctx)
Returns if the process performs updates.

Parameters:
ctx - context reference
Returns:
result of check

toString

public String toString()
Returns a string representation of the process. In the client/server architecture, this string is sent to and reparsed by the server.

Overrides:
toString in class Object
Returns:
string representation