public interface OracleDatabaseAdmin
OracleDatabase
administration: collection creation, retrieval of collection names, etc.
An OracleCollectionAdmin
object is associated
with a particular OracleCollection
object.
Modifier and Type | Method and Description |
---|---|
OracleCollection |
createCollection(java.lang.String collectionName)
Creates a collection with the specified name.
|
OracleCollection |
createCollection(java.lang.String collectionName,
OracleDocument collectionMetadata)
Creates a collection with the specified name and
implementation-specific collection metadata, expressed in
JSON.
|
java.util.List<OracleDropResult> |
dropCollections(boolean force)
Drop all collections associated with this
OracleDatabase . |
java.util.List<java.lang.String> |
getCollectionNames()
Gets a list of the names of all collections in the database.
|
java.util.List<java.lang.String> |
getCollectionNames(int limit)
Gets a list of the names of collections in the database with a
limit on the number returned.
|
java.util.List<java.lang.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.
|
java.util.List<java.lang.String> |
getCollectionNames(int limit,
java.lang.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 to
startName . |
java.sql.Connection |
getConnection()
Return the JDBC connection backing this database.
|
OracleCollection createCollection(java.lang.String collectionName) throws OracleException
Collection will be configured according to default implementation-specific collection metadata.
If the collection with the specified collectionName
exists,
it's returned.
collectionName
- collection nameOracleException
- if the collection could not
be createdOracleCollectionAdmin.drop()
OracleCollection createCollection(java.lang.String collectionName, OracleDocument collectionMetadata) throws OracleException
Passing null
for collectionMetadata
is equivalent
to invoking createCollection(String)
.
If the collection with the specified collectionName
exists,
it's returned (unless its metadata doesn't match the metadata
specified via collectionMetadata
,
in which case an exception is thrown).
In case of the Oracle RDBMS implementation of SODA,
the collectionMetadata
document can be created with OracleRDBMSMetadataBuilder
.
collectionName
- collection namecollectionMetadata
- implementation-specific collection
metadataOracleException
- if (1) the collection could not
be created, or (2) the collection
with the provided collectionName
already exists and its metadata
does not match
the metadata specified in
collectionMetadata
OracleCollectionAdmin.drop()
java.util.List<java.lang.String> getCollectionNames() throws OracleException
OracleException
- if there is an error retrieving
collection names from the
databasejava.util.List<java.lang.String> getCollectionNames(int limit) throws OracleException
limit
- a limit on the number of
names returned. Must be
positiveOracleException
- if (1) the limit is negative,
or (2) there is an error retrieving
collection names from the
databasejava.util.List<java.lang.String> getCollectionNames(int limit, int skip) throws OracleException
limit
- a limit on the number of
names returned. Must be
positiveskip
- a number of names to skip.
Must not be negativeOracleException
- if (1) the limit or skip are negative,
or (2) there is an error retrieving
collection names from the
databasejava.util.List<java.lang.String> getCollectionNames(int limit, java.lang.String startName) throws OracleException
startName
.
This method implies that the list is ordered.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 be
null
startName
,
null is returnedOracleException
- 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 databasejava.sql.Connection getConnection()
null
if this database is not
backed by a single JDBC connectionjava.util.List<OracleDropResult> dropCollections(boolean force) throws OracleException
OracleDatabase
.
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, an OracleDatabase
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, the force
parameter should be set
to false
. With this option, collections will
not be dropped if they have underlying tables or views which
could not be dropped.
force
- if set to true
all collection
metadata will be erased, even if some of the
collections could not be dropped. Normally
this parameter should be set to false
,
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.OracleDropResult
. Each of
these results contains the name of a
collection that could not be dropped and
a corresponding encountered error
message.OracleException
- if fatal error is encountered.