6 Replies Latest reply: Mar 26, 2013 3:55 PM by kavatam RSS

    Post process EventHandler not deployed properly OIM 11.1.2

    kavatam
      Hi All,

      I developed post process handler to populate MiddleName=FirstName + LastName, for user creation.

      I have performed following steps,

      1) Created and placed AddMiddleName.zip file in Oracle_IDM1/server/plugins
      2) Created and placed EventHandler.xml in folder
      3) Build with "ant" was successful with any errors
      4) Imported metadata using weblogicImportMetadata.sh and below is the result

      Initializing WebLogic Scripting Tool (WLST) ...

      Welcome to WebLogic Server Administration Scripting Shell

      Type help() for help on available commands

      Starting import metadata script ....
      Please enter your username :weblogic
      Please enter your password :
      Please enter your server URL [t3://localhost:7001] :t3://localhost:7001
      Connecting to t3://localhost:7001 with userid weblogic ...
      Successfully connected to Admin Server 'AdminServer' that belongs to domain 'oim_domain'.

      Warning: An insecure protocol was used to connect to the
      server. To ensure on-the-wire security, the SSL port or
      Admin port should be used instead.

      Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
      For more help, use help(domainRuntime)


      Disconnected from weblogic server: AdminServer
      End of importing metadata script ...


      Exiting WebLogic Scripting Tool.


      *********************************************

      Verification
      ------------
      Now checked the following
      1) In OIM database

      select * from plugins;
      Result: showed the plugin details which I deployed.

      2) In MDS database

      select * from mds_paths
      Result: Dint find any details about the plugin I deployed.



      Wanted to know whether metadata import is done or not. If not, how to verify.

      Finally Middle name is not popluating. Please help me where's the mistake.


      I would sincerely appreciate a quick solution. Thanks in advance.
        • 1. Re: Post process EventHandler not deployed properly OIM 11.1.2
          Vamsi Krishna
          On MDS schema,
          SQL>select path_fullname,path_name from mds_paths where path_fullname like '%<your eventhandlername>.xml'
          This will show your xml file you uploaded into MDS.

          Cheers,
          Vamsi.
          • 2. Re: Post process EventHandler not deployed properly OIM 11.1.2
            kavatam
            Hi Vamshi,

            I already executed that sql stament. I found only EventHandler.xml.

            Will corresponding plugin.zip also be stored in MDS, if so, my plugin.zip is not present.

            Could u tell me where is the mistake..
            • 3. Re: Post process EventHandler not deployed properly OIM 11.1.2
              kavatam
              Hi All,

              Anyone please provide solution.....


              Also tried deploying one more post process handler to check whether it is getting invoked or not.... and found that its not invoking....



              Here is my java program.....
              ------------------------------------------------------------------------

              package demo.iam.customEventHandler;

              import com.thortech.util.logging.Logger;
              import java.util.HashMap;
              import oracle.iam.platform.kernel.spi.PostProcessHandler;
              import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration;
              import oracle.iam.platform.kernel.vo.BulkEventResult;
              import oracle.iam.platform.kernel.vo.BulkOrchestration;
              import oracle.iam.platform.kernel.vo.EventResult;
              import oracle.iam.platform.kernel.vo.Orchestration;

              public class samplePostProcessEventHandler
              implements PostProcessHandler
              {
              private Logger logger = Logger.getLogger("odl-handler");

              public void SfsuPostProcessEventHandler()
              {
              this.logger.debug("Invoking Event Handler Plugin");
              }

              public boolean cancel(long paramLong1, long paramLong2, AbstractGenericOrchestration paramAbstractGenericOrchestration)
              {
              return false;
              }

              public void compensate(long paramLong1, long paramLong2, AbstractGenericOrchestration paramAbstractGenericOrchestration)
              {
              }

              public EventResult execute(long paramLong1, long paramLong2, Orchestration paramOrchestration)
              {
              this.logger.debug("Operation " + paramOrchestration.getOperation());
              this.logger.debug("Parameters " + paramOrchestration.getInterEventData());
              this.logger.debug("Parameters " + paramOrchestration.getParameters());
              EventResult localEventResult = new EventResult();
              return localEventResult;
              }

              public BulkEventResult execute(long paramLong1, long paramLong2, BulkOrchestration paramBulkOrchestration)
              {
              return null;
              }

              public void initialize(HashMap<String, String> paramHashMap)
              {
              }
              }



              plugin.xml content
              ---------------------
              <?xml version="1.0" encoding="UTF-8"?>
              <oimplugins>
              <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
              <plugin pluginclass="demo.iam.customEventHandler.samplePostProcessEventHandler"
              version="1.0." name="samplePostProcessEventHandler">
              </plugin>
              </plugins>
              </oimplugins>


              EventHandler.xml content
              -------------------------
              <?xml version="1.0" encoding="UTF-8"?>
              <eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
              <action-handler class="demo.iam.customEventHandler.samplePostProcessEventHandler"
                   entity-type="User"
                   operation="CREATE"
                   name="samplePostProcessEventHandler"
                   stage="postprocess"
                   order="1000"
                   sync="FALSE"/>
              </eventhandlers>



              Steps performed
              -----------------
              1) created zip file with lib/samplePostProcessHandler.jar and plugin.xml
              2) executed "ant -f pluginregistration.xml register" and build is successfull.
              Verification: "select * from plugins" -> plugin details present in this table.

              3) executed "./weblogicImportMetadata.sh" -> imported successfully
              Verification: "select * from mds_paths where path_name like '%samplePostProcessEventHandler%'" -> eventhandler.xml is present

              4) Created user from Admin console


              Issue: No trace of logs present found. Checked in console.log,oim_server1.log, oim_server1-diagnostic.log.
              I also created a pre-process handler, in which able to data printed using "System.out.println" in console.log.

              In the above post process handler also I used SOP but its data is not present in console.log.



              Please tell me where is the mistake and how to enable logs..... I would sincerely appreciate the solution for this.

              Edited by: kavatam on Mar 25, 2013 12:22 PM
              • 4. Re: Post process EventHandler not deployed properly OIM 11.1.2
                Nirupam Samanta
                the logger may not be configured properly.. please use sop and can check sop in server console.

                how to enable log:
                http://oim11gstudent.blogspot.in/2013/03/configure-logging-from-java-code-in-oim.html


                hope your execute method is as below:
                import oracle.core.ojdl.logging.ODLLogger;


                public class samplePostProcessEventHandler implements PreProcessHandler{
                     ODLLogger logger = ODLLogger.getODLLogger(""odl-handler name");

                     ----
                -----
                     public EventResult execute(long arg0, long arg1, Orchestration orchestration) {
                          
                          HashMap <String, Serializable> parameters = orchestration.getParameters();
                          logger.finest("Orchestartion data- parameters:"+parameters);
                          
                          String firstName= getStringParamaterValue(parameters, "First Name");
                          String lastName= getStringParamaterValue(parameters, "Last Name");
                          
                          logger.finest("Orchestartion data- parameters:"+firstName+"----"+lastName+"----");

                          String middleName =firstName + lastName
                          orchestration.addParameter("Middle Name",middleName);
                                    

                          return new EventResult();
                     }
                private String getStringParamaterValue(HashMap <String, Serializable>parameters, String key)
                     {
                          String value = (parameters.get(key) instanceof ContextAware) ? (String)((ContextAware)parameters.get(key)).getObjectValue() : (String)parameters.get(key);
                          return value;
                     }

                ---
                ----
                }
                • 5. Re: Post process EventHandler not deployed properly OIM 11.1.2
                  Vamsi Krishna
                  For select path_fullname from mds_paths where path_name like '%samplePostProcessEventHandler%,

                  what is the path_fullname value that you see?


                  Cheers,
                  Vamsi.
                  • 6. Re: Post process EventHandler not deployed properly OIM 11.1.2
                    kavatam
                    Thanks for quick replies......


                    I tried the below
                    public class samplePostProcessEventHandler implements PreProcessHandler{
                    ODLLogger logger = ODLLogger.getODLLogger(""odl-handler name");


                    and am able to the logs... :) :) :)

                    I added console-handler along with odl-handler and restarted both Weblogic and oim server... this could one of the reasons for logs displaying in log files....


                    Also I imported samplePostProcessEventHandler.xml as /db/samplePostProcessEventHandler.xml.... This also could be the reason....

                    *************************************************************************************

                    Now it is confirmed that post process event handler is triggering.... but User login attribute is not getting populated..
                    When went through logs... orchestration parameters shows the user login value as per my logic but its not getting written into database..

                    here I ve written logic as user login=last name@kp.com.... its showed properly in logs... but user login attribute is not getting popluate with my value....

                    below is my log
                    ------------------
                    [2013-03-26T15:33:59.169-04:00] [oim_server1] [NOTIFICATION] [] [eventHandler] [tid: [ACTIVE].ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 11d1def534ea1be0:7ac8cc10:13da8062130:-8000-0000000000000106,0] [APP: oim#11.1.1.3.0] My_Parameters {usr_policy_update=null, act_key=1, usr_key=oracle.iam.platform.context.ContextAwareString@57991, Middle Name=nullLucky27, *User Login=Lucky27@kp.com*, Xellerate Type=End-User, usr_disabled=0, usr_change_pwd_at_next_logon=oracle.iam.platform.context.ContextAwareString@17050dd, Status=Active, usr_provisioned_date=Tue Mar 26 15:33:58 EDT 2013, Display Name={base=Lucky27}, Role=OTHER, usr_locked=0, usr_password=5392:isxFkhe/Y2iCqs2zQ5SnLg==, usr_pwd_reset_attempts_ctr=oracle.iam.platform.context.ContextAwareNumber@cd08fd, Password Generated=1, usr_login_attempts_ctr=oracle.iam.platform.context.ContextAwareNumber@1093b47, Last Name=Lucky27}



                    Also a default pre-process event handler is popluating user login as 'displayname@oracle.com' (not sure about exact rule), if user login attribute left blank during user creation from UI. How to disable this handler? how to search for this in mds?



                    I have found the following lines in log....


                    Obligations from policy:

                    Name: VIEW_USER_DETAILS values: [usr_key, LDAP GUID, Status, usr_manager_key, User Login]

                    Name: UDCAO values: [true]


                    Obligations from policy:

                    Name: VIEW_USER_DETAILS values: [usr_key, Full Name, Display Name, User Login, First Name, Last Name, act_key, Status, usr_manager_key]

                    Name: UDCAO values: [true]

                    Name: VIEW_USER_DETAILS values: [usr_key, Full Name, Display Name, User Login, First Name, Last Name, act_key, Status, usr_manager_key]

                    Name: UDCAO values: [true]
                    Name: VIEW_USER_DETAILS values: [usr_key, Full Name, Display Name, User Login, First Name, Last Name, act_key, Status, usr_manager_key]

                    Name: UDCAO values: [true]

                    Name: VIEW_USER_DETAILS values: [usr_key, Full Name, Display Name, User Login, First Name, Last Name, act_key, Status, usr_manager_key]

                    Name: UDCAO values: [true] **********
                    ]]



                    please explain what are these lines and its purpose...