com.aliyun.openservices.ots
类 OTSClient

java.lang.Object
  继承者 com.aliyun.openservices.ots.OTSClient
所有已实现的接口:
OTS

public class OTSClient
extends Object
implements OTS

访问阿里云开放结构化数据服务(Open Table Service, OTS)的入口类。


构造方法摘要
OTSClient(String accessKeyId, String accessKeySecret)
          使用默认的OTS Endpoint和默认配置构造一个新的OTSClient实例。
OTSClient(String endpoint, String accessKeyId, String accessKeySecret)
          使用指定的OTS Endpoint和默认配置构造一个新的OTSClient实例。
OTSClient(String endpoint, String accessKeyId, String accessKeySecret, ClientConfiguration config)
          使用指定的OTS Endpoint和配置构造一个新的OTSClient实例。
 
方法摘要
 void abortTransaction(String transactionId)
          撤销一个事务(Transaction),撤销后所有在此事务中的操作都被取消,撤销后此事务ID失效。
 void batchModifyData(String tableName, Collection<RowChange> rowChanges, String transactionId)
          把PutData和/或DeleteData的多次调用组合成一个调用。
 void commitTransaction(String transactionId)
          确认并提交事务(Transaction),提交后此事务ID失效。
 void createTable(TableMeta tableMeta)
          创建表(Table)及其相关视图(View)。
 void createTableGroup(String tableGroupName, PartitionKeyType pkType)
          创建表组(Table Group)。
 void deleteData(String tableName, RowDeleteChange rowChange, String transactionId)
          删除指定行或行中的数据。
 void deleteTable(String tableName)
          删除表(Table)及与此表一起创建的视图(View)。
 void deleteTableGroup(String tableGroupName)
          删除表组(Table Group)及属于该表组的相关表(Table)和视图(View)。
 URI getEndpoint()
          返回访问的OTS Endpoint。
 Row getRow(SingleRowQueryCriteria criteria, String transactionId)
          返回表(Table)或视图(View)中的一行数据。
 List<Row> getRowsByOffset(OffsetRowQueryCriteria criteria, String transactionId)
          返回表(Table)或视图(View)的指定偏移量开始的多行数据。
 List<Row> getRowsByRange(RangeRowQueryCriteria criteria, String transactionId)
          返回表(Table)或视图(View)中主键(Primary Key)的特定范围内的多行数据。
 RowListing getRowsByRange(RangeRowQueryCriteria criteria, String transactionId, String nextToken)
          返回表(Table)或视图(View)中主键(Primary Key)的特定范围内的多行数据。
 TableMeta getTableMeta(String tableName)
          返回表(Table)的结构信息。
 List<String> listTableGroups()
          返回表组(Table Group)名的列表。
 List<String> listTables()
          返回表(Table)名的列表。
 void putData(String tableName, RowPutChange rowChange, String transactionId)
          插入一行或修改指定行中的数据。
 String startTransaction(String entityName, PartitionKeyValue pkValue)
          在表(Table)或表组(Table Group)上开始一个事务(Transaction),并得到该事务ID。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

OTSClient

public OTSClient(String accessKeyId,
                 String accessKeySecret)
使用默认的OTS Endpoint和默认配置构造一个新的OTSClient实例。

参数:
accessKeyId - 访问OTS服务的Access Key ID。
accessKeySecret - 访问OTS服务的Access Key Secret。

OTSClient

public OTSClient(String endpoint,
                 String accessKeyId,
                 String accessKeySecret)
使用指定的OTS Endpoint和默认配置构造一个新的OTSClient实例。

参数:
endpoint - OTS服务的endpoint。
accessKeyId - 访问OTS服务的Access ID。
accessKeySecret - 访问OTS服务的Access Key。

OTSClient

public OTSClient(String endpoint,
                 String accessKeyId,
                 String accessKeySecret,
                 ClientConfiguration config)
使用指定的OTS Endpoint和配置构造一个新的OTSClient实例。

参数:
endpoint - OTS服务的endpoint。
accessKeyId - 访问OTS服务的Access ID。
accessKeySecret - 访问OTS服务的Access Key。
config - 客户端配置信息(ClientConfiguration)。 如果传入null则使用默认配置。
方法详细信息

getEndpoint

public URI getEndpoint()
返回访问的OTS Endpoint。

返回:
OTS Endpoint。

createTableGroup

public void createTableGroup(String tableGroupName,
                             PartitionKeyType pkType)
                      throws OTSException,
                             ClientException
从接口 OTS 复制的描述
创建表组(Table Group)。

指定者:
接口 OTS 中的 createTableGroup
参数:
tableGroupName - 表组名称。
pkType - 表组的数据分片键的数据类型。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

listTableGroups

public List<String> listTableGroups()
                             throws OTSException,
                                    ClientException
从接口 OTS 复制的描述
返回表组(Table Group)名的列表。

指定者:
接口 OTS 中的 listTableGroups
返回:
表组(Table Group)名称的列表。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

deleteTableGroup

public void deleteTableGroup(String tableGroupName)
                      throws OTSException,
                             ClientException
从接口 OTS 复制的描述
删除表组(Table Group)及属于该表组的相关表(Table)和视图(View)。

指定者:
接口 OTS 中的 deleteTableGroup
参数:
tableGroupName - 表组名。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

createTable

public void createTable(TableMeta tableMeta)
                 throws OTSException,
                        ClientException
从接口 OTS 复制的描述
创建表(Table)及其相关视图(View)。

