com.basho.riak.client
Class RiakObject

java.lang.Object
  extended by com.basho.riak.client.RiakObject

Deprecated. with the addition of a protocol buffers client in 0.14 all the existing REST client code should be in client.http.* this class has therefore been moved. Please use com.basho.riak.client.http.RiakObject instead.

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

A (legacy REST) Riak object.

See Also:
RiakObject, IRiakClient, IRiakObject

Nested Class Summary
 class RiakObject.LinkBuilder
          Deprecated. Created by links() as a convenient way to build up link walking queries
 
Constructor Summary
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.  
 
Method Summary
 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 RiakLinks. 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 RiakLinks?
 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 RiakLinks at call time.
 int numLinks()
          Deprecated. How many RiakLinks 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RiakObject

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)
Deprecated. 
Create an empty object. The content type defaults to application/octet-stream.

Parameters:
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 bucket
key - The object's key
value - The object's value
contentType - The object's content type which defaults to application/octet-stream if null.
links - Links to other objects
userMetaData - Custom metadata key-value pairs for this object
vclock - An opaque vclock assigned by Riak
lastmod - The last time this object was modified according to Riak
vtag - This object's entity tag assigned by Riak

RiakObject

public RiakObject(RiakClient riak,
                  String bucket,
                  String key)
Deprecated. 

RiakObject

public RiakObject(RiakClient riak,
                  String bucket,
                  String key,
                  byte[] value)
Deprecated. 

RiakObject

public RiakObject(RiakClient riak,
                  String bucket,
                  String key,
                  byte[] value,
                  String contentType)
Deprecated. 

RiakObject

public RiakObject(RiakClient riak,
                  String bucket,
                  String key,
                  byte[] value,
                  String contentType,
                  List<RiakLink> links)
Deprecated. 

RiakObject

public RiakObject(RiakClient riak,
                  String bucket,
                  String key,
                  byte[] value,
                  String contentType,
                  List<RiakLink> links,
                  Map<String,String> userMetaData)
Deprecated. 

RiakObject

public RiakObject(String bucket,
                  String key)
Deprecated. 

RiakObject

public RiakObject(String bucket,
                  String key,
                  byte[] value)
Deprecated. 

RiakObject

public RiakObject(String bucket,
                  String key,
                  byte[] value,
                  String contentType)
Deprecated. 

RiakObject

public RiakObject(String bucket,
                  String key,
                  byte[] value,
                  String contentType,
                  List<RiakLink> links)
Deprecated. 

RiakObject

public RiakObject(String bucket,
                  String key,
                  byte[] value,
                  String contentType,
                  List<RiakLink> links,
                  Map<String,String> userMetaData)
Deprecated. 

RiakObject

public RiakObject(String bucket,
                  String key,
                  byte[] value,
                  String contentType,
                  List<RiakLink> links,
                  Map<String,String> userMetaData,
                  String vclock,
                  String lastmod,
                  String vtag)
Deprecated. 
Method Detail

getRiakClient

public RiakClient getRiakClient()
Deprecated. 
A 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.


setRiakClient

public RiakObject setRiakClient(RiakClient client)
Deprecated. 

copyData

public void copyData(RiakObject object)
Deprecated. 
Copy the metadata and value from object. The bucket and key are not copied.

Parameters:
object - The source object to copy from

updateMeta

public void updateMeta(StoreResponse response)
Deprecated. 
Update the object's metadata. This usually happens when Riak returns updated metadata from a store operation.

Parameters:
response - Response from a store operation containing an updated vclock, last modified date, and vtag

updateMeta

public void updateMeta(FetchResponse response)
Deprecated. 
Update the object's metadata from a fetch or fetchMeta operation

Parameters:
response - Response from a fetch or fetchMeta operation containing a vclock, last modified date, and vtag

getBucket

public String getBucket()
Deprecated. 
The object's bucket


getKey

public String getKey()
Deprecated. 
The object's key


getValue

public String getValue()
Deprecated. 
The object's value


getValueAsBytes

public byte[] getValueAsBytes()
Deprecated. 

setValue

public void setValue(String value)
Deprecated. 

setValue

public void setValue(byte[] value)
Deprecated. 

setValueStream

public void setValueStream(InputStream in,
                           Long len)
Deprecated. 
Set the object's value as a stream. A value set here is independent of and has precedent over any value set using setValue(): 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.

Parameters:
in - Input stream representing the object's value
len - 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.

setValueStream

public void setValueStream(InputStream in)
Deprecated. 

getValueStream

public InputStream getValueStream()
Deprecated. 

setValueStreamLength

public void setValueStreamLength(Long len)
Deprecated. 

getValueStreamLength

public Long getValueStreamLength()
Deprecated. 

getLinks

@Deprecated
public List<RiakLink> getLinks()
Deprecated. please use RiakObject#iterableLinks()) to iterate over the collection of RiakLinks. 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.

The object's links -- may be empty, but never be null.

Returns:
the list of RiakLinks for this RiakObject
See Also:
RiakObject#addLink()}, {@link RiakObject#removeLink()}, {@link RiakObject#iterator()}, {@link RiakObject#hasLinks()} and , {@link RiakObject#numLinks()}

setLinks

public void setLinks(List<RiakLink> links)
Deprecated. 
Makes a *deep* copy of links. Changes made to the original collection and its contents will not be reflected in this RiakObject's links. Use addLink(RiakLink), removeLink(RiakLink) and setLinks(List) to alter the collection.

Parameters:
links - a List of RiakLink

addLink

public RiakObject addLink(RiakLink link)
Deprecated. 
Add link to this RiakObject's links.

Parameters:
link - a RiakLink to add.
Returns:
this RiakObject.

removeLink

