com.baidubce.services.moladb
Class MolaDbClient

java.lang.Object
  extended by com.baidubce.AbstractBceClient
      extended by com.baidubce.services.moladb.MolaDbClient

public class MolaDbClient
extends AbstractBceClient

Represents the MolaDb client to access MolaDb.


Field Summary
 
Fields inherited from class com.baidubce.AbstractBceClient
config, DEFAULT_CONTENT_TYPE, DEFAULT_ENCODING, DEFAULT_SERVICE_DOMAIN, URL_PREFIX
 
Constructor Summary
MolaDbClient(MolaDbClientConfiguration conf)
          Constructs a new Moladb client using the client configuration to access Moladb.
 
Method Summary
 BatchGetItemResponse batchGetItem(BatchGetItemRequest request)
           The BatchGetItem operation get items with the given primary keys from Moladb.
 BatchWriteItemResponse batchWriteItem(BatchWriteItemRequest request)
           The BatchWriteItem operation write items with to Moladb.
 CreateInstanceResponse createInstance(CreateInstanceRequest request)
           Creates a new instance under same account.
protected  InternalRequest createRequest(HttpMethodName httpMethod, String... pathVariables)
           
protected  InternalRequest createRequestUnderInstance(HttpMethodName httpMethod, String... pathVariables)
           
 CreateTableResponse createTable(CreateTableRequest request)
           Create a table in moladb
 DeleteInstanceResponse deleteInstance(DeleteInstanceRequest request)
           Delete instance from Moladb
 DeleteInstanceResponse deleteInstance(String instanceName)
           Delete instance from Moladb
 DeleteItemResponse deleteItem(DeleteItemRequest request)
           The DeleteItem operation delete the item with the given primary key.
 DeleteTableResponse deleteTable(DeleteTableRequest request)
           Delete a table from moladb
 DeleteTableResponse deleteTable(String tableName)
           Delete the specified table from moladb
protected  void fillInHeadAndBody(AbstractBceRequest request, InternalRequest httpRequest)
           
 String getDefaultInstanceName()
           Get the default instance name.
 GetInstanceResponse getInstance(GetInstanceRequest request)
           Get instance detail from Moladb
 GetInstanceResponse getInstance(String instanceName)
           Get instance detail from Moladb
 GetItemResponse getItem(GetItemRequest request)
           The GetItem operation returns a set of attributes for the item with the given primary key.
 GetTableResponse getTable(GetTableRequest request)
           Get the table details from moladb
 GetTableResponse getTable(String tableName)
           Get the table details from moladb
 ListInstancesResponse listInstances()
           Get all instance names created by this account
 ListInstancesResponse listInstances(ListInstancesRequest request)
           Get the instance name list created by this account
 ListTablesResponse listTables()
           List all table names under the specified instance name from moladb
 ListTablesResponse listTables(ListTablesRequest request)
           List all table names under the specified instance name from moladb
 PutItemResponse putItem(PutItemRequest request)
           Creates a new item, or replaces an old item with a new item.
 QueryResponse query(QueryRequest request)
           The Query operation get items from Moladb with Hash Key and an interval of Range Key
 void setDefaultInstanceName(String instanceName)
           Set the default instance name.
 UpdateItemResponse updateItem(UpdateItemRequest request)
           The UpdateItem operation update the item with the given primary key.
 UpdateTableResponse updateTable(UpdateTableRequest request)
           Update a table in moladb
 
Methods inherited from class com.baidubce.AbstractBceClient
getClient, getEndpoint, getServiceId, invokeHttpClient, isRegionSupported, setClient, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MolaDbClient

public MolaDbClient(MolaDbClientConfiguration conf)
Constructs a new Moladb client using the client configuration to access Moladb.

Parameters:
conf - The Moladb client configuration options controlling how this client connects to Moladb (e.g. proxy settings, retry counts, etc).
Method Detail

setDefaultInstanceName

public void setDefaultInstanceName(String instanceName)

Set the default instance name. Operation on tables and items will be carried on this instance

Parameters:
instanceName - Default instance name to be set


getDefaultInstanceName

public String getDefaultInstanceName()

Get the default instance name.

Returns:
Default instance name

createInstance

public CreateInstanceResponse createInstance(CreateInstanceRequest request)

Creates a new instance under same account.

Parameters:
request - Container for the necessary parameters to execute the Create instance service method on Moladb.
Returns:
The responseContent from the Create instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

getInstance

public GetInstanceResponse getInstance(String instanceName)

Get instance detail from Moladb

Parameters:
instanceName - Name of the instance to be got from Moladb.
Returns:
The responseContent from the Get instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

getInstance

public GetInstanceResponse getInstance(GetInstanceRequest request)

Get instance detail from Moladb

Parameters:
request - Container for the necessary parameters to execute the Get instance service method on Moladb.
Returns:
The responseContent from the Get instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

deleteInstance

public DeleteInstanceResponse deleteInstance(DeleteInstanceRequest request)

Delete instance from Moladb

NOTE: There MUST be no table within the instance to be deleted.

Parameters:
request - Container for the necessary parameters to execute the Delete instance service method on Moladb.
Returns:
The responseContent from the Delete instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

deleteInstance

public DeleteInstanceResponse deleteInstance(String instanceName)

Delete instance from Moladb

NOTE: There MUST be no table within the instance to be deleted.

Parameters:
instanceName - the name of instance to be deleted.
Returns:
The responseContent from the Delete instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

listInstances

public ListInstancesResponse listInstances()

