Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jet.server.api.db
Class DBManager

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

    public final class DBManager

extends java.lang.Object

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

Method Summary
`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.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.

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.

### getSystemWorkspace

    public static Workspace getSystemWorkspace()

  Gets the system workspace.

  Returns:
    the system 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 specified by index.

  Parameters:
    `index` -
  Returns:
    the `Workspace`.

### workspaces

    public static Workspace workspaces(java.lang.String wkName)

  Gets the workspace specified by name.

  Parameters:
    `wkName` - the workspace name.
  Returns:
    the `Workspace`.

### isDefault

    public static boolean isDefault(Workspace wk)

  Tests whether a workspace is the default workspace.

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

### getAllSupportDrivers

    public static java.lang.String[] getAllSupportDrivers()

  Gets all JDBC drivers supported by the JReport server.

  Returns:
    a `String` array to represent all supported JDBC drivers.

### getAllSupportDBTypes

    public static java.lang.String[] getAllSupportDBTypes()

  Gets all database types supported by the JReport server.

  Returns:
    a `String` array to represent all database types supported by JReport server.

### testConnecting

    public static boolean testConnecting(java.util.Properties info)

  Tests JDBC configuration information.

  Parameters:
    `info` - a `Properties` which represents JDBC configuration information.
  Returns:
    true if the connecting succeeded, false if failed.

### backup

    public static boolean backup(Database db,
                                 java.lang.String bkVolume)

  Backups a specified `Database` to an archive.

  Parameters:
    `db` - the database to backup.
    `bkVolume` - the archive file name.
  Returns:
    true if backup succeeded, otherwise false.

### cutdownTable

    public 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. Now, for "realmtables" 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 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.
  Returns:
    true if the operation is successful, or 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 data from an archive to a table. Now, for "realmtables" database, only the result version table "RESULTVERSION_2" can be cut down, so only the table "RESULTVERSION_2" can be imported data into. And for "profiling" database, only the table "TaskContext" can be cut down, so only the table "TaskContext" can be imported data into.

  Parameters:
    `tbl` - the table that you want to import cut data into.
    `bkVolume` - the archive name that you want to import cut data from.
  Returns:
    true of the importing succeeded, otherwise false.
  See Also:
    `Database.cutdownTable(jet.server.api.db.Table, java.lang.String, java.lang.String)`

### saveConfig

    public static boolean saveConfig()

  Saves database JDBC configuration.

  Returns:
    true if succeeded

### statResultVersion

    public static FieldValue[] statResultVersion(Database db)
                                          throws java.sql.SQLException

  Retrieves some information from result version table in "realmtables" database.

  Parameters:
    `db` - a `database`.
  Returns:
    a `FieldValuue` array containing needed information.
  Throws:
    `java.sql.SQLException` - if `SQLException` is thrown during the operation.

### statTaskContext

    public static FieldValue[] statTaskContext(Database db)
                                        throws java.sql.SQLException

  Retrieves some information from task context table in "profiling" database.

  Parameters:
    `db` - the `Database` for "profiling".
  Returns:
    a `FieldValuue` array containing needed information.
  Throws:
    `java.sql.SQLException` - if `SQLException` is thrown during the operation.

### checkIntegrality

    public static java.util.Set checkIntegrality(java.lang.String dbName)
                                          throws java.sql.SQLException,
                                                 java.io.IOException

  Checks the integrity of the database specified by name.

  Parameters:
    `dbName` - the `Database` name.
  Returns:
    a `Set` containing all invalid external files.
  Throws:
    `java.sql.SQLException` - if `SQLException` is thrown during the operation.
    `java.io.IOException` - if `IOException` is thrown during the operation.

### getVolumeSummary

    public static java.util.Properties getVolumeSummary(java.lang.String bkVolume)
                                                 throws java.io.IOException

  Retrieves the summary information of a backup or cut archive.

  Parameters:
    `bkVolume` - the archive file.
  Returns:
    a `Properties` containing summary information.
  Throws:
    `java.io.IOException` - if `IOException` is thrown during the operation.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD