Package net.shibboleth.idp.installer.plugin.impl

# 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 its `AutoCloseable.close()` method.

## Field Summary

Fields
Modifier and Type
Field
Description
`private List<Path>`
`filesCopied`
The files copied in as the `IdPPlugin` was installed.
`private List<Pair<Path,Path>>`
`filesRenamedAway`
The files renamed away during the installation.
`private final org.slf4j.Logger`
`log`
logger.
`private final Map<Module.ModuleResource,Module.ResourceResult>`
`moduleChanges`
Module Changes.
`private final ModuleContext`
`moduleContext`
The `ModuleContext` that the module subsystem needs.
`private List<IdPModule>`
`modulesDisabled`
The modules disabled when the `IdPPlugin` was installed.
`private List<IdPModule>`
`modulesEnabled`
The modules enabled when the `IdPPlugin` was installed.

## Constructor Summary

Constructors
Constructor
Description
`RollbackPluginInstall(ModuleContext context, Map<Module.ModuleResource,Module.ResourceResult> changes)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`private void`
`captureChanges(Map<Module.ModuleResource,Module.ResourceResult> changes)`
Capture module changes.
`void`
`close()`
`void`
`completed()`
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 void`
`rollback()`
Perform the rollback.
`private boolean`
`rollbackCopies()`
Traverse the `filesCopied` list deleting the files.
`private boolean`
`rollbackDisabledModules()`
Traverse the `modulesDisabled` list re-enabling modules.
`private boolean`
`rollbackEnabledModules()`
Traverse the `modulesEnabled` list disabling modules.
`private boolean`
`rollbackRenamed()`
Traverse the `filesRenamedAway` list copying the files back.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
logger.

### modulesEnabled

@Live @Nonnull private List<IdPModule> modulesEnabled
The modules enabled when the `IdPPlugin` was installed.

### modulesDisabled

@Live @Nonnull private List<IdPModule> modulesDisabled
The modules disabled when the `IdPPlugin` was installed.

### filesCopied

@Live @Nonnull private List<Path> filesCopied
The files copied in as the `IdPPlugin` was installed.

### filesRenamedAway

@Live @Nonnull private List<Pair<Path,Path>> filesRenamedAway
The files renamed away during the installation.

### moduleContext

@Nonnull private final ModuleContext moduleContext
The `ModuleContext` that the module subsystem needs.

### moduleChanges

@Nonnull private final Map<Module.ModuleResource,Module.ResourceResult> moduleChanges
Module Changes.

## Constructor Details

### RollbackPluginInstall

public RollbackPluginInstall(@Nonnull @Live ModuleContext context, @Nonnull Map<Module.ModuleResource,Module.ResourceResult> changes)
Constructor.

Parameters:
  `context` - The Module Context
  `changes` - Where to capture module changes

## Method Details

### 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 the `modulesEnabled` list disabling modules.

Returns:
  true if we did any work.

### rollbackDisabledModules

private boolean rollbackDisabledModules()
Traverse the `modulesDisabled` list re-enabling modules.

Returns:
  true if we did any work.

### rollbackCopies

private boolean rollbackCopies()
Traverse the `filesCopied` list deleting the files.

Returns:
  true if we did any work.

### rollbackRenamed

private boolean rollbackRenamed()
Traverse the `filesRenamedAway` list copying the files back.

Returns:
  true if we did any work.

### captureChanges

private void captureChanges(@Nonnull Map<Module.ModuleResource,Module.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:
  `close` in interface `AutoCloseable`