com.openexchange.admin.tools
Class AdminCache

java.lang.Object
  extended by com.openexchange.admin.tools.AdminCache

public class AdminCache
extends Object


Field Summary
static String DATA_TRUNCATION_ERROR_MSG
           
static String PATTERN_REGEX_DELIMITER
           
static String PATTERN_REGEX_FUNCTION
           
static String PATTERN_REGEX_NORMAL
           
 
Constructor Summary
AdminCache()
           
 
Method Summary
 void closeConfigDBSqlStuff(Connection con, PreparedStatement stmt)
           
 void closeConfigDBSqlStuff(Connection con, PreparedStatement stmt, ResultSet rs)
           
 void closeContextSqlStuff(Connection con, int context_id)
           
 void closeSimpleConnection(Connection con)
           
 boolean contextAuthenticationDisabled()
           
 String encryptPassword(PasswordMechObject user)
          Encrypts password of a PasswordMechObject using the mechanism given in passwordMech.
 boolean existsNamedAccessCombination(String name)
           
 HashMap<String,UserModuleAccess> getAccessCombinationNames()
           
 String getAdminAuthMech(Context ctx)
           
 Credentials getAdminCredentials(Context ctx)
           
 Connection getConnectionForConfigDB()
           
 Connection getConnectionForContext(int context_id)
           
 Connection getConnectionForContextNoTimeout(int contextId)
           
 UserModuleAccess getDefaultUserModuleAccess()
          return default UserModuleAccess if not specified upon creation
 Credentials getMasterCredentials()
           
 UserModuleAccess getNamedAccessCombination(String name)
           
 String getNameForAccessCombination(UserModuleAccess access_combination)
           
 ArrayList<String> getOXDBInitialQueries()
           
 PropertyHandler getProperties()
           
 Connection getSimpleSqlConnection(String url, String user, String password, String driver)
           
 void initAccessCombinations()
           
 void initCache()
           
 boolean isLockdb()
           
 boolean isMasterAdmin(Credentials auth)
           
 boolean masterAuthenticationDisabled()
           
static StorageException parseDataTruncation(DataTruncation dt)
          Parses the truncated fields out of the DataTruncation exception and transforms this to a StorageException.
 boolean pushConnectionForConfigDB(Connection con)
           
 boolean pushConnectionForContext(int context_id, Connection con)
           
 boolean pushConnectionForContextNoTimeout(int contextId, Connection con)
           
 void removeAdminCredentials(Context ctx)
           
 void setAdminCredentials(Context ctx, String authMech, Credentials adminCredentials)
           
 void setLockdb(boolean lockdb)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_TRUNCATION_ERROR_MSG

public static final String DATA_TRUNCATION_ERROR_MSG
See Also:
Constant Field Values

PATTERN_REGEX_NORMAL

public static final String PATTERN_REGEX_NORMAL
See Also:
Constant Field Values

PATTERN_REGEX_DELIMITER

public static final String PATTERN_REGEX_DELIMITER
See Also:
Constant Field Values

PATTERN_REGEX_FUNCTION

public static final String PATTERN_REGEX_FUNCTION
See Also:
Constant Field Values
Constructor Detail

AdminCache

public AdminCache()
Method Detail

initCache

public void initCache()
               throws OXGenericException
Throws:
OXGenericException

getDefaultUserModuleAccess

public UserModuleAccess getDefaultUserModuleAccess()
return default UserModuleAccess if not specified upon creation

Returns:

getAccessCombinationNames

public HashMap<String,UserModuleAccess> getAccessCombinationNames()

getNamedAccessCombination

public UserModuleAccess getNamedAccessCombination(String name)

existsNamedAccessCombination

public boolean existsNamedAccessCombination(String name)

getNameForAccessCombination

public String getNameForAccessCombination(UserModuleAccess access_combination)

initAccessCombinations

public void initAccessCombinations()
                            throws ClassNotFoundException,
                                   OXGenericException
Throws:
ClassNotFoundException
OXGenericException

getMasterCredentials

public Credentials getMasterCredentials()

getProperties

public PropertyHandler getProperties()

getConnectionForContext

public Connection getConnectionForContext(int context_id)
                                   throws PoolException
Throws:
PoolException

getConnectionForContextNoTimeout

public Connection getConnectionForContextNoTimeout(int contextId)
                                            throws PoolException
Throws:
PoolException

pushConnectionForContext

public boolean pushConnectionForContext(int context_id,
                                        Connection con)
                                 throws PoolException
Throws:
PoolException

pushConnectionForContextNoTimeout

public boolean pushConnectionForContextNoTimeout(int contextId,
                                                 Connection con)
                                          throws PoolException
Throws:
PoolException

getConnectionForConfigDB

public Connection getConnectionForConfigDB()
                                    throws PoolException
Throws:
PoolException

pushConnectionForConfigDB

public boolean pushConnectionForConfigDB(Connection con)
                                  throws PoolException
Throws:
PoolException

getAdminCredentials

public final Credentials getAdminCredentials(Context ctx)
Returns:
the adminCredentials

getAdminAuthMech

public final String getAdminAuthMech(Context ctx)
Returns:
authMech

setAdminCredentials

public final void setAdminCredentials(Context ctx,
                                      String authMech,
                                      Credentials adminCredentials)
Parameters:
adminCredentials - the adminCredentials to set

removeAdminCredentials

public final void removeAdminCredentials(Context ctx)
Parameters:
ctx -

isLockdb

public final boolean isLockdb()

masterAuthenticationDisabled

public boolean masterAuthenticationDisabled()

contextAuthenticationDisabled

public boolean contextAuthenticationDisabled()

setLockdb

public final void setLockdb(boolean lockdb)

getOXDBInitialQueries

public ArrayList<String> getOXDBInitialQueries()
                                        throws OXGenericException
Throws:
OXGenericException

getSimpleSqlConnection

public Connection getSimpleSqlConnection(String url,
                                         String user,
                                         String password,
                                         String driver)
                                  throws SQLException,
                                         ClassNotFoundException
Throws:
SQLException
ClassNotFoundException

closeSimpleConnection

public void closeSimpleConnection(Connection con)

parseDataTruncation

public static final StorageException parseDataTruncation(DataTruncation dt)
Parses the truncated fields out of the DataTruncation exception and transforms this to a StorageException.


encryptPassword

public String encryptPassword(PasswordMechObject user)
                       throws StorageException,
                              NoSuchAlgorithmException,
                              UnsupportedEncodingException
Encrypts password of a PasswordMechObject using the mechanism given in passwordMech. If passwordMech is null, the default mechanism as configured in User.properties is used and set in the PasswordMechObject instance.

Parameters:
user -
Returns:
the encrypted password
Throws:
StorageException
NoSuchAlgorithmException
UnsupportedEncodingException

closeConfigDBSqlStuff

public void closeConfigDBSqlStuff(Connection con,
                                  PreparedStatement stmt,
                                  ResultSet rs)

closeConfigDBSqlStuff

public void closeConfigDBSqlStuff(Connection con,
                                  PreparedStatement stmt)

closeContextSqlStuff

public void closeContextSqlStuff(Connection con,
                                 int context_id)

isMasterAdmin

public boolean isMasterAdmin(Credentials auth)