You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by ma...@apache.org on 2014/08/07 14:44:13 UTC
svn commit: r1616486 - in /syncope/trunk: ./ installer/
installer/src/main/java/org/apache/syncope/installer/processes/
installer/src/main/java/org/apache/syncope/installer/utilities/
installer/src/main/resources/izpack/
Author: massi
Date: Thu Aug 7 12:44:13 2014
New Revision: 1616486
URL: http://svn.apache.org/r1616486
Log:
merge from branch
Modified:
syncope/trunk/ (props changed)
syncope/trunk/installer/pom.xml
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
syncope/trunk/installer/src/main/resources/izpack/install.xml
syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml
Propchange: syncope/trunk/
------------------------------------------------------------------------------
Merged /syncope/branches/1_2_X:r1616249-1616485
Modified: syncope/trunk/installer/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/pom.xml?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/pom.xml (original)
+++ syncope/trunk/installer/pom.xml Thu Aug 7 12:44:13 2014
@@ -17,7 +17,8 @@ KIND, either express or implied. See th
specific language governing permissions and limitations
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java Thu Aug 7 12:44:13 2014
@@ -40,21 +40,23 @@ public class ArchetypeProcess {
final String syncopeVersion = args[9];
final String syncopeAdminPassword = args[10];
+ final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
+
if (!new File(installPath).exists()) {
- FileSystemUtils.createDirectory(installPath, handler, null);
+ fileSystemUtils.createDirectory(installPath, null);
}
- final MavenUtils mavenUtils = new MavenUtils(mavenDir);
+ final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
mavenUtils.archetypeGenerate(
syncopeVersion, groupId, artifactId, secretKey, anonymousKey, installPath);
- FileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + Pom.PATH),
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + Pom.PATH),
String.format(Pom.FILE, syncopeVersion, syncopeVersion, groupId, artifactId));
- FileSystemUtils.createDirectory(confDirectory, handler, null);
- FileSystemUtils.createDirectory(logsDirectory, handler, null);
- FileSystemUtils.createDirectory(bundlesDirectory, handler, null);
+ fileSystemUtils.createDirectory(confDirectory, null);
+ fileSystemUtils.createDirectory(logsDirectory, null);
+ fileSystemUtils.createDirectory(bundlesDirectory, null);
mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);
}
Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java Thu Aug 7 12:44:13 2014
@@ -94,26 +94,29 @@ public class ContainerProcess {
jbossAdminUsername = args[18];
jbossAdminPassword = args[19];
+ final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
+
if (withDataSource) {
- FileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH), CoreWebXml.withDataSource());
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH), CoreWebXml.
+ withDataSource());
switch (selectedContainer) {
case JBOSS:
- FileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH),
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + CoreWebXml.PATH),
CoreWebXml.withDataSourceForJBoss());
- FileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
+ PersistenceContextEMFactoryXml.PATH), PersistenceContextEMFactoryXml.FILE);
- FileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId
+ JBossDeploymentStructureXml.PATH),
String.format(JBossDeploymentStructureXml.FILE, jbossJdbcModuleName));
break;
case GLASSFISH:
- FileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + GlassfishCoreWebXml.PATH),
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + GlassfishCoreWebXml.PATH),
GlassfishCoreWebXml.withDataSource());
break;
}
}
- final MavenUtils mavenUtils = new MavenUtils(mavenDir);
+ final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);
switch (selectedContainer) {
@@ -154,14 +157,12 @@ public class ContainerProcess {
break;
case GLASSFISH:
final String createJavaOptCommand = "sh " + glassfishDir + Glassfish.CREATE_JAVA_OPT_COMMAND;
- FileSystemUtils.exec(createJavaOptCommand, handler, null);
+ fileSystemUtils.exec(createJavaOptCommand, null);
final Glassfish glassfish = new Glassfish(installPath, artifactId);
- FileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployCore(), handler,
- null);
- FileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployConsole(),
- handler, null);
+ fileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployCore(), null);
+ fileSystemUtils.exec("sh " + glassfishDir + Glassfish.DEPLOY_COMMAND + glassfish.deployConsole(), null);
break;
}
}
Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java Thu Aug 7 12:44:13 2014
@@ -54,6 +54,8 @@ public class PersistenceProcess {
mysqlInnoDB = Boolean.valueOf(args[6]);
oracleTableSpace = args[7];
+ final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
+
final StringBuilder persistenceProperties = new StringBuilder(PersistenceProperties.HEADER);
switch (dbSelected) {
@@ -74,23 +76,22 @@ public class PersistenceProcess {
persistenceProperties.append(String.format(
PersistenceProperties.ORACLE, persistenceUrl, persistenceUser, persistencePassword,
oracleTableSpace));
- writeOrmFile(handler, OrmXml.ORACLE_ORM);
+ writeOrmFile(fileSystemUtils, OrmXml.ORACLE_ORM);
break;
case SQLSERVER:
persistenceProperties.append(String.format(
PersistenceProperties.SQLSERVER, persistenceUrl, persistenceUser, persistencePassword));
- writeOrmFile(handler, OrmXml.SQLSERVER_ORM);
+ writeOrmFile(fileSystemUtils, OrmXml.SQLSERVER_ORM);
break;
}
- FileSystemUtils.writeToFile(new File(
+ fileSystemUtils.writeToFile(new File(
installPath + "/" + artifactId + PersistenceProperties.PATH), persistenceProperties.toString());
}
- private void writeOrmFile(final AbstractUIProcessHandler handler, final String content) {
- FileSystemUtils.createDirectory(installPath + "/" + artifactId + OrmXml.PATH_DIR, handler, null);
- final File orm = new File(installPath + "/" + artifactId + OrmXml.PATH_COMPLETE);
- FileSystemUtils.writeToFile(orm, content);
+ private void writeOrmFile(final FileSystemUtils fileSystemUtils, final String content) {
+ fileSystemUtils.createDirectory(installPath + "/" + artifactId + OrmXml.PATH_DIR, null);
+ fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + OrmXml.PATH_COMPLETE), content);
}
}
Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java Thu Aug 7 12:44:13 2014
@@ -31,26 +31,33 @@ public class FileSystemUtils {
public static final boolean IS_WIN = System.getProperty("os.name").toLowerCase().contains("win");
- public static void createDirectory(final String directoryPath,
- final AbstractUIProcessHandler handler, final String path) {
- exec(String.format(CREATE_DIRECTORY, directoryPath), null, path);
+ private final AbstractUIProcessHandler handler;
+
+ public FileSystemUtils(final AbstractUIProcessHandler handler) {
+ this.handler = handler;
+ }
+
+ public void createDirectory(final String directoryPath, final String path) {
+ exec(String.format(CREATE_DIRECTORY, directoryPath), path);
}
private static final String CREATE_DIRECTORY = "mkdir -p %s";
- public static void exec(final String cmd, final AbstractUIProcessHandler handler, final String path) {
+ public void exec(final String cmd, final String path) {
try {
final ProcessBuilder builder = new ProcessBuilder(cmd.split(" "));
if (path != null && !path.isEmpty()) {
builder.directory(new File(path));
}
final Process process = builder.start();
- readResponse(process.getInputStream(), handler);
- } catch (IOException ex) {
+ readResponse(process.getInputStream());
+ } catch (final IOException ex) {
+ handler.emitError("Error executing " + cmd + ": " + ex.getMessage(),
+ "Error executing " + cmd + ": " + ex.getMessage());
}
}
- private static void readResponse(final InputStream inputStream, final AbstractUIProcessHandler handler) throws
+ private void readResponse(final InputStream inputStream) throws
IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = reader.readLine();
@@ -61,13 +68,15 @@ public class FileSystemUtils {
inputStream.close();
}
- public static void writeToFile(final File orm, final String content) {
+ public void writeToFile(final File file, final String content) {
try {
- final FileWriter fw = new FileWriter(orm.getAbsoluteFile());
+ final FileWriter fw = new FileWriter(file.getAbsoluteFile());
final BufferedWriter bw = new BufferedWriter(fw);
bw.write(content);
bw.close();
- } catch (IOException ex) {
+ } catch (final IOException ex) {
+ handler.emitError("Error writing file" + file.getAbsolutePath() + ": " + ex.getMessage(),
+ "Error writing file" + file.getAbsolutePath() + ": " + ex.getMessage());
}
}
Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/MavenUtils.java Thu Aug 7 12:44:13 2014
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.installer.utilities;
+import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -34,10 +35,13 @@ public class MavenUtils {
private static final String MAVEN_HOME_PROPERTY = "maven.home";
- public MavenUtils(final String mavenHomeDirectory) {
+ private final AbstractUIProcessHandler handler;
+
+ public MavenUtils(final String mavenHomeDirectory, final AbstractUIProcessHandler handler) {
if (System.getProperty(MAVEN_HOME_PROPERTY) == null || System.getProperty(MAVEN_HOME_PROPERTY).isEmpty()) {
System.setProperty(MAVEN_HOME_PROPERTY, mavenHomeDirectory);
}
+ this.handler = handler;
}
public void archetypeGenerate(final String archetypeVersion, final String groupId,
@@ -88,11 +92,12 @@ public class MavenUtils {
private InvocationResult invoke(final InvocationRequest request, final String path) {
InvocationResult result = null;
final Invoker invoker = new DefaultInvoker();
+ invoker.setOutputHandler(null);
invoker.setWorkingDirectory(new File(path));
try {
result = invoker.execute(request);
} catch (MavenInvocationException ex) {
-
+ handler.emitError("Maven exception: " + ex.getMessage(), "Maven exception: " + ex.getMessage());
}
return result;
}
Modified: syncope/trunk/installer/src/main/resources/izpack/install.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/resources/izpack/install.xml?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/install.xml (original)
+++ syncope/trunk/installer/src/main/resources/izpack/install.xml Thu Aug 7 12:44:13 2014
@@ -22,19 +22,13 @@ under the License.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://izpack.org/schema/installation
http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">
- <properties>
- <property name="info.appName" value="Apache Syncope"/>
- <property name="info.url" value="http://syncope.apache.org"/>
- <property name="info.company.name" value="Tirasa S.r.l."/>
- <property name="info.company.email" value="info@tirasa.net"/>
- </properties>
<info>
- <appname>@{info.appName}</appname>
- <appversion>@{info.appVersion}</appversion>
- <url>@{info.url}</url>
+ <appname>Apache Syncope Installer</appname>
+ <appversion>@{syncope.version}</appversion>
+ <url>http://syncope.apache.org</url>
<authors>
- <author name="@{info.company.name}" email="@{info.company.email"/>
+ <author name="Tirasa S.r.l." email="info@tirasa.net"/>
</authors>
<javaversion>1.7</javaversion>
</info>
@@ -60,7 +54,7 @@ under the License.
<locale>
<langpack iso3="eng"/>
- <langpack iso3="ita"/>
+ <!--<langpack iso3="ita"/>-->
</locale>
<variables>
@@ -174,7 +168,7 @@ under the License.
<packs>
<pack name="Apache Syncope" required="yes">
- <description>Apache Syncope</description>
+ <description>Apache Syncope Installer</description>
</pack>
</packs>
Modified: syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml?rev=1616486&r1=1616485&r2=1616486&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml (original)
+++ syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml Thu Aug 7 12:44:13 2014
@@ -25,7 +25,7 @@ under the License.
<field type="space"/>
<field type="dir" variable="mvn.directory">
- <spec id="mvn.directory.id" size="20" set=""/>
+ <spec id="mvn.directory.id" size="20" set="/usr"/>
</field>
<field type="space"/>
<field type="text" variable="mvn.groupid">
@@ -45,15 +45,15 @@ under the License.
</field>
<field type="space"/>
<field type="dir" variable="mvn.conf.directory">
- <spec id="archetype.mvn.conf.directory" size="20" set=""/>
+ <spec id="archetype.mvn.conf.directory" size="20" set="/var/tmp/syncope/conf"/>
</field>
<field type="space"/>
<field type="dir" variable="mvn.log.directory">
- <spec id="archetype.mvn.log.directory" size="20" set=""/>
+ <spec id="archetype.mvn.log.directory" size="20" set="/var/tmp/syncope/log"/>
</field>
<field type="space"/>
<field type="dir" variable="mvn.bundle.directory">
- <spec id="archetype.mvn.bundle.directory" size="20" set=""/>
+ <spec id="archetype.mvn.bundle.directory" size="20" set="/var/tmp/syncope/bundles"/>
</field>
<field type="space"/>
<field type="text" variable="mvn.syncope.version">