com.openexchange.admin.storage.mysqlStorage
Class OXUtilMySQLStorage

java.lang.Object
  extended by com.openexchange.admin.storage.interfaces.OXUtilStorageInterface
      extended by com.openexchange.admin.storage.sqlStorage.OXUtilSQLStorage
          extended by com.openexchange.admin.storage.mysqlStorage.OXUtilMySQLStorage

public class OXUtilMySQLStorage
extends OXUtilSQLStorage

Author:
d7, cutmasta

Constructor Summary
OXUtilMySQLStorage()
           
 
Method Summary
 void changeDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
           
 void changeFilestore(com.openexchange.admin.rmi.dataobjects.Filestore fstore)
          Changes a given filestore
 void createDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
          Creates a new database from scratch on the given database host.
 int createMaintenanceReason(com.openexchange.admin.rmi.dataobjects.MaintenanceReason reason)
          Create a new maintenance reason in configdb.They are needed to disable a context.
 void deleteDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
          Delete a complete database(scheme) from the given database host.
 void deleteMaintenanceReason(int[] reason_ids)
          Delete reason from configdb
 com.openexchange.admin.rmi.dataobjects.Filestore findFilestoreForContext()
          Iterates across all existing filestores and searches for one having enough space for a context.
 com.openexchange.admin.rmi.dataobjects.MaintenanceReason[] getAllMaintenanceReasons()
           
 com.openexchange.admin.rmi.dataobjects.Filestore getFilestore(int id)
          get filestore by ID
 com.openexchange.admin.rmi.dataobjects.MaintenanceReason[] getMaintenanceReasons(int[] reason_id)
           
 boolean hasSpaceForAnotherContext(com.openexchange.admin.rmi.dataobjects.Filestore filestore)
           
 com.openexchange.admin.rmi.dataobjects.Filestore[] listFilestores(java.lang.String pattern)
          List all registered filestores
 com.openexchange.admin.rmi.dataobjects.MaintenanceReason[] listMaintenanceReasons(java.lang.String search_pattern)
           
 int registerDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
          Register a new Database in configdb
 int registerFilestore(com.openexchange.admin.rmi.dataobjects.Filestore fstore)
          Register filestore in configbdb.
 int registerServer(java.lang.String serverName)
          Registers a new server in the configdb
 com.openexchange.admin.rmi.dataobjects.Database[] searchForDatabase(java.lang.String search_pattern)
          Searches for databases matching search_pattern
 com.openexchange.admin.rmi.dataobjects.Server[] searchForServer(java.lang.String search_pattern)
          Searchs for server matching given search_pattern
 void unregisterDatabase(int db_id)
          Unregister a database from configdb
 void unregisterFilestore(int store_id)
          Unregister filestore from configbdb
 void unregisterServer(int server_id)
          Unregister a server from configdb
 
Methods inherited from class com.openexchange.admin.storage.interfaces.OXUtilStorageInterface
getInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OXUtilMySQLStorage

public OXUtilMySQLStorage()
Method Detail

createMaintenanceReason

public int createMaintenanceReason(com.openexchange.admin.rmi.dataobjects.MaintenanceReason reason)
                            throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Create a new maintenance reason in configdb.They are needed to disable a context.

Specified by:
createMaintenanceReason in class OXUtilStorageInterface
Parameters:
reason - the MaintenanceReason
Returns:
the id as a long of the new created reason
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

changeDatabase

public void changeDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
                    throws com.openexchange.admin.rmi.exceptions.StorageException
Specified by:
changeDatabase in class OXUtilStorageInterface
Parameters:
db - a database object to be changed
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

changeFilestore

public void changeFilestore(com.openexchange.admin.rmi.dataobjects.Filestore fstore)
                     throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Changes a given filestore

Specified by:
changeFilestore in class OXUtilStorageInterface
Parameters:
fstore - filestore object
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

createDatabase

public void createDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
                    throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Creates a new database from scratch on the given database host. Is used ONLY internally at the moment.

Specified by:
createDatabase in class OXUtilStorageInterface
Parameters:
db - a database object to create
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

deleteDatabase

public void deleteDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
                    throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Delete a complete database(scheme) from the given database host. Is used ONYL internally at the moment.

Specified by:
deleteDatabase in class OXUtilStorageInterface
Parameters:
db - a database object to be deleted
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

deleteMaintenanceReason

public void deleteMaintenanceReason(int[] reason_ids)
                             throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Delete reason from configdb

Specified by:
deleteMaintenanceReason in class OXUtilStorageInterface
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

getAllMaintenanceReasons

