You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/11/10 18:33:31 UTC
[2/5] syncope git commit: [SYNCOPE-718] installer
[SYNCOPE-718] installer
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/34af1854
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/34af1854
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/34af1854
Branch: refs/heads/master
Commit: 34af1854f488f80a9969da8e3c833fee7c810b89
Parents: 02bd1e3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Nov 10 17:16:00 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Nov 10 17:16:00 2015 +0100
----------------------------------------------------------------------
.../installer/containers/AbstractContainer.java | 4 +++
.../syncope/installer/containers/Glassfish.java | 4 +++
.../syncope/installer/containers/Tomcat.java | 14 ++++++++
.../installer/containers/jboss/JBoss.java | 4 +++
.../installer/files/ConsoleProperties.java | 2 +-
.../installer/files/EnduserProperties.java | 34 ++++++++++++++++++++
.../installer/processes/ArchetypeProcess.java | 11 +++++++
.../installer/processes/ContainerProcess.java | 31 ++++++++++++++++++
.../src/main/resources/installer.properties | 2 ++
9 files changed, 105 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/containers/AbstractContainer.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/containers/AbstractContainer.java b/installer/src/main/java/org/apache/syncope/installer/containers/AbstractContainer.java
index 61d9927..c677058 100644
--- a/installer/src/main/java/org/apache/syncope/installer/containers/AbstractContainer.java
+++ b/installer/src/main/java/org/apache/syncope/installer/containers/AbstractContainer.java
@@ -26,6 +26,10 @@ public abstract class AbstractContainer {
protected static final String UNIX_CONSOLE_RELATIVE_PATH = "%s/%s/console/target/syncope-console.war";
+ protected static final String UNIX_ENDUSER_RELATIVE_PATH = "%s/%s/enduser/target/syncope-enduser.war";
+
protected static final String WIN_CONSOLE_RELATIVE_PATH = "%s\\%s\\console\\target\\syncope-console.war";
+ protected static final String WIN_ENDUSER_RELATIVE_PATH = "%s\\%s\\enduser\\target\\syncope-enduser.war";
+
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/containers/Glassfish.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/containers/Glassfish.java b/installer/src/main/java/org/apache/syncope/installer/containers/Glassfish.java
index 5f174df..2340377 100644
--- a/installer/src/main/java/org/apache/syncope/installer/containers/Glassfish.java
+++ b/installer/src/main/java/org/apache/syncope/installer/containers/Glassfish.java
@@ -37,6 +37,10 @@ public class Glassfish extends AbstractContainer {
return deploy(UNIX_CONSOLE_RELATIVE_PATH);
}
+ public String deployEnduser() {
+ return deploy(UNIX_CONSOLE_RELATIVE_PATH);
+ }
+
public String deploy(final String what) {
return String.format(what, installPath, artifactId);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/containers/Tomcat.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/containers/Tomcat.java b/installer/src/main/java/org/apache/syncope/installer/containers/Tomcat.java
index af8af5f..9471312 100644
--- a/installer/src/main/java/org/apache/syncope/installer/containers/Tomcat.java
+++ b/installer/src/main/java/org/apache/syncope/installer/containers/Tomcat.java
@@ -31,6 +31,8 @@ public class Tomcat extends AbstractContainer {
private static final String DEPLOY_SYNCOPE_CONSOLE_QUERY = "/manager/text/deploy?path=/syncope-console&war=file:";
+ private static final String DEPLOY_SYNCOPE_ENDUSER_QUERY = "/manager/text/deploy?path=/syncope-enduser&war=file:";
+
private final String installPath;
private final String artifactId;
@@ -69,6 +71,18 @@ public class Tomcat extends AbstractContainer {
return status == 200;
}
+ public boolean deployEnduser() {
+ int status;
+ if (IS_WIN) {
+ status = httpUtils.getWithBasicAuth(DEPLOY_SYNCOPE_ENDUSER_QUERY
+ + pathEncoded(String.format(WIN_ENDUSER_RELATIVE_PATH, installPath, artifactId)));
+ } else {
+ status = httpUtils.getWithBasicAuth(path(DEPLOY_SYNCOPE_ENDUSER_QUERY + UNIX_ENDUSER_RELATIVE_PATH));
+ }
+
+ return status == 200;
+ }
+
private String pathEncoded(final String what) {
String path = "";
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/containers/jboss/JBoss.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/containers/jboss/JBoss.java b/installer/src/main/java/org/apache/syncope/installer/containers/jboss/JBoss.java
index 24b193e..a08608c 100644
--- a/installer/src/main/java/org/apache/syncope/installer/containers/jboss/JBoss.java
+++ b/installer/src/main/java/org/apache/syncope/installer/containers/jboss/JBoss.java
@@ -63,6 +63,10 @@ public class JBoss extends AbstractContainer {
return deploy(UNIX_CONSOLE_RELATIVE_PATH, "syncope-console.war");
}
+ public boolean deployEnduser() {
+ return deploy(UNIX_ENDUSER_RELATIVE_PATH, "syncope-console.war");
+ }
+
public boolean deploy(final String whatDeploy, final String warName) {
final String responseBodyAsString = httpUtils.postWithDigestAuth(
String.format(addContentUrl, jbossHost, jbossManagementPort),
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java b/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
index 5298908..26532f2 100644
--- a/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
+++ b/installer/src/main/java/org/apache/syncope/installer/files/ConsoleProperties.java
@@ -29,6 +29,6 @@ public final class ConsoleProperties {
+ "port=%s";
private ConsoleProperties() {
- // private constructor for static utility class
+ // private constructor for static utility class
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java b/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
new file mode 100644
index 0000000..26dc304
--- /dev/null
+++ b/installer/src/main/java/org/apache/syncope/installer/files/EnduserProperties.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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 org.apache.syncope.installer.files;
+
+public final class EnduserProperties {
+
+ public static final String PLACEHOLDER = "scheme=http\n"
+ + "host=localhost\n"
+ + "port=8080";
+
+ public static final String ENDUSER = "scheme=%s\n"
+ + "host=%s\n"
+ + "port=%s";
+
+ private EnduserProperties() {
+ // private constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java b/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
index 4f17035..d0a3f62 100644
--- a/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
+++ b/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
@@ -119,6 +119,17 @@ public class ArchetypeProcess extends BaseProcess {
+ File.separator + PROPERTIES.getProperty("saveModel"),
modelerDirectory + File.separator + PROPERTIES.getProperty("saveModel"));
+ fileSystemUtils.copyFile(
+ syncopeInstallDir
+ + PROPERTIES.getProperty("enduserResDirectory")
+ + File.separator + PROPERTIES.getProperty("urlConfig"),
+ modelerDirectory + File.separator + PROPERTIES.getProperty("urlConfig"));
+ fileSystemUtils.copyFile(
+ syncopeInstallDir
+ + PROPERTIES.getProperty("enduserResDirectory")
+ + File.separator + PROPERTIES.getProperty("saveModel"),
+ modelerDirectory + File.separator + PROPERTIES.getProperty("saveModel"));
+
final Properties modelerProperties = new Properties();
modelerProperties.setProperty("modeler.directory", modelerDirectory);
mavenUtils.mvnCleanPackageWithProperties(modelerDirectory, modelerProperties, customMavenProxySettings);
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java b/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
index e7e5148..9113c22 100644
--- a/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
+++ b/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
@@ -30,6 +30,7 @@ import org.apache.syncope.installer.containers.Tomcat;
import org.apache.syncope.installer.containers.jboss.JBoss;
import org.apache.syncope.installer.enums.Containers;
import org.apache.syncope.installer.files.ConsoleProperties;
+import org.apache.syncope.installer.files.EnduserProperties;
import org.apache.syncope.installer.files.GlassfishCoreWebXml;
import org.apache.syncope.installer.files.MasterDomainXml;
import org.apache.syncope.installer.utilities.InstallLog;
@@ -156,6 +157,10 @@ public final class ContainerProcess extends BaseProcess {
+ File.separator + PROPERTIES.getProperty("consolePropertiesFile"));
String contentConsolePropertiesFile = fileSystemUtils.readFile(consolePropertiesFile);
+ File enduserPropertiesFile = new File(syncopeInstallDir + PROPERTIES.getProperty("enduserResDirectory")
+ + File.separator + PROPERTIES.getProperty("enduserPropertiesFile"));
+ String contentEnduserPropertiesFile = fileSystemUtils.readFile(enduserPropertiesFile);
+
final String scheme;
final String host;
final String port;
@@ -186,6 +191,10 @@ public final class ContainerProcess extends BaseProcess {
contentConsolePropertiesFile.replace(ConsoleProperties.PLACEHOLDER,
String.format(ConsoleProperties.CONSOLE, scheme, host, port)));
+ fileSystemUtils.writeToFile(enduserPropertiesFile,
+ contentEnduserPropertiesFile.replace(EnduserProperties.PLACEHOLDER,
+ String.format(EnduserProperties.ENDUSER, scheme, host, port)));
+
MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
File customMavenProxySettings = null;
try {
@@ -249,6 +258,16 @@ public final class ContainerProcess extends BaseProcess {
handler.emitError(messageError, messageError);
InstallLog.getInstance().error(messageError);
}
+
+ boolean deployEnduserResult = tomcat.deployEnduser();
+ if (deployEnduserResult) {
+ handler.logOutput("Enduser successfully deployed ", true);
+ InstallLog.getInstance().info("Enduser successfully deployed ");
+ } else {
+ final String messageError = "Deploy console on Tomcat failed";
+ handler.emitError(messageError, messageError);
+ InstallLog.getInstance().error(messageError);
+ }
break;
case JBOSS:
@@ -275,6 +294,16 @@ public final class ContainerProcess extends BaseProcess {
handler.emitError(messageError, messageError);
InstallLog.getInstance().error(messageError);
}
+
+ boolean deployEnduserJBoss = jBoss.deployEnduser();
+ if (deployEnduserJBoss) {
+ handler.logOutput("Enduser successfully deployed ", true);
+ InstallLog.getInstance().info("Enduser successfully deployed ");
+ } else {
+ final String messageError = "Deploy console on JBoss failed";
+ handler.emitError(messageError, messageError);
+ InstallLog.getInstance().error(messageError);
+ }
break;
case GLASSFISH:
@@ -287,6 +316,8 @@ public final class ContainerProcess extends BaseProcess {
+ Glassfish.DEPLOY_COMMAND + glassfish.deployCore(), null);
fileSystemUtils.exec("sh " + glassfishDir
+ Glassfish.DEPLOY_COMMAND + glassfish.deployConsole(), null);
+ fileSystemUtils.exec("sh " + glassfishDir
+ + Glassfish.DEPLOY_COMMAND + glassfish.deployEnduser(), null);
break;
default:
http://git-wip-us.apache.org/repos/asf/syncope/blob/34af1854/installer/src/main/resources/installer.properties
----------------------------------------------------------------------
diff --git a/installer/src/main/resources/installer.properties b/installer/src/main/resources/installer.properties
index 97d07e1..55f1882 100644
--- a/installer/src/main/resources/installer.properties
+++ b/installer/src/main/resources/installer.properties
@@ -19,10 +19,12 @@ glassfishCoreWebXmlFile=core/src/main/webapp/WEB-INF/glassfish-web.xml
urlConfig=url-config.js
saveModel=save-model.html
consoleResDirectory=console/src/main/resources
+enduserResDirectory=endyser/src/main/resources
pomFile=pom.xml
masterDomainFile=core/src/main/resources/domains/MasterDomain.xml
coreMetaInfDirectory=core/src/main/resources/META-INF
provisioningPropertiesFile=core/src/main/resources/provisioning.properties
masterPropertiesFile=core/src/main/resources/domains/Master.properties
consolePropertiesFile=console.properties
+enduserPropertiesFile=enduser.properties
modelerPomFile=modelerPom.xml