6 Extending and Customizing Oracle Enterprise Scheduler Jobs

This chapter describes how to use Oracle JDeveloper or Oracle Enterprise Manager Fusion Applications Control to create and extend scheduled jobs using Oracle Enterprise Scheduler.

This chapter includes the following sections:

6.1 About Extending and Customizing Oracle Enterprise Scheduler Jobs

Enterprise applications require the ability to respond to many real-time transactions requested by end users or web services. However, they also require the ability to offload larger transactions to run at a future time, or automate the running of application maintenance work based on a defined schedule.

Oracle Enterprise Scheduler provides the ability to run different job types, including: Java, PL/SQL, and spawned processes, distributed across nodes in a server cluster. Oracle Enterprise Scheduler runs these jobs securely, and provides monitoring and management through Fusion Applications Control.

Oracle Enterprise Scheduler provides scheduling services for the following purposes:

  • Distributing job request processing across a cluster of servers

  • Running Java, PL/SQL, and binary jobs

  • Scheduling job requests based on recurrence

  • Managing job requests with Fusion Applications Control

Oracle Enterprise Scheduler provides the critical requirements in a service-oriented environment to automate processes that must recur on a scheduled basis and to defer heavy processing to specific time windows. Oracle Enterprise Scheduler lets you:

  • Support sophisticated scheduling and workload management

  • Automate the running of administrative jobs

  • Schedule the creation and distribution of reports

  • Schedule a future time for a step in a business flow for business process management

Main Steps for Extending Oracle Enterprise Scheduler Jobs

Extending Oracle Enterprise Scheduler jobs involves the following main steps:

  1. Develop the code that implements the job logic.

  2. Create a metadata file for the job definition.

  3. Grant permissions to the job, such that only those with the proper permissions can request job submission.

  4. Enable job request submission, using an existing host application, a preconfigured user interface, or a new customized application.

Main Steps for Customizing Oracle Enterprise Scheduler Jobs

Customizing Oracle Enterprise Scheduler jobs involves editing job properties using Oracle Enterprise Manager Fusion Applications Control. The job properties that you can modify are described in Table 6-10.

6.1.1 Before You Start Extending and Customizing Oracle Enterprise Scheduler Jobs

Before you extend and customize Oracle Enterprise Scheduler jobs, you should be familiar with the Oracle Fusion application architecture that enables customization, as described in Customizing and Extending . You should also understand the typical workflow for working with customizations, as described in Understanding the Customization Development Life Cycle.

You will need to do the following before you can begin extending Oracle Enterprise Scheduler jobs:

  • For developers:

    Set up JDeveloper. For more information, see About Installing Customization Tools.

    Ensure that you have configured the target environment to which you want to deploy.

  • For administrators:

    • Install Oracle Fusion Applications, making sure to provision Oracle Enterprise Scheduler services.

      Start Oracle Enterprise Manager Cloud Control. For more information about starting and using Cloud Control, see "Getting Started with Enterprise Manager Cloud Control" in the Administrator's Guide.

6.2 About Extending Custom Oracle Enterprise Scheduler Jobs Using Existing Oracle Fusion Applications

There are two main use cases for creating Oracle Enterprise Scheduler jobs.

  • Oracle Enterprise Scheduler Administrator

    Administrators can create a new job definition using Oracle Enterprise Manager Fusion Applications Control console or Fusion Applications, using an existing host application. Scheduled jobs typically required by administrators include database maintenance tasks using PL/SQL or running spawned jobs or scripts such as SQL*Plus scripts to load data into the database. After you have defined the job, use Oracle Enterprise Manager Fusion Applications Control to submit the job request.

  • Developer or System Integrator

    When using an existing host application, use Fusion Applications Control to create Oracle Business Intelligence Publisher, PL/SQL, and spawned jobs. Use JDeveloper to create Java jobs and develop a new host application that executes a set of jobs. A Java job might invoke an ADF Business Components service or a service-oriented architecture (SOA) composite application, for example.

    In cases where there is no need to repackage the host application, PL/SQL, binary, Oracle BI Publisher and Java jobs can be added to any host application. Optionally, you can execute Java jobs from a custom host application.

    System integrators may want to use Fusion Applications Control to develop a job, while developers may prefer JDeveloper. Jobs are typically submitted using the scheduled request submission UI. Alternatively, it is possible to develop an Oracle Application Development Framework application with screens for submitting Oracle Enterprise Scheduler jobs.

About Implementing Logic for the Oracle Enterprise Scheduler Jobs

An Oracle Enterprise Scheduler job is a request to execute a specific task written in code or a script, such as Java, PL/SQL, spawned jobs, and so on.

An example of logic to be implemented by a scheduled job is writing particular data to a database under certain conditions, for example, daily shift schedules for a given subset of employees.

About Creating a Job Definition Metadata File

An Oracle Enterprise Scheduler job definition specifies the type of job to be run (such as Java, PL/SQL type jobs, and so on), the host application that will run the job, and any additional required or optional parameters and properties for the job.

It is possible to create a job definition in Oracle Enterprise Manager Fusion Applications Control or JDeveloper.

The minimum required properties and parameters for each job type are as follows:

  • Oracle BI Publisher jobs: Specify the reportid parameter. Specify Oracle BI Publisher parameters as job parameters with required validation. These can be entered by end users during request submission using the request submission user interface.

    If the report is a bursting report, identify it as such by selecting the bursting check box.

  • PL/SQL jobs: In the job definition, specify the PL/SQL procedure that includes the job logic implementation.

    All input arguments to the PL/SQL procedure can be specified as parameters with required validation. These can be entered by end users during request submission using the request submission user interface.

  • All other job types: Specify the name of the implementation logic and parameters in the job definition.

For more information about creating a job definition in Oracle Enterprise Manager Fusion Applications Control, see the "Managing Oracle Enterprise Scheduler Service and Jobs" chapter in the Administrator's Guide.

For more information about creating a job definition in JDeveloper, see the "Working with Extensions to Oracle Enterprise Scheduler" chapter in the Developer's Guide.

About Granting Relevant Permissions

Grant the appropriate permissions for the application using Oracle Authorization Policy Manager.

An example of the use of relevant permissions is to grant execution permissions to a role (an identity that determines permitted access to application functions and data) so that users belonging to that role can submit the job.

For more information about granting relevant permissions to roles in a deployed application using Oracle Authorization Policy Manager, see the "Securing Oracle Fusion Applications" chapter of the Administrator's Guide.

About Enabling Job Request Submissions

You can enable job request submissions through an Oracle ADF user interface using JDeveloper or Fusion Applications Control.

When using JDeveloper to enable job request submissions through an Oracle ADF user interface, you must define a view object to capture properties filled in by end users.

If a job is defined with properties that must be filled in by end users, the user interface allows end users to fill in these properties prior to submitting the job request. For example, if the job requires start and end times, end users can fill in the desired start and end times in the space provided by the user interface.

The properties that are filled in by end users are associated with a view object, which in turn is associated with the job definition itself. When the job runs, Oracle Enterprise Scheduler accesses the view object to retrieve the values of the properties.

You could, alternatively, submit job requests using Fusion Applications Control. Using Fusion Applications Control to enable job request submissions through an Oracle ADF user interface does not require you to create a view object for capturing end user data.

Note:

For example, suppose a parameter view object is view-linked to another view object. If you customize the view object using JDeveloper, then the Oracle Enterprise Scheduler job submission UI list of values reflects this customization, if the customization is in the Oracle Metadata Services runtime database.

For more information about submitting job requests using Fusion Applications Control, see the Submitting an Oracle Enterprise Scheduler Job Request" chapter in the Administering Oracle Enterprise Scheduler.

For more information about defining a view object for use with a job submission interface, see the "Working with Extensions to Oracle Enterprise Scheduler" chapter in the Developer's Guide.

6.2.1 About Extending a Custom PL/SQL Oracle Enterprise Scheduler Job

Extending a custom PL/SQL Oracle Enterprise Scheduler job involves creating a PL/SQL package and defining job metadata.

6.2.1.1 Implementing the Logic for the PL/SQL Job

Implementing a PL/SQL scheduled job involves creating a PL/SQL package and defining the job metadata using the PL/SQL job type. The PL/SQL procedure in the package runs as the scheduled job, and the PL/SQL procedure, therefore, must be written to accept the required errbuf and retcode arguments.