Get all instance names created by this account

Returns:
The responseContent from the List instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

listInstances

public ListInstancesResponse listInstances(ListInstancesRequest request)

Get the instance name list created by this account

Parameters:
request - Container for the necessary parameters to execute the list instance service method on Moladb.
Returns:
The responseContent from the List instance service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

createTable

public CreateTableResponse createTable(CreateTableRequest request)

Create a table in moladb

Parameters:
request - Container for the necessary parameters to execute the create table service method on Moladb.
Returns:
The responseContent from the Create table service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

deleteTable

public DeleteTableResponse deleteTable(String tableName)

Delete the specified table from moladb

Parameters:
tableName - Name of the table to be deleted from Moladb.
Returns:
The responseContent from the Delete table service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

deleteTable

public DeleteTableResponse deleteTable(DeleteTableRequest request)

Delete a table from moladb

Parameters:
request - Container for the necessary parameters to execute the delete table service method on Moladb.
Returns:
The responseContent from the Delete table service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

updateTable

public UpdateTableResponse updateTable(UpdateTableRequest request)

Update a table in moladb

Parameters:
request - Container for the necessary parameters to execute the update table service method on Moladb.
Returns:
The responseContent from the Update table service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

getTable

public GetTableResponse getTable(String tableName)

Get the table details from moladb

Parameters:
tableName - Name of table to be get from Moladb.
Returns:
The responseContent from the Get table service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

getTable

public GetTableResponse getTable(GetTableRequest request)

Get the table details from moladb

Parameters:
request - Container for the necessary parameters to execute the GetTable service method on Moladb.
Returns:
The responseContent from the Get table service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

listTables

public ListTablesResponse listTables()

List all table names under the specified instance name from moladb

Returns:
The responseContent from the list tables service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

listTables

public ListTablesResponse listTables(ListTablesRequest request)

List all table names under the specified instance name from moladb

Parameters:
request - Container for the necessary parameters to execute the ListTables service method on Moladb.
Returns:
The responseContent from the list tables service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

putItem

public PutItemResponse putItem(PutItemRequest request)

Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item. You can perform a conditional put operation (add a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values.

When you add an item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and Binary type attributes must have lengths greater than zero. Set type attributes cannot be empty.

Parameters:
request - Container for the necessary parameters to execute the PutItem service method on Moladb.
Returns:
The responseContent from the PutItem service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

getItem

public GetItemResponse getItem(GetItemRequest request)
                        throws BceClientException,
                               BceServiceException

The GetItem operation returns a set of attributes for the item with the given primary key. If there is no matching item, GetItem does not return any data.

GetItem provides an eventually consistent read by default. If your application requires a strongly consistent read, set ConsistentRead to true . Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.

Parameters:
request - Container for the necessary parameters to execute the GetItem request.
Returns:
The responseContent from the GetItem service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

deleteItem

public DeleteItemResponse deleteItem(DeleteItemRequest request)
                              throws BceClientException,
                                     BceServiceException

The DeleteItem operation delete the item with the given primary key. If there is no matching item, DeleteItem does not return any data.

Parameters:
request - Container for the necessary parameters to execute the DeleteItem request.
Returns:
The responseContent from the DeleteItem service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

updateItem

public UpdateItemResponse updateItem(UpdateItemRequest request)
                              throws BceClientException,
                                     BceServiceException

The UpdateItem operation update the item with the given primary key. If there is no matching item, UpdateItem does not return any data.

Parameters:
request - Container for the necessary parameters to execute the UpdateItem request.
Returns:
The responseContent from the UpdateItem service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

batchGetItem

public BatchGetItemResponse batchGetItem(BatchGetItemRequest request)
                                  throws BceClientException,
                                         BceServiceException

The BatchGetItem operation get items with the given primary keys from Moladb. If there is no matching item, BatchGetItem does not return any data.

The BatchGetItem can get items from multi tables with corresponding keys. These tables MUST under same instance.

Parameters:
request - Container for the necessary parameters to execute the BatchGetItem request.
Returns:
The responseContent from the BatchGetItem service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

batchWriteItem

public BatchWriteItemResponse batchWriteItem(BatchWriteItemRequest request)
                                      throws BceClientException,
                                             BceServiceException

The BatchWriteItem operation write items with to Moladb.

The BatchGetItem can write items within multi tables. These tables MUST under same instance.

Parameters:
request - Container for the necessary parameters to execute the BatchWriteItem request.
Returns:
The responseContent from the BatchWriteItem service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

query

public QueryResponse query(QueryRequest request)
                    throws BceClientException,
                           BceServiceException

The Query operation get items from Moladb with Hash Key and an interval of Range Key

The Query operation is only support on tables whose Primary key type is HashAndRange Key

Parameters:
request - Container for the necessary parameters to execute the Query request.
Returns:
The responseContent from the Query service method, as returned by Moladb.
Throws:
BceClientException - If any internal errors are encountered inside the client while attempting to make the request or handle the responseContent. For example if a network connection is not available.
BceServiceException - If an error responseContent is returned by Moladb indicating either a problem with the data in the request, or a server side issue.

createRequest

protected InternalRequest createRequest(HttpMethodName httpMethod,
                                        String... pathVariables)

createRequestUnderInstance

protected InternalRequest createRequestUnderInstance(HttpMethodName httpMethod,
                                                     String... pathVariables)

fillInHeadAndBody

protected void fillInHeadAndBody(AbstractBceRequest request,
                                 InternalRequest httpRequest)


Copyright © 2018. All rights reserved.