What is Online/Offline Connector mode ?
Online
Connector Mode
When connector is configured in online mode
it make changes on actual target system for operations –
Create , Update , Delete
Offline Connector Mode
When connector is configured in offline
mode it did not make changes on actual target system for
operations – Create , Update , Delete
Connector only returns success for
its operation
Use Case
Connector related Operations
When we install connector on OIM
we have to do many configuration related to connector Sanity testing –
For operations Create , Update ,
Delete , Recon
Approval Process related to
different operations
Email Notifications
Access Policy rules
Migrating connector to Other
environment
When we migrate connector on Test
or Prod environment then we can configure it as OFFLINE mode and we can
test all other configurations
We can change connector to ONLINE
mode after testing all configurations
Approach
Add a custom adapter which takes input parameters same as connector original task
Add a lookup which contains connector mode
Custom adapter reads lookup gets connector mode value
If it is offline then returns success
If it is online then calls original method
Diagram
package com.psl;
import Thor.API.Exceptions.tcAPIException;
import Thor.API.Exceptions.tcColumnNotFoundException;
import Thor.API.Exceptions.tcInvalidLookupException;
import com.thortech.xl.dataaccess.tcDataProvider;
import oracle.iam.connectors.icfcommon.prov.ICProvisioningManager;
import oracle.iam.platform.Platform;
import Thor.API.Operations.tcLookupOperationsIntf;
import Thor.API.tcResultSet;
public class CustomAdapter
{
public CustomAdapter() {
super();
}
public String pslCreateUnixUser(String szItResourceFieldName , String szObjectType,
long lProcessInstanceKey , tcDataProvider otcDataProvider)
{
String szReturnValue = null , szMode = "online" , szSourceLookup = "Lookup.psl.connector.mode";
//1 UD_UNIX_ITRESOURCE
//2 szObjectType - User
//3 long process data - process inst key
//4 otcDataProvider
System.out.println("[OnlineOfflineConnector] Start : Input Params");
System.out.println("[OnlineOfflineConnector] [szItResourceFieldName : "+szItResourceFieldName+" szObjectType "+szObjectType+" lProcessInstanceKey "+lProcessInstanceKey+" otcDataProvider "+otcDataProvider+"]");
System.out.println("[OnlineOfflineConnector] Start : Read Lookup . . . . .");
tcLookupOperationsIntf otcLookupOperationsIntf = Platform.getService(tcLookupOperationsIntf.class);
tcResultSet otcResultSet;
try
{
otcResultSet = otcLookupOperationsIntf.getLookupValues(szSourceLookup);
String szCodeKey, szMeaningValue;
for (int i = 0; i < otcResultSet.getRowCount(); i++)
{
otcResultSet.goToRow(i);
szCodeKey = otcResultSet.getStringValue("Lookup Definition.Lookup Code Information.Code Key");
szMeaningValue = otcResultSet.getStringValue("Lookup Definition.Lookup Code Information.Decode");
if(szItResourceFieldName.compareToIgnoreCase(szCodeKey) == 0)
{
szMode = szMeaningValue;
System.out.println("[OnlineOfflineConnector] Connector Mode is "+szMode);
break;
}
}
}
catch (tcColumnNotFoundException e)
{
System.out.println("[OnlineOfflineConnector] Exception occured "+e.getMessage());
}
catch (tcAPIException e)
{
System.out.println("[OnlineOfflineConnector] Exception occured "+e.getMessage());
}
catch (tcInvalidLookupException e)
{
System.out.println("[OnlineOfflineConnector] Exception occured "+e.getMessage());
}
if(szMode.compareToIgnoreCase("offline") == 0)
{
System.out.println("[OnlineOfflineConnector] Connector is configured in offline mode, hence return SUCCESS");
szReturnValue = "SUCCESS";
}
else
{
// Online mode Code Working
System.out.println("[OnlineOfflineConnector] Connector is configured in online mode");
System.out.println("[OnlineOfflineConnector] Creating Object oICProvisioningManager");
ICProvisioningManager oICProvisioningManager
= new ICProvisioningManager(szItResourceFieldName , lProcessInstanceKey , otcDataProvider );
System.out.println("[OnlineOfflineConnector] Object oICProvisioningManager created successfully.");
System.out.println("[OnlineOfflineConnector] Before calling createObject("+szObjectType+")");
szReturnValue = oICProvisioningManager.createObject(szObjectType);
System.out.println("[OnlineOfflineConnector] Return Value : ["+szReturnValue+"]");
System.out.println("[OnlineOfflineConnector] End");
}
return szReturnValue;
}
}
No comments:
Post a Comment