To implement the logic for a PL/SQL job:

  1. Create a PL/SQL package, including the required errbuf and retcode arguments. A sample PL/SQL package is shown in the following example.

  2. Deploy the package to Oracle Database.

  3. Grant the required permissions, and perform any other necessary tasks in the database.

    grant execute on xxSamplePkg to FUSION_APPS_EXECUTE;
    

    For more information about granting permissions for the execution of a PL/SQL job, see the "Performing Oracle Database Tasks for PL/SQL Stored Procedures" section in the Developing Applications for Oracle Enterprise Scheduler.

  4. Test the package.

Example 6-1 Sample PL/SQL package

CREATE OR REPLACE PACKAGE XxSamplePkg AUTHID CURRENT_USER AS
 
Procedure SampleJob (
     errbuf out NOCOPY varchar2,
     retcode out NOCOPY varchar2,
     name in varchar2 );
 
END XxSamplePkg;
/
 
CREATE OR REPLACE PACKAGE BODY XxSamplePkg AS
 
Procedure SampleJob (
 errbuf out NOCOPY varchar2,
 retcode out NOCOPY varchar2,
 name in varchar2 )
 IS
 
begin
      -- Write log file content using the FND_FILE API.
      FND_FILE.PUT_LINE(FND_FILE.LOG, 'Running Stored procedure SampleJob..........');
      FND_FILE.PUT_LINE(FND_FILE.LOG, 'FND USERNAME : ' || FND_GLOBAL.USER_NAME);
 
      -- Write log file content using the FND_FILE API.
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT,' Name : ' || name );
      FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'Job Request id : ' || FND_JOB.REQUEST_ID );
 
      errbuf := fnd_message.get_string('FND', 'COMPLETED NORMAL');
      retcode := 0;
 
  end SampleJob;
 
END XxSamplePkg;
/

6.2.1.2 Creating a Job Definition Metadata File for the PL/SQL Job

Use the Setup and Maintenance work area to define a job definition metadata file for the PL/SQL job. The job definition metadata file may also include user properties for the PL/SQL job as well as UI parameters to be displayed at runtime.

For more information about creating an Oracle Enterprise Scheduler metadata file, see the "Creating or Editing a Job Definition" section in the "Managing the Work of Oracle Enterprise Scheduler Jobs" chapter in Administering Oracle Enterprise Scheduler.

To create a job definition metadata file for a PL/SQL job:

  1. Click your name in the global area of Oracle Fusion Applications and select Setup and Maintenance, then click All Tasks. Search for tasks starting with "Manage Custom Enterprise Scheduler Jobs%". This will list tasks per application for creating Oracle Enterprise Scheduler jobs.

  2. From the list of tasks that is displayed, select the relevant UI application you will use to host the job definitions and parameter view objects. This Oracle Fusion application is the portlet producer application for the job.

    Click Go to Task.

    The Manage Job Definitions tab is displayed, as shown in the following figure.

    Figure 6-1 Manage Job Definitions Tab

    Manage Job Definitions Tab
  3. In the Manage Job Definitions tab, click New.

  4. In the Create Job Definition tab, click Show More to display all parameters and enter the values for the job shown in the following table.

    Table 6-1 PL/SQL Job Definition Values

    Field Description

    Display Name

    Enter a display name for the job.

    Name

    Enter a name for the job definition.

    Path

    Specify the trailing package name for the job definition metadata. The default namespace or path for custom job definitions begins with oracle/apps/ess/custom. For example, when entering test in the Path text field, the job definition is stored in the globalEss MDS namespace as oracle/apps/ess/custom/test.

    Job Application Name

    From the dropdown list, select the name of the host application running the Oracle Enterprise Scheduler job.

    Job Type

    Select the job type from the dropdown list, namely the PlsqlJobType.

    Procedure Name

    Enter the name of the stored procedure to run as part of the PL/SQL job execution.

    Standard request submission flag

    Check this box to indicate that the job request is to be submitted in the standard manner.

  5. At the bottom of the pane, click the User Properties tab. Define the following user properties by clicking New, as shown in the following table.

    Table 6-2 PL/SQL User Properties

    Name Data Type Default Value Read Only

    EXT_PortletContainerWebModule

    String

    For the default value, enter the name of the web module that will be used as a portlet when submitting the job request. This is the short name of the hosting application that contains the ScheduleRequest task flow. This short name is defined in the TopologyManager tables in FUSION_SETUP schema. There is a URL that corresponds to each short name that is used to connect to the remote ScheduleRequest task flow.

    N/A

    numberOfArgs

    String

    Set the number of job submission arguments. This number excludes errbuf and retcode, as these are not submission arguments.

    N/A

    Note:

    Typically, the web context is registered as the web module name. Verify with your applications administrator the value of the registered web module name in the Topology Manager work area. Registering the correct web module name enables the correct remote rendering of the Oracle Fusion application job request parameters from the Oracle Enterprise Scheduler central UI. (The web module name should match the one already provisioned in the TopologyManager tables.)

  6. Click the Job_Definition_Name>: Parameters tab and specify UI parameters as required. These UI parameters get stored as parameter view objects internally. The UI parameter fields are described in the following table.

    Table 6-3 PL/SQL Job UI Parameters

    Field Description

    Prompt

    Enter the text to be displayed at the prompt that is displayed during runtime.

    Data Type

    From the dropdown list, select the relevant data type.

    Page Element

    From the dropdown list, select the UI page element you want to use to display the parameter, for example, a text box.

  7. Click Save and Close to create and save the new Oracle Enterprise Scheduler PL/SQL job definition.

6.2.2 About Extending a Custom Java Oracle Enterprise Scheduler Job

Implementing a Java scheduled job involves implementing the Java business logic and defining the relevant Oracle Enterprise Scheduler job metadata. Use JDeveloper to implement a Java job and deploy the job as a shared library. Modify the deployment descriptor of the deployed user interface or host application Enterprise Archive (EAR) file so that it points to the shared library. Redeploy the file.

Deploying the job as a shared library allows you to add additional jobs in the future without having to redeploy the host application. For more information about deploying Oracle ADF applications, see the "Deploying Fusion Web Applications" chapter in the Developing Fusion Web Applications with Oracle Application Development Framework.

6.2.2.1 Implementing the Logic for the Java Job

In order to develop an application that runs a Java class under Oracle Enterprise Scheduler, you must define the Java class that implements the Oracle Enterprise Scheduler executable interface. The executable interface defines the contract that enables using Oracle Enterprise Scheduler to invoke a Java class.

To create a Java class for an existing Oracle Enterprise Scheduler Oracle Fusion application, take the following steps:

  • Create an application in JDeveloper.

  • Create a project in JDeveloper.

  • Develop the application code that uses the Oracle Enterprise Scheduler Java APIs.

To implement the logic for an Oracle Enterprise Scheduler Java job:

  1. In JDeveloper, create an application and project. Make sure to include Enterprise JavaBeans (EJB) and Java technologies in the project.

  2. Add the Oracle Enterprise Scheduler extensions to the project.

    1. In the Navigator, right-click the project you just created. Select Project Properties, and then select Libraries and Classpath.

    2. In the Libraries and Classpath pane, click Add Library.

    3. In the Add Library window, in the Libraries field, select Enterprise Scheduler Extensions and click OK.

  3. Create a Java class using the Oracle Enterprise Scheduler package.

    1. In the project overview tab, click the Java Files link.

    2. In the Java Files pane, click New. From the Create New in Project menu, select Project Name and then select Java Class.

      The Create Java Class window is displayed.

    3. In the Create Java Class window, enter a name for the Java class and the package name in the fields provided. For example, if working with the Financials Oracle Fusion application, the package name would be oracle.apps.financials.ess.program. Accept the remaining default values.

  4. In the Java class, develop the code that will do the work of the Java job. The following code sample illustrates the use of an Oracle Enterprise Scheduler job request file handle and writes a job request parameter submitted to the request log and output files.

Example 6-2 Sample Java code

