org.basex.core
Class Process

java.lang.Object
  extended by org.basex.core.Progress
      extended by org.basex.core.Process
Direct Known Subclasses:
Close, Copy, CreateDB, CreateFS, CreateIndex, CreateMAB, Cs, Delete, DropDB, DropIndex, Exit, Export, Find, Help, Info, InfoDB, InfoIndex, InfoTable, Insert, IntInfo, IntOutput, IntPrompt, IntStop, List, Open, Optimize, Run, Set, Update, XQuery, XQueryMV

public abstract class Process
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-09, ISC License, Christian Gruen

Field Summary
 java.lang.String[] args
          Command arguments.
 
Constructor Summary
Process(int f, java.lang.String... a)
          Constructor.
 
Method Summary
 java.lang.String args()
          Returns the list of arguments.
 boolean data()
          Returns if the current command needs a data reference for processing.
 boolean error(java.lang.String msg, java.lang.Object... ext)
          Adds the error message to the message buffer info.
 boolean execute(Context ctx)
          Executes the process and returns a success flag.
 void execute(Context ctx, PrintOutput out)
          Executes the process and serializes the results.
 java.lang.String info()
          Returns the query information as a string.
 void info(PrintOutput out)
          Returns process info.
 boolean info(java.lang.String str, java.lang.Object... ext)
          Adds information on the process execution.
 void output(PrintOutput out)
          Serializes the textual results.
 boolean printing()
          Returns if the current command yields some output.
 Result result()
          Returns the result set, generated by the last query.
 java.lang.String toString()
          Returns a string representation of the object.
 boolean updating()
          Returns if the current command generates updates in the data structure.
 
Methods inherited from class org.basex.core.Progress
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

args

public java.lang.String[] args
Command arguments.

Constructor Detail

Process

public Process(int f,
               java.lang.String... a)
Constructor.

Parameters:
f - command flags
a - arguments
Method Detail

execute

public void execute(Context ctx,
                    PrintOutput out)
             throws java.lang.Exception
Executes the process and serializes the results. If an error happens, an exception is thrown.

Parameters:
ctx - database context
out - output stream reference
Throws:
java.lang.Exception - execution exception

execute

public final boolean execute(Context ctx)
Executes the process and returns a success flag.

Parameters:
ctx - database context
Returns:
success flag

output

public final void output(PrintOutput out)
                  throws java.io.IOException
Serializes the textual results.

Parameters:
out - output stream
Throws:
java.io.IOException - I/O exception

info

public final void info(PrintOutput out)
                throws java.io.IOException
Returns process info.

Parameters:
out - output stream
Throws:
java.io.IOException - I/O exception

error

public final boolean error(java.lang.String msg,
                           java.lang.Object... ext)
Adds the error message to the message buffer info.

Parameters:
msg - error message
ext - error extension
Returns:
false

info

public final boolean info(java.lang.String str,
                          java.lang.Object... ext)
Adds information on the process execution.

Parameters:
str - information to be added
ext - extended info
Returns:
true

info

public final java.lang.String info()
Returns the query information as a string.

Returns:
info string

result

public final Result result()
Returns the result set, generated by the last query.

Returns:
result set

printing

public boolean printing()
Returns if the current command yields some output.

Returns:
result of check

data

public boolean data()
Returns if the current command needs a data reference for processing.

Returns:
result of check

updating

public boolean updating()
Returns if the current command generates updates in the data structure.

Returns:
result of check

args

public final java.lang.String args()
Returns the list of arguments.

Returns:
arguments

toString

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

Overrides:
toString in class java.lang.Object
Returns:
string representation