Skip to main content

Steps Developing Schedule Task with OIM 11g R2





Steps Developing Schedule Task with OIM 11g R2




1.    Create a java class by implementing oracle.iam.scheduler.vo.TaskSupport interface.


  1. Include the following JAR files in the class path to compile a custom class:


From OIM_INSTALL_HOME/server/platform


    1. iam-platform-kernel.jar
    2. iam-platform-utils.jar
    3. iam-platform-context.jar
    4. iam-plaftorm-authz-service.jar


From OIM_INSTALL_HOME/designconsole/lib


    1. oimclient.jar
    2. xlAPI.jar


All other JAR files like


xlVO.jar and xlScheduler.jar




  1. Create a library of JAR files containing the custom classes.


Sample java code




package com.scheduletask;


import java.util.HashMap;


import oracle.iam.identity.usermgmt.api.UserManager;


import oracle.iam.identity.usermgmt.vo.User;


import oracle.iam.platform.Platform;


import oracle.iam.scheduler.vo.TaskSupport;




public class CreateNewUser extends TaskSupport{  


@Override   


public void execute(HashMap hm) throws Exception     {


    System.out.println("**************inside CreateNewUser **********");


// Lookup a service        


UserManager usermgr = Platform.getService(UserManager.class);        


// Build new User       


String userKey = null; // USR_KEY       


String firstName = (String) hm.get("First Name"); // USR_FIRST_NAME       


String lastName = (String) hm.get("Last Name"); // USR_LAST_NAME       


String userLogin = (String) hm.get("User Login"); // USR_LOGIN       


String organizationKey = "1"; // ACT_KEY  [Organization]       


String userType = "End-User"; // USR_TYPE       


String role = "Full-Time"; // USR_EMP_TYPE [User Type]        


User newUser = new User(userKey);       


newUser.setLogin(userLogin);       


newUser.setFirstName(firstName);       


newUser.setLastName(lastName);       


newUser.setOrganizationKey(organizationKey);       


newUser.setUserType(userType);       


newUser.setEmployeeType(role);        


// Call a method from a service       


 usermgr.create(newUser);    


 }   


@Override  


public HashMap getAttributes()     {


    return null;   


    }    


@Override  


public void setAttributes()     {


    }


}




4.    createMETA-INF xml file for schedule task like




<?xml version="1.0" encoding="UTF-8"?>


<scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">


<task>       


<name>Create New User</name>


<class>com.scheduletask.CreateNewUser</class>


<description>Create a new OIM User</description>


<retry>5</retry>


<parameters>


<string-param required="true" encrypted="false" helpText="First Name">First Name</string-param>


<string-param required="true" encrypted="false" helpText="Last Name">Last Name</string-param>


<string-param required="true" encrypted="false" helpText="User Login">User Login</string-param>


</parameters>


</task>


</scheduledTasks>




  1. Create plugin.xml file: sample is as below. Note: The name should be plugin.xml only
    <?xml version="1.0" encoding="UTF-8"?>
    <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <plugins pluginpoint="oracle.iam.scheduler.vo.TaskSupport">
    <plugin pluginclass= "com.scheduletask.CreateNewUser" version="1.0.1" name="CreateNewUser">
    </plugin>
    </plugins>
    </oimplugins>
  2. Put all the files in a structure as below and create zip folder


Plugin_name.zip   à lib à jar


  • META-INF à Scheduletask xml
  • Plugin.xml


  1. Copy the zip folder at some location in server
  2. Set ANT_HOME=/home/oracle/Oracle/Middleware/modules/org.apache.ant_1.7.1 and PATH for $ANT_HOME/bin
  3. Go to directory /home/oracle/Oracle/Middleware/Oracle_IDM1/server/plugin_utility and modify ant.properties file for below setting
    wls.home=/home/oracle/Oracle/Middleware/wlserver_10.3
    oim.home=/home/oracle/Oracle/Middleware/Oracle_IDM1/server
    login.config=${oim.home}/config/authwl.conf
    mw.home=/home/oracle/Oracle/Middleware
  4. Run ant command ant -f  pluginregistration.xml register

This will prompt for the Oracle Identity Manager username and password along with the server information and the location of the plugin zip file. Enter the complete path of the zip file location. 

OIM User name: xelsysadm

Password:

url: t3://oimhost:oimport


Comments

Popular posts from this blog

OIM Common Tables and queries OIM 11gR2 PS2/PS3 tables and queries, OIM useful Queries, OIM sql queries, OIM Database queries, OIM tables, OIM queries svr — IT Resource information. (svr_key is primary key) spd — IT resource parameter Definition information svd  – IT Resource Type Definition. app_instance  — Application Instance Information (app_instance_key is the primary key) It will have itresoucre_key to link with svr_key in svr table and object_key to link with obj_key in obj table. obj — Resource Object information (obj_key) obi  — Object Instance information  (obi_key) catalog  — Request Catalog Information (applications instances, roles, entitlements) (Catalog_id) orc  — It stores any users account instance information (orc_key) ost  — It stores the object status information (ost_key) Note : never link ost and obj table directly, we have to link ost and oiu table with ost_key and then obi and oiu with obi_key and then ...

Upload Jar and Register Plugin in OIM 11g R2

modify ant.properties file for below setting /Middleware/Oracle_IDM1/server/plugin_utility wls.home=/l01/apps/oracle/fmw/Middleware/wlserver_10.3 oim.home=/l01/apps/oracle/fmw/Middleware/Oracle_IDM1 /server login.config=${oim.home}/config These environment variables must be set export MW_HOME=/l01/apps/oracle/fmw/Middleware export DOMAIN_HOME=/l01/apps/oracle/fmw/Middleware/user_projects/domains/iam_domain export APP_SERVER=weblogic export OIM_ORACLE_HOME=$MW_HOME/Oracle_IDM1 export ORACLE_HOME=$MW_HOME/Oracle_IDM1 export WL_HOME=$MW_HOME/wlserver_10.3 export ANT_HOME=$MW_HOME/modules/org.apache.ant_1.7.1 export JAVA_HOME=/l01/apps/oracle/java/jdk1.7.0_79 export PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$ORACLE_HOME/OPatch:$PATH Upload Jar Steps /l01/apps/oracle/fmw/Middleware/Oracle_IDM1/server/bin # ./UploadJars.sh Enter the oim user id:xelsysadm Enter Password Enter t3 url : t3://Host:oimport Ent...