Package org.basex.core.cmd
Class CreateDB
java.lang.Object
org.basex.core.jobs.Job
org.basex.core.Command
org.basex.core.cmd.ACreate
org.basex.core.cmd.CreateDB
Evaluates the 'create db' command and creates a new database.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocks()Adds the strings (databases, special identifiers) for which locks need to be acquired.voidbuild(CmdBuilder cb) Builds a string representation from the command.static Datacreate(String name, Parser parser, Context ctx, MainOptions options) Returns a database instance from the specified parser.static Datacreate(String name, Parser parser, Context ctx, MainOptions options, boolean mem) Creates a new database instance, using the specified parser.protected booleanrun()Executes the command and serializes the result (internal call).voidAttaches a parser.Methods inherited from class org.basex.core.cmd.ACreate
newData, stoppable, supportsProgMethods inherited from class org.basex.core.Command
addLocks, baseURI, baseURI, close, error, exception, execute, execute, getOption, getOption, info, info, init, maxResults, result, run, run, setInput, setInput, toString, toString, updated, updating
-
Constructor Details
-
CreateDB
Default constructor. Input can be set viaCommand.setInput(InputStream).- Parameters:
name- name of database
-
CreateDB
Constructor, specifying an initial database input.- Parameters:
name- name of databaseinput- input reference (local/remote file path or XML string; can benull)
-
-
Method Details
-
setParser
Attaches a parser.- Parameters:
prsr- input parser
-
run
protected boolean run()Description copied from class:CommandExecutes the command and serializes the result (internal call). -
addLocks
public void addLocks()Description copied from class:JobAdds the strings (databases, special identifiers) for which locks need to be acquired. -
create
public static Data create(String name, Parser parser, Context ctx, MainOptions options) throws IOException Returns a database instance from the specified parser.- Parameters:
name- name of the databaseparser- input parserctx- database contextoptions- main options- Returns:
- new database instance
- Throws:
IOException- I/O exception
-
create
public static Data create(String name, Parser parser, Context ctx, MainOptions options, boolean mem) throws IOException Creates a new database instance, using the specified parser.- Parameters:
name- name of the databaseparser- input parserctx- database contextoptions- main optionsmem- create main-memory instance- Returns:
- new database instance
- Throws:
IOException- I/O exception
-
build
Description copied from class:CommandBuilds a string representation from the command. This string must be correctly built, as commands are sent to the server as strings.
-