Class UpgradeTasksJob
java.lang.Object
edu.internet2.middleware.grouper.app.loader.OtherJobBase
edu.internet2.middleware.grouper.app.upgradeTasks.UpgradeTasksJob
- All Implemented Interfaces:
org.quartz.Job
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumStatus of a single upgrade task, as shown on the Configure -> Upgrade tasks admin screen.Nested classes/interfaces inherited from class edu.internet2.middleware.grouper.app.loader.OtherJobBase
OtherJobBase.OtherJobInput, OtherJobBase.OtherJobOutput -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic intDO NOT CALL THIS METHOD SINCE THE ATTRIBUTE CHANGED TO MULTIVALUEDstatic AttributeDefstatic GroupThe metadata group (etc:attribute:upgradeTasks:upgradeTasksMetadataGroup) whose multivalued upgradeTasksVersion attribute records which upgrade task versions have been completed.static Stringstem name for upgrade tasksstatic Stringfull name of the multivalued attribute def name that records completed upgrade task versionsstatic booleanisThereWorkToDo(Set<Integer> sortedOldDbVersions) static voidrun the daemonstatic voidmarkUpgradeTaskComplete(int version) Mark an upgrade task version complete by adding its number to the multivalued upgradeTasksVersion attribute on the metadata group - the same write the daemon (run()) does inline.static voidmarkUpgradeTaskNotComplete(int version) Remove the completed marker for an upgrade task version so the daemon (or a manual run) will run it again.static UpgradeTasksretrieveUpgradeTask(int version) Look up an upgrade task enum constant by its version number.retrieveUpgradeTaskStatus(int version, Set<Integer> completedVersions, boolean checkDdl) Compute the status of a single upgrade task for display.run(OtherJobBase.OtherJobInput otherJobInput) implement this method for the logic of the OtherJobstatic Stringrun standalonestatic StringrunUpgradeTask(int version) Run a single upgrade task by version number and, on success, record it complete.static booleanupgradeTaskHasDdlWorkToDo(UpgradeTasksInterface upgradeTasksInterface) Whether a single upgrade task currently has DDL work left to do.Methods inherited from class edu.internet2.middleware.grouper.app.loader.OtherJobBase
execute, execute, getOtherJobInput, otherJobLogUpdaterDeregister, otherJobLogUpdaterInit, otherJobLogUpdaterRegister, setOtherJobInput, storeLogInDb
-
Field Details
-
UPGRADE_TASKS_DEF
attribute definition for upgrade tasks- See Also:
-
UPGRADE_TASKS_VERSION_ATTR
version- See Also:
-
UPGRADE_TASKS_METADATA_GROUP
group holding metadata- See Also:
-
-
Constructor Details
-
UpgradeTasksJob
public UpgradeTasksJob()
-
-
Method Details
-
main
run the daemon- Parameters:
args-
-
runDaemonStandalone
run standalone -
canRunDdl
public static boolean canRunDdl() -
run
Description copied from class:OtherJobBaseimplement this method for the logic of the OtherJob- Specified by:
runin classOtherJobBase- Returns:
- the output
- See Also:
-
isThereWorkToDo
-
grouperUpgradeTasksStemName
stem name for upgrade tasks- Returns:
- stem name
-
grouperUpgradeTasksAttributeDef
-
getDBVersion
public static int getDBVersion()DO NOT CALL THIS METHOD SINCE THE ATTRIBUTE CHANGED TO MULTIVALUED -
getDBVersions
-
grouperUpgradeTasksMetadataGroup
The metadata group (etc:attribute:upgradeTasks:upgradeTasksMetadataGroup) whose multivalued upgradeTasksVersion attribute records which upgrade task versions have been completed.- Returns:
- the metadata group
-
grouperUpgradeTasksVersionAttributeName
full name of the multivalued attribute def name that records completed upgrade task versions- Returns:
- the attribute def name
-
retrieveUpgradeTask
Look up an upgrade task enum constant by its version number.- Parameters:
version- e.g. 43- Returns:
- the UpgradeTasks enum constant, or null if there is no task for that version
-
markUpgradeTaskComplete
public static void markUpgradeTaskComplete(int version) Mark an upgrade task version complete by adding its number to the multivalued upgradeTasksVersion attribute on the metadata group - the same write the daemon (run()) does inline. This tells Grouper the task is done so it will not be run again. Idempotent: a no-op if the version is already recorded.- Parameters:
version- the upgrade task version number
-
markUpgradeTaskNotComplete
public static void markUpgradeTaskNotComplete(int version) Remove the completed marker for an upgrade task version so the daemon (or a manual run) will run it again. Idempotent: a no-op if the version is not currently recorded as complete.- Parameters:
version- the upgrade task version number
-
upgradeTaskHasDdlWorkToDo
Whether a single upgrade task currently has DDL work left to do. Non-DDL tasks always return false. For DDL tasks this is the expensive check (doesUpgradeTaskHaveDdlWorkToDo reads the live schema), so it is wrapped in the DDL model cache - the same pattern run() uses - so the schema is read once and shared across the asserts in this single check.- Parameters:
upgradeTasksInterface- the task to check- Returns:
- true if this is a DDL task that still has automatic DDL work to do
-
retrieveUpgradeTaskStatus
public static UpgradeTasksJob.UpgradeTaskStatus retrieveUpgradeTaskStatus(int version, Set<Integer> completedVersions, boolean checkDdl) Compute the status of a single upgrade task for display.- Parameters:
version- the upgrade task version numbercompletedVersions- the set of versions already recorded complete (pass getDBVersions() once and reuse across rows rather than re-querying per row)checkDdl- if true, a not-complete DDL task with no DDL work to do is reported NOT_APPLICABLE (this runs the expensive schema check viaupgradeTaskHasDdlWorkToDo(edu.internet2.middleware.grouper.app.upgradeTasks.UpgradeTasksInterface)); if false, a not-complete task is simply NOT_COMPLETE (cheap - no schema read)- Returns:
- the status
-
runUpgradeTask
Run a single upgrade task by version number and, on success, record it complete. This performs the same per-task work the daemon (run()) does for one version, in a standalone loader-log context so it can be triggered individually - e.g. from the Configure -> Upgrade tasks admin screen. Runs as the root grouper session. Note the tasks are individually idempotent (each re-checks its own preconditions), but they are designed to run in ascending version order.- Parameters:
version- the upgrade task version number to run- Returns:
- the loader job message accumulated while running the task
-