WARNING: This class will be REMOVED in the next version.
Please see also IRiakClient, IRiakObject for the new API
@Deprecated public class RiakObject extends Object
RiakObject
,
IRiakClient
,
IRiakObject
Modifier and Type | Class and Description |
---|---|
class |
RiakObject.LinkBuilder
Deprecated.
Created by links() as a convenient way to build up link walking queries
|
Constructor and Description |
---|
RiakObject(RiakClient riak,
String bucket,
String key)
Deprecated.
|
RiakObject(RiakClient riak,
String bucket,
String key,
byte[] value)
Deprecated.
|
RiakObject(RiakClient riak,
String bucket,
String key,
byte[] value,
String contentType)
Deprecated.
|
RiakObject(RiakClient riak,
String bucket,
String key,
byte[] value,
String contentType,
List<RiakLink> links)
Deprecated.
|
RiakObject(RiakClient riak,
String bucket,
String key,
byte[] value,
String contentType,
List<RiakLink> links,
Map<String,String> userMetaData)
Deprecated.
|
RiakObject(RiakClient riak,
String bucket,
String key,
byte[] value,
String contentType,
List<RiakLink> links,
Map<String,String> userMetaData,
String vclock,
String lastmod,
String vtag)
Deprecated.
Create an empty object.
|
RiakObject(String bucket,
String key)
Deprecated.
|
RiakObject(String bucket,
String key,
byte[] value)
Deprecated.
|
RiakObject(String bucket,
String key,
byte[] value,
String contentType)
Deprecated.
|
RiakObject(String bucket,
String key,
byte[] value,
String contentType,
List<RiakLink> links)
Deprecated.
|
RiakObject(String bucket,
String key,
byte[] value,
String contentType,
List<RiakLink> links,
Map<String,String> userMetaData)
Deprecated.
|
RiakObject(String bucket,
String key,
byte[] value,
String contentType,
List<RiakLink> links,
Map<String,String> userMetaData,
String vclock,
String lastmod,
String vtag)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
RiakObject |
addLink(RiakLink link)
Deprecated.
Add link to this RiakObject's links.
|
RiakObject |
addUsermetaItem(String key,
String value)
Deprecated.
Adds the key, value to the collection of user meta for this object.
|
void |
copyData(RiakObject object)
Deprecated.
Copy the metadata and value from
object . |
HttpResponse |
delete()
Deprecated.
|
HttpResponse |
delete(RequestMeta meta)
Deprecated.
Convenience method for calling
RiakClient.delete(String, String, RequestMeta) . |
FetchResponse |
fetch()
Deprecated.
|
FetchResponse |
fetch(RequestMeta meta)
Deprecated.
Convenience method for calling
RiakClient.fetch(String, String)
followed by copyData(RiakObject) |
FetchResponse |
fetchMeta()
Deprecated.
|
FetchResponse |
fetchMeta(RequestMeta meta)
Deprecated.
Convenience method for calling
RiakClient.fetchMeta(String, String, RequestMeta) followed by
updateMeta(FetchResponse) |
String |
getBucket()
Deprecated.
The object's bucket
|
String |
getContentType()
Deprecated.
The object's content type as a MIME type
|
String |
getKey()
Deprecated.
The object's key
|
String |
getLastmod()
Deprecated.
The modification date of the object determined by Riak
|
Date |
getLastmodAsDate()
Deprecated.
Convenience method to get the last modified header parsed into a Date
object.
|
List<RiakLink> |
getLinks()
Deprecated.
please use
RiakObject#iterableLinks()) to iterate over the
collection of RiakLink s. Attempting to mutate the
collection will result in UnsupportedOperationException in
future versions. Use RiakObject#addLink() and RiakObject#removeLink() instead.
Use hasLinks() , numLinks() and hasLink(RiakLink)
to query state of links. |
RiakClient |
getRiakClient()
Deprecated.
A
RiakObject can be loosely attached to the RiakClient
from which retrieve it was retrieved. |
Map<String,String> |
getUsermeta()
Deprecated.
Future versions will return an unmodifiable view of the user meta. Please use
RiakObject#addUsermeta(String, String) ,
removeUsermetaItem(String) ,
setUsermeta(Map) ,
hasUsermetaItem(String) ,
hasUsermeta() and
getUsermetaItem(String) to mutate and query the User meta collection |
String |
getUsermetaItem(String key)
Deprecated.
Get an item of user meta data.
|
String |
getValue()
Deprecated.
The object's value
|
byte[] |
getValueAsBytes()
Deprecated.
|
InputStream |
getValueStream()
Deprecated.
|
Long |
getValueStreamLength()
Deprecated.
|
String |
getVclock()
Deprecated.
The object's opaque vclock assigned by Riak
|
String |
getVtag()
Deprecated.
An entity tag for the object assigned by Riak
|
boolean |
hasLink(RiakLink riakLink)
Deprecated.
Checks if the collection of RiakLinks contains the one passed in.
|
boolean |
hasLinks()
Deprecated.
Does this RiakObject have any
RiakLink s? |
boolean |
hasUsermeta()
Deprecated.
|
boolean |
hasUsermetaItem(String key)
Deprecated.
|
Iterable<RiakLink> |
iterableLinks()
Deprecated.
A thread safe, snapshot Iterable view of the state of this RiakObject's
RiakLink s at call time. |
int |
numLinks()
Deprecated.
How many
RiakLink s does this RiakObject have? |
int |
numUsermetaItems()
Deprecated.
|
RiakObject |
removeLink(RiakLink link)
Deprecated.
Remove a
RiakLink from this RiakObject. |
void |
removeUsermetaItem(String key)
Deprecated.
|
void |
setContentType(String contentType)
Deprecated.
|
void |
setLinks(List<RiakLink> links)
Deprecated.
Makes a *deep* copy of links.
|
RiakObject |
setRiakClient(RiakClient client)
Deprecated.
|
void |
setUsermeta(Map<String,String> userMetaData)
Deprecated.
Creates a copy of userMetaData.
|
void |
setValue(byte[] value)
Deprecated.
|
void |
setValue(String value)
Deprecated.
|
void |
setValueStream(InputStream in)
Deprecated.
|
void |
setValueStream(InputStream in,
Long len)
Deprecated.
Set the object's value as a stream.
|
void |
setValueStreamLength(Long len)
Deprecated.
|
StoreResponse |
store()
Deprecated.
|
StoreResponse |
store(RequestMeta meta)
Deprecated.
Convenience method for calling
RiakClient.store(RiakObject, RequestMeta) followed by
updateMeta(StoreResponse) |
StoreResponse |
store(RiakClient riak,
RequestMeta meta)
Deprecated.
Store this object to a different Riak instance.
|
void |
updateMeta(FetchResponse response)
Deprecated.
Update the object's metadata from a fetch or fetchMeta operation
|
void |
updateMeta(StoreResponse response)
Deprecated.
Update the object's metadata.
|
Iterable<String> |
usermetaKeys()
Deprecated.
|
RiakObject.LinkBuilder |
walk()
Deprecated.
|
RiakObject.LinkBuilder |
walk(boolean keep)
Deprecated.
|
RiakObject.LinkBuilder |
walk(String bucket)
Deprecated.
|
RiakObject.LinkBuilder |
walk(String bucket,
boolean keep)
Deprecated.
|
RiakObject.LinkBuilder |
walk(String bucket,
String tag)
Deprecated.
|
RiakObject.LinkBuilder |
walk(String bucket,
String tag,
boolean keep)
Deprecated.
Convenience methods for building a link walk specification starting from
this object and calling
RiakClient.walk(String, String, RiakWalkSpec) |
void |
writeToHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod)
Deprecated.
Serializes this object to an existing
HttpMethod which can be
sent as an HTTP request. |
public RiakObject(RiakClient riak, String bucket, String key, byte[] value, String contentType, List<RiakLink> links, Map<String,String> userMetaData, String vclock, String lastmod, String vtag)
riak
- Riak instance this object is associated with, which is used by
the convenience methods in this class (e.g.
store()
).bucket
- The object's bucketkey
- The object's keyvalue
- The object's valuecontentType
- The object's content type which defaults to
application/octet-stream if null.links
- Links to other objectsuserMetaData
- Custom metadata key-value pairs for this objectvclock
- An opaque vclock assigned by Riaklastmod
- The last time this object was modified according to Riakvtag
- This object's entity tag assigned by Riakpublic RiakObject(RiakClient riak, String bucket, String key)
public RiakObject(RiakClient riak, String bucket, String key, byte[] value)
public RiakObject(RiakClient riak, String bucket, String key, byte[] value, String contentType)
public RiakObject(RiakClient riak, String bucket, String key, byte[] value, String contentType, List<RiakLink> links)
public RiakObject(RiakClient riak, String bucket, String key, byte[] value, String contentType, List<RiakLink> links, Map<String,String> userMetaData)
public RiakObject(String bucket, String key, byte[] value, String contentType)
public RiakObject(String bucket, String key, byte[] value, String contentType, List<RiakLink> links)
public RiakObject(String bucket, String key, byte[] value, String contentType, List<RiakLink> links, Map<String,String> userMetaData)
public RiakClient getRiakClient()
RiakObject
can be loosely attached to the RiakClient
from which retrieve it was retrieved. Calling convenience methods like
store()
will store this object use that client.public RiakObject setRiakClient(RiakClient client)
public void copyData(RiakObject object)
object
. The bucket and key
are not copied.object
- The source object to copy frompublic void updateMeta(StoreResponse response)
response
- Response from a store operation containing an updated vclock,
last modified date, and vtagpublic void updateMeta(FetchResponse response)
response
- Response from a fetch or fetchMeta operation containing a
vclock, last modified date, and vtagpublic String getBucket()
public String getKey()
public String getValue()
public byte[] getValueAsBytes()
public void setValue(String value)
public void setValue(byte[] value)
public void setValueStream(InputStream in, Long len)
RiakObject#writeToHttpMethod(HttpMethod)
will always write the
value from getValueStream() if it is not null. Calling getValue() will
always return values set via setValue(), and calling getValueStream()
will always return the stream set via setValueStream.in
- Input stream representing the object's valuelen
- Length of the InputStream or null if unknown. If null, the
value will be buffered in memory to determine its size before
sending to the server.public void setValueStream(InputStream in)
public InputStream getValueStream()
public void setValueStreamLength(Long len)
public Long getValueStreamLength()
@Deprecated public List<RiakLink> getLinks()
RiakObject#iterableLinks())
to iterate over the
collection of RiakLink
s. Attempting to mutate the
collection will result in UnsupportedOperationException in
future versions. Use RiakObject#addLink()
and RiakObject#removeLink()
instead.
Use hasLinks()
, numLinks()
and hasLink(RiakLink)
to query state of links.RiakLink
s for this
RiakObjectRiakObject#addLink()}, {@link RiakObject#removeLink()}, {@link RiakObject#iterator()}, {@link RiakObject#hasLinks()} and , {@link RiakObject#numLinks()}
public void setLinks(List<RiakLink> links)
addLink(RiakLink)
,
removeLink(RiakLink)
and setLinks(List)
to alter the collection.links
- a List of RiakLink
public RiakObject addLink(RiakLink link)
link
- a RiakLink
to add.public RiakObject removeLink(RiakLink link)
RiakLink
from this RiakObject.link
- the RiakLink
to removepublic boolean hasLinks()
RiakLink
s?public int numLinks()
RiakLink
s does this RiakObject have?RiakLink
s this object has.public boolean hasLink(RiakLink riakLink)
riakLink
- a RiakLink@Deprecated public Map<String,String> getUsermeta()
RiakObject#addUsermeta(String, String)
,
removeUsermetaItem(String)
,
setUsermeta(Map)
,
hasUsermetaItem(String)
,
hasUsermeta()
and
getUsermetaItem(String)
to mutate and query the User meta collectionpublic void setUsermeta(Map<String,String> userMetaData)
userMetaData
- public RiakObject addUsermetaItem(String key, String value)
key
- value
- public boolean hasUsermeta()
public int numUsermetaItems()
public boolean hasUsermetaItem(String key)
key
- public String getUsermetaItem(String key)
key
- the user meta data item keypublic void removeUsermetaItem(String key)
key
- the key of the item to removepublic String getContentType()
public void setContentType(String contentType)
public String getVclock()
public String getLastmod()
public Date getLastmodAsDate()
public String getVtag()
public StoreResponse store(RequestMeta meta)
RiakClient.store(RiakObject, RequestMeta)
followed by
updateMeta(StoreResponse)
IllegalStateException
- if this object was not fetched from a Riak instance, so there
is not associated server to store it with.public StoreResponse store()
public StoreResponse store(RiakClient riak, RequestMeta meta)
riak
- Riak instance to store this object tometa
- Same as RiakClient.store(RiakObject, RequestMeta)
IllegalStateException
- if this object was not fetched from a Riak instance, so there
is not associated server to store it with.public FetchResponse fetch(RequestMeta meta)
RiakClient.fetch(String, String)
followed by copyData(RiakObject)
meta
- Same as RiakClient.fetch(String, String, RequestMeta)
IllegalStateException
- if this object was not fetched from a Riak instance, so there
is not associated server to refetch it from.public FetchResponse fetch()
public FetchResponse fetchMeta(RequestMeta meta)
RiakClient.fetchMeta(String, String, RequestMeta)
followed by
updateMeta(FetchResponse)
IllegalStateException
- if this object was not fetched from a Riak instance, so there
is not associated server to refetch meta from.public FetchResponse fetchMeta()
public HttpResponse delete(RequestMeta meta)
RiakClient.delete(String, String, RequestMeta)
.IllegalStateException
- if this object was not fetched from a Riak instance, so there
is not associated server to delete from.public HttpResponse delete()
public RiakObject.LinkBuilder walk(String bucket, String tag, boolean keep)
RiakClient.walk(String, String, RiakWalkSpec)
bucket
- The bucket to follow object links totag
- The link tags to follow from this objectkeep
- Whether to keep the output from this link walking step. If not
specified, then the output is only kept from the last step.RiakObject.LinkBuilder
object to continue building the walk query
or to run it.public RiakObject.LinkBuilder walk(String bucket, String tag)
public RiakObject.LinkBuilder walk(String bucket, boolean keep)
public RiakObject.LinkBuilder walk(String bucket)
public RiakObject.LinkBuilder walk()
public RiakObject.LinkBuilder walk(boolean keep)
public void writeToHttpMethod(org.apache.http.client.methods.HttpRequestBase httpMethod)
HttpMethod
which can be
sent as an HTTP request. Specifically, sends the object's link,
user-defined metadata and vclock as HTTP headers and the value as the
body. Used by RiakClient
to create PUT requests.Copyright © 2013. All Rights Reserved.