Class GcGrouperSyncJob
java.lang.Object
edu.internet2.middleware.grouperClient.jdbc.tableSync.GcGrouperSyncJob
- All Implemented Interfaces:
GcDbVersionable,GcSqlAssignPrimaryKey
Status of all jobs for the sync. one record for full, one for incremental, etc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanassignHeartbeatAndCheckForPendingJobs(boolean isLargeJob) assign heartbeat and see if other jobs are pending or runningvoidassign heartbeat and end jobclone()deep clone the fields in this objectvoiddb versionbooleanif we need to update this objectvoidtake a snapshot of the data since this is what is in the dbbooleanequalsDeep(Object obj) booleanassign a new primary key for insert.connection name or null for defaultif the last sync had an error, this is the error messagethis the last sync had an error, this was the error timestampuuid of the job in grouper_syncheartbeat updated every minutegetId()uuid of this record in this tablerunning, waitingForAnotherJobToFinish (if waiting for another job to finish), notRunningint of last record checkedwhen last sync startedwhen last record processed if timestamp and not integerlast time a record was processedwhen this record was last updated0-100 percent complete of the jobquartz job name if applicabletype of sync, e.g. for sql sync this is the job subtypebooleanWhether another related sync job (different syncType, same grouper_sync) is currently running or pending with a live heartbeat.booleanif heartbeat is alive and wellstatic voidstatic voidreset()delete all data if table is herevoidsetConnectionName(String connectionName1) connection name or null for defaultvoidsetErrorMessage(String errorMessage1) if the last sync had an error, this is the error messagevoidsetErrorTimestamp(Timestamp errorTimestamp1) this the last sync had an error, this was the error timestampvoidsetGrouperSync(GcGrouperSync gcGrouperSync) voidsetGrouperSyncId(String grouperSyncId1) uuid of the job in grouper_syncvoidsetHeartbeat(Timestamp heartbeat1) heatbeat updated every minutevoiduuid of this record in this tablevoidsetJobState(GcGrouperSyncJobState gcGrouperSyncJobState) voidsetJobStateDb(String jobState1) running, waitingForAnotherJobToFinish (if waiting for another job to finish), notRunningvoidsetLastSyncIndex(Long lastSyncIndexOrMillis1) int of last record checkedvoidsetLastSyncStart(Timestamp lastSyncStart) when last sync startedvoidsetLastSyncTimestamp(Timestamp lastSyncTimestamp1) when last record processed if timestamp and not integervoidsetLastTimeWorkWasDone(Timestamp lastTimeWorkWasDone1) last time a record was processedvoidsetLastUpdated(Timestamp lastUpdated1) when this record was last updatedvoidsetPercentComplete(Integer percentComplete1) 0-100 percent complete of the jobvoidsetQuartzJobName(String quartzJobName1) quartz job name if applicablevoidsetSyncType(String syncType) type of sync, e.g. for sql sync this is the job subtypevoidrun this before storingtoString()voidwaitForRelatedJobsToFinishThenRun(boolean goToPendingFirstAkaLargeJob) wait for related jobs to finish running, then run.
-
Constructor Details
-
GcGrouperSyncJob
public GcGrouperSyncJob()
-
-
Method Details
-
dbVersionReset
public void dbVersionReset()take a snapshot of the data since this is what is in the db- Specified by:
dbVersionResetin interfaceGcDbVersionable
-
dbVersionDifferent
public boolean dbVersionDifferent()if we need to update this object- Specified by:
dbVersionDifferentin interfaceGcDbVersionable- Returns:
- if needs to update this object
-
dbVersionDelete
public void dbVersionDelete()db version- Specified by:
dbVersionDeletein interfaceGcDbVersionable
-
clone
deep clone the fields in this object -
equalsDeep
-
isHeartBeatAlive
public boolean isHeartBeatAlive()if heartbeat is alive and well- Returns:
- true if heartbeat is valid (heartbeat in last 1.5 minutes)
-
getPercentComplete
0-100 percent complete of the job- Returns:
- percent complete
-
setPercentComplete
0-100 percent complete of the job- Parameters:
percentComplete1-
-
getQuartzJobName
quartz job name if applicable- Returns:
- quartz job name
-
setQuartzJobName
quartz job name if applicable- Parameters:
quartzJobName1-
-
reset
public static void reset()delete all data if table is here -
storePrepare
public void storePrepare()run this before storing -
getErrorMessage
if the last sync had an error, this is the error message- Returns:
- error message
-
setErrorMessage
if the last sync had an error, this is the error message- Parameters:
errorMessage1-
-
getErrorTimestamp
this the last sync had an error, this was the error timestamp- Returns:
- error timestamp
-
setErrorTimestamp
this the last sync had an error, this was the error timestamp- Parameters:
errorTimestamp1-
-
getGrouperSync
- Returns:
- gc grouper sync
-
setGrouperSync
- Parameters:
gcGrouperSync-
-
getConnectionName
connection name or null for default- Returns:
- connection name
-
setConnectionName
connection name or null for default- Parameters:
connectionName1-
-
main
- Parameters:
args-
-
toString
-
getHeartbeat
heartbeat updated every minute- Returns:
- heartbeat
-
setHeartbeat
heatbeat updated every minute- Parameters:
heartbeat1-
-
getId
uuid of this record in this table- Returns:
- the id
-
setId
uuid of this record in this table- Parameters:
id1- the id to set
-
getSyncType
type of sync, e.g. for sql sync this is the job subtype- Returns:
- sync type
-
setSyncType
type of sync, e.g. for sql sync this is the job subtype- Parameters:
syncType-
-
getGrouperSyncId
uuid of the job in grouper_sync- Returns:
- uuid of the job in grouper_sync
-
setGrouperSyncId
uuid of the job in grouper_sync- Parameters:
grouperSyncId1-
-
getJobStateDb
running, waitingForAnotherJobToFinish (if waiting for another job to finish), notRunning- Returns:
- the jobState
-
getJobState
- Returns:
- the state or null if not there
-
setJobState
- Parameters:
gcGrouperSyncJobState-
-
setJobStateDb
running, waitingForAnotherJobToFinish (if waiting for another job to finish), notRunning- Parameters:
jobState1- the jobState to set
-
getLastSyncStart
when last sync started- Returns:
-
setLastSyncStart
when last sync started- Parameters:
lastSyncStart-
-
getLastSyncTimestamp
when last record processed if timestamp and not integer- Returns:
- when processed
-
setLastSyncTimestamp
when last record processed if timestamp and not integer- Parameters:
lastSyncTimestamp1-
-
getLastSyncIndex
int of last record checked- Returns:
- the lastSyncIndexOrMillis
-
setLastSyncIndex
int of last record checked- Parameters:
lastSyncIndexOrMillis1- the lastSyncIndexOrMillis to set
-
getLastTimeWorkWasDone
last time a record was processed- Returns:
- the lastTimeWorkWasDone
-
setLastTimeWorkWasDone
last time a record was processed- Parameters:
lastTimeWorkWasDone1- the lastTimeWorkWasDone to set
-
getLastUpdated
when this record was last updated- Returns:
- the lastUpdated
-
setLastUpdated
when this record was last updated- Parameters:
lastUpdated1- the lastUpdated to set
-
gcSqlAssignNewPrimaryKeyForInsert
public boolean gcSqlAssignNewPrimaryKeyForInsert()Description copied from interface:GcSqlAssignPrimaryKeyassign a new primary key for insert. return true if assigned (insert) or false if not needed- Specified by:
gcSqlAssignNewPrimaryKeyForInsertin interfaceGcSqlAssignPrimaryKey
-
assignHeartbeatAndCheckForPendingJobs
public boolean assignHeartbeatAndCheckForPendingJobs(boolean isLargeJob) assign heartbeat and see if other jobs are pending or running- Parameters:
provisionerName-isLargeJob- is if this is a big job and has precendence- Returns:
- false if should stop and true if should run
-
isAnotherRelatedJobRunningOrPending
public boolean isAnotherRelatedJobRunningOrPending()Whether another related sync job (different syncType, same grouper_sync) is currently running or pending with a live heartbeat. Used to decide whether to advertise a "waiting for other jobs" message - if nothing else is running, do not claim we are waiting.- Returns:
- true if another related job is running or pending
-
assignHeartbeatAndEndJob
public void assignHeartbeatAndEndJob()assign heartbeat and end job -
waitForRelatedJobsToFinishThenRun
public void waitForRelatedJobsToFinishThenRun(boolean goToPendingFirstAkaLargeJob) wait for related jobs to finish running, then run. note you should get the job again afterwards so its up to date- Parameters:
provisionerName-goToPendingFirstAkaLargeJob- is if this is a big job and needs to register as pending first so it knows it should run now. false if quick job and doesnt matter
-