Class CacheRegistrationUtil

java.lang.Object
chemaxon.jchem.db.cache.CacheRegistrationBase
chemaxon.jchem.db.CacheRegistrationUtil

@PublicAPI public class CacheRegistrationUtil extends chemaxon.jchem.db.cache.CacheRegistrationBase
Utility class for cache registration.
Since:
JChem 5.3.2
  • Field Details

    • PROP_CACHE_REGISTRATION_SENSITIVITY

      public static final String PROP_CACHE_REGISTRATION_SENSITIVITY
      Property name that shows cache registration error sensitivity.
      See Also:
    • CACHE_REGISTRATION_SENSITIVITY_EXCEPTION

      public static final String CACHE_REGISTRATION_SENSITIVITY_EXCEPTION
      Error sensitivity - exception.
      See Also:
    • CACHE_REGISTRATION_SENSITIVITY_LOG

      public static final String CACHE_REGISTRATION_SENSITIVITY_LOG
      Error sensitivity - log
      See Also:
    • CACHE_REGISTRATION_SENSITIVITY_NONE

      public static final String CACHE_REGISTRATION_SENSITIVITY_NONE
      Error sensitivity - none.
      See Also:
  • Constructor Details

  • Method Details

    • registerCache

      public void registerCache() throws SQLException
      Registers the cache. The registration will be permanent if setPermanentCacheID(String) was called before, otherwise temporary.
      Throws:
      SQLException - if encounter an sql exception
    • registerPermanentCache

      public void registerPermanentCache(String cacheID) throws SQLException
      Registers a permanent cache identifier.
      Parameters:
      cacheID - cache identifier to be registered
      Throws:
      SQLException - if encounter an sql exception
    • unRegisterCache

      public void unRegisterCache() throws SQLException
      Unregisters the cache.
      Throws:
      SQLException - if encounter an sql exception
    • unRegisterCache

      public void unRegisterCache(String cacheID) throws SQLException
      Unregisters the given cache identifier.
      Parameters:
      cacheID - cache identifier to unregister
      Throws:
      SQLException - if encounter an sql exception
    • timestampExists

      protected boolean timestampExists(Connection c) throws SQLException
      Throws:
      SQLException
    • getRegisteredCacheIDs

      public List<String> getRegisteredCacheIDs() throws SQLException
      For internal use only!
      Returns:
      ArrayList of registered cache ids
      Throws:
      SQLException - if encounter an sql exception
    • isCacheIDRegistered

      public boolean isCacheIDRegistered(String cacheID) throws 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:
      SQLException - if encounter an sql exception
    • getTimestamp

      protected String getTimestamp(Connection c) throws SQLException
      Throws:
      SQLException
    • addTimestamp

      protected void addTimestamp(String timestamp, Connection c) throws SQLException
      Throws:
      SQLException
    • updateTimestamp

      protected void updateTimestamp(String timestamp, Connection c) throws SQLException
      Throws:
      SQLException
    • generateRandomID

      public static String generateRandomID()
      Generates a random UUID without hyphens (32 characters long)
      Returns:
      random UUID
    • setPermanentCacheID

      public static void setPermanentCacheID(String cacheIdentifier) throws 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:
      IllegalArgumentException - if the cacheIdentifier is not valid
    • getCacheID

      public static String getCacheID()
    • isPermanent

      public static boolean isPermanent()
    • resetCacheID

      public static void resetCacheID()
    • setRowIdNeeded

      public static void setRowIdNeeded(boolean needed)
      For internal use only.
      Parameters:
      needed - true if needed
    • isRowIdNeeded

      public static boolean isRowIdNeeded()
      For internal use only.
      Returns:
      true if needed