jet.server.api.db
Class DBManager

java.lang.Object
  extended by jet.server.api.db.DBManager

public final class DBManager
extends java.lang.Object

Class DBManager provides some methods help manage databases in the JREntServer, such as travel all Workspace, backup and restore database, etc.


Method Summary
static boolean backup(Database db, java.lang.String bkVolume)
          Backup a specified Database to an archive.
static java.util.Set checkIntegrality(java.lang.String dbName)
          Check integrality of the database that specified by name.
static boolean cutdownTable(Table tbl, java.lang.String bkVolume, java.lang.String where)
          Cut down data in a table and stroe those data to an archive.Now, for "systables" database, only the result version table "RESULTVERSION_2" can be cut down.
static java.lang.String[] getAllSupportDBTypes()
          Gets all database type supported by the JReport Enterprisse server.
static java.lang.String[] getAllSupportDrivers()
          Gets all JDBC drivers supported by the JReport Enterprise server.
static Workspace getDefaultWorkspace()
          Gets the default workspace.
static java.util.Properties getVolumeSummary(java.lang.String bkVolume)
          Retrieves the summary information of a backup or cutdown archive.
static boolean importsTable(Table tbl, java.lang.String bkVolume)
          Imports cut down data from an archive to a table.
static boolean isDefault(Workspace wk)
          Test whether a worksapce is the default workspace.
static boolean saveConfig()
          Save databse JDBC configuration
static FieldValue[] statResultVersion(Database db)
          Retrieves some information from result version table which in "systables" database
static FieldValue[] statTaskContext(Database db)
          Retrieves some information from task context table which 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 that specified by index.
static Workspace workspaces(java.lang.String wkName)
          Gets the workspace that specified by name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefaultWorkspace

public static Workspace getDefaultWorkspace()
Gets the default workspace.

Returns:
the default workspace.

workspaces

public static Workspaces workspaces()
Gets the workspace container.

Returns:
the Workspaces in the server.

workspaces

public static Workspace workspaces(int index)
Gets the workspace that specified by index.

Parameters:
index -
Returns:
the Workspace

workspaces

public static Workspace workspaces(java.lang.String wkName)
Gets the workspace that specified by name.

Parameters:
wkName - the workspace name
Returns:
the Workspace

isDefault

public static boolean isDefault(Workspace wk)
Test whether a worksapce is the default workspace.

Parameters:
wk - the Workspace
Returns:
true if specified Workspace is default

getAllSupportDrivers

public static java.lang.String[] getAllSupportDrivers()
Gets all JDBC drivers supported by the JReport Enterprise server.

Returns:
a String array to represent all supported JDBC drivers

getAllSupportDBTypes

public static java.lang.String[] getAllSupportDBTypes()
Gets all database type supported by the JReport Enterprisse server.

Returns:
a String array to represent all database types which supported by JReport Enterprise server

testConnecting

public static boolean testConnecting(java.util.Properties info)
Tests JDBC configuration information.

Parameters:
info - a Properties which represent JDBC configuration information
Returns:
true if connect succeed, false if connect failed.

backup

public static boolean backup(Database db,
                             java.lang.String bkVolume)
Backup a specified Database to an archive.

Parameters:
db - the database will be backuped
bkVolume - archive file name
Returns:
true if backup succeed, otherwise false.

cutdownTable

public static boolean cutdownTable(Table tbl,
                                   java.lang.String bkVolume,
                                   java.lang.String where)
Cut down data in a table and stroe those data to an archive.Now, for "systables" database, only the result version table "RESULTVERSION_2" can be cut down. And for "profiling" database, only the table "TaskContext" can be cut down.

Parameters:
tbl - the table that you want to cut down data.
bkVolume - the full path name of the archive that you want to stroe cut down data in it.
where - the sql conditions that you cut down data.
Returns:
true if the operating is successful, else return false.
See Also:
Database.importsTable(jet.server.api.db.Table, java.lang.String)

importsTable

public static boolean importsTable(Table tbl,
                                   java.lang.String bkVolume)
Imports cut down data from an archive to a table. Now, for "systables" database, only the result version table "RESULTVERSION_2" can be cut down, so only the table "RESULTVERSION_2" can be imported. And for "profiling" database, only the table "TaskContext" can be cut down, only the table "TaskContext" can be imported.

Parameters:
tbl - the table that you want to import cut down data.
bkVolume - the archive name that you want to import cut down data for it.
Returns:
true import succeed, otherwise false.
See Also:
Database.cutdownTable(jet.server.api.db.Table, java.lang.String, java.lang.String)

saveConfig

public static boolean saveConfig()
Save databse JDBC configuration

Returns:
true if succeed

statResultVersion

public static FieldValue[] statResultVersion(Database db)
                                      throws java.sql.SQLException
Retrieves some information from result version table which in "systables" database

Parameters:
db - a database
Returns:
a FieldValuue array containes needed information
Throws:
java.sql.SQLException - if SQLException throws during operation

statTaskContext

public static FieldValue[] statTaskContext(Database db)
                                    throws java.sql.SQLException
Retrieves some information from task context table which in "profiling" database.

Parameters:
db - the Database for "profiling"
Returns:
a FieldValuue array contains needed information
Throws:
java.sql.SQLException - if SQLException throws during operation

checkIntegrality

public static java.util.Set checkIntegrality(java.lang.String dbName)
                                      throws java.sql.SQLException,
                                             java.io.IOException
Check integrality of the database that specified by name.

Parameters:
dbName - the Database name
Returns:
a Set contains all invalide external files.
Throws:
java.sql.SQLException - if SQLException throws during operation
java.io.IOException - if IOException throws during operation

getVolumeSummary

public static java.util.Properties getVolumeSummary(java.lang.String bkVolume)
                                             throws java.io.IOException
Retrieves the summary information of a backup or cutdown archive.

Parameters:
bkVolume - the archive file
Returns:
a Properties contains summary information
Throws:
java.io.IOException - if IOException throws during operation