ODI // Getting an OdiInstance
Bisher musste man, wenn man bei der Ausführung einer ODI-Procedure der Technologie „Groovy“ am Agent die SDK ansprechen wollte, manuell im Sourcecode eine Connection zum Master- und Workrepository herstellen. Das macht es notwendig, dass die Connect-Info in einer Konfiguration hinterlegt werden musste.
Seit dem ODI der Version 12.2 gibt es aber eine odiRef-Funktion, die all diesen Aufwand obsolet macht und eine Instanz der Klasse OdiInstance direkt verfügbar macht.
Im Sourcecode schaut der Unterschied folgendermaßen aus:
pre ODI 12.2:
// Master Respository String masterRepositoryJdbcDriver = "oracle.jdbc.OracleDriver"; masterRepositoryJndiName = null; // if agent is running on WLS you could use a JDNI data source for repo connection MasterRepositoryDbInfo mRepDbInfo = null if (masterRepositoryJndiName) mRepDbInfo = new MasterRepositoryDbInfo(masterRepositoryJndiName, new PoolingAttributes()); else { masterRepositoryJdbcUrl = "jdbc:oracle:thin:@host:port/service"; masterRepositoryJdbcUser = "ODI_REPO_SCHEMA"; masterRepositoryJdbcPassword = "*****"; mRepDbInfo = new MasterRepositoryDbInfo(masterRepositoryJdbcUrl, masterRepositoryJdbcDriver, masterRepositoryJdbcUser, masterRepositoryJdbcPassword.toCharArray(), new PoolingAttributes()); } // Work Repository workRepositoryName = "WORKREP"; WorkRepositoryDbInfo wRepDbInfo= new WorkRepositoryDbInfo(workRepositoryName, new PoolingAttributes()); // ODI Instance OdiInstance odiInstance = OdiInstance.createInstance(new OdiInstanceConfig(mRepDbInfo, wRepDbInfo)); // Authentication odiUser = "SUPERVISOR"; odiPassword = "*****"; Authentication auth = odiInstance.getSecurityManager().createAuthentication(odiSupervisorUser, odiSupervisorPassword.toCharArray()); odiInstance.getSecurityManager().setCurrentThreadAuthentication(auth); // Transaction ITransactionDefinition txnDef = new DefaultTransactionDefinition(); ITransactionManager tm = odiInstance.getTransactionManager(); tme = odiInstance.getTransactionalEntityManager(); ITransactionStatus txnStatus = tm.getTransaction(txnDef); // // ... place your SDK code here ... // tm.commit(txnStatus); // or tm.rollback(txnStatus); auth.close(); odiInstance.close();
ab ODI 12.2:
OdiInstance odiInstance = odiRef.getOdiInstance(); // Transaction ITransactionDefinition txnDef = new DefaultTransactionDefinition(); ITransactionManager tm = odiInstance.getTransactionManager(); tme = odiInstance.getTransactionalEntityManager(); ITransactionStatus txnStatus = tm.getTransaction(txnDef); // // ... place your SDK code here ... // tm.commit(txnStatus); // or tm.rollback(txnStatus); odiInstance.close();
Sehr interessanter Beitrag.
Woher haben Sie diese Information?
Haben Sie mit groovy schon in Richtung CI, CD etwas gemacht?
Haben Sie versucht damit SQL zu ODI Mappings umzuwandeln?
Danke vorab
Hallo,
diese Info habe ich in der ODI-Dokumentation gefunden.
Bez. CI/CD: ich habe schon einmal automatischen SVN-Checkout und ODI-Import basierend auf SVN-Tags realisiert. In einem Prototyp habe ich das auch mit Jenkins automatisiert.
Bez. SQL zu ODI-Mapping: leider noch nicht, wäre aber sicher eine interessante Anwendung …
MfG Roland Brandfellner