org.ops4j.store
Interface Store<T>

All Known Implementing Classes:
TemporaryStore

public interface Store<T>

Entity Store Style Interface to store and retrieve data of type T.


Method Summary
 URI getLocation(Handle handle)
          Fixed location for a resource that has been stored before.
 T load(Handle handle)
          Load a T after (successfully) stored it before.
 Handle store(T inp)
          Read incoming object of type T (for example an InputSteam)
 

Method Detail

store

Handle store(T inp)
             throws IOException
Read incoming object of type T (for example an InputSteam)

Parameters:
inp - object to be stored. Implementations are usually bound to a certain T
Returns:
handle that can be shared. Validity of this handle may be different from implementation to implementation.
Throws:
IOException - in case incoming object cannot be read (if it involves IO)

load

T load(Handle handle)
       throws IOException
Load a T after (successfully) stored it before.

Parameters:
handle - identifier that has been returned from a previous srore call.
Returns:
instance of type T that has been stored before.
Throws:
IOException - if loading resource involves IO, things can always go wrong.

getLocation

URI getLocation(Handle handle)
                throws IOException
Fixed location for a resource that has been stored before. Beware, not all BinaryStore implementations may have such thing. Tinybundles.Store is made for programs, not as an end-user library. If possible, use the BinaryHandle you get from store(..) operations. This also gives implementations of this interface greatest freedom and keeps you apps backend independent.

Parameters:
handle - must refer to a previously stored object.
Returns:
location that is equivalent to the given handle. If possible.
Throws:
IOException - if IO is involved, things may go mad.
UnsupportedOperationException - implementation may not support this.


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.