package oracle.apps.financials.ess.program;
 
   import java.io.IOException;
   import oracle.as.scheduler.Cancellable;
   import oracle.as.scheduler.Executable;
 
   import oracle.as.scheduler.ExecutionCancelledException;
   import oracle.as.scheduler.ExecutionErrorException;
   import oracle.as.scheduler.ExecutionPausedException;
   import oracle.as.scheduler.ExecutionWarningException;
   import oracle.as.scheduler.RequestExecutionContext;
 
   import oracle.as.scheduler.RequestParameters;
   import oracle.as.scheduler.SystemProperty;

   import oracle.as.scheduler.cp.exec.ProcessHelper;
   import oracle.as.scheduler.cp.file.LogFile;
   import oracle.as.scheduler.cp.file.OutputFile;
 
   public class XxSampleJob implements Executable, Cancellable {
 
      private OutputFile requestOutput;
      private LogFile requestLog;
 
      private boolean m_isCancelled = false;
 
      private long request_id = 0L;
      private String requestParameter1 = null;
 
      public XxSampleJob() {
          super();
      }
  
      public void execute(RequestExecutionContext ctx,
                          RequestParameters params) throws ExecutionErrorException,
                                                           ExecutionWarningException,
                                                           ExecutionCancelledException,
                                                           ExecutionPausedException {
 
          request_id = ctx.getRequestId();
 
          System.out.println("XxSampleJob Running, Request ID: " +
                             ctx.getRequestId());
       
          try {        
          
              String userFileDir =
                          (String)params.getValue(SystemProperty.USER_FILE_DIR);
 
              String sysPropUserName =
                          (String)params.getValue(SystemProperty.USER_NAME);
           
              // Read the job request parameter.
              requestParameter1 = (String) params.getValue("submit.argument1");
 
              requestOutput = ProcessHelper.getOutputFile();
              requestOutput.writeln("Sample ESS Java job execution OUTPUT");          
              requestOutput.writeln("USER_NAME as SystemProperty: " +
                                    sysPropUserName);
              requestOutput.writeln("ESS Job requestID: " + request_id);
              requestOutput.writeln("ESS Job request parameter: "
                                                          + requestParameter1);
 
              requestLog = ProcessHelper.getLogFile();
              requestLog.writeln("Sample ESS Java job execution LOG");       
              requestLog.writeln("ESS requestFileDirectory: " + userFileDir);
              requestLog.writeln("ESS Job requestID: " + request_id);
              requestLog.writeln("ESS Job request parameter: "
                                                          + requestParameter1);
 
          }  catch (Exception ex) {
           
              System.out.println("Exception running XxSampleJob: " +
                                 ex.getMessage());
              ex.printStackTrace();
           
          } finally {
 
              try {
               
                  // Close all open job request log and output files.
                  ProcessHelper.closeAllFiles();
               
              } catch (IOException ioe) {
               
                  System.out.println("Exception closing files: " +
                                     ioe.getMessage());
                  ioe.printStackTrace();
              }
 
          }
 
      }
 
      @Override
      public void cancel() {
          m_isCancelled = true;
      }
 
   }

6.2.2.2 Deploying the Java Business Logic

To deploy the Java logic of an Oracle Enterprise Scheduler Java job, identify an existing Oracle Fusion application as the target host application.

Next, update the Java business logic for an existing Oracle Fusion application as follows:

  • Package the Java application in a Java Archive (JAR) file.

  • Update JAR module in the Oracle Fusion application class path.

  • Bounce the server instance to load the Java program logic in the Oracle Fusion application class loader.

To deploy the Java business logic:

  1. Create a deployment profile for the project.

    1. In JDeveloper, from the Navigator, select the project you created. Build the project to ensure that the Java class successfully compiles.

    2. Right-click the project, select Project Properties and then Deployment.

    3. In the Deployment Profiles field, click New to create a deployment profile for the JAR file.

      The Create Deployment Profile window is displayed.

    4. In the Create Deployment Profile window, enter a name for the deployment profile and click OK.

    5. In the Edit JAR Deployment Profile Properties window, verify that the Java job class is included in the JAR module output and click OK.

  2. Package the Oracle Enterprise Scheduler Java class into a JAR file and deploy it.

    1. From the Navigator, right-click the project you created. Select Deploy and then select the JAR file you just created.

      The Deployment Action window is displayed.

    2. In the Deployment Action window, click Finish to create a packaged JAR file.

      The archive module is deployed to the default project deployment path, for example, $JDEV_HOME/<PROJECT_NAME>/deploy/<JAR_NAME>.jar.

      Note:

      All custom JAR files must begin with the prefix Xx, for example XxMyJar.jar.

  3. Update the JAR module in the application class path of the Oracle Enterprise Scheduler host application.

    1. Locate the expanded deployment directory of the EAR file for the existing Oracle Fusion application, for example $MW_HOME/fusionapps/applications/fin/deploy/EarFinancialsEss.ear/APP-INF/lib.

    2. Copy the deployed custom JAR file to the expanded directory.

  4. In the domain to which the Oracle Enterprise Scheduler host application is deployed, restart the ESSAPP application deployed to the Oracle Enterprise Scheduler domain. (This can be done using Oracle WebLogic Server Console or Oracle Enterprise Manager.)

    The Oracle Enterprise Scheduler job executes the updated Java class after the application class loader successfully loads the updated class.

    For more information about restarting Oracle Enterprise Scheduler, see the "Stopping and Starting Oracle Enterprise Scheduler Service Processes" section in the Administrator's Guide.

6.2.2.3 Creating a Job Definition Metadata File for the Java Job

Using the Setup and Maintenance work area, create a Java type job definition.

To create a job definition metadata file for a Java job:

  1. Click your name in the global area of Oracle Fusion Applications and select Setup and Maintenance, then click All Tasks. Search for all tasks.

  2. From the list of tasks that is displayed, select the relevant UI application you will use to host the job definitions and parameter view objects. This Oracle Fusion application is the portlet producer application for the job.

    Click Go to Task.

    The Manage Job Definitions tab is displayed, as shown in the following figure.

    Figure 6-2 The Manage Job Definitions Tab

    The Manage Job Definitions tab
  3. In the Manage Job Definitions tab, click New.

  4. In the Create Job Definition tab, click Show More to display all parameters and enter the values for the job shown in the following table.

    Table 6-4 Job Definition Values

    Field Description

    Display Name

    Enter a display name for the job.

    Name

    Enter a name for the job definition.

    Path

    Specify the trailing package name for the job definition metadata. The default namespace or path for custom job definitions begins with oracle/apps/ess/custom. For example, when entering test in the Path text field, the job definition is stored in the globalEss MDS namespace as oracle/apps/ess/custom/test.

    Job Application Name

    From the dropdown list, select the name of the host application running the Oracle Enterprise Scheduler job.

    Job Type

    Select the job type from the dropdown list, namely the JavaJobType.

    Class Name

    Enter the qualified class name of the Java business logic.

    Standard request submission flag

    Check this box to indicate that the job request is to be submitted in the standard manner.

  5. In the Create Job Definition window, from the Job Type dropdown list, select JavaJobType.

  6. In the Create Job Definition window, in the Class Name field, enter the fully qualified class name of the Java business logic.

  7. In the Create Job Definition window, In the User Properties tab, define only the EXT_PortletContainerWebModule property.

    Typically, the web context is registered as the web module name. Verify with your applications administrator the value of the registered web module name in the Topology Manager work area. Registering the correct web module name enables the correct remote rendering of the Oracle Fusion application job request parameters from the Oracle Enterprise Scheduler central UI.

  8. Click the <Job Definition Name>: Parameters tab and specify UI parameters as required. The UI parameter fields are described in the following table.

    Table 6-5 Job UI Parameters

    Field Description

    Prompt

    Enter the text to be displayed at the prompt that is displayed during runtime.

    Data Type

    From the dropdown list, select the relevant data type.

    Page Element

    From the dropdown list, select the UI page element you want to use to display the parameter, for example, a text box.

  9. Click Save and Close to create and save the new Oracle Enterprise Scheduler Java job definition.

6.2.3 Submitting Oracle Enterprise Scheduler Jobs

You can use Oracle Fusion Applications to submit Oracle Enterprise Scheduler jobs.

To submit Oracle Enterprise Scheduler jobs:

  1. In the global area of Oracle Fusion Applications, access the Schedule Processes page by clicking the Navigator menu and then choosing Tools and Schedule Processes.
  2. Click Schedule New Process.

    The Search and Select: Process Name window is displayed.

  3. In the Process Name field, enter the name of the Oracle Enterprise Scheduler job you want to schedule and click Search.

    The job name is displayed in the search results table.

  4. From the search results table, select the job name and click OK.

    The Process Details page is displayed.

  5. In the Process Details page, in the Parameters field, specify any required parameters.
  6. Click Submit to request that the Oracle Enterprise Scheduler instance execute the job. Click Close to return to the Scheduled Processes page.
  7. In the Scheduled Processes page, refresh the Search Results table to monitor the status of the submitted job.

