net.derquinse.bocas
Interface Bocas

All Known Subinterfaces:
CachingBocas
All Known Implementing Classes:
ForwardingBocas, SkeletalBocasBackend

@Beta
public interface Bocas

Interface for a BOCAS repository. Guava library is expected to provide a ByteString object. The use of the one from derquinse-commons is temporary.

Author:
Andres Rodriguez.

Method Summary
 Set<net.derquinse.common.base.ByteString> contained(Iterable<net.derquinse.common.base.ByteString> keys)
          Returns the subset of the provided keys that are contained in the repository.
 boolean contains(net.derquinse.common.base.ByteString key)
          Returns whether the repository contains the provided key.
 Optional<BocasValue> get(net.derquinse.common.base.ByteString key)
          Returns the object for the provided key.
 Map<net.derquinse.common.base.ByteString,BocasValue> get(Iterable<net.derquinse.common.base.ByteString> keys)
          Returns the objects for a collection of keys.
 net.derquinse.common.base.ByteString put(InputStream object)
          Puts an object into the repository.
 net.derquinse.common.base.ByteString put(InputSupplier<? extends InputStream> object)
          Puts an object into the repository.
 List<net.derquinse.common.base.ByteString> putStreams(List<? extends InputStream> objects)
          Puts some objects into the repository in a single operation.
 List<net.derquinse.common.base.ByteString> putSuppliers(List<? extends InputSupplier<? extends InputStream>> objects)
          Puts some objects into the repository in a single operation.
 Map<String,net.derquinse.common.base.ByteString> putZip(InputStream object)
          Puts a zip object into the repository.
 Map<String,net.derquinse.common.base.ByteString> putZip(InputSupplier<? extends InputStream> object)
          Puts a zip object into the repository.
 Map<String,net.derquinse.common.util.zip.MaybeCompressed<net.derquinse.common.base.ByteString>> putZipAndGZip(InputStream object)
          Puts a zip object into the repository trying to compress them individually with gzip.
 Map<String,net.derquinse.common.util.zip.MaybeCompressed<net.derquinse.common.base.ByteString>> putZipAndGZip(InputSupplier<? extends InputStream> object)
          Puts a zip object into the repository trying to compress them individually with gzip.
 

Method Detail

contains

boolean contains(net.derquinse.common.base.ByteString key)
Returns whether the repository contains the provided key.

Throws:
BocasException - if an error occurs.

contained

Set<net.derquinse.common.base.ByteString> contained(Iterable<net.derquinse.common.base.ByteString> keys)
Returns the subset of the provided keys that are contained in the repository.

Throws:
BocasException - if an error occurs.

get

Optional<BocasValue> get(net.derquinse.common.base.ByteString key)
Returns the object for the provided key.

Parameters:
key - The requested key.
Returns:
The object, if found.
Throws:
BocasException - if an error occurs.

get

Map<net.derquinse.common.base.ByteString,BocasValue> get(Iterable<net.derquinse.common.base.ByteString> keys)
Returns the objects for a collection of keys.

Parameters:
keys - The requested keys.
Returns:
The objects found in the repository or an empty map if none is found.
Throws:
BocasException - if an error occurs.

put

net.derquinse.common.base.ByteString put(InputSupplier<? extends InputStream> object)
Puts an object into the repository.

Returns:
The generated key.
Throws:
BocasException - if an error occurs.

put

net.derquinse.common.base.ByteString put(InputStream object)
Puts an object into the repository.

Returns:
The generated key.
Throws:
BocasException - if an error occurs.

putSuppliers

List<net.derquinse.common.base.ByteString> putSuppliers(List<? extends InputSupplier<? extends InputStream>> objects)
Puts some objects into the repository in a single operation. The operation must be atomic.

Returns:
The list of generated keys, in the same order than the objects provided.
Throws:
BocasException - if an error occurs.

putStreams

List<net.derquinse.common.base.ByteString> putStreams(List<? extends InputStream> objects)
Puts some objects into the repository in a single operation. The operation must be atomic.

Returns:
The list of generated keys, in the same order than the objects provided.
Throws:
BocasException - if an error occurs.

putZip

Map<String,net.derquinse.common.base.ByteString> putZip(InputStream object)
Puts a zip object into the repository.

Returns:
A map from the zip entry names to their keys.
Throws:
BocasException - if an error occurs.

putZip

Map<String,net.derquinse.common.base.ByteString> putZip(InputSupplier<? extends InputStream> object)
Puts a zip object into the repository.

Returns:
A map from the zip entry names to their keys.
Throws:
BocasException - if an error occurs.

putZipAndGZip

Map<String,net.derquinse.common.util.zip.MaybeCompressed<net.derquinse.common.base.ByteString>> putZipAndGZip(InputStream object)
Puts a zip object into the repository trying to compress them individually with gzip.

Returns:
A map from the zip entry names to their keys, indicating if the entry has been compressed.
Throws:
BocasException - if an error occurs.

putZipAndGZip

Map<String,net.derquinse.common.util.zip.MaybeCompressed<net.derquinse.common.base.ByteString>> putZipAndGZip(InputSupplier<? extends InputStream> object)
Puts a zip object into the repository trying to compress them individually with gzip.

Returns:
A map from the zip entry names to their keys, indicating if the entry has been compressed.
Throws:
BocasException - if an error occurs.


Copyright © 2012 Derquinse Projects.. All Rights Reserved.