com.openexchange.admin.storage.interfaces
Class OXToolStorageInterface

java.lang.Object
  extended by com.openexchange.admin.storage.interfaces.OXToolStorageInterface
Direct Known Subclasses:
OXToolSQLStorage

public abstract class OXToolStorageInterface
extends Object


Constructor Summary
OXToolStorageInterface()
           
 
Method Summary
 boolean checkAndUpdateSchemaIfRequired(Context ctx)
           
abstract  boolean checkAndUpdateSchemaIfRequired(int contextId)
           
abstract  void checkCreateUserData(Context ctx, User usr)
           
abstract  void checkValidEmailsInUserObject(User user)
           
abstract  boolean domainInUse(Context ctx, String domain)
          Checks if given domain is used by any user,group or resource as mailaddress in given context.
abstract  Group[] domainInUseByGroup(Context ctx, String domain)
          Checks if given domain is used as mail address of any group in given context.
abstract  Resource[] domainInUseByResource(Context ctx, String domain)
          Checks if given domain is used as mail address of any resource in given context.
abstract  User[] domainInUseByUser(Context ctx, String domain)
          Checks if given domain is used as alias or primary mail address of any user in given context.
abstract  boolean existsContext(Context ctx)
          Although this method get's a context Object it will only look after the cid
abstract  boolean existsContextLoginMappings(Context ctx)
           
abstract  boolean existsContextLoginMappings(Context ctx, Connection configdb_connection)
           
abstract  boolean existsContextName(Context ctx)
          Checks via context id and context name if it already exists.
abstract  boolean existsContextName(String contextName)
          Checks if given context name already exists!Should be used in create method!
abstract  boolean existsDatabase(int db_id)
           
abstract  boolean existsDatabaseName(Database db)
          Checks via database id and database name if it already exists.
abstract  boolean existsDatabaseName(String databaseName)
          Checks if given name is already used!Should be used in create method!
abstract  boolean existsDisplayName(Context ctx, User usr)
          This method checks if the display name of the given user object is already used in for a system user.
abstract  boolean existsGroup(Context ctx, Connection con, int id)
          This method can be used to check if some group exists in a context.
abstract  boolean existsGroup(Context ctx, Group grp)
           
abstract  boolean existsGroup(Context ctx, Group[] grps)
           
abstract  boolean existsGroup(Context ctx, int gid)
           
abstract  boolean existsGroup(Context ctx, int[] gid)
           
abstract  boolean existsGroupMember(Context ctx, int group_ID, int member_ID)
           
abstract  boolean existsGroupMember(Context ctx, int group_ID, int[] user_ids)
           
abstract  boolean existsGroupMember(Context ctx, int group_ID, User[] users)
           
abstract  boolean existsGroupName(Context ctx, Group grp)
          Checks via group id and group name if it already exists in this context.
abstract  boolean existsGroupName(Context ctx, String groupName)
          Checks if given name is already used for a group in given context.Should be used in create method!
abstract  boolean existsReason(int rid)
           
abstract  boolean existsReason(String reason)
           
abstract  boolean existsResource(Context ctx, int resource_id)
           
abstract  boolean existsResourceAddress(Context ctx, String address)
           
abstract  boolean existsResourceAddress(Context ctx, String address, Integer resource_id)
           
abstract  boolean existsResourceName(Context ctx, Resource res)
          Checks via resource id and resource name if it already exists.
abstract  boolean existsResourceName(Context ctx, String resourceName)
          Checks if given name is already used for resource in given context!Should be used in create method!
abstract  boolean existsServer(int server_id)
           
abstract  boolean existsServerID(int check_ID, String table, String field)
           
abstract  boolean existsServerName(Server srv)
          Checks via server id and server name if it already exists.
abstract  boolean existsServerName(String serverName)
          Checks if given name is already used!Should be used in create method!
abstract  boolean existsStore(int store_id)
           
abstract  boolean existsStore(String url)
           
abstract  boolean existsUser(Context ctx, int uid)
           
abstract  boolean existsUser(Context ctx, int[] user_ids)
           
abstract  boolean existsUser(Context ctx, User user)
          A convenience method for a single user object.
