Class RollbackPluginInstall
- java.lang.Object
-
- net.shibboleth.idp.installer.plugin.impl.RollbackPluginInstall
-
- All Implemented Interfaces:
AutoCloseable
public class RollbackPluginInstall extends Object implements AutoCloseable
An object which does installation rollback in itsAutoCloseable.close()method.
-
-
Field Summary
Fields Modifier and Type Field Description private List<Path>filesCopiedThe files copied in as theIdPPluginwas installed.private List<Pair<Path,Path>>filesRenamedAwayThe files renamed away during the installation.private org.slf4j.Loggerloglogger.private Map<IdPModule.ModuleResource,IdPModule.ResourceResult>moduleChangesModule Changes.private ModuleContextmoduleContextTheModuleContextthat the module subsystem needs.private List<IdPModule>modulesDisabledThe modules disabled when theIdPPluginwas installed.private List<IdPModule>modulesEnabledThe modules enabled when theIdPPluginwas installed.
-
Constructor Summary
Constructors Constructor Description RollbackPluginInstall(ModuleContext context, Map<IdPModule.ModuleResource,IdPModule.ResourceResult> changes)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcaptureChanges(Map<IdPModule.ModuleResource,IdPModule.ResourceResult> changes)Capture module changes.voidclose()voidcompleted()Signal that the operation completed and that rollback won't be needed.List<Path>getFilesCopied()What was copied?List<Pair<Path,Path>>getFilesRenamedAway()What was renamed away?List<IdPModule>getModulesDisabled()What was enabled?List<IdPModule>getModulesEnabled()What was enabled?protected voidrollback()Perform the rollback.private booleanrollbackCopies()Traverse thefilesCopiedlist deleting the files.private booleanrollbackDisabledModules()Traverse themodulesDisabledlist re-enabling modules.private booleanrollbackEnabledModules()Traverse themodulesEnabledlist disabling modules.private booleanrollbackRenamed()Traverse thefilesRenamedAwaylist copying the files back.
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
logger.
-
modulesEnabled
@Live @Nonnull private List<IdPModule> modulesEnabled
The modules enabled when theIdPPluginwas installed.
-
modulesDisabled
@Live @Nonnull private List<IdPModule> modulesDisabled
The modules disabled when theIdPPluginwas installed.
-
filesCopied
@Live @Nonnull private List<Path> filesCopied
The files copied in as theIdPPluginwas installed.
-
filesRenamedAway
@Live @Nonnull private List<Pair<Path,Path>> filesRenamedAway
The files renamed away during the installation.
-
moduleContext
@Nonnull private final ModuleContext moduleContext
TheModuleContextthat the module subsystem needs.
-
moduleChanges
@Nonnull private final Map<IdPModule.ModuleResource,IdPModule.ResourceResult> moduleChanges
Module Changes.
-
-
Constructor Detail
-
RollbackPluginInstall
public RollbackPluginInstall(@Nonnull ModuleContext context, @Nonnull Map<IdPModule.ModuleResource,IdPModule.ResourceResult> changes)Constructor.- Parameters:
context- The Module Contextchanges- Where to capture module changes
-
-
Method Detail
-
getModulesEnabled
@Live @Nonnull public List<IdPModule> getModulesEnabled()
What was enabled?- Returns:
- Returns the modules enabled as the plugin was installed.
-
getModulesDisabled
@Live @Nonnull public List<IdPModule> getModulesDisabled()
What was enabled?- Returns:
- Returns the modules disabled as the plugin was installed.
-
getFilesCopied
@Live @Nonnull public List<Path> getFilesCopied()
What was copied?- Returns:
- Returns the files copied as part of the install
-
getFilesRenamedAway
@Live @Nonnull public List<Pair<Path,Path>> getFilesRenamedAway()
What was renamed away?- Returns:
- Returns the filesRenamedAway.
-
rollbackEnabledModules
private boolean rollbackEnabledModules()
Traverse themodulesEnabledlist disabling modules.- Returns:
- true if we did any work.
-
rollbackDisabledModules
private boolean rollbackDisabledModules()
Traverse themodulesDisabledlist re-enabling modules.- Returns:
- true if we did any work.
-
rollbackCopies
private boolean rollbackCopies()
Traverse thefilesCopiedlist deleting the files.- Returns:
- true if we did any work.
-
rollbackRenamed
private boolean rollbackRenamed()
Traverse thefilesRenamedAwaylist copying the files back.- Returns:
- true if we did any work.
-
captureChanges
private void captureChanges(Map<IdPModule.ModuleResource,IdPModule.ResourceResult> changes)
Capture module changes.- Parameters:
changes- what has changed
-
rollback
protected void rollback()
Perform the rollback. This is done in reverse order from the install, which is to say the the lists are iterated over backwards and the order is Enabled (which are disabled), then copied (which are deleted) then renamed (which are copied).
-
completed
public void completed()
Signal that the operation completed and that rollback won't be needed.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-