Extended Api

Available since ODB 1.9.

Some methods of ODB are grouped in a separate interface ODBExt instead of ODB to keep the main interface ODB simple.

The ODBExt interface currently provide the following methods:

/**
 * An interface to provider extended access to ODB.
 * @author osmadja
 *
 */
public interface ODBExt {
    /**Gets the external OID of an Object. The external OID contains the ID of the database + the oid of the object. 
     * The External OID can be used to identify objects outside the ODB database as it should be unique across databases.
     * It can be used for example to implement a replication process.
     * 
     * @param object
     * @return
     */
    ExternalOID getObjectExternalOID(Object object);
 
    /** Get the Database ID
     * 
     * @return
     */
    DatabaseId getDatabaseId();
 
    /** Convert an OID to External OID 
     * 
     * @param oid
     * @return The external OID
     */
    ExternalOID convertToExternalOID(OID oid);
 
    /** Gets the current transaction Id
     * 
     * @return The current transaction Id
     */
 
    TransactionId getCurrentTransactionId();
}

To get access to the extended API, just call odb.ext(). Here is an example:

ODB odb = open("ext");
Function f = new Function("Test Function");
OID oid = odb.store(f);
ExternalOID extOid = odb.ext().getObjectExternalOID(f);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License