abstract  boolean existsUser(Context ctx, User[] users)
          This method will detect if a specified user exists.
abstract  boolean existsUserName(Context ctx, String userName)
          Checks if given name is already used for an user in given context.Should be used in create method!
abstract  boolean existsUserName(Context ctx, User usr)
          Checks via user id and user name if it already exists in this context.
abstract  int getAdminForContext(Context ctx)
           
abstract  int getAdminForContext(Context ctx, Connection con)
           
abstract  int getContextIDByContextname(String ctxname)
           
abstract  int getDatabaseIDByDatabasename(String dbname)
           
abstract  int getDefaultGroupForContext(Context ctx, Connection con)
           
abstract  int getDefaultGroupForContextWithOutConnection(Context ctx)
           
abstract  int getGidNumberOfGroup(Context ctx, int group_id, Connection con)
          Gets the system's GID for specified group.
abstract  int getGroupIDByGroupname(Context ctx, String groupname)
           
abstract  String getGroupnameByGroupID(Context ctx, int group_id)
           
static OXToolStorageInterface getInstance()
          Creates a new instance implementing the group storage interface.
abstract  int getResourceIDByResourcename(Context ctx, String resourcename)
           
abstract  String getResourcenameByResourceID(Context ctx, int resource_id)
           
abstract  int getServerIDByServername(String servername)
           
abstract  int getUserIDByUsername(Context ctx, String username)
           
abstract  String getUsernameByUserID(Context ctx, int user_id)
           
abstract  boolean isContextAdmin(Context ctx, int user_id)
           
abstract  boolean isContextAdmin(Context ctx, User user)
          This method determines if the user is the context admin.
abstract  boolean isContextEnabled(Context ctx)
           
abstract  boolean isMasterDatabase(int database_id)
           
abstract  boolean isUserSettingMailBitSet(Context ctx, User user, int bit, Connection con)
           
abstract  boolean poolInUse(int pool_id)
           
abstract  void primaryMailExists(Context ctx, String mail)
           
abstract  boolean schemaBeingLockedOrNeedsUpdate(int writePoolId, String schema)
           
abstract  boolean serverInUse(int server_id)
           
abstract  void setUserSettingMailBit(Context ctx, User user, int bit, Connection con)
           
abstract  boolean storeInUse(int store_id)
           
abstract  void unsetUserSettingMailBit(Context ctx, User user, int bit, Connection con)
           
