| Oracle Repository API and Model Reference Guide |
The Diff/Merge API is a set of interfaces and classes for Java that enables calling applications to read, write, compare, and merge versions of objects held in the repository. The API can be the basis for applications and tools that compare and merge repository objects.
Using the Diff/Merge API, objects to be manipulated are read from the repository and transformed into internal delta tables of arbitrary size. A delta manager object is used to compare any two tables to produce a third table containing difference information. Any table (the 'contributor' table) can be merged with another table (the 'base' table) to create a results table. Any table can be transformed into an object of the original type and saved back to the repository.
The interface class IDeltaMgr specifies the following methods for reading, writing, comparing, and merging supported objects:
retrieveReposObject Reads repository objects (including instances of Registered types) into delta tables.
getDeltaInfo Compares two delta tables to produce a third table containing any difference (deltas) between the two.
consolidate Uses the 3diff algorithm to merge a table (the contributor) with another table (the base) to create a new table which can then be written back to the repository or (if appropriate) to the operating system using the saveAs method.
saveAs Writes a delta table to the repository as a repository object.
The API provides a class factory mechanism for creating specialized delta managers (implementations of IDeltaMgr) appropriate for the types of repository object to be handled. The factory uses the repository identifier (IRID) of a specified object to read type information from the repository, and builds a delta manager appropriate for the object type.
Initialize the Diff/Merge API to use the calling application's RepositoryConnection. Create a class factory (delta registry) object that can:
Call its init () method, using code such as the following:
IDeltaReg dr = new CDeltaReg ();
dr.init (conn) ;
conn is a RepositoryConnection to be used for connecting to the repository.
Notes:
public RepositoryConnection (String strUser, String strPass, String strNet8)
Where:
strUser is the repository username.
strPass is the password.
strNet8 is the Net8 service alias.
Creates a new RepositoryConnection object, establishing a new JDBC connection to a database with the specified username, password and Net8 service alias.
public RepositoryConnection (Connection connection)
Where:
connection is the existing JDBC connection.
Creates a repository connection based on an existing JDBC connection:
Obtain a correctly formed delta manager by calling the GetManager method of the delta registry object. The delta registry uses the supplied irid to return a delta manager correctly formed to handle the element type concerned. For example, if irid specifies an element of type ENTITY in the repository, the factory returns a delta manager that can compare and merge ENTITY objects.
IDeltaMgr dm = dr.GetManager (dr.GetRegistry ().getTables ().getObjectType (irid, ivid));
Where:
irid is the IRID (general repository identifier) of the repository object to be manipulated using the API.
ivid is is the IVID (version-specific repository identifier) of the repository object to be manipulated using the API.
dm on return, is a delta manager appropriate for the type of object specified by irid.
Use the methods on the IDeltaManager interface (described below) to:
The Diff/Merge API provides the following methods:
IDeltaTable consolidate (IDeltaTable DeltaTable1, IDeltaTable DeltaTable2)
Where:
DeltaTable1 and DeltaTable2 are the tables to be merged.
Merges two delta tables, returning the merge result as a delta table. DeltaTable1 and DeltaTable2 must represent objects of the same type.
Note: This operation has no effect on the repository view of the version history of the objects merged. It is the responsibility of the caller to manage the maintenance of the version history via calls to the JR_VERSION.merge method.
IDeltaTable getDeltaInfo (IBasicObject obBase
, IBasicObject obContributor
, boolean bCloneResult)
Where:
obBase is the base table for the comparison.
obContributor is the table to be compared with the base table.
bCloneResult TRUE will clone obContributor before adding delta information to it, FALSE will reuse the delta table of the same object, and modify its delta information.
Note: IDeltaTable is an IBasicObject.
Gets the delta information resulting from the comparison of a contributor object and a base object. Returns a delta table representing the differences between the base object and the contributor.
IDeltaTable retrieveReposObject(Number nID,
Number nVer,
ProgressDialog pd)
throws Exception
Where:
nID is the IRID of the object to be retrieved.
nVer is the IVID of the object to be retrieved.
Retrieves an object version from the repository. The object version is identified by its IRID and IVID. The object version need not be in the current context workarea, and need not be checked out. (To get delta information between two objects, compare them using getDeltaInfo().)
An exception is raised if the object specified by nID and nVer does not exist in the repository.
Note: If the object being retrieved is of type PRIMARY_ACCESS_FILE, the API uses the Repository File Service to obtain only the contents of the appropriate LOB column of the object.
void saveAs(IBasicObject ob,
Number nID,
Number nVer)
throws Exception
Where:
ob is the delta table to be saved in the repository.
nID is the IRID the object to be saved in the repository.
nVer is the IVID the object to be saved in the repository.
Saves a delta table as an object of the appropriate type in the repository. A context workarea must be currently set, and the object specified by nID must be currently checked out in the context workarea.
Note: If the object being saved is of type PRIMARY_ACCESS_FILE, the API uses the Repository File Service to save the delta table contents into the appropriate LOB column of the object.