public RiakObject removeLink(RiakLink link)
Deprecated. 
Remove a RiakLink from this RiakObject.

Parameters:
link - the RiakLink to remove
Returns:
this RiakObject

hasLinks

public boolean hasLinks()
Deprecated. 
Does this RiakObject have any RiakLinks?

Returns:
true if there are links, false otherwise

numLinks

public int numLinks()
Deprecated. 
How many RiakLinks does this RiakObject have?

Returns:
the number of RiakLinks this object has.

hasLink

public boolean hasLink(RiakLink riakLink)
Deprecated. 
Checks if the collection of RiakLinks contains the one passed in.

Parameters:
riakLink - a RiakLink
Returns:
true if the RiakObject's link collection contains riakLink.

getUsermeta

@Deprecated
public 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

User-specified metadata for the object in the form of key-value pairs -- may be empty, but never be null. New key-value pairs can be added using addUsermeta()


setUsermeta

public void setUsermeta(Map<String,String> userMetaData)
Deprecated. 
Creates a copy of userMetaData. Changes made to the original collection will not be reflected in the RiakObject's state.

Parameters:
userMetaData -

addUsermetaItem

public RiakObject addUsermetaItem(String key,
                                  String value)
Deprecated. 
Adds the key, value to the collection of user meta for this object.

Parameters:
key -
value -
Returns:
this RiakObject.

hasUsermeta

public boolean hasUsermeta()
Deprecated. 
Returns:
true if there are any user meta data set on this RiakObject.

numUsermetaItems

public int numUsermetaItems()
Deprecated. 
Returns:
how many user meta data items this RiakObject has.

hasUsermetaItem

public boolean hasUsermetaItem(String key)
Deprecated. 
Parameters:
key -
Returns:

getUsermetaItem

public String getUsermetaItem(String key)
Deprecated. 
Get an item of user meta data.

Parameters:
key - the user meta data item key
Returns:
The value for the given key or null.

removeUsermetaItem

public void removeUsermetaItem(String key)
Deprecated. 
Parameters:
key - the key of the item to remove

usermetaKeys

public Iterable<String> usermetaKeys()
Deprecated. 

getContentType

public String getContentType()
Deprecated. 
The object's content type as a MIME type


setContentType

public void setContentType(String contentType)
Deprecated. 

getVclock

public String getVclock()
Deprecated. 
The object's opaque vclock assigned by Riak


getLastmod

public String getLastmod()
Deprecated. 
The modification date of the object determined by Riak


getLastmodAsDate

public Date getLastmodAsDate()
Deprecated. 
Convenience method to get the last modified header parsed into a Date object. Returns null if header is null, malformed, or cannot be parsed.


getVtag

public String getVtag()
Deprecated. 
An entity tag for the object assigned by Riak


store

public StoreResponse store(RequestMeta meta)
Deprecated. 
Convenience method for calling RiakClient.store(RiakObject, RequestMeta) followed by updateMeta(StoreResponse)

Throws:
IllegalStateException - if this object was not fetched from a Riak instance, so there is not associated server to store it with.

store

public StoreResponse store()
Deprecated. 

store

public StoreResponse store(RiakClient riak,
                           RequestMeta meta)
Deprecated. 
Store this object to a different Riak instance.

Parameters:
riak - Riak instance to store this object to
meta - Same as RiakClient.store(RiakObject, RequestMeta)
Throws:
IllegalStateException - if this object was not fetched from a Riak instance, so there is not associated server to store it with.

fetch

public FetchResponse fetch(RequestMeta meta)
Deprecated. 
Convenience method for calling RiakClient.fetch(String, String) followed by copyData(RiakObject)

Parameters:
meta - Same as RiakClient.fetch(String, String, RequestMeta)
Throws:
IllegalStateException - if this object was not fetched from a Riak instance, so there is not associated server to refetch it from.

fetch

public FetchResponse fetch()
Deprecated. 

fetchMeta

public FetchResponse fetchMeta(RequestMeta meta)
Deprecated. 
Convenience method for calling RiakClient.fetchMeta(String, String, RequestMeta) followed by updateMeta(FetchResponse)

Throws:
IllegalStateException - if this object was not fetched from a Riak instance, so there is not associated server to refetch meta from.

fetchMeta

public FetchResponse fetchMeta()
Deprecated. 

delete

public HttpResponse delete(RequestMeta meta)
Deprecated. 
Convenience method for calling RiakClient.delete(String, String, RequestMeta).

Throws:
IllegalStateException - if this object was not fetched from a Riak instance, so there is not associated server to delete from.

delete

public HttpResponse delete()
Deprecated. 

walk

public 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)

Parameters:
bucket - The bucket to follow object links to
tag - The link tags to follow from this object
keep - Whether to keep the output from this link walking step. If not specified, then the output is only kept from the last step.
Returns:
A RiakObject.LinkBuilder object to continue building the walk query or to run it.

walk

public RiakObject.LinkBuilder walk(String bucket,
                                   String tag)
Deprecated. 

walk

public RiakObject.LinkBuilder walk(String bucket,
                                   boolean keep)
Deprecated. 

walk

public RiakObject.LinkBuilder walk(String bucket)
Deprecated. 

walk

public RiakObject.LinkBuilder walk()
Deprecated. 

walk

public RiakObject.LinkBuilder walk(boolean keep)
Deprecated. 

writeToHttpMethod

public 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. 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.


iterableLinks

public Iterable<RiakLink> iterableLinks()
Deprecated. 
A thread safe, snapshot Iterable view of the state of this RiakObject's RiakLinks at call time. Modifications are *NOT* supported.

Returns:
Iterable for this RiakObject's RiakLinks


Copyright © 2012. All Rights Reserved.