public interface OracleRDBMSMetadataBuilder
OracleDocument
.
The resulting OracleDocument
must be supplied to
OracleDatabaseAdmin.createCollection(String, OracleDocument)
method to create a collection with the provided metadata.
Custom collection metadata is needed when you want to specify, for example,
how the collection is stored, or that the collection is read-only,
or remove some of the optional (e.g. version, created-on timestamp, last
modified timestamp) columns from the underlying table storing the collection.
Custom collection metadata can also be used to map a pre-existing SQL table to
a new SODA collection.
The builder is created as follows:
OracleRDBMSClient client = ... OracleRDBMSMetadataBuilder builder = client.createMetadataBuilder();The resulting builder is initialized with default metadata settings. These settings can be modified using various
OracleRDBMSMetadataBuilder
methods. For example, to change the key assignment method to client-assigned, and
to change the content column type to VARCHAR2
, invoke
keyColumnAssignmentMethod(String)
and contentColumnType(String)
as follows:
builder.keyColumnAssignmentMethod("CLIENT").contentColumnType("VARCHAR2");Once the desired changes to the default metadata settings are made, the
OracleDocument
representing collection metadata in JSON should be
created as follows:
OracleDocument metadata = builder.build();This metadata document is supplied to the
OracleDatabaseAdmin.createCollection(String, OracleDocument)
method to create a collection with the specified custom metadata:
OracleDatabase db = ... OracleCollection collection = db.admin().createCollection("myCollection", metadata);
Modifier and Type | Method and Description |
---|---|
OracleDocument |
build()
Builds a JSON object containing the collection metadata.
|
OracleRDBMSMetadataBuilder |
contentColumnCache(boolean cache)
Sets the SecureFiles LOB cache setting for the content column.
|
OracleRDBMSMetadataBuilder |
contentColumnCompress(java.lang.String compress)
Sets the SecureFiles LOB compress setting for the content column.
|
OracleRDBMSMetadataBuilder |
contentColumnEncrypt(java.lang.String encrypt)
Sets the SecureFiles LOB encryption setting for the content column.
|
OracleRDBMSMetadataBuilder |
contentColumnMaxLength(int maxLength)
Sets the maximum length of the content column.
|
OracleRDBMSMetadataBuilder |
contentColumnName(java.lang.String name)
Sets the name of the content column.
|
OracleRDBMSMetadataBuilder |
contentColumnType(java.lang.String sqlType)
Sets the SQL type of the content column.
|
OracleRDBMSMetadataBuilder |
contentColumnValidation(java.lang.String validation)
Sets the validation mode for the content column.
|
OracleRDBMSMetadataBuilder |
creationTimeColumnName(java.lang.String name)
Sets the optional creation time column name.
|
OracleRDBMSMetadataBuilder |
keyColumnAssignmentMethod(java.lang.String assignmentMethod)
Sets the key column assignment method.
|
OracleRDBMSMetadataBuilder |
keyColumnMaxLength(int maxLength)
Sets the maximum size of the key column.
|
OracleRDBMSMetadataBuilder |
keyColumnName(java.lang.String name)
Sets the name of the key column.
|
OracleRDBMSMetadataBuilder |
keyColumnSequenceName(java.lang.String sequenceName)
Sets the sequence name for sequence-based keys.
|
OracleRDBMSMetadataBuilder |
keyColumnType(java.lang.String sqlType)
Sets the key column type.
|
OracleRDBMSMetadataBuilder |
lastModifiedColumnIndex(java.lang.String index)
Sets the last-modified column index name.
|
OracleRDBMSMetadataBuilder |
lastModifiedColumnName(java.lang.String name)
Sets the optional last-modified timestamp column name.
|
OracleRDBMSMetadataBuilder |
mediaTypeColumnName(java.lang.String name)
Sets the media type column name.
|
OracleRDBMSMetadataBuilder |
readOnly(boolean readOnly)
Sets the read/write policy.
|
OracleRDBMSMetadataBuilder |
removeOptionalColumns()
Removes the optional metadata columns.
|
OracleRDBMSMetadataBuilder |
schemaName(java.lang.String schemaName)
Sets the SQL schema name for the underlying database object.
|
OracleRDBMSMetadataBuilder |
tableName(java.lang.String tableName)
Sets the SQL table name.
|
OracleRDBMSMetadataBuilder |
versionColumnMethod(java.lang.String method)
Sets version column method.
|
OracleRDBMSMetadataBuilder |
versionColumnName(java.lang.String name)
Sets the version (ETag) column name.
|
OracleRDBMSMetadataBuilder |
viewName(java.lang.String viewName)
Sets the SQL view name.
|
OracleDocument build() throws OracleException
OracleException
will be raised if an invalid configuration
is detected. The specific validation errors that may occur are documented
throughout this interface.OracleException
- if an invalid combination is detectedOracleDatabaseAdmin.createCollection(String, OracleDocument)
OracleRDBMSMetadataBuilder schemaName(java.lang.String schemaName)
schemaName
is
null
, the schema associated with the connection will be used.schemaName
- the name of the schema or null
OracleRDBMSMetadataBuilder tableName(java.lang.String tableName)
viewName(String)
. If tableName
is null
, the
collection will be created using a table name based on the name of the
collection name.tableName
- the name of the table. May be null
viewName(String)
OracleRDBMSMetadataBuilder viewName(java.lang.String viewName)
tableName(String)
If viewName
is null
, the collection will be created using
a table name based on the name of the collection name.viewName
- the name of the view. May be null
tableName(String)
OracleRDBMSMetadataBuilder contentColumnName(java.lang.String name)
name
is null
,
the default value "JSON_DOCUMENT"
is used.name
- the name of the column. May be null
OracleRDBMSMetadataBuilder contentColumnType(java.lang.String sqlType) throws OracleException
"VARCHAR2"
, "NVARCHAR2"
, "RAW"
, "BLOB"
,
"CLOB"
, or "NCLOB"
. If sqlType
is null
,
the default value "BLOB"
is used.
Changing the content column type may automatically remove other related settings:
sqlType
- the type of the content column. May be null
OracleException
- if sqlType
is not one of the expected valuesOracleRDBMSMetadataBuilder contentColumnMaxLength(int maxLength) throws OracleException
maxLength
is 0, then the maximum is unspecified and
the default value of 2000 will be used, if applicable. If the content column type
is a LOB type and a maximum length is specified, an error will be raised when
build()
is called.maxLength
- the maximum sizeOracleException
- if maxLength
is negativecontentColumnType(String)
OracleRDBMSMetadataBuilder contentColumnValidation(java.lang.String validation) throws OracleException
validation
must be one of
"STANDARD"
, "STRICT"
, or "LAX"
.
If validation
is null
, the default "STANDARD"
mode is used.validation
- the validation mode. May be null
OracleException
- if validation
is not null
, "STANDARD"
,
"STRICT"
, or "LAX"
OracleRDBMSMetadataBuilder contentColumnCompress(java.lang.String compress) throws OracleException
compress
must be one of "NONE"
,
"HIGH"
, "MEDIUM"
, or "LOW"
.
This setting is not applicable if the
content column type
is not a
LOB type. If compress
is null
, the default value "NONE"
is used.
If the compression is set to something other than "NONE"
and
the column is not a LOB type, an error will be raised when build()
is called.
compress
- the compression mode. May be null
OracleException
- if compress
is not one of the expected valuescontentColumnType(String)
OracleRDBMSMetadataBuilder contentColumnCache(boolean cache)
content column type
is not a
LOB type. The default value is true
.
If the cache
is true
and the column is not a LOB type,
an error will be raised when build()
is called.
cache
- specifies if caching is usedcontentColumnType(String)
OracleRDBMSMetadataBuilder contentColumnEncrypt(java.lang.String encrypt) throws OracleException
encrypt
must be "NONE"
, "3DES168"
, "AES128"
,
"AES192"
, "AES256"
. If encrypt
is null, the default
value "NONE"
is used. This setting is not applicable if the
content column type
is not a
LOB type. If encrypt
is anything other than "NONE"
and the column
is not a LOB type, an error will be raised when build()
is called.encrypt
- the encryption type. May be null
OracleException
- if encrypt
is not one of the expected valuescontentColumnType(String)
OracleRDBMSMetadataBuilder keyColumnName(java.lang.String name)
name
is null,
they default value "ID"
is used.name
- the name of the key column. May be null
OracleRDBMSMetadataBuilder keyColumnType(java.lang.String sqlType) throws OracleException
sqlType
must be one of
"VARCHAR2"
, "NVARCHAR2"
, "NUMBER"
,
or "RAW"
. If sqlType
is null
, the default
value "VARCHAR2"
will be used. Setting the key column type to
"NUMBER"
or "RAW"
automatically removes the maximum size of
the key column.sqlType
- the key column type. May be null
OracleException
- if sqlType
is not one of the expected values.OracleRDBMSMetadataBuilder keyColumnMaxLength(int maxLength) throws OracleException
maxLength
is 0, then the maximum is unspecified and
the default value of 255 will be used, if applicable. If the key column type
is NUMBER
or RAW
and a maximum length is specified, an error will
be raised when build()
is called.maxLength
- the maximum sizeOracleException
- if maxLength
is negativekeyColumnType(String)
OracleRDBMSMetadataBuilder keyColumnAssignmentMethod(java.lang.String assignmentMethod) throws OracleException
assignmentMethod
must be one of "SEQUENCE"
, "GUID"
, "UUID"
,
or "CLIENT"
. If assignmentMethod
is null
,
the default value "UUID"
will be used. If assignmentMethod
is anything other than "SEQUENCE"
, the key column sequence name
will be automatically removed.
If the assignment method is "SEQUENCE"
but no key column
sequence name is specified, an error will be raised when build()
is called.assignmentMethod
- the key column assignment method. May be null
null
OracleException
- if assignmentMethod
is not one of the expected valueskeyColumnSequenceName(String)
OracleRDBMSMetadataBuilder keyColumnSequenceName(java.lang.String sequenceName)
sequenceName
is null
, the sequence name is unspecified. Specifying a sequence
name automatically changes the key column assignment method to "SEQUENCE"
.sequenceName
- the name of the sequence. May be null
keyColumnAssignmentMethod(String)
OracleRDBMSMetadataBuilder creationTimeColumnName(java.lang.String name)
name
is
null
, no creation time column will be used. The default
value is "CREATED_ON"
.name
- the name of the column. May be null
OracleRDBMSMetadataBuilder lastModifiedColumnName(java.lang.String name)
name
is null
, no last-modified column will be used and
the last-modified column index will automatically be removed. The default
value is "LAST_MODIFIED"
.name
- the name of the column. May be null
lastModifiedColumnIndex(String)
OracleRDBMSMetadataBuilder lastModifiedColumnIndex(java.lang.String index)
index
is null
, the index name is unspecified. If the
last-modified index name is specified but the last-modified
column name is not set, an error will be raised when build()
is called.index
- the name of the index. May be null
lastModifiedColumnName(String)
OracleRDBMSMetadataBuilder versionColumnName(java.lang.String name)
name
is null
,
the version column will not be used and the version column method
will automatically set to "NONE"
. The default value is
"VERSION"
.name
- the name of the column. May be null
versionColumnMethod(String)
OracleRDBMSMetadataBuilder versionColumnMethod(java.lang.String method) throws OracleException
method
must be
"SEQUENTIAL"
, "TIMESTAMP"
, "UUID"
, "SHA256"
,
"MD5"
, or "NONE"
. If method
is null
, the default
value "NONE"
is used. If the version column method is not "NONE"
and the version column name is not specified, an error will be raised when build()
is called.method
- the version method. May be null
OracleException
- if method
is not one of the expected valuesOracleRDBMSMetadataBuilder mediaTypeColumnName(java.lang.String name)
name
is null
,
the media type column is unspecified and a media type column will not be used.
If the content column type
is not "BLOB"
and the media type column is specified,
an error will be raised when build()
is called. By default, the media type
column is unspecified.name
- the name of the media type column. May be null
OracleRDBMSMetadataBuilder readOnly(boolean readOnly)
false
.readOnly
- when true, specifies the collection is read onlyOracleRDBMSMetadataBuilder removeOptionalColumns()
Calling this method is equivalent to the following:
this .creationTimeColumnName(null) .lastModifiedColumnName(null) .versionColumnName(null) .mediaTypeColumnName(null);