Class IndexedStreamStore<V extends Identifiable>

  • All Implemented Interfaces:
    Store<V>, Map<Identifier,​V>
    Direct Known Subclasses:
    FileStore

    public abstract class IndexedStreamStore<V extends Identifiable>
    extends Object
    implements Store<V>
    A high-level class for storing things to streams. Implementations must produce the streams. These streams must be storable and retrievable by a key or identifier (being a store, this is required) and allow for retrieving streams based on other keys as well, which are simple hash strings of the identifier. A simple example would be a file system where each file has a name (a hash of the identifier) and then several other strings are used to create unique index entries. The index entries are named by hashes of the new key and their content is a simple string with the identifier in it.

    Note that this will try to convert the objects to XML using a supplied converter. Failing this, it will default to java object serialization.

    Created by Jeff Gaynor
    on 4/25/12 at 10:54 AM

    • Constructor Detail

      • IndexedStreamStore

        public IndexedStreamStore()
    • Method Detail

      • getCreatedItems

        public HashMap<Identifier,​V> getCreatedItems()
        A hash map of items created by this store. You should keep track of every item created and if an item already exists return that.
        Returns:
        returns created items.
      • put

        protected void put​(V t)
      • hashString

        protected String hashString​(String identifier)
      • create

        public V create()
        Description copied from interface: Store
        Create a new object of the given type. This is not in the store until it is registered. Attempts to update the object should throw an exception. Note that this allows for a separation of creation semantics. Some objects require specific initialization before saving
        Specified by:
        create in interface Store<V extends Identifiable>
        Returns: