odi.sdk Public API 新旧版本Demo

阅读更多

以下两个版本都以场景调用为案例

 

1.旧版本Demo API,关键包odi-sdk-invocation.jar

 

 

         OdiCommandScenario ODIcmdScenario = new OdiCommandScenario();
	        ODIcmdScenario.setScenName("SNOWWOLF.ERP_SIEBEL_LOAD_DISTRIBUTOR_RS_DATA_CDC");
	        ODIcmdScenario.setScenVersion("001");
	        ODIcmdScenario.setContext("Global");
	        ODIcmdScenario.setLogLevel(5);
	        ODIcmdScenario.addVariable("SNOWWOLF.SIEBEL_IMPORT_STATUS", "未导入");//PROJECT NAME.VAR NAME
	        //set synchronous mode
	        ODIcmdScenario.setSyncMode(OdiScenario.SYNC_MODE_SYNCHRONOUS);
	        //set connection details
	        OdiRepositoryConnection ODIConnection = new OdiRepositoryConnection();
	        ODIConnection.setJdbcDriver("oracle.jdbc.driver.OracleDriver");
	        ODIConnection.setJdbcUrl("jdbc:oracle:thin:@xxx.xx.x.xxx:1521:orcl");
	        ODIConnection.setJdbcUser("SOAM");
	        ODIConnection.setJdbcPassword("TMP");
	 
	        ODIConnection.setOdiUser("ADMIN");
	        ODIConnection.setOdiPassword("TMP");
	        ODIConnection.setWorkRepositoryCode("SOAWDEV");
	 
	
	        try
	        {
	        OdiInvocation ODIInvocation = new OdiInvocation("xxx.xx.x.xxx", 20913);//port:must be scheduler agent port
	        OdiInvocationResult ODIresult = ODIInvocation.invokeCommand(ODIcmdScenario, ODIConnection);
	        int status ;
	 
	        if (ODIresult.isOk())
	        {
	        status = 1;
	    //    logger.debug("Session " + ODIresult.getSessionNumber());
	        }
	        else
	        {
	        status = 0;
	     //   logger.debug("Error in connecting to repository " + ODIresult.getErrorMessage());
	        }
	        ODIInvocation.close();
	        }
	        catch (Exception e)
	        {
	            e.printStackTrace();
	    //    logger.debug("Exception " + io);
	        }   

  2.新版本API   通过代理方式

     在线API http://docs.oracle.com/cd/E23943_01/apirefs.1111/e17060/toc.htm

 

 

 RemoteRuntimeAgentInvoker invoker = new RemoteRuntimeAgentInvoker(
        "http://localhost:8001/oraclediagent", this.getOdiUsername(), SnpsStringTools.replaceNVL(this.getOdiPassword()).toCharArray());


ExecutionInfo  executeinfo= invoker.invokeStartScenario("I_SWY_DM_WTJG_TTT", "001",
    		  new StartupParams(), "", "GLOBAL", 5,
    		  "From Web Call", true, "WORKREP");
       
 

 

 

你可能感兴趣的:(ETL,ELT,ODI)