Symantec IGA

  • 1.  How to call external java methods from Policy Xpress ?

    Broadcom Employee
    Posted Dec 28, 2012 03:52 PM

    You need to package and deploy your class correctly, then invoke it from PX using the Run Java Code -> Execute Main function option.

    In order to call a java class from Policy Xpress you will need to do the following:

    1.
    Create a java class that has a Main method. The arguments to the class are passed as string arguments (var is args - see below).

    Here is an example of such a class. It is also attached to this document.
    /**
    *
    */
    package com.ca.px.example;

    import com.netegrity.imapi.IMContext;

    /**
    */
    public class PxExternalCode {


    /**

    * @param args

    */

    public static void main(String[] args) {


    System.out.println("Main - Entered.");


    System.out.println("Main - Calling invoke method.");


    new PxExternalCode().invoke(null, args);


    System.out.println("Main - exit. DONE");

    }



    public static void invoke(IMContext context, String[] args) {


    System.out.println("invoke - Entered");


    System.out.println("invoke - printing the received arguments");


    System.out.println(args[0]);


    System.out.println("invoke - Exit");

    }

    }


    2.
    After compiling the class you need to deploy it. You have two options:

    If the class is packaged as a jar file then you need to place your jar file under: user_console.war\web-inf\lib

    If the class file is not packaged as a jar file then you need to place your class under its respective package folder structure under user_console.war\web-inf\classes.

    So, for the example above it will be under: user_console.war\web-inf\classes\com\ca\px\example (where you'll place the class file).

    Note: the 'classes' folder under user_console.war\web-inf does not exist by default and you'll need to create it.

    If your Identity Manager server is clustered then this should be deployed in any node of your cluster.


    3.
    Restart the Identity Manager server. If clustered , restart all nodes.


    4.
    Create a PX Policy. Choose the trigger you need.

    In Action Rules -> create an action rule -> Choose the Execute Java Method -> Main method option. There you should specify the full name of your class. In our example you should use: com.ca.px.example.PxExternalCode.

    You can add parameters in this screen using the Data elements you have in your policy. These parameters will be passed onto your java class as arguments in the 'args' variable. Your class can use them via the args variable.



    This information is also available as tech doc 583969 on CA's support web site:
    https://support.ca.com/irj/portal/kbtech?docid=583969


    Yours,

    Sagi Gabay,
    CA Technologies.



  • 2.  RE: How to call external java methods from Policy Xpress ?

     
    Posted Dec 28, 2012 07:58 PM
    Thanks for the info Sagi!


  • 3.  RE: How to call external java methods from Policy Xpress ?

    Posted Dec 29, 2012 02:29 PM
    What Release(s) does this work with?


  • 4.  RE: How to call external java methods from Policy Xpress ?

    Posted Oct 15, 2013 12:01 PM
    How to return values from the external java method/class executed, back to Policy Xpress?


  • 5.  RE: How to call external java methods from Policy Xpress ?

    Posted Oct 15, 2013 08:17 PM
    Unfortunately, returning a value back to Policy Xpress is not currently supported (would make a great enhancement request!).