Package org.basex.core
Class Databases
java.lang.Object
org.basex.core.Databases
Provides central access to all databases and backups.
- Author:
- BaseX Team 2005-21, BSD License, Jens Erat
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbackups()Returns the names of all backups.Returns the name of a specific backup, or all backups found for a specific database, in a descending order.static StringExtracts the date of a database from the name of a backup.list()Lists all available databases and backups.static StringExtracts the name of a database from the name of a backup.static PatternReturns a regular expression for the specified name pattern.static booleanvalidChar(int ch, boolean firstLast) Checks if the specified character is a valid character for a database name.static booleanChecks if the specified string is a valid database name.static booleanvalidPattern(String pattern) Checks if the specified string is a valid database pattern.
-
Field Details
-
DBCHARS
Allowed characters for database names (additional to letters and digits). The following characters are invalid:-
,?*" are used by the glob syntax -
;is reserved for separating commands. -
:*?\"<>\/|" are used for filenames and paths
- See Also:
-
-
-
Method Details
-
list
Lists all available databases and backups.- Returns:
- database and backup list
-
regex
Returns a regular expression for the specified name pattern.- Parameters:
pattern- pattern- Returns:
- regular expression
-
backups
Returns the names of all backups.- Returns:
- backups
-
backups
Returns the name of a specific backup, or all backups found for a specific database, in a descending order.- Parameters:
db- database- Returns:
- names of specified backups
-
name
Extracts the name of a database from the name of a backup.- Parameters:
backup- Name of the backup file. Valid formats:[dbname]-yyyy-mm-dd-hh-mm-ss,[dbname]- Returns:
- name of the database (
[dbname])
-
date
Extracts the date of a database from the name of a backup.- Parameters:
backup- name of the backup file, including the date- Returns:
- date string
-
validChar
public static boolean validChar(int ch, boolean firstLast) Checks if the specified character is a valid character for a database name.- Parameters:
ch- the character to be checkedfirstLast- character is first or last- Returns:
- result of check
-
validName
Checks if the specified string is a valid database name.- Parameters:
name- name to be checked (can benull)- Returns:
- result of check
-
validPattern
Checks if the specified string is a valid database pattern.- Parameters:
pattern- pattern to be checked (can benull)- Returns:
- result of check
-