psdi.security.ldap

Class DefaultLdapSyncAdapter

  • All Implemented Interfaces:
    LdapSyncListener


    public class DefaultLdapSyncAdapter
    extends LdapSyncAdapter
    A default adapter class that synchronizes the LDAP directory data with configured MAXIMO database table mappings. An object if this class is registered as a listener to the synchronizer object and receives notification events whenever LDAP user or group data need to be synchronized.
    • Field Detail

      • cachedPreparedStatements

        protected java.util.HashMap cachedPreparedStatements
        A cache of prepared statements to improve the performance of the repeatedly executed SQL statements.
    • Constructor Detail

      • DefaultLdapSyncAdapter

        public DefaultLdapSyncAdapter()
    • Method Detail

      • deleteMemberRecords

        protected void deleteMemberRecords(java.sql.Connection con,
                                           SyncData syncData,
                                           MemberDataMap memberDataMap)
                                    throws java.sql.SQLException
        Deletes member records based on the data provided.
        Parameters:
        con - database connection to be used
        syncData - synchronization data obtained from LDAP server
        memberDataMap - member data mapping to be used
        Throws:
        java.sql.SQLException - if fails to delete members
      • addMemberRecords

        protected void addMemberRecords(java.sql.Connection con,
                                        SyncData syncData,
                                        MemberDataMap memberDataMap,
                                        java.util.Set members)
                                 throws LdapSyncException,
                                        java.sql.SQLException
        Adds member records based on the data provided.
        Parameters:
        con - database connection to be used
        syncData - synchronization data obtained from LDAP server
        memberDataMap - member data mapping to be used
        members - list of user account names
        Throws:
        java.sql.SQLException - if fails to add members
        LdapSyncException
      • getMemberDataMapKeyColumnValue

        protected java.lang.Object getMemberDataMapKeyColumnValue(java.lang.String keyColumn,
                                                                  SyncData syncData,
                                                                  MemberDataMap memberDataMap)
        Returns the key value for the given key column from the member data mapping.
        Parameters:
        keyColumn - key column
        syncData - synchronization data from LDAP Server
        memberDataMap - member data map
        Returns:
        key value for the given key column
      • getMemberDataMapColumnValue

        protected java.lang.Object getMemberDataMapColumnValue(java.sql.Connection con,
                                                               java.lang.String column,
                                                               SyncData syncData,
                                                               MemberDataMap memberDataMap)
                                                        throws LdapSyncException
        Returns the column value for the given column from the member data mapping.
        Parameters:
        column - column name
        syncData - synchronization data from LDAP Server
        memberDataMap - member data map
        Returns:
        key value for the given key column
        Throws:
        LdapSyncException
      • cachePreparedStatement

        protected void cachePreparedStatement(java.lang.String query,
                                              java.sql.PreparedStatement stmt)
        Puts the statement in the cache based on the query.
        Parameters:
        query - query to be used as a key.
        stmt - statement to be cached.
      • getCachedPreparedStatement

        protected java.sql.PreparedStatement getCachedPreparedStatement(java.lang.String query)
        Returns a cached statement object for the given query.
        Parameters:
        query - query to be used to retrieve the cached statement.
        Returns:
        a cached statement object for the given query, if exists, otherwise null.
      • closeCachedPreparedStatements

        protected void closeCachedPreparedStatements()
        Closes all the cached prepared statements. This is done when the synchronizer indicates that the synchronization operation is completed.
      • getDataMapValue

        protected java.lang.Object getDataMapValue(java.sql.Connection con,
                                                   java.lang.String tableId,
                                                   java.lang.String columnName,
                                                   SyncData syncData,
                                                   DataMap dataMap)
                                            throws LdapSyncException
        Returns the value to be used to for the given table and column based on the data mapping. If the data mapping contains an LDAP attribute, the appropriate data obtained from LDAP server is returned. If the data mapping contains special attributes that need processing, the processing is completed and the resulted value is returned.
        Parameters:
        con - database connection to be used
        tableId - table id
        columnName - column name
        syncData - data from the LDAP server
        dataMap - data mapping
        Returns:
        the value to be used.
        Throws:
        LdapSyncException - if fails to get the data value.
      • insertRecord

        protected MboRemote insertRecord(java.sql.Connection con,
                                         java.lang.String tableId,
                                         MboSetRemote mboSet,
                                         SyncData syncData,
                                         DataMap dataMap)
                                  throws LdapSyncException,
                                         MXException,
                                         java.rmi.RemoteException
        Inserts a record into MboSet based on the information provided.
        Parameters:
        con - connection to be used
        tableId - table id
        mboSet - The MboSet to get the new record.
        syncData - data from LDAP Server
        dataMap - data mapping
        Returns:
        The new Mbo.
        Throws:
        LdapSyncException
        MXException
        java.rmi.RemoteException
      • updateRecord

        protected void updateRecord(java.sql.Connection con,
                                    java.lang.String tableId,
                                    MboRemote mbo,
                                    SyncData syncData,
                                    DataMap dataMap)
                             throws LdapSyncException,
                                    MXException,
                                    java.rmi.RemoteException
        Updates an existing mbo based on the information provided.
        Parameters:
        con - connection to be used
        tableId - table id
        mbo - The Mbo
        syncData - data from LDAP Server
        dataMap - data mapping
        Throws:
        LdapSyncException
        MXException
        java.rmi.RemoteException
      • deleteRecord

        protected void deleteRecord(MboRemote mbo)
                             throws MXException,
                                    java.rmi.RemoteException
        Deletes an existing mbo.
        Parameters:
        mbo - The mbo to be deleted.
        Throws:
        MXException
        java.rmi.RemoteException
      • logBindValue

        protected void logBindValue(java.lang.String bindColumnName,
                                    java.lang.Object bindValue)
        Logs the bind column name and its value.