5 Replies Latest reply: Jun 4, 2012 12:27 AM by Bijal RSS

    Calling ODI scenario fom java program

    Bijal
      Hi,

      i have my ODI scenario. But i need to execute that scenario from a java code n pass variables as well. can any one plz guide me how to do it
        • 1. Re: Calling ODI scenario fom java program
          SH
          Take a look at the ODI SDK. All the classes you need for executing a scenario from Java are detailed there.

          http://docs.oracle.com/cd/E17904_01/apirefs.1111/e17060/toc.htm
          • 2. Re: Calling ODI scenario fom java program
            Bijal
            in wich package is are these classes available
            • 3. Re: Calling ODI scenario fom java program
              SH
              Take a look at the following link there are code samples available for download which show how to manipulate scenarios via the ODI SDK.

              http://www.oracle.com/technetwork/indexes/samplecode/dataintegration-sample-522116.html
              • 4. Re: Calling ODI scenario fom java program
                Bhabani Ranjan
                I am afraid no one will provide the exact code for your requirement. You need to do some research on SDK.
                How to access odi object through sdk, then how to invoke then how to pass variable.

                To learn about SDK visit odiexprts.com and search for SDK. Here is the basic code to invoke a scenario using sdk.
                Once you will get the basic idea you can take the help of StartupParameter to pass variable. .

                agent = new RemoteRuntimeAgentInvoker("http://localhost:20910/oraclediagent", "SUPERVISOR", "SUNOPSIS".toCharArray());
                startupParams = new StartupParams();
                agent.invokeStartScenario("RUNCOMMAND", "001", startupParams, "", "DEV", 5, "Dynamic", true, "WORKREP1");

                OP:Let us know whether link given by SH and my reply is helpful for you or not and then please close the thread.

                Thanks.

                Edited by: Bhabani on Jun 1, 2012 1:44 PM
                • 5. Re: Calling ODI scenario fom java program
                  Bijal
                  Hi,

                  In 11g we have a folder oracle.sdk in our ODI home. So from there pick up the following jars and paste in ur java classpath:
                  1)     bsf.jar
                  2)     bsh-2.0b2.jar
                  3)     commons-collections-3.2.jar
                  4)     eclipselink.jar
                  5)     odi-core.jar
                  6)     ojdl.jar
                  7)     oracle.ucp_11.1.0.jar
                  8)     persistence.jar
                  9)     spring-beans.jar
                  10)     spring-core.jar
                  11)     spring-dao.jar
                  12)     spring-jdbc.jar

                  After that this was the code. Edit as per ur requirements.

                  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();
                  }
                  }
                  }