6.3 About Creating a Custom Oracle Enterprise Scheduler Application to Extend Oracle Enterprise Scheduler Jobs

Use Apache Ant scripts to develop and deploy an Oracle Enterprise Scheduler host application and user interface. Use JDeveloper to create the relevant metadata.

6.3.1 Creating Host and UI Applications Using an Ant Script

Use the supplied Ant script to create the host and user interface applications for the Oracle Enterprise Scheduler jobs.

When deploying the application, be sure to identify the product family and use an existing registered Oracle WebLogic Server domain. This allows you to test your application without having to create and register a domain, or register any associated applications with the product family.

To create host and user interface applications using scripts:

  1. Extract the Oracle Enterprise Scheduler customer_extensibility script from the JDeveloper installation or JDeveloper extensions to the development work environment, for example, into a folder called template_home.

    The template_home directory contains an Ant build.xml driver file that processes the template Oracle Enterprise Scheduler host and producer web applications by replacing macros with specified input.

  2. Change directories to the template_home directory to create the user_home directory that will contain the resulting macro-substituted files copied from the template_home directory.
  3. Run the script in any of the following ways:
    • Interactively, where you are prompted for the relevant input. Accept the default, if there is one, by pressing Enter at each prompt.

      In the template_home directory, enter ant or ant create-user-home. Following is a code sample of a running script.

    • Using predefined property files. Any properties not defined in a file can be entered at the prompt. A sample properties file is shown in the following example. To create a properties file, run the command $> cat myProperties.properties, where myProperties.properties is the name of the properties file.

      Then run the following command:

      $> ant create-user-home -propertyfile myProperties.properties
      
    • Specifying individual properties at the command line. Any properties not defined in a file can be entered at the prompt. Following is a code sample.

      To view supported options, enter ant help-create-user-home at the prompt.

  4. On successful execution, you can modify the template application workspace from the user_home directory in JDeveloper.

    At the prompt, enter ant help-deploy to list the supported deployment options.

Example 6-3 Interactive Script Execution

$ ant
 Buildfile: build.xml
-init:
 
 create-user-home:
    [input] Enter which template should be used (source_template) (default=Fusion)
    [input]      ([Fusion], Standalone)
                   Fusion
    [input] Enter Middleware Home Directory path (fmw_home_dir) (default=) []
            /JDEVADF_INSTALLATION/
    [input] Enter host application name (hosting_application_name) (default=MyAppEss) [MyAppEss]
            MyAppEss
    [input] Enter host application JPS stripe id (hosting_application_stripe_id)  
            (default=MyAppEss) [MyAppEss]
            MyAppEss
    [input] Enter UI application name (ui_application_name) (default=MyApp) [MyApp]
            MyApp
    [input] Enter UI application JPS stripe ID (ui_application_stripe_id) (default=MyApp) [MyApp]
            MyAppEss
    [input] Enter the shared library name for the job business logic (jobdef_library_name)
            (default=MyJobsLibrary) [MyJobsLibrary]
            oracle.ess.shared
    [input] Enter an empty directory where the applications will be created (user_home)
            /workspace/ess_user_home
     [echo]
     [echo]
    [mkdir] Created dir: /workspace/ess_user_home
 [propertyfile] Creating new property file: /workspace/ess_user_home/template.properties
     [copy] Copying 31 files to /workspace/ess_user_home
     [copy] Copied 36 empty directories to 14 empty directories under /workspace/ess_user_home
     [copy] Copying 19 files to /workspace/ess_user_home
     [move] Moving 1 file to /workspace/ess_user_home/Template_Hosting
     [move] Moving 1 file to /workspace/ess_user_home/Template_UI
     [echo]
     [echo] ========================================
     [echo]
     [echo] A new application workspace has been created at: /workspace/ess_user_home
     [echo] This application workspace can be opened and modified using JDeveloper
     [echo] To deploy the applications, run the following command:
     [echo]     ant -f /workspace/ess_user_home/ant/build-ess.xml deploy
     [echo] To create new jobs from predefined templates, run the following command:
     [echo]     ant -f /workspace/ess_user_home/build.xml create-new-job-def
 
 BUILD SUCCESSFUL

Example 6-4 Script Execution Via Property Files

user_home=/home/myuser/ess_user_home/
 
 ui_application_name=MyApp
 ui_application_stripe_id=MyApp
 ui_application_version=V2.0
 
 hosting_application_name=MyAppEss
 hosting_application_stripe_id=MyAppEss
 hosting_application_version=V2.0
 
 jobdef_library_name=oracle.ess.sharedlibrary
 jobdef_library_spec_version=11
 jobdef_library_impl_version=11.1.1.5.0

Example 6-5 Script Execution Via the Command Line

$> ant create-user-home -Dui_application_name=MyApp -Dhosting_application_name=MyAppEss

6.3.2 Generating an Oracle Enterprise Scheduler Synchronous Java Job Business Logic Template

If you want to run a synchronous Java scheduled job, then you must develop the business logic for the job. Use the build.xml file extracted in Creating Host and UI Applications Using an Ant Script to create a template for the business logic of the Java job.

To generate an Oracle Enterprise Scheduler Java job business logic template:

  1. To create new jobs from predefined templates, run the following command:
    ant -f ${ess_user_home_dir}/build.xml create-new-job-def
    
  2. When prompted, enter the Oracle Enterprise Scheduler job name, for example, HelloSyncJavaJob, and the package name, for example, oracle.apps.financials.ess.program.

    Note:

    Ensure that the full job package name is unique across product families.

    Following is a sample command execution.

  3. In JDeveloper, open the Oracle Enterprise Scheduler host application project saved to the user_home application workspace location.
  4. In the Navigator, expand the EssSharedLibrary Model project to modify the template-generated Java job business logic.
  5. Modify the file as required and save your changes.

Example 6-6 Creating a Java Job Business Logic Template

Buildfile: /workspace/ess_user_home/build.xml

-init:

create-new-job-def:
    [echo] Available Job Definition Templates:
    [echo]     1) Simple Synchronous Java Job
   [input] Enter number of job definition template to create (job_template_to_create)
 1
    [echo] Calling default target on /my_ess_main/ess/util/customer_extensibility/Fusion/
           Template_JobLibrary/simple_synchronous_job/build.xml
 
-init:
 
create-job-definition:
   [input] Enter Java package name for Job Definition (jobdef_package_name)
           (default=oracle.apps.ess.custom) [oracle.apps.ess.custom]
           oracle.apps.financials.ess.program
   [input] Enter Java class name for Job Definition (jobdef_class_name)
           (default=MySynchronousJavaJob) [MySynchronousJavaJob]
           HelloSyncJavaJob
    [copy] Copying 1 file to /workspace/ess_user_home/MyAppEss/EssSharedLibrary/src
    [copy] Copying 1 file to /workspace/ess_user_home/MyAppEss/EssSharedLibrary/src/oracle/
           apps/financials/ess/program
 
BUILD SUCCESSFUL

6.3.3 About Creating Oracle Enterprise Scheduler Job Metadata Using JDeveloper

To submit job requests using the Oracle Enterprise Scheduler host application, you must create metadata that defines a job request, including the following:

  • Job type: This specifies an execution type and defines a common set of parameters for a job request.

  • Job definition: This is the basic unit of work that defines a job request in Oracle Enterprise Scheduler.

6.3.3.1 Creating an Oracle Enterprise Scheduler Job Definition in the Host Application

To use a Java class with Oracle Enterprise Scheduler you must create a job definition. When creating a job definition, specify a name, select a job type, and specify system properties.

