Class AbstractDataStoreFactory

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​DataStore<? extends java.io.Serializable>> dataStoreMap
      Map of data store ID to data store.
      private static java.util.regex.Pattern ID_PATTERN
      Pattern to control possible values for the id parameter of getDataStore(String).
      private java.util.concurrent.locks.Lock lock
      Lock on access to the data store map.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract <V extends java.io.Serializable>
      DataStore<V>
      createDataStore​(java.lang.String id)
      Returns a new instance of a type-specific data store based on the given unique ID.
      <V extends java.io.Serializable>
      DataStore<V>
      getDataStore​(java.lang.String id)
      Returns a type-specific data store based on the given unique ID.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lock

        private final java.util.concurrent.locks.Lock lock
        Lock on access to the data store map.
      • dataStoreMap

        private final java.util.Map<java.lang.String,​DataStore<? extends java.io.Serializable>> dataStoreMap
        Map of data store ID to data store.
      • ID_PATTERN

        private static final java.util.regex.Pattern ID_PATTERN
        Pattern to control possible values for the id parameter of getDataStore(String).
    • Constructor Detail

      • AbstractDataStoreFactory

        public AbstractDataStoreFactory()
    • Method Detail

      • getDataStore

        public final <V extends java.io.Serializable> DataStore<V> getDataStore​(java.lang.String id)
                                                                         throws java.io.IOException
        Description copied from interface: DataStoreFactory
        Returns a type-specific data store based on the given unique ID.

        If a data store by that ID does not already exist, it should be created now, stored for later access, and returned. Otherwise, if there is already a data store by that ID, it should be returned. The DataStore.getId() must match the id parameter from this method.

        The ID must be at least 1 and at most 30 characters long, and must contain only alphanumeric or underscore characters.

        Specified by:
        getDataStore in interface DataStoreFactory
        Type Parameters:
        V - serializable type of the mapped value
        Parameters:
        id - unique ID to refer to typed data store
        Throws:
        java.io.IOException
      • createDataStore

        protected abstract <V extends java.io.Serializable> DataStore<V> createDataStore​(java.lang.String id)
                                                                                  throws java.io.IOException
        Returns a new instance of a type-specific data store based on the given unique ID.

        The DataStore.getId() must match the id parameter from this method.

        Type Parameters:
        V - serializable type of the mapped value
        Parameters:
        id - unique ID to refer to typed data store
        Throws:
        java.io.IOException