Class CurrentInstallStateImpl
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.installer.impl.CurrentInstallStateImpl
-
- All Implemented Interfaces:
CurrentInstallState,Component,DestructableComponent,InitializableComponent
public final class CurrentInstallStateImpl extends AbstractInitializableComponent implements CurrentInstallState
Tells the installers about the current install state.
-
-
Field Summary
Fields Modifier and Type Field Description private String[][]deleteAfterUpgradesThe files we will delete if they created on upgrade.private Set<String>enabledModulesThe module IDs which are enabled.private booleanidpPropertiesPresentWhether the IdP properties file exists.private ClassLoaderinstalledPluginsLoaderThe classloader for "us plus the plugins in the target".private booleanldapPropertiesPresentWhether the LDAP properties file exists.private org.slf4j.LoggerlogClass logger.private StringoldVersionOld Version.private List<Path>pathsToDeleteThe files to delete after an upgrade.private PropertiespropsPrevious props.private booleansystemPresentWhether system is present.private PathtargetDirWhere we are installing to.-
Fields inherited from interface net.shibboleth.idp.installer.CurrentInstallState
V3_VERSION
-
-
Constructor Summary
Constructors Constructor Description CurrentInstallStateImpl(InstallerProperties installerProps)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoInitialize()private voidfindEnabledModules()Populate {enabledModulesfrom the current classpath and the new IdP home.private voidfindPreviousVersion()Work out what the "current" install state is (before we do any more work).PropertiesgetCurrentlyInstalledProperties()Get the properties associated with the current configuration.Collection<String>getEnabledModules()Which modules (by ID) are enabled for this release.ClassLoadergetInstalledPluginsLoader()Build a classpath loader which adds all the plugins in.StringgetInstalledVersion()What is the installer version.List<Path>getPathsToBeDeleted()Return the list of paths of files which were not there prior to the install but which might be created by the installed but to no purpose.booleanisIdPPropertiesPresent()Was idp.properties present in the target file when we started the install?booleanisLDAPPropertiesPresent()Was ldapp.properties present in the target file when we started the install?booleanisSystemPresent()If this is an upgrade were there files in %{idp.home}system? If so then we need to copy the files in.private voidsetupPreviousProps()Populate {propsfrom idp.properties and other files pointed to by "idp.additionalProperties".-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
targetDir
private final Path targetDir
Where we are installing to.
-
deleteAfterUpgrades
private final String[][] deleteAfterUpgrades
The files we will delete if they created on upgrade.
-
idpPropertiesPresent
private boolean idpPropertiesPresent
Whether the IdP properties file exists.
-
ldapPropertiesPresent
private boolean ldapPropertiesPresent
Whether the LDAP properties file exists.
-
systemPresent
private boolean systemPresent
Whether system is present.
-
oldVersion
private String oldVersion
Old Version.
-
props
private Properties props
Previous props.
-
pathsToDelete
@NonnullAfterInit private List<Path> pathsToDelete
The files to delete after an upgrade.
-
installedPluginsLoader
@Nullable private ClassLoader installedPluginsLoader
The classloader for "us plus the plugins in the target".
-
-
Constructor Detail
-
CurrentInstallStateImpl
public CurrentInstallStateImpl(InstallerProperties installerProps)
Constructor.- Parameters:
installerProps- the installer situation.
-
-
Method Detail
-
findPreviousVersion
private void findPreviousVersion() throws ComponentInitializationExceptionWork out what the "current" install state is (before we do any more work).- Throws:
ComponentInitializationException- if we find a strange state
-
setupPreviousProps
private void setupPreviousProps() throws ComponentInitializationExceptionPopulate {propsfrom idp.properties and other files pointed to by "idp.additionalProperties".- Throws:
ComponentInitializationException- on various IO issues
-
findEnabledModules
private void findEnabledModules()
Populate {enabledModulesfrom the current classpath and the new IdP home.
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
getInstalledVersion
@Nullable public String getInstalledVersion()
What is the installer version.- Specified by:
getInstalledVersionin interfaceCurrentInstallState- Returns:
- "3" for a V3 install, null for a new install or the value we wrote during last install.
-
isIdPPropertiesPresent
public boolean isIdPPropertiesPresent()
Was idp.properties present in the target file when we started the install?- Specified by:
isIdPPropertiesPresentin interfaceCurrentInstallState- Returns:
- if it was.
-
isLDAPPropertiesPresent
public boolean isLDAPPropertiesPresent()
Was ldapp.properties present in the target file when we started the install?- Specified by:
isLDAPPropertiesPresentin interfaceCurrentInstallState- Returns:
- if it was.
-
getCurrentlyInstalledProperties
@Nullable public Properties getCurrentlyInstalledProperties()
Get the properties associated with the current configuration. This comes idp.properties and anything it points to via "idp.additionalProperties".- Specified by:
getCurrentlyInstalledPropertiesin interfaceCurrentInstallState- Returns:
- the properties, or null if this is a new install.
-
getPathsToBeDeleted
public List<Path> getPathsToBeDeleted()
Return the list of paths of files which were not there prior to the install but which might be created by the installed but to no purpose.- Specified by:
getPathsToBeDeletedin interfaceCurrentInstallState- Returns:
- the list of paths.
-
isSystemPresent
public boolean isSystemPresent()
If this is an upgrade were there files in %{idp.home}system? If so then we need to copy the files in. Otherwise not. For new installs this is false- Specified by:
isSystemPresentin interfaceCurrentInstallState- Returns:
- whether the old install has %{idp.home}\system
-
getEnabledModules
@Nonnull public Collection<String> getEnabledModules()
Which modules (by ID) are enabled for this release.- Specified by:
getEnabledModulesin interfaceCurrentInstallState- Returns:
- those modules enabled.
-
getInstalledPluginsLoader
public ClassLoader getInstalledPluginsLoader()
Build a classpath loader which adds all the plugins in.- Specified by:
getInstalledPluginsLoaderin interfaceCurrentInstallState- Returns:
- a classloader
-
-