To create a job definition in the host application:

  1. In the Navigator, right-click the EssSharedLibrary project and select New to display the New Gallery window.
  2. In the New Gallery in the Categories area, expand Business Tier and select Enterprise Scheduler Metadata.
  3. From the New Gallery Items area, select Job Definition and click OK.

    The Create Job Definition window is displayed.

  4. In the Create Job Definition window, specify the following:
    • In the Name field, enter a name for the job definition. For example, for the scheduler host application, enter SampleJob.

    • In the Package field, enter a package name. For example, enter oracle/apps/ess/custom/test.

    • From the Job Type dropdown list, select JavaJobType.

    Click OK. The job definition SampleJob.xml is created, as well as the jobs folder in the package oracle/apps/ess/custom/test. The Job Definition page is displayed.

  5. In the Job Definition page, specify the fully qualified class name of the template-generated Java business logic created in Generating an Synchronous Java Job Business Logic Template.
  6. Next to the Class Name field, select the Overwrite check box.
  7. In the Class Name field, enter the name of the Java class you created, for example, oracle.apps.financials.ess.program.HelloSyncJavaJob.
  8. In the System Properties section, click Add and create a system property called EffectiveApplication. Set the value of the property to the host application name, for example, MyAppEss.
  9. In the Parameters section, define the following required properties:
    • jobDefinitionName: The short name of the job. For example, SampleJob.

    • jobDefinitionApplication: The short name of the host application running the job. For example, MyAppEss.

    • jobPackageName: The name of the package running the job. For example, /oracle/apps/ess/custom/test.

    • srsFlag: A boolean parameter (Y or N) that controls whether the job is displayed in the job request submission user interface. Enter Y.

    • EXT_PortletContainerWebModule: The name of the web module for the Oracle Enterprise Scheduler Central UI application to use as a portlet when submitting a job request. For example, MyApp, or any producer web application (if you prefer to use an existing registered web module that hosts the Oracle ADF view objects).

    • parametersVO: The ADF Business Components view object you define so that end users may enter additional properties at runtime through an Oracle ADF user interface. For example, oracle.apps.financials.ess.SampleVO. For more information about creating a view object in the Oracle ADF producer application, see Creating an Model Project ..

6.3.3.2 Creating a Schedule Request Submission UI to Enable End Users to Fill in Properties

If your job includes any properties to be filled in by end users at runtime, you need to create an Oracle ADF user interface and an ADF Business Components view object with validation, and the parameters to be filled in. The Oracle Enterprise Scheduler schedule request submission UI allows end users to fill in these properties prior to submitting the job request.

For more information about Oracle ADF view objects, see the "Creating a Business Domain Layer Using Entity Objects" chapter in the Developing Fusion Web Applications with Oracle Application Development Framework.

6.3.3.2.1 Creating an Oracle ADF Model Project

Create an Oracle ADF model project to display the properties to be filled in by end users at runtime.

To create an Oracle ADF model project:

  1. In JDeveloper, open the Oracle Enterprise Scheduler Oracle ADF application.

  2. From the Application menu, select New Project.

  3. In the New Gallery under Categories, expand General and select Projects.

  4. In the Items area, select ADF Model Project and click OK.

  5. On the Name Your Project wizard page, enter the project name, for example EssModel. Click Finish to close the wizard.

  6. From the Navigator, right-click the EssModel project and select Project Properties, then Libraries and Classpath, and then Add Library.

  7. Add the required data model project libraries as described in the chapter "Setting Up Your JDeveloper Application Workspace and Projects" in the Developer's Guide.

  8. Click OK to close the Project Properties dialog.

6.3.3.2.2 Creating an ADF Business Components View Object for Oracle Enterprise Scheduler

Use a parameters view object for jobs with parameters that require collecting values from end users at runtime. The properties filled in by end users are associated with an ADF Business Components view object, which is associated with the job definition itself. When the job runs, Oracle Enterprise Scheduler accesses the view object to retrieve the values of the properties.

To create an ADF Business Components view object for Oracle Enterprise Scheduler:

  1. In JDeveloper in the Navigator, right-click the project EssModel in which you want to create the view object, and select New.

  2. In the New Gallery, expand Business Tier, select ADF Business Components and then View Object. Click OK.

    If this is the first component you are creating in the project, then the Initialize Business Components Project dialog is displayed, allowing you to select a database connection.

  3. In the Initialize Business Components Project dialog, select the database connection or select New to create a connection.

    Click OK. This launches the Create View Object wizard.

  4. In the Create View Object wizard on the Name page, enter the following.

    • Package: Enter package information for the view object, for example oracle.apps.financials.ess.

    • Name: Provide a name, for example, SampleVO.

    • Select the data source type you want to use as the basis for this view object: For the data source, select Rows Populated Programmatically, Not Based on a Query.

    Note:

    Enter the view object package and name values specified for the job definition property parametersVO in Creating an Job Definition in the Host Application.

  5. Click Next. In the Attributes page, click Finish to create the Oracle Enterprise Scheduler parameter view object SampleVO.

  6. Define attributes for the view objects sequentially, ATTRIBUTE1, ATTRIBUTE2, and so on, with an attribute for each required parameter.

  7. Create a query for the view object:

    1. On the View Object page, from the left-hand list panel, select Query.

    2. In the Query panel, click Edit.

    3. Use the following query and test for validity:

      select null as ATTRIBUTE1 from dual
      
    4. Click OK.

    Note:

    A maximum of 100 attributes can be used for the property parametersVO. The attributes should be named incrementally, for example ATTRIBUTE1, ATTRIBUTE2, and so on. Attribute names are not case-sensitive, such that ATTRIBUTE1 and Attribute2 can be used sequentially.

  8. Ensure that the view object attributes can always be updated:

    1. On the View Object page, from the left-hand list panel, select Attributes.

    2. Edit the ATTRIBUTE1 table row.

    3. In the Edit Attribute: Attribute1 window, select the option Always.

    4. In the Edit Attribute: Attribute1 window, click Control Hints to display the Control Hints page. In the Control Hints page, specify required prompts, validation, and formatting for each parameter.

    5. Click OK.

  9. If not already specified, add the property parametersVO to your Oracle Enterprise Scheduler host application job definition and specify the fully qualified path of the view object as the value of parametersVO. For example, set parametersVO to oracle.apps.financials.ess.SampleVO in the job definition /oracle/apps/ess/custom/test/SampleJob.xml.

    <parameter name="parametersVO" data-type="string">oracle.apps.financials.ess.SampleVO</parameter> 
    

6.3.4 About Assembling Oracle Enterprise Scheduler Oracle Fusion Applications

Assembling the Oracle Enterprise Scheduler Oracle Fusion applications involves the following main steps:

  • Assembling an Oracle Enterprise Scheduler shared library

  • Assembling the host application

  • Assembling the Oracle ADF producer application

6.3.4.1 Assembling an Oracle Enterprise Scheduler Shared Library

Assembling a shared library for Oracle Enterprise Scheduler involves the following main steps:

  • Creating or updating a shared library JAR manifest

  • Updating the shared library JAR deployment profile

The name and version information for a shared Java EE library are specified in the META-INF/MANIFEST.MF file.

To assemble a shared library:

  1. Specify attributes for the shared library in a manifest file.

    1. Create or edit the manifest file in a text editor.

    2. Enter the following command:

      cd <ess_user_home>/MyAppEss/EssSharedLibrary/emacs MANIFEST.MF
      
    3. Add or edit a string value to specify the name of the shared Java EE library. For example:

      Extension-Name: oracle.ess.shared
      

      Extension-Name specifies the name of the shared Java library. Use the value specified in the script prompt for the shared library name. Oracle Enterprise Scheduler host applications that reference the library must specify Extension-Name exactly to use the shared files.

      As a best practice, enter the optional version information for the shared Java EE library. A sample MANIFEST.MF file is shown in the following example.

    4. Save the file. The MANIFEST file is used by the JAR deployment file.

  2. Compile the project. In the Navigator, right-click the Oracle Enterprise Scheduler shared library project and select Make EssSharedLibrary*.jpr*.

  3. Right-click the Oracle Enterprise Scheduler shared library project and select Project Properties to display the Project Properties window.

  4. In the Project Properties window, select Deployment.

  5. In the Deployment Profiles region, select EssSharedLibrary (Shared Library JAR File).

  6. Click Edit to open the Edit JAR Deployment Profile Properties window. In the Edit JAR Deployment Profile Properties window, click JAR Options.

  7. In the JAR Options window, select the check box Include Manifest File (META-INF/MANIFEST.MF).

  8. Click Add to specify the manifest file you created. This file should be merged into the manifest file that is generated by JDeveloper.

  9. In the Edit JAR Deployment Profile Properties window, expand File Groups and select Filters. Under the Merged Contents of this File Group's Contributors list, deselect essmeta.

  10. In the JAR Deployment Profile Properties page, click OK. In the Project Properties page, click OK.

Example 6-7 Sample MANIFEST.MF File

