Package oracle.soda

Interface OracleDatabaseAdmin


  • public interface OracleDatabaseAdmin
    Provides DDL and metadata methods for the OracleDatabase administration: collection creation, retrieval of collection names, etc.

    An OracleCollectionAdmin object is associated with a particular OracleCollection object.

    • 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 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.

        Parameters:
        collectionName - collection name
        collectionMetadata - implementation-specific collection metadata
        Returns:
        OracleCollection created collection
        Throws:
        OracleException - 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
        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 positive
        skip - 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 to startName. This method implies that the list is ordered.
        Parameters:
        limit - a limit on the number of names returned. Must be positive
        startName - the starting name. All names greater than or equal to this name will be returned. Cannot be null
        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 this 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.

        Parameters:
        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.
        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.