[java-identity-provider] 03/07: IDP-1499 Installer: Ant task to call the new installer
Rod Widdowson
rdw at steadingsoftware.com
Sat Oct 19 08:04:12 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=cd083cd6d1d3a1aea366f4e1a998c7d8b1360582
commit cd083cd6d1d3a1aea366f4e1a998c7d8b1360582
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Oct 18 13:22:47 2019 +0100
IDP-1499 Installer: Ant task to call the new installer
https://issues.shibboleth.net/jira/browse/IDP-1499
---
.../idp/installer/ant/impl/V4InstallTask.java | 91 ++++++++++++++++++++++
.../idp/installer/{ => impl}/Installer.java | 11 ++-
.../resources/net/shibboleth/idp/installer/ant.xml | 1 +
3 files changed, 100 insertions(+), 3 deletions(-)
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/V4InstallTask.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/V4InstallTask.java
new file mode 100644
index 0000000..4a7c17d
--- /dev/null
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/ant/impl/V4InstallTask.java
@@ -0,0 +1,91 @@
+/*
+ * 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.ant.impl;
+
+import javax.annotation.Nonnull;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.shibboleth.idp.installer.BuildWar;
+import net.shibboleth.idp.installer.CopyDistribution;
+import net.shibboleth.idp.installer.InstallerProperties;
+import net.shibboleth.idp.installer.InstallerPropertiesImpl;
+import net.shibboleth.idp.installer.V4Install;
+import net.shibboleth.idp.installer.impl.CurrentInstallStateImpl;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
+/**
+ * A thin veneer around the V4 installer.
+ */
+public class V4InstallTask extends Task {
+
+ /** What to do?*/
+ private String task;
+
+ /** set what to do.
+ * @param what the value to set. One of "install", "install-nocopy", "build-war"
+ */
+ public void setTask(@Nonnull final String what) {
+ task = Constraint.isNotNull(StringSupport.trimOrNull(what), "Task must be non-null").toLowerCase();
+ }
+
+ @Override public void execute() {
+ final Logger log = LoggerFactory.getLogger(V4InstallTask.class);
+ boolean copyInstall = false;
+ boolean doInstall = false;
+ if ("install".equals(task)) {
+ copyInstall = true;
+ doInstall = true;
+ } else if ("install-nocopy".equals(task)) {
+ doInstall = true;
+ } else if (!"build-war".equals(task)) {
+ log.error("Parameter must be \"install\", \"install-nocopy\" or \"build-war\" was \"{}\"", task);
+ throw new BuildException("Invalid parameter to task");
+ }
+ try {
+ final InstallerProperties ip = new InstallerPropertiesImpl(!copyInstall);
+ final CurrentInstallStateImpl is;
+ ip.initialize();
+ is = new CurrentInstallStateImpl(ip);
+ is.initialize();
+ if (copyInstall) {
+ final CopyDistribution dist = new CopyDistribution(ip, is);
+ dist.initialize();
+ dist.execute();
+ }
+
+ if (doInstall) {
+ final V4Install inst = new V4Install(ip, is);
+ inst.initialize();
+ inst.execute();
+ }
+
+ final BuildWar bw = new BuildWar(ip, is);
+ bw.initialize();
+ bw.execute();
+ } catch (final ComponentInitializationException e) {
+ log.error("Could set up state", e);
+ throw new BuildException(e);
+ }
+ }
+}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/Installer.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java
similarity index 85%
rename from idp-installer/src/main/java/net/shibboleth/idp/installer/Installer.java
rename to idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java
index e075c7b..dc81c3c 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/Installer.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/Installer.java
@@ -15,12 +15,17 @@
* limitations under the License.
*/
-package net.shibboleth.idp.installer;
+package net.shibboleth.idp.installer.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.shibboleth.idp.installer.impl.CurrentInstallStateImpl;
+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.utilities.java.support.component.ComponentInitializationException;
/**
@@ -33,7 +38,7 @@ public final class Installer {
/** simulate the ant tasks.
* @param args what
- * @throws ComponentInitializationException
+ * @throws ComponentInitializationException if badness occurrs
*/
public static void main(final String[] args) throws ComponentInitializationException {
final Logger log = LoggerFactory.getLogger(Installer.class);
diff --git a/idp-installer/src/main/resources/net/shibboleth/idp/installer/ant.xml b/idp-installer/src/main/resources/net/shibboleth/idp/installer/ant.xml
index 2a2bdaf..ff9a807 100644
--- a/idp-installer/src/main/resources/net/shibboleth/idp/installer/ant.xml
+++ b/idp-installer/src/main/resources/net/shibboleth/idp/installer/ant.xml
@@ -5,4 +5,5 @@
<taskdef name="mergeproperties" classname="net.shibboleth.idp.installer.ant.impl.MergePropertiesTask"/>
<taskdef name="rewriteproperties" classname="net.shibboleth.idp.installer.ant.impl.RewritePropertiesTask"/>
<taskdef name="metadatagenerate" classname="net.shibboleth.idp.installer.ant.impl.MetadataGeneratorTask"/>
+ <taskdef name="v4install" classname="net.shibboleth.idp.installer.ant.impl.V4InstallTask"/>
</antlib>
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list