指定者:
接口 OTS 中的 createTable
参数:
tableMeta - 表及相关视图的结构信息。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

getTableMeta

public TableMeta getTableMeta(String tableName)
                       throws OTSException,
                              ClientException
从接口 OTS 复制的描述
返回表(Table)的结构信息。

指定者:
接口 OTS 中的 getTableMeta
参数:
tableName - 表名。
返回:
表的结构信息。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

listTables

public List<String> listTables()
                        throws OTSException,
                               ClientException
从接口 OTS 复制的描述
返回表(Table)名的列表。

指定者:
接口 OTS 中的 listTables
返回:
表名的列表。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

deleteTable

public void deleteTable(String tableName)
                 throws OTSException,
                        ClientException
从接口 OTS 复制的描述
删除表(Table)及与此表一起创建的视图(View)。

指定者:
接口 OTS 中的 deleteTable
参数:
tableName - 表名。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

startTransaction

public String startTransaction(String entityName,
                               PartitionKeyValue pkValue)
                        throws OTSException,
                               ClientException
从接口 OTS 复制的描述
在表(Table)或表组(Table Group)上开始一个事务(Transaction),并得到该事务ID。

指定者:
接口 OTS 中的 startTransaction
参数:
entityName - 表名或表组名。
pkValue - 表示事务(Transaction)建立在哪个数据分片键(Partition Key)上。
返回:
事务(Transaction)ID。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

commitTransaction

public void commitTransaction(String transactionId)
                       throws OTSException,
                              ClientException
从接口 OTS 复制的描述
确认并提交事务(Transaction),提交后此事务ID失效。

指定者:
接口 OTS 中的 commitTransaction
参数:
transactionId - 事务ID。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

abortTransaction

public void abortTransaction(String transactionId)
                      throws OTSException,
                             ClientException
从接口 OTS 复制的描述
撤销一个事务(Transaction),撤销后所有在此事务中的操作都被取消,撤销后此事务ID失效。

指定者:
接口 OTS 中的 abortTransaction
参数:
transactionId - 事务ID。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

getRow

public Row getRow(SingleRowQueryCriteria criteria,
                  String transactionId)
           throws OTSException,
                  ClientException
从接口 OTS 复制的描述
返回表(Table)或视图(View)中的一行数据。

指定者:
接口 OTS 中的 getRow
参数:
criteria - 查询条件。
transactionId - 事务ID,不为空时操作在事务中进行。
返回:
满足查询条件的一行数据。如果如果未找到,返回null。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

getRowsByOffset

public List<Row> getRowsByOffset(OffsetRowQueryCriteria criteria,
                                 String transactionId)
                          throws OTSException,
                                 ClientException
从接口 OTS 复制的描述
返回表(Table)或视图(View)的指定偏移量开始的多行数据。

指定者:
接口 OTS 中的 getRowsByOffset
参数:
criteria - 查询条件。
transactionId - 事务ID,不为空时操作在事务中进行。
返回:
满足查询条件的多行数据。如果如果未找到,返回空列表。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

getRowsByRange

public List<Row> getRowsByRange(RangeRowQueryCriteria criteria,
                                String transactionId)
                         throws OTSException,
                                ClientException
从接口 OTS 复制的描述
返回表(Table)或视图(View)中主键(Primary Key)的特定范围内的多行数据。

指定者:
接口 OTS 中的 getRowsByRange
参数:
criteria - 查询条件。
transactionId - 事务ID,不为空时操作在事务中进行。
返回:
满足查询条件的多行数据。如果如果未找到,返回空列表。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

getRowsByRange

public RowListing getRowsByRange(RangeRowQueryCriteria criteria,
                                 String transactionId,
                                 String nextToken)
                          throws OTSException,
                                 ClientException
从接口 OTS 复制的描述
返回表(Table)或视图(View)中主键(Primary Key)的特定范围内的多行数据。

指定者:
接口 OTS 中的 getRowsByRange
参数:
criteria - 查询条件。
transactionId - 事务ID,不为空时操作在事务中进行。
nextToken - 查找的断点,当nextToken为null时,则为请求开始
返回:
满足查询条件的多行数据。如果如果未找到,返回空列表。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

putData

public void putData(String tableName,
                    RowPutChange rowChange,
                    String transactionId)
             throws OTSException,
                    ClientException
从接口 OTS 复制的描述
插入一行或修改指定行中的数据。

指定者:
接口 OTS 中的 putData
参数:
tableName - 数据所在表(Table)的名称。
rowChange - 表示数据的修改信息。
transactionId - 事务ID,不为空时操作在事务中进行。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

deleteData

public void deleteData(String tableName,
                       RowDeleteChange rowChange,
                       String transactionId)
                throws OTSException,
                       ClientException
从接口 OTS 复制的描述
删除指定行或行中的数据。

指定者:
接口 OTS 中的 deleteData
参数:
tableName - 数据所在表(Table)的名称。
rowChange - 表示数据的删除信息。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。

batchModifyData

public void batchModifyData(String tableName,
                            Collection<RowChange> rowChanges,
                            String transactionId)
                     throws OTSException,
                            ClientException
从接口 OTS 复制的描述
把PutData和/或DeleteData的多次调用组合成一个调用。

指定者:
接口 OTS 中的 batchModifyData
参数:
tableName - 数据所在表(Table)的名称。
rowChanges - 表示数据的修改信息。 集合中可以包含RowPutChangeRowDeleteChange的实例。
抛出:
OTSException - OTS访问返回错误消息
ClientException - 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。


Copyright © 2013. All Rights Reserved.