Pages

Monday, July 16, 2012

tcImportOperationsIntf API Example

The tcImportOperationsIntf inteface API being used to import the Deployment config files from the local system to the Oracle Identity Manager without using Deployment Manager.

Pre-Requisite:


Initial Setup.

Please follow the link and setup the OIM client environment to use to create the OIM Objects.

Client Code Setup

Add xlDDM.jar File to the CLASSPATH


Add the xlDDM.jar file into the classpath to import the OIM config objects into the OIM repository.

tcImportOperationsIntf API Usage:

The following tasks needs to be performed to import the Oracle Identity Manager config objects from the local file system to the Oracle Identity Manager without using Deployment Manager. They are

1.    Create the OIMClient Handle


OIMClient client= new OIMClient();
client.login(username,password.toCharArray());

2.    Get tcImportOperationsIntf service object


tcImportOperationsIntf import= client.getService(tcImportOperationsIntf.class);

3.   Acquiring the Lock to import the Config Files

import.acquireLock(true);

3.   Verifying the Acquire Lock Object

boolean acquire=import.isLockAcquired()

4.   Build the Config Import File Content

String importFileName="lookup.xml";
StringBuffer sb= new StringBuffer();
BufferedReader br = null;
try
{
        br = new BufferedReader(new InputStreamReader(new FileInputStream(importFileName)));
        String readLine=null;
        while((readLine =br.readLine()) != null)
        {
                    sb.append(readLine+"\n");
        }
 } catch (FileNotFoundException e)
 {
             e.printStackTrace();
 }
 catch (IOException e)
 {
       e.printStackTrace();
 }
 finally
 {
     if(br != null)
     {
       
        try
        {
           br.close();
        }
        catch (IOException e)
       {
         e.printStackTrace();
       }
    }
 }

5.   Adding Config Import XML file to the import object

if(acquire)
{
   Collection<RootObject> importFiles=import.addXMLFile(importFileName, sb.toString());

6.   Retrieving Missing Dependencies from the Import the Objects

String category="Lookup";     

Collection<RootObject> missingDepndencies= import.getMissingDependencies(importFiles, category);

7.   Processing Import Object

      if(missingDepndencies.isEmpty())
      {
        import.importOperationsIntf.performImport(importFiles);
      }
    }

No comments:

Post a Comment