public com.openexchange.admin.rmi.dataobjects.MaintenanceReason[] getAllMaintenanceReasons()
                                                                                    throws com.openexchange.admin.rmi.exceptions.StorageException
Specified by:
getAllMaintenanceReasons in class OXUtilStorageInterface
Returns:
an array of all available MaintenanceReasons in configdb.
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

listMaintenanceReasons

public com.openexchange.admin.rmi.dataobjects.MaintenanceReason[] listMaintenanceReasons(java.lang.String search_pattern)
                                                                                  throws com.openexchange.admin.rmi.exceptions.StorageException
Specified by:
listMaintenanceReasons in class OXUtilStorageInterface
Returns:
an array of all available MaintenanceReasons in configdb match the specified pattern
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

getMaintenanceReasons

public com.openexchange.admin.rmi.dataobjects.MaintenanceReason[] getMaintenanceReasons(int[] reason_id)
                                                                                 throws com.openexchange.admin.rmi.exceptions.StorageException
Specified by:
getMaintenanceReasons in class OXUtilStorageInterface
Parameters:
reason_id - the id of a MaintenanceReason
Returns:
MaintenanceReason from configdb identified by the reason_id
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

listFilestores

public com.openexchange.admin.rmi.dataobjects.Filestore[] listFilestores(java.lang.String pattern)
                                                                  throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
List all registered filestores

Specified by:
listFilestores in class OXUtilStorageInterface
Parameters:
pattern - a pattern to search for
Returns:
an array of filestore objects
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

registerDatabase

public int registerDatabase(com.openexchange.admin.rmi.dataobjects.Database db)
                     throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Register a new Database in configdb

Specified by:
registerDatabase in class OXUtilStorageInterface
Parameters:
db - a database object to register
Returns:
long with the id of the database
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

registerFilestore

public int registerFilestore(com.openexchange.admin.rmi.dataobjects.Filestore fstore)
                      throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Register filestore in configbdb.

Specified by:
registerFilestore in class OXUtilStorageInterface
Parameters:
fstore - filestore object
Returns:
the id of the created filestore as a long.
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

findFilestoreForContext

public com.openexchange.admin.rmi.dataobjects.Filestore findFilestoreForContext()
                                                                         throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Iterates across all existing filestores and searches for one having enough space for a context.

Specified by:
findFilestoreForContext in class OXUtilStorageInterface
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

hasSpaceForAnotherContext

public boolean hasSpaceForAnotherContext(com.openexchange.admin.rmi.dataobjects.Filestore filestore)
                                  throws com.openexchange.admin.rmi.exceptions.StorageException
Specified by:
hasSpaceForAnotherContext in class OXUtilStorageInterface
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

registerServer

public int registerServer(java.lang.String serverName)
                   throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Registers a new server in the configdb

Specified by:
registerServer in class OXUtilStorageInterface
Parameters:
serverName - a server name to be registered
Returns:
long with the id of the server
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

searchForDatabase

public com.openexchange.admin.rmi.dataobjects.Database[] searchForDatabase(java.lang.String search_pattern)
                                                                    throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Searches for databases matching search_pattern

Specified by:
searchForDatabase in class OXUtilStorageInterface
Parameters:
search_pattern - a pattern to search for
Returns:
a database array
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

searchForServer

public com.openexchange.admin.rmi.dataobjects.Server[] searchForServer(java.lang.String search_pattern)
                                                                throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Searchs for server matching given search_pattern

Specified by:
searchForServer in class OXUtilStorageInterface
Parameters:
search_pattern - a pattern to search for
Returns:
Server array with found servers
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

unregisterDatabase

public void unregisterDatabase(int db_id)
                        throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Unregister a database from configdb

Specified by:
unregisterDatabase in class OXUtilStorageInterface
Parameters:
db_id - a database id which is unregistered
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

unregisterFilestore

public void unregisterFilestore(int store_id)
                         throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Unregister filestore from configbdb

Specified by:
unregisterFilestore in class OXUtilStorageInterface
Parameters:
store_id - the id of the filestore
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

unregisterServer

public void unregisterServer(int server_id)
                      throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
Unregister a server from configdb

Specified by:
unregisterServer in class OXUtilStorageInterface
Parameters:
server_id - a server id which is unregistered
Throws:
com.openexchange.admin.rmi.exceptions.StorageException

getFilestore

public com.openexchange.admin.rmi.dataobjects.Filestore getFilestore(int id)
                                                              throws com.openexchange.admin.rmi.exceptions.StorageException
Description copied from class: OXUtilStorageInterface
get filestore by ID

Specified by:
getFilestore in class OXUtilStorageInterface
Returns:
Filestore
Throws:
com.openexchange.admin.rmi.exceptions.StorageException