public interface OXUtilInterface
extends java.rmi.Remote
// Register database,server and a filestore. final OXUtilInterface iface = (OXUtilInterface)Naming.lookup("rmi:///oxhost/"+OXUtilInterface.RMI_NAME); final Credentials auth = new Credentials(); auth.setLogin("masteradmin"); auth.setPassword("secret"); Database client_db = new Database(); client_db.setName(name); client_db.setDriver("com.mysql.jdbc.Driver"); client_db.setLogin("openexchange"); client_db.setMaster(true); client_db.setMaxUnits(1000); client_db.setPassword("secret"); client_db.setPoolHardLimit(20); client_db.setPoolInitial(5); client_db.setPoolMax(100); client_db.setUrl("jdbc:mysql://localhost/?useUnicode=true&characterEncoding=UTF-8& autoReconnect=false&useUnicode=true&useServerPrepStmts=false&useTimezone=true& serverTimezone=UTC&connectTimeout=15000&socketTimeout=15000"); client_db.setClusterWeight(100); // Register database iface.registerDatabase(client_db,auth); // Register server Server srv = new Server(); srv.setName("local"); iface.registerServer(srv,auth); // Register filestore Filestore client_st = new Filestore(); client_st.setUrl("file:/var/ox/filestore"); client_st.setSize(100L); client_st.setMaxContexts(100); iface.registerFilestore(srv,auth);The system is now ready to be filled with 100 contexts.
OXContextInterface
for an example of creating a context.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_DRIVER |
static java.lang.String |
DEFAULT_HOSTNAME |
static int |
DEFAULT_MAXUNITS |
static boolean |
DEFAULT_POOL_HARD_LIMIT |
static int |
DEFAULT_POOL_INITIAL |
static int |
DEFAULT_POOL_MAX |
static int |
DEFAULT_STORE_MAX_CTX |
static long |
DEFAULT_STORE_SIZE |
static java.lang.String |
DEFAULT_USER |
static java.lang.String |
RMI_NAME
RMI name to be used in the naming lookup.
|
Modifier and Type | Method and Description |
---|---|
void |
changeDatabase(Database db,
Credentials auth)
Change parameters of a database registered in system
|
void |
changeFilestore(Filestore fstore,
Credentials auth)
Change filestore.
|
void |
changeServer(Server server,
java.lang.String schemaName,
Credentials credentials)
Changes the server for all the contexts in the specified schema
|
Database[][] |
checkDatabase(Credentials auth)
Checks databases by schema consistency.
|
java.util.Map<Database,java.lang.Integer> |
countDatabaseSchema(java.lang.String search_pattern,
java.lang.Boolean onlyEmptySchemas,
Credentials auth)
Counts schemas per database host matching search_pattern
|
MaintenanceReason |
createMaintenanceReason(MaintenanceReason reason,
Credentials auth)
Add new maintenance reason.
|
Database |
createSchema(Credentials credentials,
java.lang.Integer optDatabaseId)
Creates a new schema in the given database host if possible.
|
java.lang.String[] |
createSchemas(Database db,
java.lang.Integer optNumberOfSchemas,
Credentials credentials)
Creates schemas on given database host.
|
int |
deleteEmptySchemas(Database db,
java.lang.Integer optNumberOfSchemasToKeep,
Credentials credentials)
Deletes an existing empty schema from given database host.
|
void |
deleteMaintenanceReason(MaintenanceReason[] reasons,
Credentials auth)
Deletes maintenance reason text.
|
Database[] |
listAllDatabase(Credentials auth)
Convenience method for listing all databases registered in the system.
|
Database[] |
listAllDatabaseSchema(java.lang.Boolean onlyEmptySchemas,
Credentials auth)
Convenience method for listing all database schemas registered in the system.
|
Filestore[] |
listAllFilestore(Credentials auth)
Convenience method for listing all filestores.
|
MaintenanceReason[] |
listAllMaintenanceReason(Credentials auth)
Get all maintenance reasons.
|
Server[] |
listAllServer(Credentials auth)
Convenience method for listing all servers
|
Database[] |
listDatabase(java.lang.String search_pattern,
Credentials auth)
Search for databases registered in the system.
|
Database[] |
listDatabaseSchema(java.lang.String search_pattern,
java.lang.Boolean onlyEmptySchemas,
Credentials auth)
Search for database schemas registered in the system.
|
Filestore[] |
listFilestore(java.lang.String search_pattern,
Credentials auth)
A method to list file stores matching some search pattern.
|
Filestore[] |
listFilestore(java.lang.String searchPattern,
Credentials credentials,
boolean omitUsage)
A method to list file stores matching some search pattern.
|
MaintenanceReason[] |
listMaintenanceReason(java.lang.String search_pattern,
Credentials auth)
Get all maintenance reasons which match the specified search_pattern
|
Server[] |
listServer(java.lang.String search_pattern,
Credentials auth)
Search for server
|
void |
recalculateFilestoreUsage(java.lang.Integer contextId,
java.lang.Integer userId,
Credentials auth)
Recalculates the filestore usage for the given context.
|
void |
recalculateFilestoreUsage(RecalculationScope scope,
java.lang.Integer optContextId,
Credentials auth)
Recalculates the filestore usage for a given scope or for all filestores in case the scope is
null . |
Database |
registerDatabase(Database db,
java.lang.Boolean createSchemas,
java.lang.Integer optNumberOfSchemas,
Credentials auth)
Register a new database to the system.
|
Filestore |
registerFilestore(Filestore fstore,
Credentials auth)
Register new filestore to the system.
|
Server |
registerServer(Server srv,
Credentials auth)
Register an OX Server in the system.
|
Database[] |
unblockDatabase(Database database,
Credentials auth)
Unblocks specified database schema (in case marked as being updated for too long).
|
void |
unregisterDatabase(Database dbhandle,
Credentials auth)
Unregister database identified by its ID from configdb.
|
void |
unregisterFilestore(Filestore store,
Credentials auth)
Unregister filestore from system identified by its ID
|
void |
unregisterServer(Server serv,
Credentials auth)
Delete an OX server from the system.
|
static final java.lang.String DEFAULT_DRIVER
static final int DEFAULT_MAXUNITS
static final boolean DEFAULT_POOL_HARD_LIMIT
static final int DEFAULT_POOL_INITIAL
static final int DEFAULT_POOL_MAX
static final java.lang.String DEFAULT_USER
static final java.lang.String DEFAULT_HOSTNAME
static final long DEFAULT_STORE_SIZE
static final int DEFAULT_STORE_MAX_CTX
static final java.lang.String RMI_NAME
MaintenanceReason createMaintenanceReason(MaintenanceReason reason, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
reason
- MaintenanceReason.auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid deleteMaintenanceReason(MaintenanceReason[] reasons, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
reasons
- Reasons which should be deleted!Currently ID must be set in each object!auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionMaintenanceReason[] listMaintenanceReason(java.lang.String search_pattern, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
search_pattern
- A search pattern to list only those reason which match that patternauth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.java.rmi.RemoteException
- General RMI ExceptionInvalidDataException
MaintenanceReason[] listAllMaintenanceReason(Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.java.rmi.RemoteException
- General RMI ExceptionInvalidDataException
Server registerServer(Server srv, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
srv
- Server object containing the server nameauth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid unregisterServer(Server serv, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
auth
- Credentials for authenticating against server.serv
- Server with id set.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid changeServer(Server server, java.lang.String schemaName, Credentials credentials) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
server
- Server with id set.schemaName
- The schema name for which to change the servercredentials
- Credentials for authenticating against server.java.rmi.RemoteException
- General RMI ExceptionStorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.lang.String[] createSchemas(Database db, java.lang.Integer optNumberOfSchemas, Credentials credentials) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException, NoSuchDatabaseException
db
- The database hostoptNumberOfSchemas
- Specifies the number of schemas that shall be created; if not set number of schemas is determined by max. units for associated database divides by CONTEXTS_PER_SCHEMA
configuration optioncredentials
- Credentials for authenticating against server.java.rmi.RemoteException
- General RMI ExceptionStorageException
- If schemas cannot be createdInvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.NoSuchDatabaseException
- If no such database existsint deleteEmptySchemas(Database db, java.lang.Integer optNumberOfSchemasToKeep, Credentials credentials) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException, NoSuchDatabaseException
db
- The database host and scheme
optNumberOfSchemasToKeep
- Specifies the number of schemas that shall be kept (per database host); if missing all empty schemas are attempted to be deletedcredentials
- Credentials for authenticating against serverjava.rmi.RemoteException
- General RMI ExceptionStorageException
- If schemas cannot be createdInvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.NoSuchDatabaseException
- If no such database existsDatabase registerDatabase(Database db, java.lang.Boolean createSchemas, java.lang.Integer optNumberOfSchemas, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
Database client_db = new Database(); client_db.setDisplayname("mydb"); client_db.setDriver("com.mysql.jdbc.Driver"); client_db.setLogin("openexchange"); client_db.setMaster(true); client_db.setMaxUnits(1000); client_db.setPassword("xxx"); client_db.setPoolHardLimit(20); client_db.setPoolInitial(2); client_db.setPoolMax(100); client_db.setUrl("jdbc:mysql://localhost/?useUnicode=true&characterEncoding=UTF-8&" + "autoReconnect=false&useUnicode=true&useServerPrepStmts=false&useTimezone=true&" + "serverTimezone=UTC&connectTimeout=15000&socketTimeout=15000");
db
- The database to registercreateSchemas
- Whether the schemas holding payload data are supposed to be pre-createdoptNumberOfSchemas
- Given that createSchemas
is true
that parameter specifies the number of schemas that shall be created;
if not set number of schemas is determined by max. units for associated database divided by CONTEXTS_PER_SCHEMA
configuration optionauth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid changeDatabase(Database db, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
Database client_db = ...load Database from server viasearchForDatabase
to make sure that the Object contains the correct Database id. client_db.setDisplayname(client_db.getDisplayname()+"changed"); client_db.setDriver(client_db.getDriver()+"changed"); client_db.setLogin(client_db.getLogin()+"changed"); client_db.setMaxUnits(2000); client_db.setPassword(client_db.getPassword()+"changed"); client_db.setPoolHardLimit(40); client_db.setPoolInitial(4); client_db.setPoolMax(200); client_db.setUrl(client_db.getUrl()+"changed"); ....change Database
db
- Database containing the information of the database to edit.auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid unregisterDatabase(Database dbhandle, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
database
- Database with id set.auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionDatabase[] listDatabase(java.lang.String search_pattern, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
search_pattern
- Search pattern e.g "*" "*my*".auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionDatabase[] listDatabaseSchema(java.lang.String search_pattern, java.lang.Boolean onlyEmptySchemas, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
search_pattern
- Search pattern e.g "*" "*my*".onlyEmptySchemas
- Whether only empty schemas are supposed to be consideredauth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionjava.util.Map<Database,java.lang.Integer> countDatabaseSchema(java.lang.String search_pattern, java.lang.Boolean onlyEmptySchemas, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
search_pattern
- A pattern to search foronlyEmptySchemas
- Whether only empty database schemas are supposed to be countedauth
- Credentials for authenticating against server.StorageException
java.rmi.RemoteException
InvalidCredentialsException
InvalidDataException
Database[] listAllDatabase(Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionDatabase[] listAllDatabaseSchema(java.lang.Boolean onlyEmptySchemas, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
onlyEmptySchemas
- Whether only empty schemas are supposed to be consideredauth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionDatabase[][] checkDatabase(Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionDatabase[] unblockDatabase(Database database, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException, NoSuchDatabaseException
database
- The database schema to unblockauth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionNoSuchDatabaseException
- If no such database/schema existsServer[] listServer(java.lang.String search_pattern, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
search_pattern
- Search pattern e.g "*" "*my*".auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionServer[] listAllServer(Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionFilestore registerFilestore(Filestore fstore, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
fstore
- Filestore to register with the store data.auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid changeFilestore(Filestore fstore, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
fstore
- Contains store to change.auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionFilestore[] listFilestore(java.lang.String search_pattern, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
#listFileStore(String, Credentials, boolean)
with
parameter omitUsage set to false
.search_pattern
- Search pattern e.g "*" "*file://%*"auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionFilestore[] listFilestore(java.lang.String searchPattern, Credentials credentials, boolean omitUsage) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
searchPattern
- The search pattern the file store should match to. The pattern "*" will list all file stores.credentials
- must be the master administration credentials to be allowed to list file stores.omitUsage
- true
to not load the current file store usage from the database, which is an expensive operation
because it has to load the usage of every context and summarize them up.java.rmi.RemoteException
- if a general RMI problem occurs.StorageException
- if a problem on the storage layer occurs.InvalidCredentialsException
- if the supplied credentials do not match the master administration credentials.InvalidDataException
- if the pattern is empty or invalid.Filestore[] listAllFilestore(Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI Exceptionvoid unregisterFilestore(Filestore store, Credentials auth) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException, InvalidDataException
store
- Filestore to unregister with id set.auth
- Credentials for authenticating against server.StorageException
- When an error in the subsystems occurred.InvalidCredentialsException
- When the supplied credentials were not correct or invalid.InvalidDataException
- If the data sent within the method contained invalid data.java.rmi.RemoteException
- General RMI ExceptionDatabase createSchema(Credentials credentials, java.lang.Integer optDatabaseId) throws java.rmi.RemoteException, StorageException, InvalidCredentialsException
null
the best suitable database host is selected automatically.credentials
- Credentials for authenticating against server.optDatabaseId
- Optional database identifier. In case the optDBId
is null
, the best suitable database is selected automatically.Database
for the new schema.java.rmi.RemoteException
StorageException
InvalidCredentialsException
void recalculateFilestoreUsage(java.lang.Integer contextId, java.lang.Integer userId, Credentials auth) throws InvalidCredentialsException, StorageException, java.rmi.RemoteException, InvalidDataException
contextId
- The id of the contextuserId
- The optional id of the userauth
- Credentials for authenticating against server.InvalidCredentialsException
- In case the credentials are wrongStorageException
- In case the usage couldn't be recalculatedjava.rmi.RemoteException
- General RMI ExceptionInvalidDataException
- If the data sent within the method contained invalid datavoid recalculateFilestoreUsage(RecalculationScope scope, java.lang.Integer optContextId, Credentials auth) throws InvalidCredentialsException, StorageException, java.rmi.RemoteException
null
.scope
- The scopeoptContextId
- An optional context identifier to limit the calculation to that contextauth
- Credentials for authenticating against server.InvalidCredentialsException
- In case the credentials are wrongStorageException
- In case the usage couldn't be recalculatedjava.rmi.RemoteException
- General RMI Exception