Designing with Sun JCA Adapters

Using the Oracle Applications Wizard and JCA Adapter Tooling with an EJB Project

The following task outlines the steps need to implement a specific EJB project using the Oracle Applications Adapter Wizard. The results are written to an output file.

ProcedureTo implement the Oracle Applications JCA Adapter with an EJB Project

  1. Create the required connector or connectors in the Application Server. In this particular example, create a connector for the File eWay and another for the Oracle Applications eWay.

  2. Navigate to the Application Server Admin Console at htt://localhost:4848.

  3. Configure the parameters for your connectors under Resources > Connector > Connector Connection Pool and Resources > Connector > Connector Resources.

  4. Launch NetBeans.

  5. From the File menu, select Enterprise > EJB Module.

  6. Create a new EJB project OracleAppsInvokeEJB

    New EJB Project
  7. Launch the Oracle wizard by right—clicking on the OracleAppsInvokeEJB project and selecting New.

    Launch Oracle Wizard
  8. Select Other > SOA > Oracleapps OTD Wizard.

  9. Click Next.

  10. Enter the Oracle Applications database connection information, and click Next.

    Oracle Applications Connection Information
  11. Select the Oracle Applications Business Function and Module for the project, and click Next.

    Oracle Applications Module
  12. Enter a name for the OTD.

    Enter Name for OTD

    An OTD and a JAR file containing the code corresponding to the above selected database objects are generated. The OTD is generated in the project at the location src/java/otds. The JAR file is added to the project libraries.

    OTD JAR Generation
  13. Create a JCA-driven MDB by navigating to the File menu, and selecting New Project > Enterprise.

    JCA-driven MDB
  14. Enter the required information for the JCA-driven MDB.

    MDB Information
  15. Select File Inbound RAR as the Inbound JCA.

    Choose File Inbound RAR
  16. Edit the Inbound File JCA configuration parameters in the following two dialogue windows.

    Edit JCA Configuration Parameters First BoxEdit JCA Configuration Parameters Second Box

    An MDB is created.

    Generated MDB
  17. In the generated MDB, drag Oracle Applications from the palette to invoke Oracle Applications.

  18. Drag and drop the File JCA onto the onContents() of the MDB, and enter the parameters for the File eWay JCA Adapter declarations.

    File JCA Adapter Declaration

    The Resource JNDI Name should be the same as that declared in the GlassFish Application Server (for example, Resources > Connector > Connector Resources)

  19. Select the File OTD that is generated and click Finish.

    Select File OTD
  20. The resulting Java template is created.

    File Java Template
  21. Drag and drop the Oracle Applications JCA onto the onContents() of the MDB, and enter the parameters for the Oracle Applications JCA Adapter declarations.

    Oracle Applications JCA Adapter Declaration

    The Resource JNDI Name should be the same as that declared in the GlassFish Application Server (for example, Resources > Connector > Connector Resources)

  22. Select the Oracle Applications OTD that is generated and click Finish.

    Select Oracle Applications OTD
  23. The resulting Java template is created.

    Oracle Applications Java Template
  24. Implement the following Java code to the _execute_sample method:


    private void _execute_sample(byte[] data, String encoding, 
    com.stc.connector.fileadapter.appconn.FileClientApplication fileOTD,otdFinBudget.
    OtdFinBudgetOTD oraOTD) throws java.lang.Exception {
    
            int counter = 0;
    
            int budget_count = 0;
    
            int budget_error_count = 0;
    
            int request_ID = -1;
    
            String org_ID = "204";
    
            // Set eWayID
    
            String eWayID = "B";
    
            // Set GroupID
    
            String GroupID = "B";
    
            // Set ObjectID
    
            String ObjectID = "B";
    
            fileOTD.setText("1. =====> Insert record into Budget SB Staging table ..");
    
            fileOTD.write();
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().insert();
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setBUDGET_ENTITY_ID
    (new java.math.BigDecimal("1000"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setBUDGET_ENTITY_NAME("RP_Opnames");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setBUDGET_VERSION_ID
    (new java.math.BigDecimal("1002"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setBUDGET_NAME("CORPORATE 1996");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setCURRENCY_CODE("USD");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setFISCAL_YEAR
    (new java.math.BigDecimal("1996"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setUPDATE_LOGIC_TYPE("A");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSET_OF_BOOKS_ID
    (new java.math.BigDecimal("1"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD_TYPE("Month");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setDR_FLAG("Y");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setACCOUNT_TYPE("A");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD1_AMOUNT
    (new java.math.BigDecimal("100"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD2_AMOUNT
    (new java.math.BigDecimal("200"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD3_AMOUNT
    (new java.math.BigDecimal("300"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD4_AMOUNT
    (new java.math.BigDecimal("400"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD5_AMOUNT
    (new java.math.BigDecimal("500"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD6_AMOUNT
    (new java.math.BigDecimal("600"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD7_AMOUNT
    (new java.math.BigDecimal("700"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD8_AMOUNT
    (new java.math.BigDecimal("800"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD9_AMOUNT
    (new java.math.BigDecimal("900"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD10_AMOUNT
    (new java.math.BigDecimal("1000"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD11_AMOUNT
    (new java.math.BigDecimal("1100"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setPERIOD12_AMOUNT
    (new java.math.BigDecimal("1200"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setCODE_COMBINATION_ID
    (new java.math.BigDecimal("17378"));
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSEGMENT1("01");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSEGMENT2("760");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSEGMENT3("7420");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSEGMENT4("0000");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSEGMENT5("000");
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSB_EWAY_ID(eWayID);
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSB_GROUP_ID(GroupID);
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().setSB_OBJECT_ID(ObjectID);
    
            oraOTD.getSB_GL_BUDGET_INTERFACE().insertRow();
    
            fileOTD.setText("2. =====> Counting record in Budget staging table ...");
    
            fileOTD.write();
    
            oraOTD.getSB_BUDGET_UTILS_PKG_FN_CNT_GL_BUDGET_INT().setP_GROUP_ID(GroupID);
    
            oraOTD.getSB_BUDGET_UTILS_PKG_FN_CNT_GL_BUDGET_INT().setP_OBJECT_ID(ObjectID);
    
            oraOTD.getSB_BUDGET_UTILS_PKG_FN_CNT_GL_BUDGET_INT().setP_EWAY_ID(eWayID);
    
            oraOTD.getSB_BUDGET_UTILS_PKG_FN_CNT_GL_BUDGET_INT().setP_CODE("A");
    
            oraOTD.getSB_BUDGET_UTILS_PKG_FN_CNT_GL_BUDGET_INT().execute();
    
            budget_count = oraOTD.getSB_BUDGET_UTILS_PKG_FN_CNT_GL_BUDGET_INT().
    getRETURN_VALUE1().intValue();
    
            fileOTD.setText("     returned Budget Count  =  
    ".concat( Integer.toString( budget_count )));
    
            fileOTD.write();
    
            fileOTD.setText("\nDone with Step 2");
    
            fileOTD.write();                        
    
        }