public abstract class AbstractLdapSynchronizer extends LdapSynchronizer
Modifier and Type | Field and Description |
---|---|
protected java.sql.Connection |
connection
A database connection used for writing the appropriate user and
group data to MAXIMO tables.
|
protected LdapContextSettings |
contextSettings
LDAP Server related settings provided in the configuration file.
|
protected int |
errorCount
Number of errors in this cycle.
|
protected boolean |
fullSyncNeeded
A boolean flag to indicate whether a full synchronization is needed
or not.
|
static int |
GROUP_SEARCH_PAGE_SIZE
The default search page result for group searches
|
protected GroupSettings |
groupSettings
Group settings provided in the configuration file.
|
protected LdapSyncListener |
ldapSyncListener
Synchronization listener object that will receive notifications
for each user or group that need to be synchronized to MAXIMO
database tables.
|
protected MXLogger |
logger
Logger object used to output any messages to indicate the progress
of the synchronization.
|
protected static int |
maxErrors
The maximum number of errors allowed per cycle.
|
protected int |
noGroupsSynchronized
A number used to indicate how many group objects are synchronized
with respect to MAXIMO tables when a synchronization task is performed.
|
protected int |
noUsersSynchronized
A number used to indicate how many user objects are synchronized
with respect to MAXIMO tables when a synchronization task is performed.
|
protected MXLogger |
sqlLogger
Logger object used to output any SQL messages to indicate the progress
of the synchronization.
|
protected SynchronizerSettings |
synchronizerSettings
Synchronization settings provided in the configuration file.
|
protected boolean |
syncNeeded
A boolean flag to indicate whether synchronization is needed or not.
|
protected SyncParameters |
syncParameters
Synchronization parameters.
|
static int |
USER_SEARCH_PAGE_SIZE
The default search page result for user searches
|
protected UserSettings |
userSettings
User settings provided in the configuration file.
|
Constructor and Description |
---|
AbstractLdapSynchronizer()
A default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
buildURL(java.lang.String host,
int port,
boolean sslEnabled)
Builds a URL to be used as the provider URL to perform directory
operations.
|
protected void |
closeContext(javax.naming.Context ctx)
Closes the given context.
|
protected void |
commitGroupChanges()
Perform a database commit operation and logs a message.
|
protected void |
commitGroupChanges(int objectsProcessed)
Perform a database commit operation based on the number of
group objects processed.
|
protected void |
commitUserChanges()
Perform a database commit operation and logs a message.
|
protected void |
commitUserChanges(int objectsProcessed)
Perform a database commit operation based on the number of
user objects processed.
|
protected javax.naming.ldap.LdapContext |
createDefaultLdapContext()
Creates a default LDAP context based on the configuration settings
provided.
|
protected javax.naming.ldap.LdapContext |
createSearchLdapContext()
Creates a LDAP context to be used for searches.
|
protected abstract void |
determineSynchronizationNeed()
Determines whether synchronization is needed or not.
|
protected java.util.Hashtable |
getDefaultLdapContextEnvironment()
Returns the default context environment to be used
for creating the context.
|
protected java.lang.String[] |
getGroupAttributes()
Returns list of attributes for which values need to be obtained
from the directory server when performing group search.
|
protected abstract java.lang.String |
getGroupDNAttributeName()
Returns the attribute used for identifying the distinguished
name of a group object.
|
protected java.lang.String |
getGroupMemberAsGroupAttribute()
Returns the attribute name used for indentifying
group of a group.
|
protected java.lang.String |
getGroupMemberAsUserAttribute()
Returns the attribute name used for indentifying
user of a group.
|
protected java.lang.String |
getGroupMembersAttribute()
Returns the attribute name of group member
|
protected abstract java.lang.String |
getGroupObjectClass()
Returns the object class used to indentify group objects.
|
protected java.lang.String |
getGroupSearchBase()
Returns the base distinguished name of the directory hirerarchy
to be used for searching group objects.
|
protected javax.naming.directory.SearchControls |
getGroupSearchControls()
Returns the search controls used for group searches.
|
protected java.lang.String |
getGroupSearchFilter()
Returns the search filter (LDAP query) to be used for
performing search for group objects.
|
protected int |
getGroupSearchPageSize()
Returns the maximum numbers of objects to be returned
in every page result.
|
protected int |
getGroupSearchScope()
Returns the sarch scope to be used for group searches.
|
LdapSyncListener |
getLDAPSyncListener()
Returns the listener object that receives synchronization events.
|
protected java.util.Hashtable |
getSearchLdapContextEnvironment()
Returns the search context environment to be used
for creating the context.
|
SynchronizerSettings |
getSynchronizerSettings()
Returns synchronizer settings configured.
|
SyncParameters |
getSyncParameters()
Returns the synchronization parameters used
during the synchronization.
|
protected java.lang.String[] |
getUserAttributes()
Returns list of attributes for which values need to be obtained
from the directory server when performing user search.
|
protected abstract java.lang.String |
getUserDNAttributeName()
Returns the attribute used for identifying the distinguished
name of a user object.
|
protected abstract java.lang.String |
getUserObjectClass()
Returns the object class used to indentify user objects.
|
protected java.lang.String |
getUserSearchBase()
Returns the base distinguished name of the directory hirerarchy
to be used for searching user objects.
|
protected javax.naming.directory.SearchControls |
getUserSearchControls()
Returns the search controls used for user searches.
|
protected java.lang.String |
getUserSearchFilter()
Returns the search filter (LDAP query) to be used for performing search
for user objects.
|
protected int |
getUserSearchPageSize()
Returns the maximum numbers of objects to be returned
in every page result.
|
protected int |
getUserSearchScope()
Returns the sarch scope to be used for user searches.
|
void |
init(LdapSynchronizerInitData initData)
Initializes the synchronizer with the initialization data that's
obtained from configuration values.
|
protected void |
initSync()
Called to let the synchronizer initialize itself before the
synchronization work starts.
|
boolean |
isFullSyncNeeded()
Returns whether a full synchronizaiton is needed or not.
|
boolean |
isSyncNeeded()
Returns whether synchronization is needed or not.
|
void |
performSync(java.sql.Connection con,
SyncParameters syncParams,
UserInfo userInfo)
Performs the synchronization operation based on the synchronization
parameters.
|
protected abstract java.util.Set |
retrieveAllGroupMembers(java.lang.String groupDN)
Retrieves all the group members of the given group distinguished
name.
|
protected void |
setFullSyncNeeded(boolean needed)
Sets the flag to indicate whether full synchronization is needed
or not.
|
void |
setLDAPSyncListener(LdapSyncListener ldapSyncListener)
Sets the listener object that gets notification events during
synchronization process.
|
void |
setOwner(LdapSyncTask val)
Set reference to the calling class
|
protected void |
setSyncNeeded(boolean needed)
Sets the flag to indicate whether synchronization is needed
or not.
|
protected void |
syncGroupMembers(SyncData groupSyncData,
java.util.Set groupMembers)
Sends an event to the listener with the list of members of a group
to synchronize the data to MAXIMO tables.
|
protected void |
syncGroups()
Performs LDAP query against the LDAP Directory server and retrieves
the results page by page and processes each page result.
|
protected void |
syncUsers()
Performs LDAP query against the LDAP Directory server and retrieves
the results page by page and processes each page result.
|
protected void |
updateSyncParameters()
Called when the synchronization task is completed successfully.
|
public static final int USER_SEARCH_PAGE_SIZE
public static final int GROUP_SEARCH_PAGE_SIZE
protected SyncParameters syncParameters
protected SynchronizerSettings synchronizerSettings
protected LdapContextSettings contextSettings
protected UserSettings userSettings
protected GroupSettings groupSettings
protected MXLogger logger
protected MXLogger sqlLogger
protected LdapSyncListener ldapSyncListener
protected boolean fullSyncNeeded
protected boolean syncNeeded
protected int noUsersSynchronized
protected int noGroupsSynchronized
protected java.sql.Connection connection
protected int errorCount
protected static int maxErrors
public AbstractLdapSynchronizer()
public void init(LdapSynchronizerInitData initData) throws LdapSyncException
init
in class LdapSynchronizer
initData
- initialization dataLdapSyncException
- if fail to initializepublic SyncParameters getSyncParameters()
public SynchronizerSettings getSynchronizerSettings()
public void performSync(java.sql.Connection con, SyncParameters syncParams, UserInfo userInfo) throws LdapSyncException
performSync
in class LdapSynchronizer
con
- database connection to be used for synchronizing
LDAP data with MAXIMO database tables.syncParams
- synchronization prametersLdapSyncException
- if fails to synchronizepublic void setOwner(LdapSyncTask val)
protected void closeContext(javax.naming.Context ctx)
ctx
- context to be closed.protected void updateSyncParameters()
protected java.util.Hashtable getDefaultLdapContextEnvironment()
protected javax.naming.ldap.LdapContext createDefaultLdapContext() throws javax.naming.NamingException
javax.naming.NamingException
- if fails to create the context.protected java.lang.String buildURL(java.lang.String host, int port, boolean sslEnabled)
host
- host name of the LDAP Serverport
- port numbersslEnabled
- indicates whether the port is for SSL or not.protected java.util.Hashtable getSearchLdapContextEnvironment()
protected javax.naming.ldap.LdapContext createSearchLdapContext() throws javax.naming.NamingException
javax.naming.NamingException
public boolean isFullSyncNeeded()
public boolean isSyncNeeded()
protected void setFullSyncNeeded(boolean needed)
needed
- true value indicates full synchronization is needed.protected void setSyncNeeded(boolean needed)
needed
- true value indicates synchronization is needed.protected void initSync() throws LdapSyncException
LdapSyncException
- if fails to initializeprotected java.lang.String getUserSearchBase()
protected java.lang.String getUserSearchFilter()
protected javax.naming.directory.SearchControls getUserSearchControls()
protected java.lang.String[] getUserAttributes()
protected int getUserSearchScope()
protected int getUserSearchPageSize()
protected void syncUsers() throws LdapSyncException
LdapSyncException
protected void commitUserChanges(int objectsProcessed) throws LdapSyncException
objectsProcessed
- number of user objects processed.LdapSyncException
- if fails to commit the changes.protected void commitUserChanges() throws LdapSyncException
LdapSyncException
- if fails to commit the changes.protected void commitGroupChanges(int objectsProcessed) throws LdapSyncException
objectsProcessed
- number of group objects processed.LdapSyncException
- if fails to commit the changes.protected void commitGroupChanges() throws LdapSyncException
LdapSyncException
- if fails to commit the changes.protected abstract void determineSynchronizationNeed() throws LdapSyncException
LdapSyncException
- if fails to determine the needprotected abstract java.lang.String getUserObjectClass()
protected abstract java.lang.String getGroupObjectClass()
protected abstract java.lang.String getUserDNAttributeName()
protected abstract java.lang.String getGroupDNAttributeName()
protected java.lang.String getGroupMembersAttribute()
protected java.lang.String getGroupMemberAsUserAttribute()
protected java.lang.String getGroupMemberAsGroupAttribute()
protected java.lang.String getGroupSearchBase()
protected java.lang.String getGroupSearchFilter()
protected javax.naming.directory.SearchControls getGroupSearchControls()
protected java.lang.String[] getGroupAttributes()
protected int getGroupSearchScope()
protected int getGroupSearchPageSize()
protected void syncGroups() throws LdapSyncException
LdapSyncException
protected abstract java.util.Set retrieveAllGroupMembers(java.lang.String groupDN) throws LdapSyncException
groupDN
- group distinguished name for which users
need to be retrieved.LdapSyncException
- if fails to retrieve members.protected void syncGroupMembers(SyncData groupSyncData, java.util.Set groupMembers) throws LdapSyncException
groupSyncData
- data obtained from LDAP server for the groupgroupMembers
- list of user account namesLdapSyncException
- if fails to synchronize members.public void setLDAPSyncListener(LdapSyncListener ldapSyncListener)
ldapSyncListener
- a listener object that need to receive
synchronization events.public LdapSyncListener getLDAPSyncListener()