org.basex.core.proc
Class CreateDB

java.lang.Object
  extended by org.basex.core.Progress
      extended by org.basex.core.Process
          extended by org.basex.core.proc.CreateDB

public final class CreateDB
extends Process

Evaluates the 'create db' command and creates a new database.

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

Field Summary
 
Fields inherited from class org.basex.core.Process
args
 
Constructor Summary
CreateDB(java.lang.String input)
          Constructor.
CreateDB(java.lang.String input, java.lang.String name)
          Default constructor.
 
Method Summary
 java.lang.String toString()
          Returns a string representation of the object.
static Data xml(Context ctx, IO io, java.lang.String name)
          Creates and returns a database for the specified XML document.
static Data xml(Context ctx, Parser p, java.lang.String db)
          Creates and returns a database instance from the specified parser.
static Data xml(IO io, Prop pr)
          Creates and returns a main memory database from the specified input reference.
static Data xml(Parser p)
          Creates and returns a main memory database for the specified parser.
static Data xml(javax.xml.transform.sax.SAXSource s, Prop pr)
          Creates and returns a main memory database from the specified SAX source.
 
Methods inherited from class org.basex.core.Process
args, data, error, execute, execute, info, info, info, output, printing, result, updating
 
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
 

Constructor Detail

CreateDB

public CreateDB(java.lang.String input,
                java.lang.String name)
Default constructor.

Parameters:
input - input XML file or XML string
name - name of database (special characters are stripped before the name is applied)

CreateDB

public CreateDB(java.lang.String input)
Constructor. The file name, excluding the suffix, is used as database name.

Parameters:
input - input file or XML string
Method Detail

xml

public static Data xml(Context ctx,
                       IO io,
                       java.lang.String name)
                throws java.io.IOException
Creates and returns a database for the specified XML document.

Parameters:
ctx - database context
io - file reference
name - name of the database to be created
Returns:
database instance
Throws:
java.io.IOException - I/O exception

xml

public static Data xml(Context ctx,
                       Parser p,
                       java.lang.String db)
                throws java.io.IOException
Creates and returns a database instance from the specified parser.

Parameters:
ctx - database context
p - xml parser
db - name of the database to be created; if db is null, a main memory instance is created
Returns:
database instance
Throws:
java.io.IOException - I/O exception

xml

public static Data xml(Parser p)
                throws java.io.IOException
Creates and returns a main memory database for the specified parser.

Parameters:
p - xml parser
Returns:
database instance
Throws:
java.io.IOException - I/O exception

xml

public static Data xml(IO io,
                       Prop pr)
                throws java.io.IOException
Creates and returns a main memory database from the specified input reference.

Parameters:
io - file reference
pr - database properties
Returns:
database instance
Throws:
java.io.IOException - I/O exception

xml

public static Data xml(javax.xml.transform.sax.SAXSource s,
                       Prop pr)
                throws java.io.IOException
Creates and returns a main memory database from the specified SAX source.

Parameters:
s - sax source
pr - database properties
Returns:
database instance
Throws:
java.io.IOException - I/O exception

toString

public java.lang.String toString()
Description copied from class: Process
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 Process
Returns:
string representation