abstract  void validateUserName(String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OXToolStorageInterface

public OXToolStorageInterface()
Method Detail

getInstance

public static OXToolStorageInterface getInstance()
                                          throws StorageException
Creates a new instance implementing the group storage interface.

Returns:
an instance implementing the group storage interface.
Throws:
StorageException - Storage exception

domainInUse

public abstract boolean domainInUse(Context ctx,
                                    String domain)
                             throws StorageException
Checks if given domain is used by any user,group or resource as mailaddress in given context.

Parameters:
domain -
Returns:
Throws:
StorageException

domainInUseByGroup

public abstract Group[] domainInUseByGroup(Context ctx,
                                           String domain)
                                    throws StorageException
Checks if given domain is used as mail address of any group in given context.

Parameters:
domain -
Returns:
Groups which use this domain.null if no group uses this domain.
Throws:
StorageException

domainInUseByResource

public abstract Resource[] domainInUseByResource(Context ctx,
                                                 String domain)
                                          throws StorageException
Checks if given domain is used as mail address of any resource in given context.

Parameters:
domain -
Returns:
Resources which use this domain. null if no resource uses this domain.
Throws:
StorageException

domainInUseByUser

public abstract User[] domainInUseByUser(Context ctx,
                                         String domain)
                                  throws StorageException
Checks if given domain is used as alias or primary mail address of any user in given context.

Parameters:
domain -
Returns:
Users which use this domain. null if no user uses this domain.
Throws:
StorageException

existsContext

public abstract boolean existsContext(Context ctx)
                               throws StorageException
Although this method get's a context Object it will only look after the cid

Parameters:
ctx -
Returns:
Throws:
StorageException

existsContextLoginMappings

public abstract boolean existsContextLoginMappings(Context ctx)
                                            throws StorageException
Throws:
StorageException

existsContextLoginMappings

public abstract boolean existsContextLoginMappings(Context ctx,
                                                   Connection configdb_connection)
                                            throws StorageException
Throws:
StorageException

existsDatabase

public abstract boolean existsDatabase(int db_id)
                                throws StorageException
Throws:
StorageException

existsGroup

public abstract boolean existsGroup(Context ctx,
                                    Group[] grps)
                             throws StorageException
Throws:
StorageException

existsGroup

public abstract boolean existsGroup(Context ctx,
                                    Group grp)
                             throws StorageException
Throws:
StorageException

existsGroup

public abstract boolean existsGroup(Context ctx,
                                    int gid)
                             throws StorageException
Throws:
StorageException

existsGroup

public abstract boolean existsGroup(Context ctx,
                                    Connection con,
                                    int id)
                             throws StorageException
This method can be used to check if some group exists in a context. The connection is given to be able to check for groups that are not committed yet.

Parameters:
ctx - Context.
con - readable database connection.
id - unique identifier of the group.
Returns:
true if the group exists, false otherwise.
Throws:
StorageException - if some problem occurs executing the SQL statements.

existsGroup

public abstract boolean existsGroup(Context ctx,
                                    int[] gid)
                             throws StorageException
Throws:
StorageException

existsGroupMember

public abstract boolean existsGroupMember(Context ctx,
                                          int group_ID,
                                          int member_ID)
                                   throws StorageException
Throws:
StorageException

existsGroupMember

public abstract boolean existsGroupMember(Context ctx,
                                          int group_ID,
                                          int[] user_ids)
                                   throws StorageException
Throws:
StorageException

existsGroupMember

public abstract boolean existsGroupMember(Context ctx,
                                          int group_ID,
                                          User[] users)
                                   throws StorageException
Throws:
StorageException

existsReason

public abstract boolean existsReason(int rid)
                              throws StorageException
Throws:
StorageException

existsReason

public abstract boolean existsReason(String reason)
                              throws StorageException
Throws:
StorageException

existsResource

public abstract boolean existsResource(Context ctx,
                                       int resource_id)
                                throws StorageException
Throws:
StorageException

existsResourceAddress

public abstract boolean existsResourceAddress(Context ctx,
                                              String address)
                                       throws StorageException
Throws:
StorageException

existsResourceAddress

public abstract boolean existsResourceAddress(Context ctx,
                                              String address,
                                              Integer resource_id)
                                       throws StorageException
Throws:
StorageException

existsServer

public abstract boolean existsServer(int server_id)
                              throws StorageException
Throws:
StorageException

existsServerID

public abstract boolean existsServerID(int check_ID,
                                       String table,
                                       String field)
                                throws StorageException
Throws:
StorageException

existsStore

public abstract boolean existsStore(int store_id)
                             throws StorageException
Throws:
StorageException

existsStore

public abstract boolean existsStore(String url)
                             throws StorageException
Throws:
StorageException

existsUser

public abstract boolean existsUser(Context ctx,
                                   int uid)
                            throws StorageException
Throws:
StorageException

existsUser

public abstract boolean existsUser(Context ctx,
                                   int[] user_ids)
                            throws StorageException
Throws:
StorageException

existsUser

public abstract boolean existsUser(Context ctx,
                                   User[] users)
                            throws StorageException
This method will detect if a specified user exists. It check this through the user id and the user name specified in the user object

Parameters:
ctx -
users -
Returns:
Throws:
StorageException

existsUser

public abstract boolean existsUser(Context ctx,
                                   User user)
                            throws StorageException
A convenience method for a single user object. See existsUser(Context, User[])

Parameters:
ctx -
user -
Returns:
Throws:
StorageException

existsGroupName

public abstract boolean existsGroupName(Context ctx,
                                        Group grp)
                                 throws StorageException
Checks via group id and group name if it already exists in this context. Should be used in change method!

Parameters:
ctx -
grp -
Returns:
Throws:
StorageException

existsGroupName

public abstract boolean existsGroupName(Context ctx,
                                        String groupName)
                                 throws StorageException
Checks if given name is already used for a group in given context.Should be used in create method!

Parameters:
ctx -
groupName -
Returns:
Throws:
StorageException

existsUserName

public abstract boolean existsUserName(Context ctx,
                                       User usr)
                                throws StorageException
Checks via user id and user name if it already exists in this context. Should be used in change method!

Parameters:
ctx -
usr -
Returns:
Throws:
StorageException

existsUserName

public abstract boolean existsUserName(Context ctx,
                                       String userName)
                                throws StorageException
Checks if given name is already used for an user in given context.Should be used in create method!

Parameters:
ctx -
userName -
Returns:
Throws:
StorageException

existsServerName

public abstract boolean existsServerName(Server srv)
                                  throws StorageException
Checks via server id and server name if it already exists. Should be used in change method!

Parameters:
srv -
Returns:
Throws:
StorageException

existsServerName

public abstract boolean existsServerName(String serverName)
                                  throws StorageException
Checks if given name is already used!Should be used in create method!

Parameters:
serverName -
Returns:
Throws:
StorageException

existsDatabaseName

public abstract boolean existsDatabaseName(Database db)
                                    throws StorageException
Checks via database id and database name if it already exists. Should be used in change method!

Parameters:
db -
Returns:
Throws:
StorageException

existsDatabaseName

public abstract boolean existsDatabaseName(String databaseName)
                                    throws StorageException
Checks if given name is already used!Should be used in create method!

Parameters:
databaseName -
Returns:
Throws:
StorageException

existsResourceName

public abstract boolean existsResourceName(Context ctx,
                                           Resource res)
                                    throws StorageException
Checks via resource id and resource name if it already exists. Should be used in change method!

Parameters:
ctx -
res -
Returns:
Throws:
StorageException

existsResourceName

public abstract boolean existsResourceName(Context ctx,
                                           String resourceName)
                                    throws StorageException
Checks if given name is already used for resource in given context!Should be used in create method!

Parameters:
ctx -
resourceName -
Returns:
Throws:
StorageException

existsContextName

public abstract boolean existsContextName(Context ctx)
                                   throws StorageException
Checks via context id and context name if it already exists. Should be used in change method!

Parameters:
ctx -
Returns:
Throws:
StorageException

existsContextName

public abstract boolean existsContextName(String contextName)
                                   throws StorageException
Checks if given context name already exists!Should be used in create method!

Parameters:
contextName -
Returns:
Throws:
StorageException

getAdminForContext

public abstract int getAdminForContext(Context ctx,
                                       Connection con)
                                throws StorageException
Throws:
StorageException

getAdminForContext

public abstract int getAdminForContext(Context ctx)
                                throws StorageException
Throws:
StorageException

getContextIDByContextname

public abstract int getContextIDByContextname(String ctxname)
                                       throws StorageException
Throws:
StorageException

getDatabaseIDByDatabasename

public abstract int getDatabaseIDByDatabasename(String dbname)
                                         throws StorageException
Throws:
StorageException

getDefaultGroupForContext

public abstract int getDefaultGroupForContext(Context ctx,
                                              Connection con)
                                       throws StorageException
Throws:
StorageException

getDefaultGroupForContextWithOutConnection

public abstract int getDefaultGroupForContextWithOutConnection(Context ctx)
                                                        throws StorageException
Throws:
StorageException

getGidNumberOfGroup

public abstract int getGidNumberOfGroup(Context ctx,
                                        int group_id,
                                        Connection con)
                                 throws StorageException
Gets the system's GID for specified group.

Parameters:
ctx - The context
group_id - The group ID
con - A connection with at least read-only permission
Returns:
The system's GID for specified group or -1 if no GID is set.
Throws:
StorageException - If a storage error occurs or group does not exist

getGroupIDByGroupname

public abstract int getGroupIDByGroupname(Context ctx,
                                          String groupname)
                                   throws StorageException
Throws:
StorageException

getGroupnameByGroupID

public abstract String getGroupnameByGroupID(Context ctx,
                                             int group_id)
                                      throws StorageException
Throws:
StorageException

getResourceIDByResourcename

public abstract int getResourceIDByResourcename(Context ctx,
                                                String resourcename)
                                         throws StorageException
Throws:
StorageException

getResourcenameByResourceID

public abstract String getResourcenameByResourceID(Context ctx,
                                                   int resource_id)
                                            throws StorageException
Throws:
StorageException

getServerIDByServername

public abstract int getServerIDByServername(String servername)
                                     throws StorageException
Throws:
StorageException

getUserIDByUsername

public abstract int getUserIDByUsername(Context ctx,
                                        String username)
                                 throws StorageException
Throws:
StorageException

getUsernameByUserID

public abstract String getUsernameByUserID(Context ctx,
                                           int user_id)
                                    throws StorageException
Throws:
StorageException

isContextAdmin

public abstract boolean isContextAdmin(Context ctx,
                                       int user_id)
                                throws StorageException
Throws:
StorageException

isContextAdmin

public abstract boolean isContextAdmin(Context ctx,
                                       User user)
                                throws StorageException
This method determines if the user is the context admin. Therefore either the user_id or the username have to be filled. Furthermore this methods sets the uid in the given user object to the correct value if the object contains the name only.

Parameters:
ctx -
user -
Returns:
Throws:
StorageException

isContextEnabled

public abstract boolean isContextEnabled(Context ctx)
                                  throws StorageException
Throws:
StorageException

existsDisplayName

public abstract boolean existsDisplayName(Context ctx,
                                          User usr)
                                   throws StorageException
This method checks if the display name of the given user object is already used in for a system user. This method doesn't check for display names in the contacts of the users

Parameters:
ctx -
usr -
Returns:
Throws:
StorageException

isMasterDatabase

public abstract boolean isMasterDatabase(int database_id)
                                  throws StorageException
Throws:
StorageException

isUserSettingMailBitSet

public abstract boolean isUserSettingMailBitSet(Context ctx,
                                                User user,
                                                int bit,
                                                Connection con)
                                         throws StorageException
Throws:
StorageException

poolInUse

public abstract boolean poolInUse(int pool_id)
                           throws StorageException
Throws:
StorageException

primaryMailExists

public abstract void primaryMailExists(Context ctx,
                                       String mail)
                                throws StorageException,
                                       InvalidDataException
Throws:
StorageException
InvalidDataException

checkAndUpdateSchemaIfRequired

public final boolean checkAndUpdateSchemaIfRequired(Context ctx)
                                             throws StorageException
Throws:
StorageException

checkAndUpdateSchemaIfRequired

public abstract boolean checkAndUpdateSchemaIfRequired(int contextId)
                                                throws StorageException
Throws:
StorageException

schemaBeingLockedOrNeedsUpdate

public abstract boolean schemaBeingLockedOrNeedsUpdate(int writePoolId,
                                                       String schema)
                                                throws StorageException
Throws:
StorageException

serverInUse

public abstract boolean serverInUse(int server_id)
                             throws StorageException
Throws:
StorageException

setUserSettingMailBit

public abstract void setUserSettingMailBit(Context ctx,
                                           User user,
                                           int bit,
                                           Connection con)
                                    throws StorageException
Throws:
StorageException

storeInUse

public abstract boolean storeInUse(int store_id)
                            throws StorageException
Throws:
StorageException

unsetUserSettingMailBit

public abstract void unsetUserSettingMailBit(Context ctx,
                                             User user,
                                             int bit,
                                             Connection con)
                                      throws StorageException
Throws:
StorageException

checkCreateUserData

public abstract void checkCreateUserData(Context ctx,
                                         User usr)
                                  throws InvalidDataException,
                                         EnforceableDataObjectException,
                                         StorageException
Throws:
InvalidDataException
EnforceableDataObjectException
StorageException

validateUserName

public abstract void validateUserName(String name)
                               throws InvalidDataException
Throws:
InvalidDataException

checkValidEmailsInUserObject

public abstract void checkValidEmailsInUserObject(User user)
                                           throws InvalidDataException
Throws:
InvalidDataException