Class DatastoreService


  • public final class DatastoreService
    extends java.lang.Object
    Datastore Service
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String VALUE_FALSE  
      static java.lang.String VALUE_TRUE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean existsInstanceKey​(java.lang.String strKey)
      Check if a key is available in the datastore depending the current web app instance
      static boolean existsKey​(java.lang.String strKey)
      Check if a key is available in the datastore
      static ReferenceList getDataByPrefix​(java.lang.String strPrefix)
      Gets a list of key/value where keys are matching a given prefix
      static java.lang.String getDataValue​(java.lang.String strKey, java.lang.String strDefault)
      Get entity
      static ReferenceList getInstanceDataByPrefix​(java.lang.String strPrefix)
      Gets a list of key/value where keys are matching a given prefix depending the current web app instance
      static java.lang.String getInstanceDataValue​(java.lang.String strKey, java.lang.String strDefault)
      Get entity depending the current web app instance
      static void init()
      initialize the service
      static void removeData​(java.lang.String strKey)
      Remove a give key
      static void removeDataByPrefix​(java.lang.String strPrefix)
      Remove all data where keys begin with a given prefix
      static void removeInstanceData​(java.lang.String strKey)
      Remove a give key depending the current web app instance
      static void removeInstanceDataByPrefix​(java.lang.String strPrefix)
      Remove all data where keys begin with a given prefix depending the current web app instance
      static java.lang.String replaceKeys​(java.lang.String strSource)
      This method replace keys by their value into a given content
      static void setDataValue​(java.lang.String strKey, java.lang.String strValue)
      Set entity
      static void setInstanceDataValue​(java.lang.String strKey, java.lang.String strValue)
      Set entity depending the current web app instance
      static void startCache()
      Start cache.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

        public static void init()
        initialize the service
      • getDataValue

        public static java.lang.String getDataValue​(java.lang.String strKey,
                                                    java.lang.String strDefault)
        Get entity
        Parameters:
        strKey - The entity's key
        strDefault - The default value
        Returns:
        The value
      • getInstanceDataValue

        public static java.lang.String getInstanceDataValue​(java.lang.String strKey,
                                                            java.lang.String strDefault)
        Get entity depending the current web app instance
        Parameters:
        strKey - The entity's key
        strDefault - The default value
        Returns:
        The value
      • setDataValue

        public static void setDataValue​(java.lang.String strKey,
                                        java.lang.String strValue)
        Set entity
        Parameters:
        strKey - The entity's key
        strValue - The value
      • setInstanceDataValue

        public static void setInstanceDataValue​(java.lang.String strKey,
                                                java.lang.String strValue)
        Set entity depending the current web app instance
        Parameters:
        strKey - The entity's key
        strValue - The value
      • removeData

        public static void removeData​(java.lang.String strKey)
        Remove a give key
        Parameters:
        strKey - The key
      • removeInstanceData

        public static void removeInstanceData​(java.lang.String strKey)
        Remove a give key depending the current web app instance
        Parameters:
        strKey - The key
      • removeDataByPrefix

        public static void removeDataByPrefix​(java.lang.String strPrefix)
        Remove all data where keys begin with a given prefix
        Parameters:
        strPrefix - The prefix
      • removeInstanceDataByPrefix

        public static void removeInstanceDataByPrefix​(java.lang.String strPrefix)
        Remove all data where keys begin with a given prefix depending the current web app instance
        Parameters:
        strPrefix - The prefix
      • getDataByPrefix

        public static ReferenceList getDataByPrefix​(java.lang.String strPrefix)
        Gets a list of key/value where keys are matching a given prefix
        Parameters:
        strPrefix - The prefix
        Returns:
        The list
      • getInstanceDataByPrefix

        public static ReferenceList getInstanceDataByPrefix​(java.lang.String strPrefix)
        Gets a list of key/value where keys are matching a given prefix depending the current web app instance
        Parameters:
        strPrefix - The prefix
        Returns:
        The list
      • replaceKeys

        public static java.lang.String replaceKeys​(java.lang.String strSource)
        This method replace keys by their value into a given content
        Parameters:
        strSource - The string that contains datastore keys
        Returns:
        The string with keys replaced
      • existsKey

        public static boolean existsKey​(java.lang.String strKey)
        Check if a key is available in the datastore
        Parameters:
        strKey - The key
        Returns:
        True if the key is found otherwise false
      • existsInstanceKey

        public static boolean existsInstanceKey​(java.lang.String strKey)
        Check if a key is available in the datastore depending the current web app instance
        Parameters:
        strKey - The key
        Returns:
        True if the key is found otherwise false
      • startCache

        public static void startCache()
        Start cache. NB : Cache can't be created at DataStore creation because CacheService uses DatastoreService (Circular reference)