[java-identity-provider] 03/09: IDP-2106 Remove all API interfaces from the installer
Rod Widdowson
rdw at steadingsoftware.com
Thu May 18 10:21:49 UTC 2023
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=25dab453321c7249d8af13ae1189b9ca12aaef0c
commit 25dab453321c7249d8af13ae1189b9ca12aaef0c
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue May 16 16:07:53 2023 +0100
IDP-2106 Remove all API interfaces from the installer
https://shibboleth.atlassian.net/browse/IDP-2106
Remove the CurrentInstallState Interface.
---
.../net/shibboleth/idp/installer/BuildWar.java | 3 +-
.../shibboleth/idp/installer/CopyDistribution.java | 5 +-
.../idp/installer/CurrentInstallState.java | 88 ----------------------
.../net/shibboleth/idp/installer/V4Install.java | 11 ++-
.../installer/impl/CurrentInstallStateImpl.java | 7 +-
.../shibboleth/idp/installer/impl/Installer.java | 6 +-
6 files changed, 16 insertions(+), 104 deletions(-)
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java
index 6cd092168..fb9c35ea9 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java
@@ -29,6 +29,7 @@ import org.apache.tools.ant.taskdefs.Jar;
import org.slf4j.Logger;
import net.shibboleth.idp.Version;
+import net.shibboleth.idp.installer.impl.CurrentInstallStateImpl;
import net.shibboleth.idp.installer.impl.InstallationLogger;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -60,7 +61,7 @@ public final class BuildWar extends AbstractInitializableComponent {
* @param props The environment for the work.
* @param installState Where we are right now.
*/
- public BuildWar(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallState installState) {
+ public BuildWar(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallStateImpl installState) {
if (!props.isInitialized()) {
throw new UninitializedComponentException("Installer Properties not initialized");
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
index a245f5eb4..79bccee2f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
@@ -26,6 +26,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Copy;
import org.slf4j.Logger;
+import net.shibboleth.idp.installer.impl.CurrentInstallStateImpl;
import net.shibboleth.idp.installer.impl.InstallationLogger;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.UninitializedComponentException;
@@ -45,13 +46,13 @@ public final class CopyDistribution extends AbstractInitializableComponent {
@Nonnull private final InstallerProperties installerProps;
/** The state of the current install. */
- @Nonnull private final CurrentInstallState installState;
+ @Nonnull private final CurrentInstallStateImpl installState;
/** Constructor.
* @param props The environment for the work.
* @param state Where we are right now.
*/
- public CopyDistribution(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallState state) {
+ public CopyDistribution(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallStateImpl state) {
if (!props.isInitialized()) {
throw new UninitializedComponentException("Installer Properties not Initialized");
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
deleted file mode 100644
index a92af36ef..000000000
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.installer;
-
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.apache.tools.ant.BuildException;
-
-import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.component.InitializableComponent;
-
-/** Tells the installers about the current install state. */
-public interface CurrentInstallState extends InitializableComponent {
-
- /** What to return if this is V3. */
- @Nonnull @NotEmpty static final String V3_VERSION = "3";
-
- /** What is the installer version.
- * @return {@value #V3_VERSION} for a V3 install, null for a new install or the value we wrote during last install.
- * @throws BuildException if we find an inconsistency
- */
- @Nullable String getInstalledVersion() throws BuildException;
-
- /** Was idp.properties present in the target file when we started the install?
- * @return if it was.
- */
- boolean isIdPPropertiesPresent();
-
- /** Was ldapp.properties present in the target file when we started the install?
- * @return if it was.
- */
- boolean isLDAPPropertiesPresent();
-
- /** Get the properties associated with the current configuration.
- * This comes idp.properties and anything it points to via
- * {@value IdPPropertiesApplicationContextInitializer#IDP_ADDITIONAL_PROPERTY}.
- * @return the properties, or null if this is a new install.
- */
- @Nullable Properties getCurrentlyInstalledProperties();
-
- /**
- * 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.
- *
- * @return the list of paths.
- */
- @Nonnull List<Path> getPathsToBeDeleted();
-
- /** 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
- * @return whether the old install has %{idp.home}\system
- */
- boolean isSystemPresent();
-
- /** Which modules (by ID) are enabled for this release.
- * @return those modules enabled.
- */
- @Nonnull Collection<String> getEnabledModules();
-
- /** Build a classpath loader which adds all the plugins in.
- * @return a classloader
- */
- @Nullable ClassLoader getInstalledPluginsLoader();
-
-}
\ No newline at end of file
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
index be82e870c..016c5659f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
@@ -47,6 +47,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import net.shibboleth.idp.Version;
+import net.shibboleth.idp.installer.impl.CurrentInstallStateImpl;
import net.shibboleth.idp.installer.impl.InstallationLogger;
import net.shibboleth.idp.installer.plugin.impl.PluginState;
import net.shibboleth.idp.module.IdPModule;
@@ -77,7 +78,7 @@ public class V4Install extends AbstractInitializableComponent {
@Nonnull private final InstallerProperties installerProps;
/** Current Install. */
- @Nonnull private final CurrentInstallState currentState;
+ @Nonnull private final CurrentInstallStateImpl currentState;
/** Key Manager. */
@Nonnull private final KeyManagement keyManager;
@@ -89,7 +90,7 @@ public class V4Install extends AbstractInitializableComponent {
* @param props The properties to drive the installs.
* @param installState The current install.
*/
- public V4Install(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallState installState) {
+ public V4Install(@Nonnull final InstallerProperties props, @Nonnull final CurrentInstallStateImpl installState) {
if (!props.isInitialized()) {
throw new UninitializedComponentException("Installer Properties not Initialized");
}
@@ -338,8 +339,6 @@ public class V4Install extends AbstractInitializableComponent {
} catch (final IOException e) {
throw new BuildException("Failed to generate secrets.properties", e);
}
- } else if (CurrentInstallState.V3_VERSION.equals(currentState.getInstalledVersion())) {
- log.debug("Detected a V3 to V4 update.");
}
}
// CheckStyle: CyclomaticComplexity|MethodLength ON
@@ -537,7 +536,7 @@ public class V4Install extends AbstractInitializableComponent {
@Nonnull private final InstallerProperties installerProps;
/** Current Install. */
- @Nonnull private final CurrentInstallState currentState;
+ @Nonnull private final CurrentInstallStateImpl currentState;
/** Did we create idp-signing.*?*/
private boolean createdSigning;
@@ -556,7 +555,7 @@ public class V4Install extends AbstractInitializableComponent {
* @param installState - about where we installing into.
*/
protected KeyManagement(@Nonnull final InstallerProperties props,
- @Nonnull final CurrentInstallState installState) {
+ @Nonnull final CurrentInstallStateImpl installState) {
if (!props.isInitialized()) {
throw new UninitializedComponentException("Installer Properties not Initialized");
}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java
index cdbb661aa..125ce8877 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallStateImpl.java
@@ -47,7 +47,6 @@ import javax.annotation.Nullable;
import org.apache.tools.ant.BuildException;
import org.slf4j.Logger;
-import net.shibboleth.idp.installer.CurrentInstallState;
import net.shibboleth.idp.installer.InstallerProperties;
import net.shibboleth.idp.installer.InstallerSupport;
import net.shibboleth.idp.module.IdPModule;
@@ -60,7 +59,7 @@ import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.primitive.LoggerFactory;
/** Tells the installers about the current install state. */
-public final class CurrentInstallStateImpl extends AbstractInitializableComponent implements CurrentInstallState {
+public final class CurrentInstallStateImpl extends AbstractInitializableComponent {
/** Class logger. */
@Nonnull private final Logger log = InstallationLogger.getLogger(CurrentInstallStateImpl.class);
@@ -180,7 +179,9 @@ public final class CurrentInstallStateImpl extends AbstractInitializableComponen
if (getInstalledVersion() == null) {
return;
}
- final ModuleContext moduleContext = new ModuleContext(targetDir.toString());
+ final String td = targetDir.toString();
+ assert td != null;
+ final ModuleContext moduleContext = new ModuleContext(td);
enabledModules = new HashSet<>();
final Iterator<IdPModule> modules = ServiceLoader.load(IdPModule.class).iterator();
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java
index 0b22add9e..a129f03bd 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java
@@ -21,8 +21,6 @@ import org.slf4j.Logger;
import net.shibboleth.idp.installer.BuildWar;
import net.shibboleth.idp.installer.CopyDistribution;
-import net.shibboleth.idp.installer.CurrentInstallState;
-import net.shibboleth.idp.installer.InstallerProperties;
import net.shibboleth.idp.installer.InstallerPropertiesImpl;
import net.shibboleth.idp.installer.V4Install;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -56,9 +54,9 @@ public final class Installer {
log.error("Parameter must be \"install\", \"install-nocopy\" or \"build-war\" was \"{}\"", args[0]);
return;
}
- final InstallerProperties ip = new InstallerPropertiesImpl(!copyInstall);
+ final InstallerPropertiesImpl ip = new InstallerPropertiesImpl(!copyInstall);
ip.initialize();
- final CurrentInstallState is = new CurrentInstallStateImpl(ip);
+ final CurrentInstallStateImpl is = new CurrentInstallStateImpl(ip);
is.initialize();
if (copyInstall) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list