We have BLTH code that was working in previous versions, but is no longer functioning the same way after upgrades.
Release : 14.4, 14.5
Custom code, including BLTH code is the responsibility of the end client to keep up to date and functional. As we update the underlying Identity Management code as we design new versions, those underlying changes can cause existing customizations to no longer work.
Broadcom Development tries to minimize this impact to the greatest extent possible, but sometimes it is unavoidable and previously working code will need to be reviewed and updated for the new versions.
The following discusses implementing and troubleshooting custom BLTH code for example purposes. Broadcom does not provide support for custom code, including ensuring that code works after an upgrade.
The following information has been generated with our sample "setManagerBLTH" BLTH code.
1. Verify that the Java_Home is pointing to a Java 8, preferably the same Java 8 that Identity Manager is utilizing.
2. Download log4j
https://downloads.apache.org/logging/log4j/
These log4j libraries must be added to the samples lib folder
..\CA-IM_Tools\lib
3. Edit the make_sample.bat to include log4j classes:
%JAVAC_EXE% -classpath .;%IMS_LIB_PATH%\ims.jar;%IMS_LIB_PATH%\imsapi6.jar;%IMS_LIB_PATH%\smcrypto.jar;%IMS_LIB_PATH%\smjavasdk2.jar;%IMS_LIB_PATH%\log4j-1.2-api-2.20.0.jar -d . BLTHSetManager.java
4. Add this to the import section of the setMangerBLTH:
import org.apache.log4j.Logger;
After:
public class BLTHSetManager extends BLTHAdapter {
5. Add this line to get the class name:
private static Logger logger = Logger.getLogger(BLTHSetManager.class.getName());
6. Now throughout the class you can add these types of messages:
logger.error("This is the message");
Example:
// The next line has been added for debug log testing
logger.error("We are not trying to set the string managerUniqueName");
String managerUniqueName = blthContext.getAdminUniqueName();
// The next line has been added for debug log testing
logger.error("We have set the managerUniqueName to" + managerUniqueName);
You can all add onscreen messages as discussed here: 14.5 Documentation - Custom Message Example
Details on how to deploy the class: 14.5 Documentation - Deploying Run Time Files
Details on how to add to the IME: 14.5 Documentation - Configuring Business Logic Task Handlers
The following is a full extended code example with Debug from the Task-Specific for this sample:
com.ca.identitymanager.samples.BLTHSetManager
setManagerBLTH extended example code, including the above debugging:/*
* Copyright (C) 2009, CA. All rights reserved.
*
* CA makes no representations concerning either the merchantability of this
* software or the suitability of this software for any particular purpose.
* It is provided "as is" without express or implied warranty of any kind.
*/
package com.ca.identitymanager.samples;
import com.netegrity.imapi.BLTHAdapter;
import com.netegrity.imapi.BLTHContext;
import com.netegrity.ims.exception.IMSException;
import org.apache.log4j.Logger;
/**
* This is an example of Business Logic Task Handler (BLTH)
* that sets manager attribute to the unique name
* of the administrator that executes the task Create User.
*/
public class BLTHSetManager extends BLTHAdapter {
// added for proper logging in jboss
private static Logger logger = Logger.getLogger(BLTHSetManager.class.getName());
public void handleSetSubject(BLTHContext blthContext) throws Exception {
// get current administrator name
// The next line has been added for debug log testing
logger.error("We are now trying to set the string managerUniqueName");
String managerUniqueName = blthContext.getAdminUniqueName();
// The next line has been added for debug log testing
logger.error("We have set the managerUniqueName to: " + managerUniqueName);
if (managerUniqueName == null) {
// The next line has been added for debug log testing
logger.error("We have Failed to set the managerUniqueName it is null");
// this message will be presented on the screen
IMSException imsEx = new IMSException();
imsEx.addUserMessage("Failed to get administrator unique name");
throw imsEx;
}
try {
// The next line has been added for debug log testing
logger.error("We have a value in managerUniqueName, now setting the screenfiled context of the user's manager attribute to that value");
// Setting RDB specific attribute
// Attribute name "tblUsers.manager" may have different name in other directories,
// for exemple: for LDAP it will be "manager"
// Changed at time of test to manager imMangerId is the physical name of the attribute in the user directory.xml
blthContext.getUser().setAttribute("imManagerId", managerUniqueName);
logger.error("We have set the screenfieled context of the user's manager attribute to the value present in the string managerUniqueName");
} catch (Exception ex) {
// The next line has been added for debug log testing
logger.error("We have FAILED to set the screenfieled context of the user's manager attribute to the value present in the string managerUniqueName");
// this message will be presented on the screen
IMSException imsEx = new IMSException();
imsEx.addUserMessage("Failed to set admin unique name. " + ex.getMessage());
throw imsEx;
}
logger.error("We have set the user's manager and are now exiting the BLTH");
}
}
This now produces the following messages in the application server log, which can be used to help troubleshoot custom BLTH code:
2023-03-20 11:24:27,353 ERROR [com.ca.identitymanager.samples.BLTHSetManager] (default task-2) We are now trying to set the string managerUniqueName
2023-03-20 11:24:27,354 ERROR [com.ca.identitymanager.samples.BLTHSetManager] (default task-2) We have set the managerUniqueName to: uid=imadmin,ou=people,ou=im,ou=ca,o=com
2023-03-20 11:24:27,354 ERROR [com.ca.identitymanager.samples.BLTHSetManager] (default task-2) We have a value in managerUniqueName, now setting the screenfieled context of the user's manager attribute to that value
2023-03-20 11:24:27,354 ERROR [com.ca.identitymanager.samples.BLTHSetManager] (default task-2) We have set the screenfieled context of the user's manager attribute to the value present in the string managerUniqueName
2023-03-20 11:24:27,354 ERROR [com.ca.identitymanager.samples.BLTHSetManager] (default task-2) We have set the user's manager and are now exiting the BLTH
For specific Hands-On assistance designing, building, deploying or troubleshooting Custom BLTH code, reach out to your Account team, or directly to Professional Services Partner's:
https://expert.broadcom.com/