org.basex.core.cmd
Class ACreate

java.lang.Object
  extended by org.basex.core.Proc
      extended by org.basex.core.Command
          extended by org.basex.core.cmd.ACreate
Direct Known Subclasses:
Add, AlterDB, CreateDB, CreateIndex, Delete, DropDB, DropIndex, Optimize, OptimizeAll, Rename, Replace, Retrieve, Store

public abstract class ACreate
extends Command

Abstract class for database creation commands.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.core.Command
args, context, in, mprop, out, perf, prop
 
Fields inherited from class org.basex.core.Proc
listen, updating
 
Constructor Summary
protected ACreate(Perm p, boolean d, java.lang.String... arg)
          Protected constructor, specifying command flags and arguments.
protected ACreate(java.lang.String... arg)
          Protected constructor, specifying command arguments.
 
Method Summary
protected static void create(IndexType index, Data data, ACreate cmd)
          Builds the specified index.
 void databases(LockResult lr)
          Adds the names of the databases that may be touched by the process.
protected static boolean drop(IndexType index, Data data)
          Drops the specified index.
 boolean newData(Context ctx)
          Closes an open data reference and returns true if this command will change the Context.data reference.
protected  IO sourceToIO(java.lang.String name)
          Converts the input (second argument of Command.args, or Command.in reference) to an IO reference.
 boolean stoppable()
          Returns true if this command can be stopped.
 boolean supportsProg()
          Returns true if this command returns a progress value.
 
Methods inherited from class org.basex.core.Command
build, close, databases, error, execute, execute, getOption, getOption, info, info, result, run, run, run, setInput, setInput, toString, updated, updating
 
Methods inherited from class org.basex.core.Proc
abort, checkStop, 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
 

Constructor Detail

ACreate

protected ACreate(java.lang.String... arg)
Protected constructor, specifying command arguments.

Parameters:
arg - arguments

ACreate

protected ACreate(Perm p,
                  boolean d,
                  java.lang.String... arg)
Protected constructor, specifying command flags and arguments.

Parameters:
p - required permission
d - requires opened database
arg - arguments
Method Detail

sourceToIO

protected IO sourceToIO(java.lang.String name)
                 throws java.io.IOException
Converts the input (second argument of Command.args, or Command.in reference) to an IO reference.

Parameters:
name - name of source
Returns:
IO reference
Throws:
java.io.IOException - I/O exception

create

protected static void create(IndexType index,
                             Data data,
                             ACreate cmd)
                      throws java.io.IOException
Builds the specified index.

Parameters:
index - index to be built
data - data reference
cmd - calling command
Throws:
java.io.IOException - I/O exception

drop

protected static boolean drop(IndexType index,
                              Data data)
Drops the specified index.

Parameters:
index - index type
data - data reference
Returns:
success of operation

newData

public boolean newData(Context ctx)
Description copied from class: Command
Closes an open data reference and returns true if this command will change the Context.data reference. This method is required by the progress dialog in the frontend.

Overrides:
newData in class Command
Parameters:
ctx - database context
Returns:
result of check

databases

public void databases(LockResult lr)
Description copied from class: Proc
Adds the names of the databases that may be touched by the process.

Overrides:
databases in class Proc
Parameters:
lr - Container for lock result to pass around

supportsProg

public final boolean supportsProg()
Description copied from class: Command
Returns true if this command returns a progress value. This method is required by the progress dialog in the frontend.

Overrides:
supportsProg in class Command
Returns:
result of check

stoppable

public boolean stoppable()
Description copied from class: Command
Returns true if this command can be stopped. This method is required by the progress dialog in the frontend.

Overrides:
stoppable in class Command
Returns:
result of check