public class VMMSynchronizer extends Synchronizer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CHECKPOINT
The ParamName on LdapSyncParams table for storing check point values for the last iteration of VMMSYNC, when ChangePolling was enabled.
|
protected java.sql.Connection |
connection
A database connection used for writing the appropriate user and
group data to MAXIMO tables.
|
protected VMMContextSettings |
contextSettings
VMM 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 java.util.HashMap |
lastCheckPoint
The last check point during the last iteration of VMMSYNC.
|
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 java.util.HashMap |
newCheckPoint
The current check point during this iteration of VMMSYNC.
|
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 boolean |
syncNeeded
A boolean flag to indicate whether synchronization is needed or not.
|
static int |
USER_SEARCH_PAGE_SIZE
The default search page result for user searches
|
protected UserSettings |
userSettings
User settings provided in the configuration file.
|
protected VMMSynchronizerSettings |
vmmSynchronizerSettings
Synchronization settings provided in the configuration file.
|
protected VMMSyncListener |
vmmSyncListener
Synchronization listener object that will receive notifications
for each user or group that need to be synchronized to MAXIMO
database tables.
|
protected VMMSyncParameters |
vmmSyncParameters
Synchronization parameters.
|
Constructor and Description |
---|
VMMSynchronizer()
A default constructor.
|
Modifier and Type | Method and Description |
---|---|
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 java.util.HashMap |
getCheckpointFromSearchResults(commonj.sdo.DataObject returnDO)
If change polling is supported and this is a partial sync, then get the current checkpoint
from the search results, for use in the next sync.
|
protected java.util.HashMap |
getCheckpointFromVMM()
If change polling is supported, get the current checkpoint from VMM.
|
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 java.lang.String |
getGroupDNAttributeName()
Returns the attribute used for identifying the distinguished
name of a group object ("cn").
|
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 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 (VMM query) to be used for
performing search for group objects.
|
protected int |
getGroupSearchScope()
Returns the sarch scope to be used for group searches.
|
VMMSynchronizerSettings |
getSynchronizerSettings()
Returns synchronizer settings configured.
|
VMMSyncParameters |
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 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 (VMM 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.
|
VMMSyncListener |
getVMMSyncListener()
Returns the listener object that receives synchronization events.
|
void |
init(VMMSynchronizerInitData 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,
VMMSyncParameters syncParams,
UserInfo userInfo)
Performs the synchronization operation based on the synchronization
parameters.
|
protected 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 |
setOwner(VMMSyncTask val)
Set reference to the calling class
|
protected void |
setSyncNeeded(boolean needed)
Sets the flag to indicate whether synchronization is needed
or not.
|
void |
setVMMSyncListener(VMMSyncListener vmmSyncListener)
Sets the listener object that gets notification events during
synchronization process.
|
protected void |
syncGroupMembers(VMMSyncData 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 |
syncVMMGroups()
Performs VMM query against the VMM server and retrieves
the results page by page and processes each page result.
|
protected void |
syncVMMUsers()
Performs VMM query against the VMM server and retrieves
the results page by page and processes each page result.
|
protected void |
updateSyncParameters()
Called by the controller when the synchronization task is
completed successfully, so that the new parameters are used
for the next synchronization task.
|
public static final int USER_SEARCH_PAGE_SIZE
public static final int GROUP_SEARCH_PAGE_SIZE
public static final java.lang.String CHECKPOINT
protected java.util.HashMap lastCheckPoint
#determineSynchronizationNeed
.
Key = repository ID, value = number.protected java.util.HashMap newCheckPoint
protected VMMSyncParameters vmmSyncParameters
protected VMMSynchronizerSettings vmmSynchronizerSettings
protected VMMContextSettings contextSettings
protected UserSettings userSettings
protected GroupSettings groupSettings
protected MXLogger logger
protected MXLogger sqlLogger
protected VMMSyncListener vmmSyncListener
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 void init(VMMSynchronizerInitData initData) throws VMMSyncException
init
in class Synchronizer
initData
- initialization dataVMMSyncException
- if fail to initializepublic VMMSyncParameters getSyncParameters()
public VMMSynchronizerSettings getSynchronizerSettings()
public void performSync(java.sql.Connection con, VMMSyncParameters syncParams, UserInfo userInfo) throws VMMSyncException
performSync
in class Synchronizer
con
- database connection to be used for synchronizing
VMM data with MAXIMO database tables.syncParams
- synchronization prametersVMMSyncException
- if fails to synchronizeVMMSynchronizer.getVMMSyncListener()
,
VMMSynchronizer.determineSynchronizationNeed()
,
#getInitialCheckpoint
,
VMMSynchronizer.syncVMMUsers()
,
VMMSynchronizer.syncVMMGroups()
,
VMMSynchronizer.updateSyncParameters()
public void setOwner(VMMSyncTask val)
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 VMMSyncException
VMMSyncException
- 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 java.util.HashMap getCheckpointFromVMM() throws VMMSyncException
protected java.util.HashMap getCheckpointFromSearchResults(commonj.sdo.DataObject returnDO) throws VMMSyncException
newCheckPoint
.protected void syncVMMUsers() throws VMMSyncException
protected void commitUserChanges(int objectsProcessed) throws VMMSyncException
objectsProcessed
- number of user objects processed.VMMSyncException
- if fails to commit the changes.protected void commitUserChanges() throws VMMSyncException
VMMSyncException
- if fails to commit the changes.protected void commitGroupChanges(int objectsProcessed) throws VMMSyncException
objectsProcessed
- number of group objects processed.VMMSyncException
- if fails to commit the changes.protected void commitGroupChanges() throws VMMSyncException
VMMSyncException
- if fails to commit the changes.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 void syncVMMGroups() throws VMMSyncException
protected java.util.Set retrieveAllGroupMembers(java.lang.String groupDN) throws VMMSyncException
VMMSyncException
protected java.lang.String getGroupDNAttributeName()
protected void syncGroupMembers(VMMSyncData groupSyncData, java.util.Set groupMembers) throws VMMSyncException
groupSyncData
- data obtained from VMM server for the groupgroupMembers
- list of user account namesLdapSyncException
- if fails to synchronize members.VMMSyncException
DefaultVMMSyncAdapter.syncGroupMembers(psdi.security.vmm.VMMSyncEvent)
public void setVMMSyncListener(VMMSyncListener vmmSyncListener)
vmmSyncListener
- a listener object that need to receive
synchronization events.public VMMSyncListener getVMMSyncListener()
protected void updateSyncParameters()