Extension-Name: oracle.ess.shared
Specification-Version: 11.1.0
Implementation-Version: 11.1.0.0.0

6.3.4.2 Assembling the Host Application

Assembling the host application involves the following main steps:

  • Creating a MAR deployment file

  • Updating the EAR deployment file

To assemble the host application:

  1. Open the Oracle Enterprise Scheduler host application in JDeveloper, and from the Application menu, select Application Properties.

  2. In the Application Properties window, select Deployment.

  3. Click New to display the Create Deployment Profile page and do the following:

    1. In the Archive Type field, from the dropdown list, select MAR File.

    2. In the Name field enter a name, for example myAppEss_MAR.

    3. Click OK.

  4. In the Edit MAR Deployment Profile Properties window, select MAR Options.

    Modify the name of the MAR file, removing _MAR from the end of the name, for example, changing myAppEss_MAR.mar to myAppEss.mar.

  5. Select the Oracle Enterprise Scheduler metadata:

    1. In the Edit MAR Deployment Profile Properties window, expand Metadata File Groups and select User Metadata.

    2. In the Order of Contributors panel on the right-hand side, click Add to display the Add Contributor dialog.

    3. In the Add Contributor dialog, browse to the location of the project directory, and expand it to add the essmeta metadata that contains the namespace for the jobs directory. Select the path that you need to include in the Add Contributor dialog by double-clicking the essmeta directory.

    4. In the Add Contributor dialog, click OK.

  6. Select the directory for the metadata:

    1. In the Edit MAR Deployment Profile Properties window, expand Metadata File Groups and User Metadata, and select Directories.

    2. Select the directory that contains the Oracle Enterprise Scheduler application user metadata for the host application.

    3. Select the bottommost directory in the tree. This is the directory from which the namespace is created. The folder you select in this dialog determines the top-level namespace in adf-config.xml file.

    4. This namespace should be the same as the package defined in the job definition, for example oracle/apps/ess/custom/<directory name>.

      Note:

      In general, to create the namespace oracle/apps/<product>/<component>/ess, select the ess directory.

    5. In the Edit MAR Deployment Profile Properties page, click OK.

  7. In the Application Properties window, select Deployment.

    In the Deployment Profiles pane on the right-hand side, select the EAR profile and click Edit.

  8. In the Edit EAR Deployment Profile Properties window, select Application Assembly.

    Under Java EE Modules, select the check box for the MAR module.

  9. In the Edit EAR Deployment Profile Properties window, select EAR Options.

    Deselect Include Manifest File (META-INF/MANIFEST.MF).

  10. In the Edit EAR Deployment Profile Properties page, click OK. In the Application Properties page, click OK.

6.3.4.3 Assembling the Oracle ADF Producer Application

Assembling the Oracle ADF application involves the following main steps:

  • Creating an ADF Library job deployment file

  • Preparing a Web Application Archive (WAR) deployment profile

Oracle ADF libraries have the option of automatic compilation that happens with deployment profile dependencies. This option allows the Oracle Enterprise Scheduler Oracle ADF Library used by the user interface project to be automatically included in the WEB-INF/lib directory in the WAR file.

To assemble the Oracle ADF producer application:

  1. Open the Oracle Enterprise Scheduler Oracle ADF application in JDeveloper.

  2. In the Navigator, right-click the EssModel project and click New to display the New Gallery window.

  3. In the New Gallery in the Categories area, expand General and select Deployment Profiles. Create the deployment profile as follows:

    1. In the Items region, select ADF Library Jar File.

    2. Click OK to open the Create Deployment Profile window.

    3. In the Create Deployment Profile - ADF Library Jar File window, enter a name for the profile, using the format Adf<projName> in accordance with package structure and naming standards.

    4. Click OK to save the new deployment profile and close the Create Deployment Profile window.

  4. In the Navigator, right-click the SuperWeb project and select Project Properties, and then Deployment.

  5. In the Deployment Profiles region, edit the SuperWeb WAR deployment profile.

  6. In the Edit WAR Profile Deployment Properties window, select Profile Dependencies.

  7. In the pane on the right-hand side, under Java EE Modules, select the dependency under the ADF library JAR deployment file (EssModel.jpr), for example, ADFMyApp.

  8. Click OK to save the WAR deployment profile.

6.3.5 About Deploying Oracle Enterprise Scheduler Oracle Fusion Applications

Deploying Oracle Enterprise Scheduler Oracle Fusion applications involves the following main steps. You must deploy the Oracle Enterprise Scheduler Oracle Fusion application in the order specified.

Note:

You can deploy these applications using either Oracle JDeveloper or an Ant script.

  1. Deploy the shared Oracle Enterprise Scheduler library using JDeveloper or an Ant script.

  2. Deploy the Oracle Enterprise Scheduler host application using JDeveloper or an Ant script.

  3. Deploy the Oracle Enterprise Scheduler Oracle ADF producer application using JDeveloper or an Ant script.

Application-specific policies packed with script-generated host and Oracle ADF applications automatically migrate to the policy store when the application is deployed. Prior to deployment, verify that any grant of permissions in the application jazn-data.xml file contains no duplicates.

For more information about securely deploying applications, see the "Deploying Secure Applications" chapter in the Oracle Fusion Middleware Applications Security Guide.

6.3.5.1 Deploying the Shared Oracle Enterprise Scheduler Library Using JDeveloper

You can deploy the shared Oracle Enterprise Scheduler library using JDeveloper or an Ant script.

To deploy the share library using JDeveloper:

  1. In the Navigator, right-click the Oracle Enterprise Scheduler shared library project, select Deploy and then select the shared library JAR.

    The Deploy EssSharedLibrary_JAR window is displayed.

  2. Select Deploy to a WebLogic Application Server and click Next.

  3. In the Select Server window, select the application server to which you want to deploy the Oracle Enterprise Scheduler shared library.

  4. Click Add to create a connection to the application server if none is defined. Click Next.

  5. In the WebLogic Options window, make the following selections:

    1. Select Deploy to selected instances in the Domain, and select the Oracle Enterprise Scheduler server instance in the table row. The Oracle Enterprise Scheduler shared library should be deployed to the same server as the Oracle Enterprise Scheduler host application.

    2. Select Deploy as a shared library.

    3. Click Finish.

  6. Verify the deployment using the deployment log. Upon successful deployment, you can see the Oracle Enterprise Scheduler jobs shared library deployed as 'oracle.ess.shared(11,11.1.1)' in the Oracle WebLogic Server Administration Console.

6.3.5.2 Deploying the Shared Oracle Enterprise Scheduler Library Using an Ant Script

To deploy the shared library using an Ant script:

  1. Run the following Ant command:

    ant -f ${ESS_HOME}/ant/build-ess.xml deploy_job_logic
    

    The command deploy_job_logic builds, packages and deploys only the Oracle Enterprise Scheduler jobs shared library.

    Note:

    When prompted, enter the Oracle WebLogic Server password.

  2. To specify a different value for the ESS shared library name, take the following steps:

    1. In a text editor, modify the shared library JAR MANIFEST file. For example:

      vi ${ess_user_home_dir}/MyAppEss/EssSharedLibrary/MANIFEST.MF
      
    2. Edit the string value of Extension-Name to specify the name of the shared Java EE library.

    3. Enter the optional version information for the shared Java EE library.

    4. Update the Oracle Enterprise Scheduler build.properties file by editing ${ESS_HOME}/ant/config/ess-build.properties.

    5. Change the value of the property customEss.shared.library.name to match the value specified in the JAR MANIFEST file. The following example shows a sample build.properties file.

    6. Save the file.

Example 6-8 Sample build.properties File

