use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.
the class CallBackHelper method preProcess.
public Map preProcess(SSOToken token, String entryDN, String orgDN, Map oldAttrMap, Map newAttrMap, int operation, int objectType, boolean softDelete) throws AMException {
Set implSet = getPrePostImpls(orgDN);
if (implSet != null && !implSet.isEmpty()) {
// Post processing impls present
// Iterate through the Pre-Processing Impls and execute
Iterator itr = implSet.iterator();
while (itr.hasNext()) {
String className = (String) itr.next();
AMCallBack impl = getCallBackObject(className);
if (impl == null) {
continue;
}
try {
Map map;
switch(operation) {
case CREATE:
map = impl.preProcessCreate(token, entryDN, newAttrMap, objectType);
newAttrMap = ((map == null) ? newAttrMap : map);
break;
case MODIFY:
map = impl.preProcessModify(token, entryDN, oldAttrMap, newAttrMap, objectType);
newAttrMap = ((map == null) ? newAttrMap : map);
break;
case DELETE:
impl.preProcessDelete(token, entryDN, oldAttrMap, softDelete, objectType);
break;
}
} catch (AMException ae) {
// Exception thrown by the external impl
debug.error("CallBackHelper.preProcess(): Preprocessing" + "impl " + className + " exception thrown by impl:", ae);
throw ae;
}
}
return newAttrMap;
}
// not null as newAttrSet will be the latest one needed for updation
return ((newAttrMap != null) ? newAttrMap : oldAttrMap);
}
use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.
the class CallBackHelper method preProcess.
// TODO: Remove this. Use the Maps interface only
public AttrSet preProcess(SSOToken token, String entryDN, String orgDN, AttrSet oldAttrSet, AttrSet newAttrSet, int operation, int objectType, boolean softDelete) throws AMException {
Set implSet = getPrePostImpls(orgDN);
if (implSet != null && !implSet.isEmpty()) {
// Post processing impls present
// Iterate through the Pre-Processing Impls and execute
Iterator itr = implSet.iterator();
Map newAttrMap = CommonUtils.attrSetToMap(newAttrSet);
Map oldAttrMap = CommonUtils.attrSetToMap(oldAttrSet);
while (itr.hasNext()) {
String className = (String) itr.next();
AMCallBack impl = getCallBackObject(className);
if (impl == null) {
continue;
}
try {
Map map;
switch(operation) {
case CREATE:
map = impl.preProcessCreate(token, entryDN, newAttrMap, objectType);
newAttrMap = ((map == null) ? newAttrMap : map);
break;
case MODIFY:
map = impl.preProcessModify(token, entryDN, oldAttrMap, newAttrMap, objectType);
newAttrMap = ((map == null) ? newAttrMap : map);
break;
case DELETE:
impl.preProcessDelete(token, entryDN, oldAttrMap, softDelete, objectType);
break;
}
} catch (AMException ae) {
// Exception thrown by the external impl
debug.error("CallBackHelper.preProcess(): Preprocessing" + "impl " + className + " exception thrown by impl:", ae);
throw ae;
}
}
return CommonUtils.mapToAttrSet(newAttrMap);
}
// not null as newAttrSet will be the latest one needed for updation
return ((newAttrSet != null) ? newAttrSet : oldAttrSet);
}
use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.
the class CallBackHelper method postProcess.
public void postProcess(SSOToken token, String entryDN, String orgDN, Map oldAttrMap, Map newAttrMap, int operation, int objectType, boolean softDelete) throws AMException {
// Use the external impls instantiated at the time of pre-processing
Set implSet = getPrePostImpls(orgDN);
if ((implSet != null) && (!implSet.isEmpty())) {
// Iterate through the Pre-Processing Impls and execute
Iterator itr = implSet.iterator();
while (itr.hasNext()) {
String className = (String) itr.next();
AMCallBack impl = getCallBackObject(className);
if (impl == null) {
continue;
}
try {
switch(operation) {
case CREATE:
impl.postProcessCreate(token, entryDN, newAttrMap, objectType);
break;
case MODIFY:
impl.postProcessModify(token, entryDN, oldAttrMap, newAttrMap, objectType);
break;
case DELETE:
impl.postProcessDelete(token, entryDN, oldAttrMap, softDelete, objectType);
break;
}
} catch (AMException ae) {
// Exception thrown by the external impl
debug.error("CallBackHelper.postProcess(): Preprocessing" + "impl " + impl.getClass().getName() + " exception thrown: ", ae);
}
}
}
}
use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.
the class CallBackHelper method getAttributes.
public Map getAttributes(SSOToken token, String entryDN, Set attrNames, String orgDN) {
if (!isExternalGetAttributesEnabled(orgDN)) {
return null;
}
Set implSet = getPrePostImpls(orgDN);
if (implSet != null && !implSet.isEmpty()) {
Map attributes = new HashMap();
Iterator itr = implSet.iterator();
while (itr.hasNext()) {
String className = (String) itr.next();
AMCallBack impl = getCallBackObject(className);
if (impl == null) {
continue;
}
Map implAttrs = impl.getAttributes(token, entryDN, attrNames);
if (implAttrs != null && !implAttrs.isEmpty()) {
attributes = CommonUtils.mergeMaps(implAttrs, attributes);
}
}
return attributes;
}
return null;
}
use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.
the class CallBackHelper method postProcessModifyMemberShip.
/**
* Special method for post processing memberShip modification for roles &
* groups.
*/
public void postProcessModifyMemberShip(SSOToken token, String entryDN, String orgDN, Set members, int operation, int objectType) throws AMException {
// Use the external impls instantiated at the time of pre-processing
Set implSet = getPrePostImpls(orgDN);
if ((implSet != null) && (!implSet.isEmpty())) {
// Iterate through the PrePost-Processing plugins and execute
Iterator itr = implSet.iterator();
while (itr.hasNext()) {
String className = (String) itr.next();
AMCallBack impl = getCallBackObject(className);
if (impl == null) {
continue;
}
try {
switch(operation) {
case DirectoryServicesImpl.ADD_MEMBER:
impl.postProcessAddUser(token, entryDN, members, objectType);
break;
case DirectoryServicesImpl.REMOVE_MEMBER:
impl.postProcessRemoveUser(token, entryDN, members, objectType);
break;
}
} catch (AMException ae) {
// Exception thrown by the external impl
debug.error("CallBackHelper.postProcessModifyMemberShip()" + ": Preprocessing impl " + impl.getClass().getName() + " exception thrown: ", ae);
}
}
}
}
Aggregations