본문 바로가기

ETL Tools/Oracle Data Integrator

[ODI 11g] JAVA 통해 ODI Scenario 호출

1. 파일 생성

/**
 *  1. 파일 생성
 */
package oracle.odi.publicapi.samples.agent;

import oracle.odi.core.OdiInstance;
import oracle.odi.core.config.MasterRepositoryDbInfo;
import oracle.odi.core.config.OdiInstanceConfig;
import oracle.odi.core.config.WorkRepositoryDbInfo;
import oracle.odi.core.security.Authentication;
import oracle.odi.runtime.agent.invocation.ExecutionInfo;
import oracle.odi.runtime.agent.invocation.InvocationException;
import oracle.odi.runtime.agent.invocation.RemoteRuntimeAgentInvoker;


/**
 * This sample starts a scenario in a remote agent.
 */
public class OdiStartScenInvocation
{
public static void main(String[] args)
{
try
{
// Starting the session on the remote agent.
RemoteRuntimeAgentInvoker remoteRuntimeAgentInvoker = new RemoteRuntimeAgentInvoker("http://localhost:20910/oraclediagent", "MyOdiUser", "MyOdiPassword".toCharArray());
ExecutionInfo exeInfo = remoteRuntimeAgentInvoker.invokeStartScenario("MYSCENARIO", "001", null, null, "GLOBAL", 5, null, true, "WORKREP");
// Retrieve the session ID.
System.out.println("scenario started in session : " + exeInfo.getSessionId());  //$NON-NLS-1$
}
catch (InvocationException e)
{
System.err.println("Agent NACK received for " + e.getInvocationRequestName()); //$NON-NLS-1$
System.err.print("|Code: " + e.getCode()); //$NON-NLS-1$
System.err.print("|Session Id: " + e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}


참고:
 - new RemoteRuntimeAgentInvoker("Agent Url","ODI User Name(SUPERVISOR)","ODI Password(SUNOPSIS)" );
 

 - remoteRuntimeAgentInvoker.invokeStartScenario("시나리오명(MYSCENARIO)", "버전(001)",/*시나리오에 사용되는 변수값 정의*/ null,/* Keyword?*/ null, "컨텍스트 명(GLOBAL)",/*로그*/ 5, null, /*실행 동기, 비동기*/ true, "워크 리포지토리 정보(WORKREP)");
 

2. 컴파일

javac -classpath  .;C:\oracle\Middleware\Oracle_ODI1\oracledi.sdk\lib\*;
C:\oracle\Middleware\Oracl
e_ODI1\oracledi\agent\lib\* OdiStartScenTest.java


*중요* 컴파일시 참조되는 CLASSPATH 
SDK Library Path - $ODI_HOME/oracledi.sdk/lib/*
Agent Library Path - $ODI_HOME/oracledi/agent/lib/* 

3. 실행

java OdiStartScenInvocation



4. Operator에서 확인