Package oracle.nosql.driver.ops

# Class TableResult

java.lang.Object
oracle.nosql.driver.ops.Result
oracle.nosql.driver.ops.TableResult

public class TableResult extends Result
TableResult is returned from `NoSQLHandle.getTable(oracle.nosql.driver.ops.GetTableRequest)` and `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)` operations. It encapsulates the state of the table that is the target of the request.

Operations available in `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)` such as table creation, modification, and drop are asynchronous operations. When such an operation has been performend it is necessary to call `NoSQLHandle.getTable(oracle.nosql.driver.ops.GetTableRequest)` until the status of the table is `TableResult.State.ACTIVE` or there is an error condition. The method `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` exists to perform this task and should be used to wait for an operation to complete.

`NoSQLHandle.getTable(oracle.nosql.driver.ops.GetTableRequest)` is synchronous, returning static information about the table as well as its current state.

See Also:
  - `NoSQLHandle.getTable(oracle.nosql.driver.ops.GetTableRequest)`
  - `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `TableResult.Replica`
  Cloud service only.
  `static enum`
  `TableResult.State`
  The current state of the table

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TableResult()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getCompartmentId()`
  Cloud service only.
  `String`
  `getDdl()`
  Returns the DDL (create table) statement used to create this table if available.
  `DefinedTags`
  `getDefinedTags()`
  Cloud service only.
  `FreeFormTags`
  `getFreeFormTags()`
  Cloud service only.
  `String`
  `getMatchETag()`
  Cloud service only.
  `String`
  `getNamespace()`
  On-premises service only.
  `String`
  `getOperationId()`
  Returns the operation id for an asynchronous operation.
  `TableResult.Replica[]`
  `getReplicas()`
  Cloud service only.
  `String`
  `getSchema()`
  Returns the JSON-formatted schema of the table if available and null if not
  `String`
  `getTableId()`
  Cloud service only.
  `TableLimits`
  `getTableLimits()`
  Returns the throughput and capacity limits for the table.
  `String`
  `getTableName()`
  Returns the table name of the target table.
  `TableResult.State`
  `getTableState()`
  Returns the table state.
  `boolean`
  `isFrozen()`
  Returns whether or not the table's schema is frozen.
  `boolean`
  `isLocalReplicaInitialized()`
  Cloud service only.
  `boolean`
  `isReplicated()`
  Cloud service only.
  `String`
  `toString()`
  `void`
  `waitForCompletion(NoSQLHandle handle, int waitMillis, int delayMillis)`
  Waits for a table operation to complete.
  `static TableResult`
  `waitForState(NoSQLHandle handle, String tableName, String operationId, TableResult.State state, int waitMillis, int delayMillis)`
  Deprecated.
  use `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` instead.
  `static TableResult`
  `waitForState(NoSQLHandle handle, String tableName, TableResult.State state, int waitMillis, int delayMillis)`
  Deprecated.
  use `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` instead.
  `static TableResult`
  `waitForState(NoSQLHandle handle, TableResult result, TableResult.State state, int waitMillis, int delayMillis)`
  Deprecated.
  use `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` instead.

  ### Methods inherited from class oracle.nosql.driver.ops.Result

  `getRateLimitDelayedMs, getRetryStats`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### TableResult

    public TableResult()

