public final class DBManager
extends java.lang.Object
DBManager
provides some methods to help manage databases in
the JReport Server, such as travel all Workspace
, backup and
restore database, etc.Modifier and Type | Method and Description |
---|---|
static boolean |
backup(Database db,
java.lang.String bkVolume)
Backups a specified
Database to an archive. |
static java.util.Set |
checkIntegrality(java.lang.String dbName)
Checks the integrity of the database specified by name.
|
static boolean |
cutdownTable(Table tbl,
java.lang.String bkVolume,
java.util.Date before,
java.util.Date after)
Cuts down data in a table and store those data to an archive.
|
static boolean |
cutdownTable(Table tbl,
java.lang.String bkVolume,
java.lang.String where)
Cuts down data in a table and store those data to an archive.
|
static java.lang.String[] |
getAllSupportDBTypes()
Gets all database types supported by the JReport server.
|
static java.lang.String[] |
getAllSupportDrivers()
Gets all JDBC drivers supported by the JReport server.
|
static Workspace |
getDefaultWorkspace()
Gets the default workspace.
|
static Workspace |
getSystemWorkspace()
Gets the system workspace.
|
static java.util.Properties |
getVolumeSummary(java.lang.String bkVolume)
Retrieves the summary information of a backup or cut archive.
|
static boolean |
importsTable(Table tbl,
java.lang.String bkVolume)
Imports cut data from an archive to a table.
|
static boolean |
isDefault(Workspace wk)
Tests whether a workspace is the default workspace.
|
static boolean |
saveConfig()
Saves database JDBC configuration.
|
static FieldValue[] |
statResultVersion(Database db)
Retrieves some information from result version table in "realmtables"
database.
|
static FieldValue[] |
statTaskContext(Database db)
Retrieves some information from task context table in "profiling"
database.
|
static boolean |
testConnecting(java.util.Properties info)
Tests JDBC configuration information.
|
static Workspaces |
workspaces()
Gets the workspace container.
|
static Workspace |
workspaces(int index)
Gets the workspace specified by index.
|
static Workspace |
workspaces(java.lang.String wkName)
Gets the workspace specified by name.
|
public static Workspace getDefaultWorkspace()
public static Workspace getSystemWorkspace()
public static Workspaces workspaces()
Workspaces
in the server.public static Workspace workspaces(int index)
index
- Workspace
.public static Workspace workspaces(java.lang.String wkName)
wkName
- the workspace name.Workspace
.public static boolean isDefault(Workspace wk)
wk
- the Workspace.
Workspace
is the default.public static java.lang.String[] getAllSupportDrivers()
String
array to represent all supported JDBC drivers.public static java.lang.String[] getAllSupportDBTypes()
String
array to represent all database types supported
by JReport server.public static boolean testConnecting(java.util.Properties info)
info
- a Properties
which represents JDBC configuration information.public static boolean backup(Database db, java.lang.String bkVolume)
Database
to an archive.db
- the database to backup.bkVolume
- the archive file name.public static boolean cutdownTable(Table tbl, java.lang.String bkVolume, java.lang.String where)
tbl
- the table that you want to cut down data from.bkVolume
- the full path name of the archive that you want to store the cut
data in.where
- the sql conditions by which you cut down data.Database.importsTable(jet.server.api.db.Table, java.lang.String)
public static boolean cutdownTable(Table tbl, java.lang.String bkVolume, java.util.Date before, java.util.Date after)
tbl
- the table that you want to cut down data from.bkVolume
- the full path name of the archive that you want to store the cut
data in.before
- the Date that all records before it will be cut downafter
- the Date that all records after it will be cut downDatabase.importsTable(jet.server.api.db.Table, java.lang.String)
public static boolean importsTable(Table tbl, java.lang.String bkVolume)
tbl
- the table that you want to import cut data into.bkVolume
- the archive name that you want to import cut data from.Database.cutdownTable(jet.server.api.db.Table, java.lang.String, java.lang.String)
public static boolean saveConfig()
public static FieldValue[] statResultVersion(Database db) throws java.sql.SQLException
db
- a database
.FieldValuue
array containing needed information.java.sql.SQLException
- if SQLException
is thrown during the operation.public static FieldValue[] statTaskContext(Database db) throws java.sql.SQLException
db
- the Database
for "profiling".FieldValuue
array containing needed information.java.sql.SQLException
- if SQLException
is thrown during the operation.public static java.util.Set checkIntegrality(java.lang.String dbName) throws java.sql.SQLException, java.io.IOException
dbName
- the Database
name.Set
containing all invalid external files.java.sql.SQLException
- if SQLException
is thrown during the operation.java.io.IOException
- if IOException
is thrown during the operation.public static java.util.Properties getVolumeSummary(java.lang.String bkVolume) throws java.io.IOException
bkVolume
- the archive file.Properties
containing summary information.java.io.IOException
- if IOException
is thrown during the operation.