Package com.oracle.nosql.spring.data.config

# Class NosqlDbConfig

java.lang.Object
com.oracle.nosql.spring.data.config.NosqlDbConfig

public class NosqlDbConfig extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NosqlDbConfig(String endpoint, AuthorizationProvider authorizationProvider)`
  `NosqlDbConfig(NoSQLHandleConfig nosqlHandleConfig)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static NosqlDbConfig`
  `createCloudConfig(String endpoint, String configFile)`
  Creates a NosqlDbConfig object based on endpoint and config file path.
  `static NosqlDbConfig`
  `createCloudConfig(String endpoint, String configFile, String profileName)`
  Creates a NosqlDbConfig object based on endpoint, config file path and profile name.
  `static NosqlDbConfig`
  `createCloudSimConfig(String endpoint)`
  Creates a NosqlDbConfig object for a CloudSim server.
  `static NosqlDbConfig`
  `createProxyConfig(String endpoint)`
  Creates a NosqlDbConfig object for an on-prem server using an httproxy server.
  `static NosqlDbConfig`
  `createProxyConfig(String endpoint, String username, char[] password)`
  Creates a NosqlDbConfig object for an on-prem server using a secured httproxy server.
  `NosqlCapacityMode`
  `getDefaultCapacityMode()`
  Returns the default capacity mode set.
  `int`
  `getDefaultReadUnits()`
  Returns the value that was set for default read units or 50 otherwise.
  `int`
  `getDefaultStorageGB()`
  Returns the value that was set for default storageGB or 25 otherwise.
  `int`
  `getDefaultWriteUnits()`
  Returns the value that was set for default write units or 50 otherwise.
  `NoSQLHandleConfig`
  `getNosqlHandleConfig()`
  `int`
  `getQueryCacheCapacity()`
  Returns the capacity of the prepared query cache.
  `int`
  `getQueryCacheLifetime()`
  Returns the lifetime of the prepared query cache in milliseconds.
  `int`
  `getTableReqPollInterval()`
  Returns the table request poll interval in milliseconds.
  `int`
  `getTableReqTimeout()`
  Returns the table request timeout in milliseconds.
  `int`
  `getTimestampPrecision()`
  Returns the precision of the Timestamp NoSQL DB type when creating a new table.
  `NosqlDbConfig`
  `setDefaultCapacityMode(NosqlCapacityMode defaultCapacityMode)`
  Sets the default capacity mode when table is created if `NosqlTable` annotation is not present.
  `NosqlDbConfig`
  `setDefaultReadUnits(int defaultReadUnits)`
  Sets the default read units when table is created if `NosqlTable` annotation is not present or it doesn't specify a readUnits value.
  `NosqlDbConfig`
  `setDefaultStorageGB(int defaultStorageGB)`
  Sets the default storageGB when table is created if `NosqlTable` annotation is not present or it doesn't specify a storageGB value.
  `NosqlDbConfig`
  `setDefaultWriteUnits(int defaultWriteUnits)`
  Sets the default write units when table is created if `NosqlTable` annotation is not present or it doesn't specify a writeUnits value.
  `NosqlDbConfig`
  `setQueryCacheCapacity(int capacity)`
  Sets the capacity of the prepared query cache.
  `NosqlDbConfig`
  `setQueryCacheLifetime(int lifetime)`
  Sets the lifetime of the prepared query cache in milliseconds.
  `NosqlDbConfig`
  `setTableReqPollInterval(int pollInterval)`
  Sets the table request poll interval in milliseconds.
  `NosqlDbConfig`
  `setTableReqTimeout(int tableReqTimeout)`
  Sets the table request timeout in milliseconds.
  `NosqlDbConfig`
  `setTimestampPrecision(int precision)`
  Sets the precision of the Timestamp NoSQL DB type when creating a new table.

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### NosqlDbConfig

    public NosqlDbConfig(String endpoint, AuthorizationProvider authorizationProvider)

  - ### NosqlDbConfig

    public NosqlDbConfig(NoSQLHandleConfig nosqlHandleConfig)

- ## Method Details

  - ### createCloudConfig

    public static NosqlDbConfig createCloudConfig(String endpoint, String configFile) throws IOException
    Creates a NosqlDbConfig object based on endpoint and config file path. Note: Will use the DEFAULT profile from config file. Note: For use with NoSQL DB Cloud Service only.
    Parameters:
      `endpoint` - Endpoint of service. Example: `Region.endpoint()`
      `configFile` - Path to config file. Example: "~/.oci/config"
    Returns:
      returns the NosqlDbConfig object.
    Throws:
      `IOException` - if config file cannot be accessed.

  - ### createCloudConfig

    public static NosqlDbConfig createCloudConfig(String endpoint, String configFile, String profileName) throws IOException
    Creates a NosqlDbConfig object based on endpoint, config file path and profile name. Note: For use with NoSQL DB Cloud Service only.
    Parameters:
      `endpoint` - Endpoint of service. Example: `Region.endpoint()`
      `configFile` - Path to config file. Example: "~/.oci/config"
      `profileName` - The name of the profile defined in config file. Example: "DEFAULT".
    Returns:
      returns the NosqlDbConfig object.
    Throws:
      `IOException` - if config file cannot be accessed.

  - ### createCloudSimConfig

    public static NosqlDbConfig createCloudSimConfig(String endpoint)
    Creates a NosqlDbConfig object for a CloudSim server.
    Parameters:
      `endpoint` - Endpoint of service. Example: "http://localhost:8080"
    Returns:
      returns the NosqlDbConfig object.

  - ### createProxyConfig

    public static NosqlDbConfig createProxyConfig(String endpoint)
    Creates a NosqlDbConfig object for an on-prem server using an httproxy server.
    Parameters:
      `endpoint` - Endpoint of service. Example: "http://localhost:8080"
    Returns:
      returns the NosqlDbConfig object.

  - ### createProxyConfig

    public static NosqlDbConfig createProxyConfig(String endpoint, String username, char[] password)
    Creates a NosqlDbConfig object for an on-prem server using a secured httproxy server.
    Parameters:
      `endpoint` - Endpoint of service. Example: "https://localhost:8080"
      `username` - User name
      `password` - User password
    Returns:
      returns the NosqlDbConfig object.

  - ### getNosqlHandleConfig

    public NoSQLHandleConfig getNosqlHandleConfig()

  - ### getQueryCacheCapacity

    public int getQueryCacheCapacity()
    Returns the capacity of the prepared query cache. By default this is set to `Constants.DEFAULT_QUERY_CACHE_CAPACITY`.

  - ### setQueryCacheCapacity

    public NosqlDbConfig setQueryCacheCapacity(int capacity)
    Sets the capacity of the prepared query cache. By default, this is set to `Constants.DEFAULT_QUERY_CACHE_CAPACITY`. The prepared query cache is controlled by both `setQueryCacheCapacity(int)` and `setQueryCacheLifetime(int)`. If capacity is 0 then entries are only ever removed because they expire. If lifetime is 0 then entries are only ever removed because the cache has reached capacity.

  - ### getQueryCacheLifetime

    public int getQueryCacheLifetime()
    Returns the lifetime of the prepared query cache in milliseconds. By default this is set to `Constants.DEFAULT_QUERY_CACHE_LIFETIME_MS`.

  - ### setQueryCacheLifetime

    public NosqlDbConfig setQueryCacheLifetime(int lifetime)
    Sets the lifetime of the prepared query cache in milliseconds. By default, this is set to `Constants.DEFAULT_QUERY_CACHE_LIFETIME_MS`. The prepared query cache is controlled by both `setQueryCacheCapacity(int)` and `setQueryCacheLifetime(int)`. If capacity is 0 then entries are only ever removed because they expire. If lifetime is 0 then entries are only ever removed because the cache has reached capacity.

  - ### getTableReqTimeout

    public int getTableReqTimeout()
    Returns the table request timeout in milliseconds. By default this is set to `Constants.DEFAULT_TABLE_REQ_TIMEOUT_MS`

  - ### setTableReqTimeout

    public NosqlDbConfig setTableReqTimeout(int tableReqTimeout)
    Sets the table request timeout in milliseconds. By default this is set to `Constants.DEFAULT_TABLE_REQ_TIMEOUT_MS`

  - ### getTableReqPollInterval

    public int getTableReqPollInterval()
    Returns the table request poll interval in milliseconds. By default this is set to `Constants.DEFAULT_TABLE_RED_POLL_INTERVAL_MS`

  - ### setTableReqPollInterval

    public NosqlDbConfig setTableReqPollInterval(int pollInterval)
    Sets the table request poll interval in milliseconds. By default this is set to `Constants.DEFAULT_TABLE_RED_POLL_INTERVAL_MS`

  - ### getTimestampPrecision

    public int getTimestampPrecision()
    Returns the precision of the Timestamp NoSQL DB type when creating a new table. By default this is set to `Constants.DEFAULT_TIMESTAMP_PRECISION`.

    Timestamp values have a precision (0 - 9) which represents the fractional seconds to be held by the timestamp. A value of 0 means that no fractional seconds are stored, 3 means that the timestamp stores milliseconds, and 9 means a precision of nanoseconds.

    In the context of a CREATE TABLE statement, a precision must be explicitly specified. This restriction is to prevent users from inadvertently creating TIMESTAMP values with precision 9 (which takes more space) when in reality they don't need that high precision.

    See Timestamp documentation for more details.

  - ### setTimestampPrecision

    public NosqlDbConfig setTimestampPrecision(int precision)
    Sets the precision of the Timestamp NoSQL DB type when creating a new table. By default this is set to `Constants.DEFAULT_TIMESTAMP_PRECISION`.
    Timestamp values have a precision (0 - 9) which represents the fractional seconds to be held by the timestamp. A value of 0 means that no fractional seconds are stored, 3 means that the timestamp stores milliseconds, and 9 means a precision of nanoseconds.
    In the context of a CREATE TABLE statement, a precision must be explicitly specified. This restriction is to prevent users from inadvertently creating TIMESTAMP values with precision 9 (which takes more space) when in reality they don't need that high precision.
    See Timestamp documentation for more details.

  - ### setDefaultStorageGB

    public NosqlDbConfig setDefaultStorageGB(int defaultStorageGB)
    Sets the default storageGB when table is created if `NosqlTable` annotation is not present or it doesn't specify a storageGB value. Valid values are only values greater than 0. This applies only in cloud or cloud sim scenarios.

    If not set the default value is 25GB.

    For `TableLimits` to be set one of the following two conditions must be met:

    - capacityMode is set to PROVISIONED and all three: readUnits, writeUnits and storageGB must be greater than 0,
    - or capacityMode is set to ON_DEMAND and storageGB must be greater than 0.

    Note: StorageBG, capacity mode and read/write units can later be configured from the OCI console or using the API.

  - ### getDefaultStorageGB

    public int getDefaultStorageGB()
    Returns the value that was set for default storageGB or 25 otherwise.

  - ### setDefaultCapacityMode

    public NosqlDbConfig setDefaultCapacityMode(NosqlCapacityMode defaultCapacityMode)
    Sets the default capacity mode when table is created if `NosqlTable` annotation is not present. This applies only in cloud or cloud sim scenarios.

    If not set the default value is `TableLimits.CapacityMode.PROVISIONED`.

    Note: StorageBG, capacity mode and read/write units can later be configured from the OCI console or using the API.

  - ### getDefaultCapacityMode

    public NosqlCapacityMode getDefaultCapacityMode()
    Returns the default capacity mode set. If not set the returned value is `TableLimits.CapacityMode.PROVISIONED`.

  - ### setDefaultReadUnits

    public NosqlDbConfig setDefaultReadUnits(int defaultReadUnits)
    Sets the default read units when table is created if `NosqlTable` annotation is not present or it doesn't specify a readUnits value. Valid values are only values greater than 0. This applies only in cloud or cloud sim scenarios. When in PROVISIONED mode all three: storageGB, readUnits and writeUnits must be greater than 0 to be valid. `TableLimits`.

    If not set the default value is 50.

    Note: StorageBG, capacity mode and read/write units can later be configured from the OCI console or using the API.

  - ### getDefaultReadUnits

    public int getDefaultReadUnits()
    Returns the value that was set for default read units or 50 otherwise.

  - ### setDefaultWriteUnits

    public NosqlDbConfig setDefaultWriteUnits(int defaultWriteUnits)
    Sets the default write units when table is created if `NosqlTable` annotation is not present or it doesn't specify a writeUnits value. Valid values are only values greater than 0. This applies only in cloud or cloud sim scenarios. When in PROVISIONED mode all three: storageGB, readUnits and writeUnits must be greater than 0 to be valid. `TableLimits`.

    If not set the default value is 50.

    Note: StorageBG, capacity mode and read/write units can later be configured from the OCI console or using the API.

  - ### getDefaultWriteUnits

    public int getDefaultWriteUnits()
    Returns the value that was set for default write units or 50 otherwise.