com.basho.riak.client.api.RiakCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riak-client Show documentation
Show all versions of riak-client Show documentation
HttpClient-based client for Riak
The newest version!
/*
* Copyright 2013 Basho Technologies Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basho.riak.client.api;
import com.basho.riak.client.core.RiakCluster;
import com.basho.riak.client.core.RiakFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* The base class for all Riak Commands.
*
* All the commands the {@link RiakClient} can execute extend this class.
*
Client Commands
* Fetching, storing and deleting objects
*
* - {@link com.basho.riak.client.api.commands.kv.FetchValue}
* - {@link com.basho.riak.client.api.commands.kv.MultiFetch}
* - {@link com.basho.riak.client.api.commands.kv.StoreValue}
* - {@link com.basho.riak.client.api.commands.kv.UpdateValue}
* - {@link com.basho.riak.client.api.commands.kv.DeleteValue}
*
* Listing keys in a namespace
* - {@link com.basho.riak.client.api.commands.kv.ListKeys}
* Secondary index (2i) commands
*
* - {@link com.basho.riak.client.api.commands.indexes.RawIndexQuery}
* - {@link com.basho.riak.client.api.commands.indexes.BinIndexQuery}
* - {@link com.basho.riak.client.api.commands.indexes.IntIndexQuery}
* - {@link com.basho.riak.client.api.commands.indexes.BigIntIndexQuery}
*
* Fetching and storing datatypes (CRDTs)
*
* - {@link com.basho.riak.client.api.commands.datatypes.FetchCounter}
* - {@link com.basho.riak.client.api.commands.datatypes.FetchSet}
* - {@link com.basho.riak.client.api.commands.datatypes.FetchMap}
* - {@link com.basho.riak.client.api.commands.datatypes.UpdateCounter}
* - {@link com.basho.riak.client.api.commands.datatypes.UpdateSet}
* - {@link com.basho.riak.client.api.commands.datatypes.UpdateMap}
*
* Querying and modifying buckets
*
* - {@link com.basho.riak.client.api.commands.buckets.FetchBucketProperties}
* - {@link com.basho.riak.client.api.commands.buckets.StoreBucketProperties}
* - {@link com.basho.riak.client.api.commands.buckets.ListBuckets}
*
* Search commands
*
* - {@link com.basho.riak.client.api.commands.search.Search}
* - {@link com.basho.riak.client.api.commands.search.FetchIndex}
* - {@link com.basho.riak.client.api.commands.search.StoreIndex}
* - {@link com.basho.riak.client.api.commands.search.DeleteIndex}
* - {@link com.basho.riak.client.api.commands.search.FetchSchema}
* - {@link com.basho.riak.client.api.commands.search.StoreSchema}
*
* Map-Reduce
*
* - {@link com.basho.riak.client.api.commands.mapreduce.BucketMapReduce}
* - {@link com.basho.riak.client.api.commands.mapreduce.BucketKeyMapReduce}
* - {@link com.basho.riak.client.api.commands.mapreduce.IndexMapReduce}
* - {@link com.basho.riak.client.api.commands.mapreduce.SearchMapReduce}
*
*
*
* @param The response type
* @param The query info type
* @author Dave Rusek
* @author Brian Roach
* @since 2.0
*/
public abstract class RiakCommand
{
protected final T execute(RiakCluster cluster) throws ExecutionException, InterruptedException
{
RiakFuture future = executeAsync(cluster);
future.await();
return future.get();
}
protected final T execute(RiakCluster cluster, long timeout, TimeUnit unit)
throws ExecutionException, InterruptedException, TimeoutException
{
RiakFuture future = executeAsync(cluster);
return future.get(timeout, unit);
}
protected abstract RiakFuture executeAsync(RiakCluster cluster);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy