X

Welcome to All Things Warehouse Builder

  • SDK
    March 2, 2012

ODI 11g – Insight to the SDK

David Allan
Architect

This post is a useful index into the ODI SDK that cross references the type names from the user interface with the SDK class and also the finder for how to get a handle on the object or objects. The volume of content in the SDK might seem a little ominous, there is a lot there, but there is a general pattern to the SDK that I will describe here.

Also I will illustrate some basic CRUD operations so you can see how the SDK usage pattern works. The examples are written in groovy, you can simply run from the groovy console in ODI 11.1.1.6.

Entry to the Platform


ObjectFinder SDK
odiInstanceodiInstance (groovy variable for console)OdiInstance

Topology Objects


ObjectFinderSDK
TechnologyIOdiTechnologyFinderOdiTechnology
ContextIOdiContextFinderOdiContext
Logical SchemaIOdiLogicalSchemaFinderOdiLogicalSchema
Data ServerIOdiDataServerFinderOdiDataServer
Physical SchemaIOdiPhysicalSchemaFinderOdiPhysicalSchema
Logical Schema to Physical MappingIOdiContextualSchemaMappingFinderOdiContextualSchemaMapping
Logical AgentIOdiLogicalAgentFinderOdiLogicalAgent
Physical AgentIOdiPhysicalAgentFinderOdiPhysicalAgent
Logical Agent to Physical MappingIOdiContextualAgentMappingFinderOdiContextualAgentMapping
Master RepositoryIOdiMasterRepositoryInfoFinderOdiMasterRepositoryInfo
Work RepositoryIOdiWorkRepositoryInfoFinderOdiWorkRepositoryInfo

Project Objects


ObjectFinder SDK
ProjectIOdiProjectFinderOdiProject
FolderIOdiFolderFinderOdiFolder
InterfaceIOdiInterfaceFinderOdiInterface
PackageIOdiPackageFinderOdiPackage
ProcedureIOdiUserProcedureFinderOdiUserProcedure
User FunctionIOdiUserFunctionFinderOdiUserFunction
VariableIOdiVariableFinderOdiVariable
SequenceIOdiSequenceFinderOdiSequence
KMIOdiKMFinderOdiKM

Load Plans and Scenarios


ObjectFinder SDK
Load PlanIOdiLoadPlanFinderOdiLoadPlan
Load Plan and Scenario FolderIOdiScenarioFolderFinderOdiScenarioFolder

Model Objects 


ObjectFinder SDK
ModelIOdiModelFinderOdiModel
Sub ModelIOdiSubModelOdiSubModel
DataStoreIOdiDataStoreFinderOdiDataStore
ColumnIOdiColumnFinderOdiColumn
KeyIOdiKeyFinderOdiKey
ConditionIOdiConditionFinderOdiCondition

Operator Objects


ObjectFinder SDK
Session FolderIOdiSessionFolderFinderOdiSessionFolder
SessionIOdiSessionFinderOdiSession
ScheduleOdiSchedule

 

How to Create an Object?

Here is a simple example to create a project, it uses IOdiEntityManager.persist to persist the object.

import oracle.odi.domain.project.OdiProject;
import oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition;

txnDef = new DefaultTransactionDefinition();
tm = odiInstance.getTransactionManager()
txnStatus = tm.getTransaction(txnDef)

project = new OdiProject("Project For Demo", "PROJECT_DEMO")
odiInstance.getTransactionalEntityManager().persist(project)
tm.commit(txnStatus)

How to Update an Object?

This update example uses the methods on the OdiProject object to change the project’s name that was created above, it is then persisted.

import oracle.odi.domain.project.OdiProject;
import oracle.odi.domain.project.finder.IOdiProjectFinder;
import oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition;

txnDef = new DefaultTransactionDefinition();
tm = odiInstance.getTransactionManager()
txnStatus = tm.getTransaction(txnDef)

prjFinder = (IOdiProjectFinder)odiInstance.getTransactionalEntityManager().getFinder(OdiProject.class);
project = prjFinder.findByCode("PROJECT_DEMO");

project.setName("A Demo Project");

odiInstance.getTransactionalEntityManager().persist(project)
tm.commit(txnStatus)

How to Delete an Object?

Here is a simple example to delete all of the sessions, it uses IOdiEntityManager.remove to delete the object.

import oracle.odi.domain.runtime.session.finder.IOdiSessionFinder;
import oracle.odi.domain.runtime.session.OdiSession;
import oracle.odi.core.persistence.transaction.support.DefaultTransactionDefinition;

txnDef = new DefaultTransactionDefinition();
tm = odiInstance.getTransactionManager()
txnStatus = tm.getTransaction(txnDef)

sessFinder = (IOdiSessionFinder)odiInstance.getTransactionalEntityManager().getFinder(OdiSession.class);
sessc = sessFinder.findAll();
sessItr = sessc.iterator()
while (sessItr.hasNext()) {
  sess = (OdiSession) sessItr.next()
  odiInstance.getTransactionalEntityManager().remove(sess)
}
tm.commit(txnStatus)

This isn't an all encompassing summary of the SDK, but covers a lot of the content to give you a good handle on the objects and how they work. For details of how specific complex objects are created via the SDK, its best to look at postings such as the interface builder posting here. Have fun, happy coding!

Join the discussion

Comments ( 4 )
  • Phil Friday, March 23, 2012

    David,

    ODI GUI has an option to duplicate an object like interface, package, procedure, etc.

    Right click the object and select the option "Duplicate Selection".

    Is there a way to do that using SDK?

    -Phil


  • David Friday, March 23, 2012

    Hi Phil

    There doesn't look to be a way of simply using a similar duplication method that is in the UI. I tried the 'clone' method at the root of the object tree but it threw an error.

    Cheers

    David


  • guest Wednesday, September 5, 2012

    Hi David,

    Just to make sure. So it is not possible to duplicate an interface or an object right?

    Thanks,

    Ganim.


  • David Wednesday, September 5, 2012

    Hi Ganim

    I think the only way to duplicate(copy-paste) via the SDK today is using the export/import services.

    Cheers

    David


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.