# ESS build properties
 ess.script.base.dir=${user_home}
 
 fmw.home=${fmw_home}
 jdev.home=${fmw.home}/jdeveloper
 oracle.common=${fmw.home}/oracle_common
 
 # ========== ESS JDev project details ===============
 customEss.project.dir=${ess.script.base.dir}
 customEss.hostapp.workspace=${hosting_application_name}
 customEss.hostapp.jwsfile=${hosting_application_name}
 customEss.hostapp.earprofile=${hosting_application_name}
 customEss.hostapp.jprproject=EssSharedLibrary
 customEss.hostapp.jarprofile=EssSharedLibrary
 customEss.hostapp.jarfile=${jobdef_library_name}
 
 customEss.shared.library.name=${jobdef_library_name}
 
 customEss.hostapp.mds.partition=globalEss
 customEss.hostapp.mds.jdbc=mds-ApplicationMDSDB
 customEss.hostapp.name=${hosting_application_name}
 
 customEss.producerapp.workspace=${ui_application_name}
 customEss.producerapp.jwsfile=${ui_application_name}
 customEss.producerapp.earprofile=${ui_application_name}
 customEss.producerapp.name=${ui_application_name}
 
 # ========== WebLogic Server details ===============
 MW_HOME=${fmw.home}
 ORACLE_HOME=${jdev.home}
 MW_ORA_HOME=${jdev.home}
 COMMON_COMPONENTS_HOME=${oracle.common}
 WEBLOGIC_HOME=${fmw.home}/wlserver_10.3
 weblogic.server.host=<server_host> 
 weblogic.server.port=<server_port>
 
 weblogic.server.ssl.port=<server_ssl_port>
 
 weblogic.admin.user=<admin_username>
 weblogic.t3.url=t3://${weblogic.server.host}:${weblogic.server.port}
 # WebLogic server name where ESS producer web application is targeted for
 # deployment
 adfapp.server.name=AdminServer
 # WebLogic server name where ESS host application is targeted for deployment
 ess.server.name=ess_server1

6.3.5.3 Deploying the Oracle Enterprise Scheduler Host Application Using JDeveloper

You can deploy the Oracle Enterprise Scheduler application using JDeveloper or an Ant script.

To deploy the Oracle Enterprise Scheduler host application using JDeveloper:

  1. In JDeveloper, open the Oracle Enterprise Scheduler host application.

  2. From the Application menu, select Deploy and then select the name of the host application, for example MyAppEss.

  3. In the Deploy MyAppEss window, select Deploy to Application Server and click Next.

  4. In the Select Server window, select the application server to which you want to deploy the Oracle Enterprise Scheduler host application.

    Click Add to create a connection to the application server if none is defined.

  5. Click Next. In the WebLogic Options window, make the following selections:

    1. Select Deploy to selected instances in the Domain, and select the Oracle Enterprise Scheduler server instance in the table row, to which the Oracle Enterprise Scheduler host application is to be deployed.

    2. Select Deploy as a standalone Application.

    3. Click Finish.

    JDeveloper displays the Deployment Configuration page. Select the relevant options for your metadata repository.

  6. Click Deploy.

    Verify the deployment using the deployment log.

    Upon successful deployment, you can expect to see the Oracle Enterprise Scheduler host application deployed in Fusion Applications Control.

6.3.5.4 Deploying the Oracle Enterprise Scheduler Host Application Using an Ant Script

To deploy the Oracle Enterprise Scheduler host application using an Ant script, run the following Ant command:

ant -f ${ESS_HOME}/ant/build-ess.xml deploy_ess_host

The command deploy_ess_host builds, packages, and deploys only the Oracle Enterprise Scheduler host application. It is assumed that the Oracle Enterprise Scheduler shared job library is already deployed prior to running this command.

Note:

When prompted, enter the Oracle WebLogic Server password.

6.3.5.5 Deploying the Oracle ADF Producer Application Using JDeveloper

You can deploy the Oracle ADF producer application using JDeveloper or an Ant script. This step is optional if using an existing deployed producer web application. The value you defined for EXT_PortletContainerWebModule in Creating an Job Definition in the Host Application indicates the name of the application to be used.

To deploy the Oracle ADF producer application using JDeveloper:

  1. In JDeveloper, open the Oracle ADF producer application.

  2. From the Application menu, select Deploy and then select the name of the Oracle ADF producer application.

  3. In the Deploy MyApp window, select Deploy to Application Server and click Next.

  4. In the Select Server window, select the application server to which you want to deploy the Oracle Enterprise Scheduler Oracle ADF application.

  5. Click Add to create a connection to the application server if none is defined.

  6. Click Next. In the WebLogic Options window, make the following selections:

    1. Select Deploy to selected instances in the Domain, and select the Oracle Enterprise Scheduler server instance in the table row, to which the Oracle Enterprise Scheduler Oracle ADF application is to be deployed.

    2. Select Deploy as a standalone Application.

    3. Click Finish.

    4. The Select Deployment Type dialog window is displayed, prompting you to expose the MyApp portlet application as a WSRP service. Select Yes.

  7. Click Next. The Deployment Configuration page is displayed. Select the relevant options for your metadata repository.

  8. Enter globalEss as the partition name and click Deploy

  9. Verify the deployment using the deployment log.

    Upon successful deployment, you can expect to see the deployed Oracle Enterprise Scheduler Oracle ADF application in Fusion Applications Control.

  10. Open the WSRP Producer test page to validate the deployment using the following URL:

    http://<ADF_HOST>:<ADF_PORT>/<MyApp-context-root>/
    

6.3.5.6 Deploying the Oracle ADF Producer Application Using an Ant Script

To deploy the Oracle ADF producer application using an Ant script, run the following Ant command:

ant -f ${ess_user_home_dir}/ant/build-ess.xml deploy_ess_ui

The deploy_ess_ui command builds, packages, and deploys only the Oracle Enterprise Scheduler Oracle ADF producer application.

Note:

When prompted, enter the Oracle WebLogic Server password.

6.3.6 About Registering Oracle Enterprise Scheduler Topology Objects

Registering Oracle Enterprise Scheduler topology objects involves the following main steps:

  • Creating Oracle Enterprise Scheduler topology objects

  • Registering Oracle Enterprise Scheduler topology objects

Note:

Register the topology objects only when using an Ant script-generated Oracle ADF producer web application. Alternatively, you can use an existing registered web or Oracle Enterprise Scheduler Oracle ADF producer application and skip this section.

6.3.6.1 Creating Oracle Enterprise Scheduler Topology Objects

Use the Setup and Maintenance work area to create Oracle Enterprise Scheduler topology objects, including the Oracle Enterprise Scheduler domain, host application, and Oracle Enterprise Scheduler Oracle ADF producer application.

To create Oracle Enterprise Scheduler topology objects:

  1. Create the Oracle Enterprise Scheduler domain topology object.

    1. In the global area of Oracle Fusion Applications, click your name and select Setup and Maintenance.

    2. From the Tasks Pane, select Topology Objects and then select Manage Domains.

    3. On the Manage Domains page in the list of domains, click the Actions dropdown list and select Create.

    4. In the Create Domain window that is displayed, enter a name for the domain and click Save and Close.

  2. Create the Oracle Enterprise Scheduler host application topology object:

    1. In the global area of Oracle Fusion Applications, click your name and select Setup and Maintenance.

    2. From the Tasks Pane, select Topology Objects and then select Manage Enterprise Applications.

    3. On the Manage Enterprise Applications page in the list of domains, click the Actions dropdown list and select Create.

    4. In the Create Enterprise Application page, enter the details in the following table.

      Table 6-6 Enterprise Application Topology Object Details

      Field Description

      Name

      Enter the name of the enterprise application that you want to register, for example EarCustomHostEss.

      Code

      Enter a unique code to identify the enterprise application. After you have created it, the code cannot be changed.

      Domain

      Select the name of the domain to be used by the enterprise application, for example EssDomain.

      Default URL

      Enter a static URL if the enterprise application is always to be deployed at the same location. Optional.

      Source File

      Enter the name of the EAR file. Optional.

      Pillar

      From the Available Pillars list, shuttle the relevant pillar or pillars to the Selected Pillars list.

    5. Click Save and Close to create the Oracle Enterprise Scheduler host application topology object.

  3. Repeat Step 2 to create the Oracle Enterprise Scheduler Oracle ADF producer application topology object.

6.3.6.2 Registering Oracle Enterprise Scheduler Topology Objects

Use the Setup and Maintenance work area to register the Oracle Enterprise Scheduler topology objects you created.