- ## Method Details

  - ### getTableState

    public TableResult.State getTableState()
    Returns the table state. A table in state `TableResult.State.ACTIVE` or `TableResult.State.UPDATING` is usable for normal operation.
    Returns:
      the state

  - ### getDdl

    public String getDdl()
    Returns the DDL (create table) statement used to create this table if available. If the table has been altered since initial creation the statement is also altered to reflect the current table schema. This value, when non-null, is functionally equivalent to the schema returned by `getSchema()`. The most reliable way to get the DDL statement is using `NoSQLHandle.getTable(oracle.nosql.driver.ops.GetTableRequest)` on an existing table.
    Returns:
      the create table statement
    Since:
      5.4

  - ### getTableId

    public String getTableId()
    Cloud service only.

    Returns the OCID of the table. This value will be null if used with the on-premises service.

    Returns:
      the table OCID
    Since:
      5.4

  - ### getCompartmentId

    public String getCompartmentId()
    Cloud service only.

    Returns compartment id of the target table

    Returns:
      the compartment id if set
    Since:
      5.4

  - ### getNamespace

    public String getNamespace()
    On-premises service only.

    Returns the namespace of the table, or null if it is not in a namespace. Note that the tablename is prefixed with the namespace as well if it is in a namespace.

    Returns:
      the namespace id if set
    Since:
      5.4

  - ### getTableName

    public String getTableName()
    Returns the table name of the target table. If on-premises and the table is in a namespace the namespace is included as a prefix using the format namespace:tableName
    Returns:
      the table name

  - ### getSchema

    public String getSchema()
    Returns the JSON-formatted schema of the table if available and null if not
    Returns:
      the schema
    Since:
      5.4

  - ### getTableLimits

    public TableLimits getTableLimits()
    Returns the throughput and capacity limits for the table. Limits from an on-premises service will always be null.
    Returns:
      the limits

  - ### getFreeFormTags

    public FreeFormTags getFreeFormTags()
    Cloud service only. Returns the `FreeFormTags` associated with this table, if available, or null otherwise.
    Returns:
      the FreeFormTags
    Since:
      5.4

  - ### getDefinedTags

    public DefinedTags getDefinedTags()
    Cloud service only. Returns the `DefinedTags` associated with this table, if available, or null otherwise.
    Returns:
      the DefinedTags
    Since:
      5.4

  - ### getMatchETag

    public String getMatchETag()
    Cloud service only. Returns the matchETag associated with this table. The matchETag is an opaque field that represents the current version of the table itself and can be used in future table modification operations to only perform them if the matchETag for the table has not changed. This is an optimistic concurrency control mechanism.
    Returns:
      the matchETag
    Since:
      5.4

  - ### getOperationId

    public String getOperationId()
    Returns the operation id for an asynchronous operation. This is null if the request did not generate a new operation. The value can be used in `GetTableRequest.setOperationId(java.lang.String)` to find potential errors resulting from the operation.
    Returns:
      the operation id, or null if not set

  - ### isFrozen

    public boolean isFrozen()
    Returns whether or not the table's schema is frozen. The schema can only be frozen when using the cloud service and a frozen schema is required for replicating a table
    Returns:
      true if the schema is frozen
    Since:
      5.4.13

  - ### isReplicated

    public boolean isReplicated()
    Cloud service only. Returns true if the table is replicated.
    Returns:
      the flag
    Since:
      5.4.13

  - ### isLocalReplicaInitialized

    public boolean isLocalReplicaInitialized()
    Cloud service only. Returns true if the table is a replica and its initialization process has been completed, otherwise return false.
    Returns:
      true if the table is a replica and it's been initialized
    Since:
      5.4.13

  - ### getReplicas

    public TableResult.Replica[] getReplicas()
    Cloud service only. Returns a array of `TableResult.Replica` if the table is replicated, or null if table is not replicated.
    Returns:
      the remote Replicas
    Since:
      5.4.13

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### waitForState

    @Deprecated public static TableResult waitForState(NoSQLHandle handle, TableResult result, TableResult.State state, int waitMillis, int delayMillis)
    Deprecated.
    use `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` instead. Waits for the specified table to reach the desired state. This is a blocking, polling style wait that delays for the specified number of milliseconds between each polling operation. The state of `TableResult.State.DROPPED` is treated specially in that it will be returned as success, even if the table does not exist. Other states will throw an exception if the table is not found.
    Parameters:
      `handle` - the NoSQLHandle to use
      `result` - a previously received TableResult
      `state` - the desired state
      `waitMillis` - the total amount of time to wait, in millseconds. This value must be non-zero and greater than delayMillis
      `delayMillis` - the amount of time to wait between polling attempts, in milliseconds. If 0 it will default to 500.
    Returns:
      the TableResult representing the table at the desired state
    Throws:
      `IllegalArgumentException` - if the parameters are not valid.
      `RequestTimeoutException` - if the operation times out.
      `NoSQLException` - if the operation id used is not null that the operation has failed for some reason.

  - ### waitForState

    @Deprecated public static TableResult waitForState(NoSQLHandle handle, String tableName, TableResult.State state, int waitMillis, int delayMillis)
    Deprecated.
    use `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` instead. Waits for the specified table to reach the desired state. This is a blocking, polling style wait that delays for the specified number of milliseconds between each polling operation. The state of `TableResult.State.DROPPED` is treated specially in that it will be returned as success, even if the table does not exist. Other states will throw an exception if the table is not found.
    Parameters:
      `handle` - the NoSQLHandle to use
      `tableName` - the table name
      `state` - the desired state
      `waitMillis` - the total amount of time to wait, in millseconds. This value must be non-zero and greater than delayMillis
      `delayMillis` - the amount of time to wait between polling attempts, in milliseconds. If 0 it will default to 500.
    Returns:
      the TableResult representing the table at the desired state
    Throws:
      `IllegalArgumentException` - if the parameters are not valid.
      `RequestTimeoutException` - if the operation times out.

  - ### waitForState

    @Deprecated public static TableResult waitForState(NoSQLHandle handle, String tableName, String operationId, TableResult.State state, int waitMillis, int delayMillis)
    Deprecated.
    use `waitForCompletion(oracle.nosql.driver.NoSQLHandle, int, int)` instead. Waits for the specified table to reach the desired state. This is a blocking, polling style wait that delays for the specified number of milliseconds between each polling operation. The state of `TableResult.State.DROPPED` is treated specially in that it will be returned as success, even if the table does not exist. Other states will throw an exception if the table is not found.
    Parameters:
      `handle` - the NoSQLHandle to use
      `tableName` - the table name
      `operationId` - optional operation id
      `state` - the desired state
      `waitMillis` - the total amount of time to wait, in millseconds. This value must be non-zero and greater than delayMillis
      `delayMillis` - the amount of time to wait between polling attempts, in milliseconds. If 0 it will default to 500.
    Returns:
      the TableResult representing the table at the desired state
    Throws:
      `IllegalArgumentException` - if the parameters are not valid.
      `RequestTimeoutException` - if the operation times out.

  - ### waitForCompletion

    public void waitForCompletion(NoSQLHandle handle, int waitMillis, int delayMillis)
    Waits for a table operation to complete. Table operations are asynchronous. This is a blocking, polling style wait that delays for the specified number of milliseconds between each polling operation. This call returns when the table reaches a terminal state, which is either `TableResult.State.ACTIVE` or `TableResult.State.DROPPED`. This instance must be the return value of a previous `NoSQLHandle.tableRequest(oracle.nosql.driver.ops.TableRequest)` and contain a non-null operation id representing the in-progress operation unless the operation has already completed. This instance is modified with any change in table state or metadata.
    Parameters:
      `handle` - the NoSQLHandle to use
      `waitMillis` - the total amount of time to wait, in millseconds. This value must be non-zero and greater than delayMillis
      `delayMillis` - the amount of time to wait between polling attempts, in milliseconds. If 0 it will default to 500.
    Throws:
      `IllegalArgumentException` - if the parameters are not valid.
      `RequestTimeoutException` - if the operation times out.