Search in sources :

Example 6 with AMCallBack

use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.

the class CallBackHelper method preProcessModifyMemberShip.

/**
     * Special method for pre processing memberShip modification for roles &
     * groups.
     */
public Set preProcessModifyMemberShip(SSOToken token, String entryDN, String orgDN, Set members, int operation, int objectType) throws AMException {
    Set implSet = getPrePostImpls(orgDN);
    if (implSet != null && !implSet.isEmpty()) {
        // Post processing impls present
        // 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:
                        members = impl.preProcessAddUser(token, entryDN, members, objectType);
                        break;
                    case DirectoryServicesImpl.REMOVE_MEMBER:
                        members = impl.preProcessRemoveUser(token, entryDN, members, objectType);
                        break;
                }
            } catch (AMException ae) {
                // Exception thrown by the external impl
                debug.error("CallBackHelper.preProcessModifyMemberShip():" + " Preprocessing impl " + className + " exception " + "thrown by impl:", ae);
                throw ae;
            }
        }
    }
    return members;
}
Also used : AMCallBack(com.iplanet.am.sdk.AMCallBack) AttrSet(com.iplanet.services.ldap.AttrSet) Set(java.util.Set) Iterator(java.util.Iterator) AMException(com.iplanet.am.sdk.AMException)

Example 7 with AMCallBack

use of com.iplanet.am.sdk.AMCallBack in project OpenAM by OpenRock.

the class CallBackHelper method postProcess.

// TODO: Remove this. Use the Maps interface only
public void postProcess(SSOToken token, String entryDN, String orgDN, AttrSet oldAttrSet, AttrSet newAttrSet, 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())) {
        Map newAttrMap = CommonUtils.attrSetToMap(newAttrSet);
        Map oldAttrMap = CommonUtils.attrSetToMap(oldAttrSet);
        // 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);
            }
        }
    }
}
Also used : AMCallBack(com.iplanet.am.sdk.AMCallBack) AttrSet(com.iplanet.services.ldap.AttrSet) Set(java.util.Set) Iterator(java.util.Iterator) AMException(com.iplanet.am.sdk.AMException) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

AMCallBack (com.iplanet.am.sdk.AMCallBack)7 AttrSet (com.iplanet.services.ldap.AttrSet)7 Iterator (java.util.Iterator)7 Set (java.util.Set)7 AMException (com.iplanet.am.sdk.AMException)6 HashMap (java.util.HashMap)4 Map (java.util.Map)4