To register Oracle Enterprise Scheduler topology objects:

  1. Register the Oracle Enterprise Scheduler domain.

    1. In the global area of Oracle Fusion Applications, click your name and select Setup and Maintenance.

    2. From the Tasks Pane, select Topology Registrations and then select Register Domains.

    3. On the Register Domains page in the list of domains, click the Actions dropdown list and select Create.

    4. In the Add Domain window that is displayed, enter the details for the Oracle Enterprise Scheduler domain created in Creating Topology Objects as described in the following table.

      Table 6-7 Domain Registration Values

      Field Description

      Enterprise Environment

      From the dropdown list, select the enterprise environment to be used, for example oracle.

      Domain

      From the dropdown list, select the name of the domain.

      Name/Administrator Server Name

      Enter a name for the registered domain.

      Enter a name for the domain's administration server.

      Internal/External/Administrator Server Host/Port/Protocol

      Enter the URL, port number, and protocol (such as HTTP, HTTPS, and so on) for the internal server to be registered, as well as the external server and the administration server.

      Enterprise Manager Protocol

      From the dropdown list, select the protocol to be used for accessing Oracle Enterprise Manager, for example HTTP or HTTPS.

      Enterprise Manager Port

      Enter the port number to be used when accessing Oracle Enterprise Manager in the domain.

      Java Management Extensions Port

      Enter the port number to be used for Java management extensions.

    5. Click Save and Close to save your changes.

  2. Register the Oracle Enterprise Scheduler web producer module.

    1. In the global area of Oracle Fusion Applications, click your name and select Setup and Maintenance.

    2. From the Tasks Pane, select Topology Objects and then select Manage Modules.

    3. On the Manage Modules page from the list of applications, click the Actions dropdown list and select Register Modules.

    4. In the Register Modules window that is displayed, enter the details as shown in the following table.

      Table 6-8 Domain Registration Values

      Field Description

      Name

      Enter the name of the module that you want to register.

      Code

      Enter a unique code to identify the module. After you have created it, the code cannot be changed.

      Description

      Enter a brief, meaningful description of the module. Optional.

      Enterprise Application

      Select and associate the enterprise application to which the module belongs.

      Type

      Select the relevant module type from the list.

      Context Root

      Enter the context root of the module.

    5. Click Save and Close to save your changes.

  3. Register the Oracle Enterprise Scheduler host and producer applications.

    1. In the global area of Oracle Fusion Applications, click your name and select Setup and Maintenance.

    2. From the Tasks Pane, select Topology Registrations and then select Register Enterprise Applications.

    3. On the Register Enterprise Applications page from the list of applications, click the Actions dropdown list and select Add.

    4. In the Add Enterprise Application window that is displayed, enter the details in the following table.

      Table 6-9 Domain Registration Values

      Field Description

      Enterprise Environment

      From the dropdown list, select the enterprise environment to be used, for example oracle.

      Enterprise Application

      Select and associate the enterprise application to which the module belongs.

      Name

      Enter the name of the enterprise application.

      External Server Protocol/Host/Port

      Enter the URL, port number, and protocol (such as HTTP, HTTPS, and so on) for the external server to be registered with the enterprise application.

    5. Click Save and Close to save your changes.

    6. In the Register Enterprise Applications page, click the Actions dropdown list and select Add to display the Add Enterprise Application window.

    7. Click the Enterprise Application dropdown list to display the Search and Select: Enterprise Application window.

    8. In the Name field, enter a name for the application you want to search for and click the Domain dropdown list to select the domain in which you want to search.

      Click Search to search for the Oracle Enterprise Scheduler producer web application.

    9. From the list of enterprise applications that is displayed, select the relevant Oracle Enterprise Scheduler producer web application and click OK, as shown in the following figure.

      Figure 6-3 Select the Relevant Enterprise Application

      Select the relevant enterprise application
    10. In the Add Enterprise Application page, fill in the details for the Oracle Enterprise Scheduler producer web application as described in the following table.

    11. Click Save and Close.

6.3.7 About Granting Job Metadata Permissions to Application Roles and Users

You can use Oracle Authorization Policy Manager to manage application roles and resource-based policies. Identifying the application roles and users, and granting them the required privileges to execute Oracle Enterprise Scheduler job-related tasks is a one-time operation.

Granting Oracle Enterprise Scheduler metadata permission to the new job involves the following main steps:

  • Creating a new resource for the custom job definition

  • Creating a new policy

6.3.7.1 Creating a Resource

In Oracle Authorization Policy Manager, create an application resource instance.

To create a resource:

  1. Run Oracle Authorization Policy Manager by entering the following URL in a browser.

    http://<fs-domain_url>/apm/
    
  2. From the navigator pane, right-click the application Resources icon button and select New.

    An untitled page is displayed.

  3. Define a resource with the resource type ESSMetadataResourceType, as well as the name and display name of the Oracle Enterprise Scheduler component using the following syntax: oracle.apps.ess.applicationName.JobDefinitionName.JobName.

  4. Save the resource.

6.3.7.2 Defining a Policy

Define a policy that specifies the privileges allocated to a particular user when submitting the job request.

To define a policy:

  1. In Oracle Authorization Policy Manager in the Home tab, under the Applications region, select an application for which you want to manage the policy, for example, MyAppEss.

  2. Click Search Policies to display the Search Authorization Policies tab.

  3. In the Search Authorization Policies tab, select the principal user on which to base the policy being created, for example, FinUser1.

  4. In the Functional Security tab, select Resource Based Policies.

  5. Click New Policy to create a new policy for the selected user.

  6. Add resource instances to the policy by clicking Add in the Resources table.

  7. Select the resource instance created for the custom Oracle Enterprise Scheduler job definition (from Creating a Resource).

  8. Specify the actions EXECUTE and READ to provision Oracle Enterprise Scheduler job execution privileges to the user.

  9. Click Save.

6.3.7.3 Testing Oracle Enterprise Scheduler Job Submissions from the Oracle Enterprise Scheduler Central UI

Submit a job request to ensure that everything works as it should.

To submit a test job request:

  1. Log in to Functional Setup Manager with the user for whom you defined an authorization policy, for example, as FinUser1.

    The URL for Functional Setup Manager is as follows:

    https://<HOST>/setup/faces/TaskListManagerTop
    
  2. From the Tools menu, select Schedule Processes.

  3. Click Schedule New Process and select a job process name when prompted. Select the job definition you created.

  4. Click OK.

    The Oracle Enterprise Scheduler Schedule Request Submission window is displayed.

  5. In the Parameters region, specify the job parameters as required.

  6. Click Submit to schedule the job execution, and Close to exit the window.

  7. Refresh the Search Results table to monitor the status of the submitted job.

6.4 About Customizing Existing Oracle Enterprise Scheduler Job Properties

You can customize Oracle Enterprise Scheduler jobs that are associated with Oracle Fusion applications. Customizing existing Oracle Enterprise Scheduler jobs involves editing job properties using Oracle Enterprise Manager Fusion Applications Control.

An example of a customization is to set the timeout value for a scheduled job to be run asynchronously. When the job takes longer than the timeout, you can find the job that timed out in Fusion Applications Control and manually complete the job.

The job properties that can be edited are shown in the following table.

For more information about editing scheduled job properties, see the "Managing Oracle Enterprise Scheduler Service and Jobs" chapter in the Administrator's Guide.

Table 6-10 Job Properties

API Description

oracle.as.scheduler.SystemProperty.PRIORITY

This property specifies the request processing priority, from 0 to 9, where 0 is the lowest priority and 9 is the highest. If this property is not specified, the system default value used is oracle.as.scheduler.RuntimeService#DEFAULT_PRIORITY.

oracle.as.scheduler.SystemProperty.RETRIES

This property defines the numerical value that specifies the retry limit for a failed job request. If job execution fails, the request retries up to the number of times specified by this property until the job succeeds. If the retry limit is zero, a failed request will not be retried. If this property is not specified, the system default used is oracle.as.scheduler.RuntimeService#DEFAULT_RETRIES.

oracle.as.scheduler.SystemProperty.REQUEST_CATEGORY

This property specifies an application-specific label for a request. The label, defined by an application or system administrator, allows administrators to group job requests according to their own specific needs.

oracle.as.scheduler.SystemProperty.ASYNC_REQUEST_TIMEOUT

This property specifies the time in minutes that the job request processor waits for an asynchronous request after it has begun execution. After the time elapses, the job request times out.

enableTrace

The property specifies a numerical value that indicates the level of tracing control for the job. Possible values are as follows:

  • 1: Database trace

  • 5: Database trace with bind

  • 9: Database trace with wait

  • 13: Database trace with bind and wait

  • 16: PL/SQL profile

  • 17: Database trace and PL/SQL profile

  • 21: Database trace with bind and PL/SQL profile

  • 25: Database trace with wait and PL/SQL profile

  • 29: Database trace with bind, wait, and PL/SQL profile

enableTimeStatistics

This property enables or disables the accumulation of time statistics.