Thursday, September 3, 2015

OIM 11g R2 Getting all Application Instances Using OIM Java API's

  1. package oimclient;

  2. import java.util.HashMap;
  3. import java.util.Hashtable;
  4. import java.util.List;

  5. import oracle.iam.platform.OIMClient;
  6. import oracle.iam.platform.entitymgr.vo.SearchCriteria;
  7. import oracle.iam.provisioning.api.ApplicationInstanceService;
  8. import oracle.iam.provisioning.vo.ApplicationInstance;

  9. public class GetAllAppInstances {


  10.     public static void main(String[] args) throws Exception {
  11.         Hashtable env = new Hashtable();
  12.         env.put("java.naming.provider.url", "t3://localhost:14000");
  13.         env.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
  14.         System.setProperty("java.security.auth.login.config","G:/Oracle/Middleware/Oracle_IDM1/server/config/authwl.conf");
  15.         System.setProperty("APPSERVER_TYPE","wls");

  16.         OIMClient oimClient = new OIMClient(env);
  17.         oimClient.login("xelsysadm", "Welcome1".toCharArray());

  18.         ApplicationInstanceService aiService = oimClient.getService(ApplicationInstanceService.class);

  19.         SearchCriteria criteria = new SearchCriteria(ApplicationInstance.APPINST_NAME,
  20.             "*", SearchCriteria.Operator.BEGINS_WITH);

  21.         List<ApplicationInstance> aiList = aiService.findApplicationInstance(criteria, new HashMap<String, Object>());

  22.         for(ApplicationInstance ai : aiList) {
  23.          System.out.println("ai name = " + ai.getApplicationInstanceName());
  24.         }

  25.         
  26.     }
  27. }

No comments:

Post a Comment

Other Posts