chemaxon.jchem.db
Class CacheRegistrationUtil

java.lang.Object
  extended by chemaxon.jchem.db.CacheRegistrationBase
      extended by chemaxon.jchem.db.CacheRegistrationUtil

public class CacheRegistrationUtil
extends chemaxon.jchem.db.CacheRegistrationBase

Utility class for cache registration.

Since:
JChem 5.3.2
Author:
Tamas Csizmazia

Field Summary
static java.lang.String CACHE_REGISTRATION_SENSITIVITY_EXCEPTION
          Error sensitivity - exception.
static java.lang.String CACHE_REGISTRATION_SENSITIVITY_LOG
          Error sensitivity - log
static java.lang.String CACHE_REGISTRATION_SENSITIVITY_NONE
          Error sensitivity - none.
protected static java.lang.String cacheID
           
protected static boolean permanent
           
static java.lang.String PROP_CACHE_REGISTRATION_SENSITIVITY
          Property name that shows cache registration error sensitivity.
 
Fields inherited from class chemaxon.jchem.db.CacheRegistrationBase
CACHE_ID_FIELD_NAME, CACHE_ID_LENGTH, CACHE_PROTECTED_FIELD_NAME, CACHE_TIME_FIELD_NAME, CACHE_UPDATE_ID_FIELD_NAME, CACHE_UPDATE_INFO_FIELD_NAME, cacheTable, con, PROP_CACHE_REGISTRATION_TABLE_NAME, PROP_CACHE_VALIDITY_TIMESTAMP, propertyTable
 
Constructor Summary
CacheRegistrationUtil(ConnectionHandler conh)
           
 
Method Summary
protected  void addTimestamp(java.lang.String timestamp, java.sql.Connection c)
           
static java.lang.String getCacheID()
           
protected  java.lang.String getCacheRegisterer(java.lang.String registerTablename, java.lang.String cacheID, java.lang.String timestamp, boolean isProtected)
           
 java.util.ArrayList getRegisteredCacheIDs()
          For internal use only!
protected  java.lang.String getTimestamp(java.sql.Connection c)
           
 boolean isCacheIDRegistered(java.lang.String cacheID)
          Checks whether a cache identifier is currently registered or not.
static boolean isPermanent()
           
 void registerCache()
          Registers the cache.
 void registerPermanentCache(java.lang.String cacheID)
          Registers a permanent cache identifier.
static void resetCacheID()
           
static void setPermanentCacheID(java.lang.String cacheIdentifier)
          Sets the ID used for identifying the permanent cache.
protected  boolean timestampExists(java.sql.Connection c)
           
 void unRegisterCache()
          Unregisters the cache.
 void unRegisterCache(java.lang.String cacheID)
          Unregisters the given cache identifier.
protected  void updateTimestamp(java.lang.String timestamp, java.sql.Connection c)
           
 
Methods inherited from class chemaxon.jchem.db.CacheRegistrationBase
getCacheRegistrationInfos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_CACHE_REGISTRATION_SENSITIVITY

public static final java.lang.String PROP_CACHE_REGISTRATION_SENSITIVITY
Property name that shows cache registration error sensitivity.

See Also:
Constant Field Values

CACHE_REGISTRATION_SENSITIVITY_EXCEPTION

public static final java.lang.String CACHE_REGISTRATION_SENSITIVITY_EXCEPTION
Error sensitivity - exception.

See Also:
Constant Field Values

CACHE_REGISTRATION_SENSITIVITY_LOG

public static final java.lang.String CACHE_REGISTRATION_SENSITIVITY_LOG
Error sensitivity - log

See Also:
Constant Field Values

CACHE_REGISTRATION_SENSITIVITY_NONE

public static final java.lang.String CACHE_REGISTRATION_SENSITIVITY_NONE
Error sensitivity - none.

See Also:
Constant Field Values

cacheID

protected static java.lang.String cacheID

permanent

protected static boolean permanent
Constructor Detail

CacheRegistrationUtil

public CacheRegistrationUtil(ConnectionHandler conh)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

registerCache

public void registerCache()
                   throws java.sql.SQLException
Registers the cache. The registration will be permanent if setPermanentCacheID(String) was called before, otherwise temporary.

Throws:
java.sql.SQLException

registerPermanentCache

public void registerPermanentCache(java.lang.String cacheID)
                            throws java.sql.SQLException
Registers a permanent cache identifier.

Parameters:
cacheID - cache identifier to be registered
Throws:
java.sql.SQLException

unRegisterCache

public void unRegisterCache()
                     throws java.sql.SQLException
Unregisters the cache.

Throws:
java.sql.SQLException

unRegisterCache

public void unRegisterCache(java.lang.String cacheID)
                     throws java.sql.SQLException
Unregisters the given cache identifier.

Parameters:
cacheID - cache identifier to unregister
Throws:
java.sql.SQLException

timestampExists

protected boolean timestampExists(java.sql.Connection c)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

getRegisteredCacheIDs

public java.util.ArrayList getRegisteredCacheIDs()
                                          throws java.sql.SQLException
For internal use only!

Returns:
ArrayList of registered cache ids
Throws:
java.sql.SQLException

isCacheIDRegistered

public boolean isCacheIDRegistered(java.lang.String cacheID)
                            throws java.sql.SQLException
Checks whether a cache identifier is currently registered or not.

Parameters:
cacheID - ID to check.
Returns:
true if the cache identifier is registered.
Throws:
java.sql.SQLException

getTimestamp

protected java.lang.String getTimestamp(java.sql.Connection c)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

addTimestamp

protected void addTimestamp(java.lang.String timestamp,
                            java.sql.Connection c)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateTimestamp

protected void updateTimestamp(java.lang.String timestamp,
                               java.sql.Connection c)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getCacheRegisterer

protected java.lang.String getCacheRegisterer(java.lang.String registerTablename,
                                              java.lang.String cacheID,
                                              java.lang.String timestamp,
                                              boolean isProtected)

setPermanentCacheID

public static void setPermanentCacheID(java.lang.String cacheIdentifier)
                                throws java.lang.IllegalArgumentException
Sets the ID used for identifying the permanent cache.

Parameters:
cacheIdentifier - the cache ID to set. Should not be null, and it's length must be between 1 and 32, inclusive.
Throws:
java.lang.IllegalArgumentException

getCacheID

public static java.lang.String getCacheID()

isPermanent

public static boolean isPermanent()

resetCacheID

public static void resetCacheID()