[java-identity-provider] 10/11: IDP-1499 New V4 Installer: Cleanup prior to first push
Rod Widdowson
rdw at steadingsoftware.com
Fri Oct 11 11:08:33 EDT 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=07e3cc58ff22dea8d9f7ed1ebab13cf9796c7c24
commit 07e3cc58ff22dea8d9f7ed1ebab13cf9796c7c24
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Oct 11 15:51:47 2019 +0100
IDP-1499 New V4 Installer: Cleanup prior to first push
https://issues.shibboleth.net/jira/browse/IDP-1499
Move everything back up into api. Cleanup some comments.
---
.../idp/installer/{impl => }/AntRun.java | 2 +-
.../idp/installer/{impl => }/BuildWar.java | 5 +--
.../idp/installer/{impl => }/CopyDistribution.java | 38 ++++++++++++----------
.../installer/{impl => }/CurrentInstallState.java | 4 +--
.../installer/{impl => }/InstallerProperties.java | 18 +++++-----
.../idp/installer/{impl => }/InstallerSupport.java | 10 +++---
.../idp/installer/{impl => }/KeyManagement.java | 2 +-
.../{impl => }/PropertiesWithComments.java | 6 ++--
.../idp/installer/{impl => }/V4Install.java | 2 +-
.../installer/ant/impl/MergePropertiesTask.java | 2 +-
.../idp/installer/ant/impl/PasswordHandler.java | 2 +-
.../installer/ant/impl/RewritePropertiesTask.java | 2 +-
.../idp/installer/{impl => }/package-info.java | 10 ++++--
.../shibboleth/idp/installer/{impl => }/Test.java | 7 +---
.../idp/installer/TestPropertiesWithComments.java | 2 --
15 files changed, 59 insertions(+), 53 deletions(-)
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/AntRun.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/AntRun.java
similarity index 98%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/AntRun.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/AntRun.java
index f3729f6..c3819de 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/AntRun.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/AntRun.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/BuildWar.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java
similarity index 95%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/BuildWar.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java
index 31644a6..797f359 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/BuildWar.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/BuildWar.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.nio.file.Path;
@@ -38,7 +38,7 @@ import net.shibboleth.utilities.java.support.component.ComponentSupport;
* <li>Deletes webapp.tmp</li>
* </ul>
*/
-public class BuildWar extends AbstractInitializableComponent {
+public final class BuildWar extends AbstractInitializableComponent {
/** Log. */
private final Logger log = LoggerFactory.getLogger(BuildWar.class);
@@ -64,6 +64,7 @@ public class BuildWar extends AbstractInitializableComponent {
* @throws BuildException if unexpected badness occurs.
*/
public void execute() throws BuildException {
+ ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
final Path target = installerProps.getTargetDir();
final Path warFile = target.resolve("war").resolve("idp.war");
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
similarity index 93%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
index 7c404df..3b0f04b 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CopyDistribution.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/CopyDistribution.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -34,7 +34,9 @@ import net.shibboleth.utilities.java.support.component.AbstractInitializableComp
import net.shibboleth.utilities.java.support.component.ComponentSupport;
/**
- * Copy the distribution to its final location.
+ * Copy the distribution to the final location. Prior to doing so
+ * take a backup of the old distribution. "The final location" means
+ * the dist, doc and system subdirectories.
*/
public final class CopyDistribution extends AbstractInitializableComponent {
@@ -54,7 +56,8 @@ public final class CopyDistribution extends AbstractInitializableComponent {
installerProps = props;
}
- /** Copy the distribution from the dstribution to its new location.
+ /** Copy the distribution from the dstribution to their new locations, having
+ * first taken a backup.
* @throws BuildException if badness occurs
*/
public void execute() throws BuildException {
@@ -64,18 +67,6 @@ public final class CopyDistribution extends AbstractInitializableComponent {
copyBinDocSystem();
}
- /** Helper for the {@link #backupOld(InstallerProperties)} method.
- * @param from where from
- * @param to where to.
- * @throws BuildException if badness occurs
- */
- private void backup(final Path from, final Path to) throws BuildException {
- log.debug("Backing up From {} to {}", from, to);
- final Copy copy = InstallerSupport.getCopyTask(from, to);
- copy.setFailOnError(false);
- copy.execute();
- }
-
/** Copy bin, edit-webapp, dist and doc to old-date-time.
* @throws BuildException if badness occurs
*/
@@ -88,7 +79,19 @@ public final class CopyDistribution extends AbstractInitializableComponent {
backup(installerProps.getTargetDir().resolve("system"), backup.resolve("system"));
}
- /** Helper for the delete {@link #deleteOld(InstallerProperties)} method.
+ /** Helper for the {@link #backupOld(InstallerProperties)} method.
+ * @param from where from
+ * @param to where to.
+ * @throws BuildException if badness occurs
+ */
+ private void backup(final Path from, final Path to) throws BuildException {
+ log.debug("Backing up From {} to {}", from, to);
+ final Copy copy = InstallerSupport.getCopyTask(from, to);
+ copy.setFailOnError(false);
+ copy.execute();
+ }
+
+ /** Helper for the {@link #deleteOld(InstallerProperties)} method.
* @param what what to delete
*/
private void delete(final Path what) {
@@ -119,8 +122,7 @@ public final class CopyDistribution extends AbstractInitializableComponent {
delete(system);
}
-
- /** Helper for the delete {@link #copyDist(InstallerProperties)} and
+ /** Helper for the {@link #copyDist(InstallerProperties)} and
* {@link #copyBinDocSystem(InstallerProperties)} methods.
* @param srcDist the source distribution.
* @param dist the dist directory
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
similarity index 97%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
index 7eb918b..8673020 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/CurrentInstallState.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/CurrentInstallState.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.io.FileInputStream;
import java.io.IOException;
@@ -93,7 +93,7 @@ final class CurrentInstallState extends AbstractInitializableComponent {
/** What is the installer version.
* @return "3" for a V3 install, null for a new install or the value we write during last install.
- * @throws BuildException if we find an inconsiostency
+ * @throws BuildException if we find an inconsistency
*/
@Nullable protected String getInstalledVersion() {
return oldVersion;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
similarity index 97%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
index b2c917a..a09496f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerProperties.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.io.File;
import java.io.FileInputStream;
@@ -234,10 +234,12 @@ public class InstallerProperties extends AbstractInitializableComponent {
}
}
- /** Lookup a property. If it isn't defined then ask the user (if we are allowed)
+ /** Lookup a property. If it isn't defined then ask the user (if we are allowed).
+ * This is used by most (but all) getters that redirect through a property
* @param propertyName the property to lookup.
* @param prompt what to say to the user
- * @param defaultSupplier how to get the default value
+ * @param defaultSupplier how to get the default value. Using a Supplier allows this
+ * to be a reasonably heavyweight operation.
* @throws BuildException of anything goes wrong
* @return the value
*/
@@ -263,7 +265,9 @@ public class InstallerProperties extends AbstractInitializableComponent {
return value;
}
- /** Lookup a property. If it isn't defined then ask the user (if we are allowed)
+ /** Lookup a property. If it isn't defined then ask the user (if we are allowed) via
+ * a no-echo interface.
+ * Note that this does not work within a debugger.
* @param propertyName the property to lookup.
* @param prompt what to say to the user
* @throws BuildException of anything goes wrong
@@ -284,8 +288,8 @@ public class InstallerProperties extends AbstractInitializableComponent {
return request.getInput();
}
-
- /** Get where we are installing/updating/building the war.
+ /** Get where we are installing/updating/building the war. This is slightly
+ * complicated because the default depends on what we are doing.
* @return the target directory
* @throws BuildException if something goes awry.
*/
@@ -314,7 +318,6 @@ public class InstallerProperties extends AbstractInitializableComponent {
return srcDir;
}
-
/** Get the host name for this install. Defaults to information pulled from the network.
* @return the host name.*/
@Nonnull public String getEntityID() {
@@ -324,7 +327,6 @@ public class InstallerProperties extends AbstractInitializableComponent {
return entityID;
}
-
/** Is this address named? Helper method for {@link #bestHostName()}
* @return true unless the name is the canonical name...
* @param addr what to look at
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerSupport.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java
similarity index 95%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerSupport.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java
index 870ebfe..45f4e1f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerSupport.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerSupport.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.io.IOException;
import java.nio.file.Files;
@@ -33,7 +33,9 @@ import org.apache.tools.ant.types.selectors.PresentSelector.FilePresence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/** General common names and helper functions for the installer. */
+/** General common names and helper functions for the Installer.
+ * This is not intended for general use.
+ */
public final class InstallerSupport {
/** The name of the file and the property with the current V4 installation value.*/
@@ -136,7 +138,7 @@ public final class InstallerSupport {
* @param where where
* @throws BuildException if badness occurrs
*/
- public static void deleteTree(final Path where) throws BuildException {
+ protected static void deleteTree(final Path where) throws BuildException {
if (!Files.exists(where)) {
log.debug("Directory {} does not exist. Skipping delete.", where);
return;
@@ -156,7 +158,7 @@ public final class InstallerSupport {
* @param destFile where to
* @return the jar task
*/
- public static Jar createJarTask(final Path baseDir, final Path destFile) {
+ protected static Jar createJarTask(final Path baseDir, final Path destFile) {
final Jar jarTask = new Jar();
jarTask.setBasedir(baseDir.toFile());
jarTask.setDestFile(destFile.toFile());
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/KeyManagement.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/KeyManagement.java
similarity index 99%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/KeyManagement.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/KeyManagement.java
index 3133372..915284a 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/KeyManagement.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/KeyManagement.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/PropertiesWithComments.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/PropertiesWithComments.java
similarity index 98%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/PropertiesWithComments.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/PropertiesWithComments.java
index e5b036d..0143de0 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/PropertiesWithComments.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/PropertiesWithComments.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -90,7 +90,7 @@ public final class PropertiesWithComments {
* @param isComment whether this is a comment or not.
* @throws IOException when badness happens.
*/
- protected void addCommentedProperty(@Nonnull @NotEmpty final String line, final boolean isComment)
+ private void addCommentedProperty(@Nonnull @NotEmpty final String line, final boolean isComment)
throws IOException {
final Properties parser = new Properties();
final String modifiedLine;
@@ -259,7 +259,7 @@ public final class PropertiesWithComments {
* It may be a commented property from a line like this "#prop=value" or a property prop=value.
*
*/
- protected class CommentedProperty {
+ private class CommentedProperty {
/** The property name. */
private final String property;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V4Install.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
similarity index 99%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V4Install.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
index 5a8350a..d0ddb0c 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V4Install.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.io.File;
import java.io.FileInputStream;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/MergePropertiesTask.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/MergePropertiesTask.java
index f889c3f..89e7652 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/MergePropertiesTask.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/MergePropertiesTask.java
@@ -25,7 +25,7 @@ import java.util.Properties;
import javax.annotation.Nonnull;
-import net.shibboleth.idp.installer.impl.PropertiesWithComments;
+import net.shibboleth.idp.installer.PropertiesWithComments;
import net.shibboleth.utilities.java.support.logic.Constraint;
import org.apache.tools.ant.BuildException;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/PasswordHandler.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/PasswordHandler.java
index 74c39fa..5f2042b 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/PasswordHandler.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/PasswordHandler.java
@@ -27,7 +27,7 @@ import javax.annotation.Nonnull;
import org.apache.tools.ant.input.InputRequest;
import org.apache.tools.ant.input.SecureInputHandler;
-import net.shibboleth.idp.installer.impl.PropertiesWithComments;
+import net.shibboleth.idp.installer.PropertiesWithComments;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
/** Ant helper class to ask for passwords, rejecting zero length passwords and asking for confirmation. */
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/RewritePropertiesTask.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/RewritePropertiesTask.java
index be47b4f..8c86320 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/RewritePropertiesTask.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/RewritePropertiesTask.java
@@ -25,7 +25,7 @@ import java.io.InputStream;
import javax.annotation.Nonnull;
-import net.shibboleth.idp.installer.impl.PropertiesWithComments;
+import net.shibboleth.idp.installer.PropertiesWithComments;
import net.shibboleth.utilities.java.support.logic.Constraint;
import org.apache.tools.ant.BuildException;
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java
similarity index 59%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java
index 7f5bd0b..9624108 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/package-info.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/package-info.java
@@ -15,7 +15,13 @@
* limitations under the License.
*/
/**
- * Classes of use during installation.
+ * Classes available for installation.
+ * <b>NOTE</b> that only {@link net.shibboleth.idp.installer.InstallerSupport}
+ * is suitable for programmatic extension. All other classes are either for use
+ * only by this package (i.e. {@link net.shibboleth.idp.installer.PropertiesWithComments})
+ * or are final and have limited public methods (the three classes that do the heavy lifting
+ * {@link net.shibboleth.idp.installer.V4Install}, {@link net.shibboleth.idp.installer.CopyDistribution},
+ * {@link net.shibboleth.idp.installer.BuildWar}
*/
-package net.shibboleth.idp.installer.impl;
\ No newline at end of file
+package net.shibboleth.idp.installer;
\ No newline at end of file
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/impl/Test.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/Test.java
similarity index 89%
rename from idp-installer/src/test/java/net/shibboleth/idp/installer/impl/Test.java
rename to idp-installer/src/test/java/net/shibboleth/idp/installer/Test.java
index 07518d4..9de586c 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/impl/Test.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/Test.java
@@ -15,20 +15,15 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer.impl;
+package net.shibboleth.idp.installer;
import java.io.IOException;
-import java.util.Properties;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.shibboleth.idp.installer.impl.BuildWar;
-import net.shibboleth.idp.installer.impl.CopyDistribution;
-import net.shibboleth.idp.installer.impl.InstallerProperties;
-import net.shibboleth.idp.installer.impl.V4Install;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
/**
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java
index bf56cef..0cd3d4c 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/TestPropertiesWithComments.java
@@ -27,8 +27,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
-import net.shibboleth.idp.installer.impl.PropertiesWithComments;
-
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list