Interface OracleDatabaseAdmin
-
public interface OracleDatabaseAdmin
Provides DDL and metadata methods for theOracleDatabase
administration: collection creation, retrieval of collection names, etc.An
OracleCollectionAdmin
object is associated with a particularOracleCollection
object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
OracleDatabaseAdmin.CollectionCreateMode
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OracleCollection
createCollection(String collectionName)
Creates a collection with the specified name.OracleCollection
createCollection(String collectionName, OracleDocument collectionMetadata)
Creates a collection with the specified name and implementation-specific collection metadata, expressed in JSON.OracleCollection
createCollection(String collectionName, OracleDocument collectionMetadata, OracleDatabaseAdmin.CollectionCreateMode mode)
Creates a collection with the specified name and implementation-specific collection metadata, expressed in JSON.List<OracleDropResult>
dropCollections(boolean force)
Drop all collections associated with thisOracleDatabase
.List<String>
getCollectionNames()
Gets a list of the names of all collections in the database.List<String>
getCollectionNames(int limit)
Gets a list of the names of collections in the database with a limit on the number returned.List<String>
getCollectionNames(int limit, int skip)
Gets a list of the names of collections in the database with a limit on the number returned, starting at a specific offset in the list.List<String>
getCollectionNames(int limit, String startName)
Gets a list of the names of collections in the database with a limit on the number returned, starting at the first name greater than or equal tostartName
.Connection
getConnection()
Return the JDBC connection backing this database.
-
-
-
Method Detail
-
createCollection
OracleCollection createCollection(String collectionName) throws OracleException
Creates a collection with the specified name.Collection will be configured according to default implementation-specific collection metadata.
If the collection with the specified
collectionName
exists, it's returned.- Parameters:
collectionName
- collection name- Returns:
- OracleCollection created collection
- Throws:
OracleException
- if the collection could not be created- See Also:
OracleCollectionAdmin.drop()
-
createCollection
OracleCollection createCollection(String collectionName, OracleDocument collectionMetadata) throws OracleException
Creates a collection with the specified name and implementation-specific collection metadata, expressed in JSON.Passing
null
forcollectionMetadata
is equivalent to invokingcreateCollection(String)
.If the collection with the specified
collectionName
exists, it's returned (unless its metadata doesn't match the metadata specified viacollectionMetadata
, in which case an exception is thrown).In case of the Oracle RDBMS implementation of SODA, the
collectionMetadata
document can be created withOracleRDBMSMetadataBuilder
.- Parameters:
collectionName
- collection namecollectionMetadata
- implementation-specific collection metadata- Returns:
- OracleCollection created collection
- Throws:
OracleException
- if (1) the collection could not be created, or (2) the collection with the providedcollectionName
already exists and its metadata does not match the metadata specified incollectionMetadata
- See Also:
OracleCollectionAdmin.drop()
-
createCollection
OracleCollection createCollection(String collectionName, OracleDocument collectionMetadata, OracleDatabaseAdmin.CollectionCreateMode mode) throws OracleException
Creates a collection with the specified name and implementation-specific collection metadata, expressed in JSON.Passing
null
forcollectionMetadata
andCollectionCreateMode.DDL
formode
is equivalent to invokingcreateCollection(String)
.Passing
CollectionCreateMode.DDL
formode
is equivalent to invokingcreateCollection(String, OracleDocument)
.If the collection with the specified
collectionName
exists, it's returned (unless its metadata doesn't match the metadata specified viacollectionMetadata
, in which case an exception is thrown).In case of the Oracle RDBMS implementation of SODA, the
collectionMetadata
document can be created withOracleRDBMSMetadataBuilder
.- Parameters:
collectionName
- collection namecollectionMetadata
- implementation-specific collection metadatamode
- collection create mode:OracleDatabaseAdmin.CollectionCreateMode.DDL
orOracleDatabaseAdmin.CollectionCreateMode.MAP
. IfOracleDatabaseAdmin.CollectionCreateMode.DDL
is specified, SODA will first attempt to create the table backing the collection. If the table already exists, SODA will attempt to create a collection on top of it. IfOracleDatabaseAdmin.CollectionCreateMode.MAP
is specified, SODA will attempt to create a collection on top of an existing table (specified undertableName
field in the metadata).- Returns:
- OracleCollection created collection
- Throws:
OracleException
- if (1) the collection could not be created, or (2) the collection with the providedcollectionName
already exists and its metadata does not match the metadata specified incollectionMetadata
- See Also:
OracleCollectionAdmin.drop()
-
getCollectionNames
List<String> getCollectionNames() throws OracleException
Gets a list of the names of all collections in the database.- Returns:
- a list of collection names
- Throws:
OracleException
- if there is an error retrieving collection names from the database
-
getCollectionNames
List<String> getCollectionNames(int limit) throws OracleException
Gets a list of the names of collections in the database with a limit on the number returned. This method implies that the list is ordered.- Parameters:
limit
- a limit on the number of names returned. Must be positive- Returns:
- a list of collection names
- Throws:
OracleException
- if (1) the limit is negative, or (2) there is an error retrieving collection names from the database
-
getCollectionNames
List<String> getCollectionNames(int limit, int skip) throws OracleException
Gets a list of the names of collections in the database with a limit on the number returned, starting at a specific offset in the list. This method implies that the list is ordered.- Parameters:
limit
- a limit on the number of names returned. Must be positiveskip
- a number of names to skip. Must not be negative- Returns:
- a list of collection names
- Throws:
OracleException
- if (1) the limit or skip are negative, or (2) there is an error retrieving collection names from the database
-
getCollectionNames
List<String> getCollectionNames(int limit, String startName) throws OracleException
Gets a list of the names of collections in the database with a limit on the number returned, starting at the first name greater than or equal tostartName
. This method implies that the list is ordered.- Parameters:
limit
- a limit on the number of names returned. Must be positivestartName
- the starting name. All names greater than or equal to this name will be returned. Cannot benull
- Returns:
- a list of collection names.
If there is no collection name
greater than
startName
, null is returned - Throws:
OracleException
- if (1) the limit is negative, or (2) the startName is null or empty, or (3) there is an error retrieving collection names from the database
-
getConnection
Connection getConnection()
Return the JDBC connection backing this database.- Returns:
- the JDBC connection backing this database.
null
if this database is not backed by a single JDBC connection
-
dropCollections
List<OracleDropResult> dropCollections(boolean force) throws OracleException
Drop all collections associated with thisOracleDatabase
.Caution: using the force option (i.e. setting the force parameter to true), will delete all collection metadata for the given
OracleDatabase
. In the case of Oracle RDBMS, anOracleDatabase
is associated with a schema (i.e. user), so all collection metadata for that schema will be deleted. However, the underlying tables or views of these collections might not be deleted (if, for example, they have uncommitted writes). This intended use of the force option is to clear collection metadadata for the given schema, in preparation for dropping the whole schema. Otherwise, theforce
parameter should be set tofalse
. With this option, collections will not be dropped if they have underlying tables or views which could not be dropped.- Parameters:
force
- if set totrue
all collection metadata will be erased, even if some of the collections could not be dropped. Normally this parameter should be set tofalse
, so that no danling tables or views backing collections are left in the database. The intended use of this option is to clear the collection metadata in preparation for dropping the whole schema.- Returns:
- A list of
OracleDropResult
. Each of these results contains the name of a collection that could not be dropped and a corresponding encountered error message. - Throws:
OracleException
- if fatal error is encountered.
-
-