You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2014/09/26 17:53:11 UTC

svn commit: r1627815 - in /syncope/trunk: ./ installer/src/main/java/org/apache/syncope/installer/processes/ installer/src/main/java/org/apache/syncope/installer/utilities/ installer/src/main/java/org/apache/syncope/installer/validators/ installer/src/...

Author: andreapatricelli
Date: Fri Sep 26 15:53:10 2014
New Revision: 1627815

URL: http://svn.apache.org/r1627815
Log:
[SYNCOPE-529] merge from branch 1_2_X

Modified:
    syncope/trunk/   (props changed)
    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/utilities/DriverLoader.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/java/org/apache/syncope/installer/validators/PersistenceValidator.java
    syncope/trunk/installer/src/main/resources/izpack/ProcessPanel.Spec.xml
    syncope/trunk/installer/src/main/resources/izpack/install.xml
    syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_eng
    syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_ita
    syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml

Propchange: syncope/trunk/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_2_X:r1627743-1627814

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=1627815&r1=1627814&r2=1627815&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 Fri Sep 26 15:53:10 2014
@@ -21,14 +21,17 @@ package org.apache.syncope.installer.pro
 import org.apache.syncope.installer.utilities.FileSystemUtils;
 import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
 import java.io.File;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
 import org.apache.syncope.installer.files.Pom;
 import org.apache.syncope.installer.utilities.InstallLog;
 import org.apache.syncope.installer.utilities.MavenUtils;
+import org.xml.sax.SAXException;
 
 public class ArchetypeProcess {
 
     public void run(final AbstractUIProcessHandler handler, final String[] args) {
-
         final String installPath = args[0];
         final String mavenDir = args[1];
         final String groupId = args[2];
@@ -40,21 +43,61 @@ public class ArchetypeProcess {
         final String bundlesDirectory = args[8];
         final String syncopeVersion = args[9];
         final String syncopeAdminPassword = args[10];
+        final boolean isProxyEnabled = Boolean.valueOf(args[11]);
+        final String proxyHost = args[12];
+        final String proxyPort = args[13];
+        final String proxyUser = args[14];
+        final String proxyPwd = args[15];
+        final boolean mavenProxyAutoconf = Boolean.valueOf(args[16]);
 
         final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
         fileSystemUtils.createDirectory(installPath);
         InstallLog.initialize(installPath, handler);
-
         final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
+        File customMavenProxySettings = null;
+        try {
+            if (isProxyEnabled && mavenProxyAutoconf) {
+                customMavenProxySettings = MavenUtils.createSettingsWithProxy(installPath, proxyHost, proxyPort,
+                        proxyUser, proxyPwd);
+            }
+        } catch (IOException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "I/O error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        } catch (ParserConfigurationException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "Parser configuration error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        } catch (TransformerException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "Transformer error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        } catch (SAXException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "XML parsing error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        }
         mavenUtils.archetypeGenerate(
-                syncopeVersion, groupId, artifactId, secretKey, anonymousKey, installPath);
+                syncopeVersion, groupId, artifactId, secretKey, anonymousKey, installPath, customMavenProxySettings);
 
         fileSystemUtils.writeToFile(new File(installPath + "/" + artifactId + Pom.PATH),
                 String.format(Pom.FILE, syncopeVersion, syncopeVersion, groupId, artifactId));
         fileSystemUtils.createDirectory(confDirectory);
         fileSystemUtils.createDirectory(logsDirectory);
         fileSystemUtils.createDirectory(bundlesDirectory);
-        mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);
+        mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory,
+                customMavenProxySettings);
     }
-
 }

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=1627815&r1=1627814&r2=1627815&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 Fri Sep 26 15:53:10 2014
@@ -21,6 +21,9 @@ package org.apache.syncope.installer.pro
 import org.apache.syncope.installer.utilities.FileSystemUtils;
 import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
 import java.io.File;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
 import org.apache.syncope.installer.containers.Glassfish;
 import org.apache.syncope.installer.containers.Tomcat;
 import org.apache.syncope.installer.containers.jboss.JBoss;
@@ -31,6 +34,7 @@ import org.apache.syncope.installer.file
 import org.apache.syncope.installer.files.CoreWebXml;
 import org.apache.syncope.installer.utilities.InstallLog;
 import org.apache.syncope.installer.utilities.MavenUtils;
+import org.xml.sax.SAXException;
 
 public class ContainerProcess {
 
@@ -72,6 +76,18 @@ public class ContainerProcess {
 
     private String jbossAdminPassword;
 
+    private boolean isProxyEnabled;
+
+    private String proxyHost;
+
+    private String proxyPort;
+
+    private String proxyUser;
+
+    private String proxyPwd;
+
+    private boolean mavenProxyAutoconf;
+
     public void run(final AbstractUIProcessHandler handler, final String[] args) {
 
         installPath = args[0];
@@ -94,6 +110,12 @@ public class ContainerProcess {
         jbossJdbcModuleName = args[17];
         jbossAdminUsername = args[18];
         jbossAdminPassword = args[19];
+        isProxyEnabled = Boolean.valueOf(args[20]);
+        proxyHost = args[21];
+        proxyPort = args[22];
+        proxyUser = args[23];
+        proxyPwd = args[24];
+        mavenProxyAutoconf = Boolean.valueOf(args[25]);
 
         final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
 
@@ -121,7 +143,46 @@ public class ContainerProcess {
         }
 
         final MavenUtils mavenUtils = new MavenUtils(mavenDir, handler);
-        mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory);
+        File customMavenProxySettings = null;
+        try {
+            if (isProxyEnabled && mavenProxyAutoconf) {
+                customMavenProxySettings = MavenUtils.createSettingsWithProxy(installPath, proxyHost, proxyPort,
+                        proxyUser, proxyPwd);
+            }
+        } catch (IOException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "I/O error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        } catch (ParserConfigurationException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "Parser configuration error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        } catch (TransformerException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "Transformer error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        } catch (SAXException ex) {
+            final StringBuilder messageError = new StringBuilder(
+                    "XML parsing error during creation of Maven custom settings.xml");
+            final String emittedError = messageError.toString();
+            handler.emitError(emittedError, emittedError);
+            InstallLog.getInstance().error(messageError.append(ex.getMessage() == null ? "" : ex.getMessage()).
+                    toString());
+        }
+        mavenUtils.createPackage(installPath + "/" + artifactId, confDirectory, logsDirectory, bundlesDirectory,
+                customMavenProxySettings);
+        if (isProxyEnabled && mavenProxyAutoconf) {
+            FileSystemUtils.delete(customMavenProxySettings);
+        }
 
         switch (selectedContainer) {
             case TOMCAT:

Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java?rev=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java Fri Sep 26 15:53:10 2014
@@ -18,19 +18,21 @@
  */
 package org.apache.syncope.installer.utilities;
 
+import java.net.Authenticator;
 import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
 import org.apache.syncope.installer.enums.DBs;
 
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.sql.Driver;
 
-public class DriverLoader extends URLClassLoader {
+public final class DriverLoader extends URLClassLoader {
 
     private final static String POSTGRES_JAR = "http://jdbc.postgresql.org/download/postgresql-9.3-1101.jdbc41.jar";
 
-    private final static String MYSQL_JAR
-            = "http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar";
+    private final static String MYSQL_JAR =
+            "http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar";
 
     private static final String POSTGRES_CLASS_DRIVER = "org.postgresql.Driver";
 
@@ -43,14 +45,17 @@ public class DriverLoader extends URLCla
 
     private static DriverLoader driverLoader;
 
-    public static Driver load(final DBs selectedDB) {
+    public static Driver load(final DBs selectedDB, final boolean isProxyEnabled, final String proxyHost,
+            final String proxyPort, final String proxyUser, final String proxyPwd) {
         Driver driver = null;
         switch (selectedDB) {
             case POSTGRES:
-                driver = downloadDriver(POSTGRES_JAR, POSTGRES_CLASS_DRIVER);
+                driver = downloadDriver(POSTGRES_JAR, POSTGRES_CLASS_DRIVER, isProxyEnabled, proxyHost, proxyPort,
+                        proxyUser, proxyPwd);
                 break;
             case MYSQL:
-                driver = downloadDriver(MYSQL_JAR, MYSQL_CLASS_DRIVER);
+                driver = downloadDriver(MYSQL_JAR, MYSQL_CLASS_DRIVER, isProxyEnabled, proxyHost, proxyPort,
+                        proxyUser, proxyPwd);
                 break;
             case SQLSERVER:
                 break;
@@ -62,10 +67,27 @@ public class DriverLoader extends URLCla
         return driver;
     }
 
-    private static Driver downloadDriver(final String driverUrl, final String driverClassName) {
+    private static Driver downloadDriver(final String driverUrl, final String driverClassName,
+            final boolean isProxyEnabled, final String proxyHost, final String proxyPort, final String proxyUser,
+            final String proxyPwd) {
         Driver driver = null;
         try {
-            final URL[] url = {new URL(driverUrl)};
+            if (isProxyEnabled) {
+                System.setProperty("http.proxyHost", proxyHost);
+                System.setProperty("http.proxyPort", proxyPort);
+                if (proxyUser != null && !proxyUser.isEmpty() && proxyPwd != null) {
+                    Authenticator.setDefault(new Authenticator() {
+
+                        @Override
+                        public PasswordAuthentication getPasswordAuthentication() {
+                            return new PasswordAuthentication(proxyUser, proxyPwd.toCharArray());
+                        }
+                    });
+                    System.setProperty("http.proxyUser", proxyUser);
+                    System.setProperty("http.proxyPassword", proxyPwd);
+                }
+            }
+            final URL[] url = { new URL(driverUrl) };
             driverLoader = new DriverLoader(url);
             driver = (Driver) driverLoader.loadClass(driverClassName).newInstance();
         } catch (ClassNotFoundException e) {

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=1627815&r1=1627814&r2=1627815&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 Fri Sep 26 15:53:10 2014
@@ -26,7 +26,18 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.w3c.dom.Document;
 
 public class FileSystemUtils {
 
@@ -100,4 +111,24 @@ public class FileSystemUtils {
         }
     }
 
+    public static void writeXML(final Document doc, final OutputStream out) throws IOException,
+            TransformerException {
+        try {
+            final TransformerFactory factory = TransformerFactory.newInstance();
+            final Transformer transformer = factory.newTransformer();
+            transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+            transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+            transformer.transform(new DOMSource(doc),
+                    new StreamResult(new OutputStreamWriter(out, "UTF-8")));
+        } finally {
+            IOUtils.closeQuietly(out);
+        }
+    }
+
+    public static void delete(final File file) {
+        FileUtils.deleteQuietly(file);
+    }
 }

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=1627815&r1=1627814&r2=1627815&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 Fri Sep 26 15:53:10 2014
@@ -20,16 +20,26 @@ package org.apache.syncope.installer.uti
 
 import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.shared.invoker.DefaultInvocationRequest;
 import org.apache.maven.shared.invoker.DefaultInvoker;
 import org.apache.maven.shared.invoker.InvocationRequest;
 import org.apache.maven.shared.invoker.InvocationResult;
 import org.apache.maven.shared.invoker.Invoker;
 import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
 
 public class MavenUtils {
 
@@ -45,14 +55,18 @@ public class MavenUtils {
     }
 
     public void archetypeGenerate(final String archetypeVersion, final String groupId,
-            final String artifactId, final String secretKey, final String anonymousKey, final String installPath) {
+            final String artifactId, final String secretKey, final String anonymousKey, final String installPath,
+            final File customSettingsFile) {
 
         final InvocationRequest request = new DefaultInvocationRequest();
         request.setGoals(Collections.singletonList("archetype:generate"));
         request.setInteractive(false);
-        final Properties properties
-                = archetypeProperties(archetypeVersion, groupId, artifactId, secretKey, anonymousKey);
+        final Properties properties =
+                archetypeProperties(archetypeVersion, groupId, artifactId, secretKey, anonymousKey);
         request.setProperties(properties);
+        if (customSettingsFile != null && FileUtils.sizeOf(customSettingsFile) > 0) {
+            request.setUserSettingsFile(customSettingsFile);
+        }
         logToHandler(request.getGoals(), properties);
         logToFile(request.getGoals(), properties);
         invoke(request, installPath);
@@ -73,11 +87,13 @@ public class MavenUtils {
     }
 
     public void createPackage(final String path, final String confDirectory,
-            final String logDirectory, final String bundlesDirectory) {
-
+            final String logDirectory, final String bundlesDirectory, final File customSettingsFile) {
         final InvocationRequest request = new DefaultInvocationRequest();
         final Properties properties = packageProperties(confDirectory, logDirectory, bundlesDirectory);
         request.setProperties(properties);
+        if (customSettingsFile != null && FileUtils.sizeOf(customSettingsFile) > 0) {
+            request.setUserSettingsFile(customSettingsFile);
+        }
         final List<String> mavenGoals = new ArrayList<String>();
         mavenGoals.add("clean");
         mavenGoals.add("package");
@@ -135,4 +151,56 @@ public class MavenUtils {
         return result;
     }
 
+    public static File createSettingsWithProxy(final String path, final String proxyHost, final String proxyPort,
+            final String proxyUser, final String proxyPassword) throws IOException, ParserConfigurationException,
+            TransformerException, SAXException {
+        final File settingsXML = new File(System.getProperty(MAVEN_HOME_PROPERTY) + (System.getProperty(
+                MAVEN_HOME_PROPERTY).endsWith("/") ? "conf/settings.xml" : "/conf/settings.xml"));
+        final File tempSettingsXML = new File(path + (path.endsWith("/") ? "settings_temp.xml" : "/settings_temp.xml"));
+        if (settingsXML.canRead() && !tempSettingsXML.exists()) {
+            tempSettingsXML.createNewFile();
+
+            final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            final DocumentBuilder builder = dbf.newDocumentBuilder();
+            // parse settings.xml
+            final Document settings = builder.parse(settingsXML);
+
+            final Element proxies = (Element) settings.getDocumentElement().getElementsByTagName("proxies").item(0);
+
+            final Element proxy = settings.createElement("proxy");
+
+            final Element id = settings.createElement("id");
+            final Element active = settings.createElement("active");
+            final Element protocol = settings.createElement("protocol");
+            final Element host = settings.createElement("host");
+            final Element port = settings.createElement("port");
+            final Element nonProxyHosts = settings.createElement("nonProxyHosts");
+            id.appendChild(settings.createTextNode("optional"));
+            active.appendChild(settings.createTextNode("true"));
+            protocol.appendChild(settings.createTextNode("http"));
+            host.appendChild(settings.createTextNode(proxyHost));
+            port.appendChild(settings.createTextNode(proxyPort));
+            proxy.appendChild(id);
+            proxy.appendChild(active);
+            proxy.appendChild(protocol);
+            // create username and password tags only if required
+            if (proxyUser != null && !proxyUser.isEmpty() && proxyPassword != null) {
+                final Element username = settings.createElement("username");
+                final Element password = settings.createElement("password");
+                username.appendChild(settings.createTextNode(proxyUser));
+                password.appendChild(settings.createTextNode(proxyPassword));
+                proxy.appendChild(username);
+                proxy.appendChild(password);
+            }
+            proxy.appendChild(host);
+            proxy.appendChild(port);
+            proxy.appendChild(nonProxyHosts);
+
+            proxies.appendChild(proxy);
+
+            FileSystemUtils.writeXML(settings, new FileOutputStream(tempSettingsXML));
+
+        }
+        return tempSettingsXML;
+    }
 }

Modified: syncope/trunk/installer/src/main/java/org/apache/syncope/installer/validators/PersistenceValidator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/java/org/apache/syncope/installer/validators/PersistenceValidator.java?rev=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/java/org/apache/syncope/installer/validators/PersistenceValidator.java (original)
+++ syncope/trunk/installer/src/main/java/org/apache/syncope/installer/validators/PersistenceValidator.java Fri Sep 26 15:53:10 2014
@@ -20,7 +20,6 @@ package org.apache.syncope.installer.val
 
 import com.izforge.izpack.api.data.InstallData;
 import java.sql.Driver;
-import java.sql.SQLException;
 import java.util.Properties;
 import org.apache.syncope.installer.enums.DBs;
 import org.apache.syncope.installer.utilities.DriverLoader;
@@ -37,6 +36,16 @@ public class PersistenceValidator extend
 
     private StringBuilder warning;
 
+    private boolean isProxyEnabled;
+
+    private String proxyHost;
+
+    private String proxyPort;
+
+    private String proxyUser;
+
+    private String proxyPwd;
+
     @Override
     public Status validateData(final InstallData installData) {
 
@@ -46,6 +55,11 @@ public class PersistenceValidator extend
         persistenceUrl = installData.getVariable("persistence.url");
         persistenceDbuser = installData.getVariable("persistence.dbuser");
         persistenceDbPassword = installData.getVariable("persistence.dbpassword");
+        isProxyEnabled = Boolean.valueOf(installData.getVariable("mvn.proxy"));
+        proxyHost = installData.getVariable("mvn.proxy.host");
+        proxyPort = installData.getVariable("mvn.proxy.port");
+        proxyUser = installData.getVariable("mvn.proxy.user");
+        proxyPwd = installData.getVariable("mvn.proxy.pwd");
 
         boolean verified = true;
         error = new StringBuilder("Required fields:\n");
@@ -84,16 +98,21 @@ public class PersistenceValidator extend
     }
 
     private Status checkConnection(final DBs selectedDb) {
-
+        Driver driver = null;
         try {
-            final Driver driver = DriverLoader.load(selectedDb);
+            driver = DriverLoader.load(selectedDb, isProxyEnabled, proxyHost, proxyPort, proxyUser,
+                    proxyPwd);
             final Properties props = new Properties();
             props.put("user", persistenceDbuser);
             props.put("password", persistenceDbPassword);
             driver.connect(persistenceUrl, props);
             return Status.OK;
-        } catch (SQLException ex) {
-            error = new StringBuilder("Db connection error: please check your insert data");
+        } catch (Exception ex) {
+            error =
+                    new StringBuilder(
+                            "Error during connection to database: please check inserted data.");
+            error.append(driver == null ? new StringBuilder(" Unable to get ").append(selectedDb.getName()).append(
+                    " driver!").toString() : "");
             return Status.ERROR;
         }
     }

Modified: syncope/trunk/installer/src/main/resources/izpack/ProcessPanel.Spec.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/resources/izpack/ProcessPanel.Spec.xml?rev=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/ProcessPanel.Spec.xml (original)
+++ syncope/trunk/installer/src/main/resources/izpack/ProcessPanel.Spec.xml Fri Sep 26 15:53:10 2014
@@ -32,6 +32,12 @@ under the License.
       <arg>$mvn.bundle.directory</arg>
       <arg>$mvn.syncope.version</arg>
       <arg>$mvn.syncope.admin.password</arg>
+      <arg>$mvn.proxy</arg><!-- 11 -->
+      <arg>$mvn.proxy.host</arg><!-- 12 -->
+      <arg>$mvn.proxy.port</arg><!-- 13 -->
+      <arg>$mvn.proxy.user</arg><!-- 14 -->
+      <arg>$mvn.proxy.pwd</arg><!-- 15 -->
+      <arg>$mvn.proxy.autoconf</arg><!-- 16 -->
     </executeclass>
   </job>
   <job name="Persistence configuration...">
@@ -68,6 +74,12 @@ under the License.
       <arg>$jboss.container.jdbc.module</arg><!-- 17 -->
       <arg>$jboss.container.user</arg><!-- 18 -->
       <arg>$jboss.container.pwd</arg><!-- 19 -->
+      <arg>$mvn.proxy</arg><!-- 20 -->
+      <arg>$mvn.proxy.host</arg><!-- 21 -->
+      <arg>$mvn.proxy.port</arg><!-- 22 -->
+      <arg>$mvn.proxy.user</arg><!-- 23 -->
+      <arg>$mvn.proxy.pwd</arg><!-- 24 -->
+      <arg>$mvn.proxy.autoconf</arg><!-- 25 -->
     </executeclass>
   </job>
   <onFail previous="true" next="false" />

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=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/install.xml (original)
+++ syncope/trunk/installer/src/main/resources/izpack/install.xml Fri Sep 26 15:53:10 2014
@@ -65,6 +65,12 @@ under the License.
   </dynamicvariables>
   
   <conditions>
+    
+    <condition type="variable" id="mvn.choice.proxy">
+      <name>mvn.proxy</name>
+      <value>true</value>
+    </condition>
+    
     <condition type="variable" id="postgres.choice">
       <name>install.type.selection</name>
       <value>postgres</value>

Modified: syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_eng
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_eng?rev=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_eng (original)
+++ syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_eng Fri Sep 26 15:53:10 2014
@@ -17,7 +17,7 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
-<langpack>+
+<langpack>
   <str id="mvn.directory.id" txt="Maven home directory:"/>
   <str id="archetype.mvn.groupid" txt="GroupId:"/>
   <str id="archetype.mvn.artifactid" txt="ArtifactId:"/>
@@ -28,6 +28,13 @@ under the License.
   <str id="archetype.mvn.bundle.directory" txt="Bundle directory name:"/>
   <str id="mvn.syncope.version.id" txt="Syncope Version:"/>
   <str id="mvn.syncope.admin.password.id" txt="Admin Password:"/>
+  <str id="mvn.proxy.id" txt="Use Proxy Server:"/>
+  <str id="mvn.proxy.autoconf.id" txt="Automatically configure Maven proxy"/>
+  <str id="mvn.proxy.autoconf.desc.id" txt="Check this field if Maven is not yet configured to use proxy:"/>
+  <str id="mvn.proxy.host.id" txt="Proxy Host:"/>
+  <str id="mvn.proxy.port.id" txt="Proxy Port:"/>
+  <str id="mvn.proxy.user.id" txt="Proxy User (if required):"/>
+  <str id="mvn.proxy.pwd.id" txt="Proxy Password (if required):"/>
   
   <str id="persistence.jdbc.url" txt="Database JDBC url:"/>
   <str id="persistence.db.user" txt="Username:"/>

Modified: syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_ita
URL: http://svn.apache.org/viewvc/syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_ita?rev=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_ita (original)
+++ syncope/trunk/installer/src/main/resources/izpack/userInputLang.xml_ita Fri Sep 26 15:53:10 2014
@@ -28,6 +28,13 @@ under the License.
   <str id="archetype.mvn.bundle.directory" txt="Bundle directory name:"/>
   <str id="mvn.syncope.version.id" txt="Syncope Version:"/>
   <str id="mvn.syncope.admin.password.id" txt="Admin Password:"/>
+  <str id="mvn.proxy.id" txt="Usa un Server Proxy:"/>
+  <str id="mvn.proxy.autoconf.id" txt="Configura automaticamente il proxy per Maven"/>
+  <str id="mvn.proxy.autoconf.desc.id" txt="Seleziona questo campo se Maven non è configurato per usare un proxy:"/>
+  <str id="mvn.proxy.host.id" txt="Proxy Host:"/>
+  <str id="mvn.proxy.port.id" txt="Proxy Port:"/>
+  <str id="mvn.proxy.user.id" txt="Proxy User (se richiesto):"/>
+  <str id="mvn.proxy.pwd.id" txt="Proxy Password (se richiesta):"/>
   
   <str id="persistence.jdbc.url" txt="Database JDBC url:"/>
   <str id="persistence.db.user" txt="Username:"/>

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=1627815&r1=1627814&r2=1627815&view=diff
==============================================================================
--- syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml (original)
+++ syncope/trunk/installer/src/main/resources/izpack/userInputSpec.xml Fri Sep 26 15:53:10 2014
@@ -61,8 +61,38 @@ under the License.
     </field>
     <!--    <field type="space"/>
     <field type="password" variable="mvn.syncope.admin.password">
-      <spec id="mvn.syncope.admin.password.id" size="20" set="password"/>
+      <spec>
+        <pwd id="mvn.syncope.admin.password.id" size="20" set="password"/>
+      </spec>
     </field>-->
+    <field type="space"/>
+    <field type="divider" align="top"/>
+    <field type="check" variable="mvn.proxy">
+      <spec id="mvn.proxy.id" true="true" false="false" set="false"/>
+    </field>
+    <field type="space"/>
+    <field type="check" variable="mvn.proxy.autoconf" conditionid="mvn.choice.proxy">
+      <description id="mvn.proxy.autoconf.desc.id"/>
+      <spec id="mvn.proxy.autoconf.id" true="true" false="false" set="false"/>
+    </field>
+    <field type="space"/>
+    <field type="text" variable="mvn.proxy.host" conditionid="mvn.choice.proxy">
+      <spec id="mvn.proxy.host.id" size="20" set="localhost"/>
+    </field>
+    <field type="space"/>
+    <field type="text" variable="mvn.proxy.port" conditionid="mvn.choice.proxy">
+      <spec id="mvn.proxy.port.id" size="5" set="3128"/>
+    </field>
+    <field type="space"/>
+    <field type="text" variable="mvn.proxy.user" conditionid="mvn.choice.proxy">
+      <spec id="mvn.proxy.user.id" size="20"/>
+    </field>
+    <field type="space"/>
+    <field type="password" variable="mvn.proxy.pwd" conditionid="mvn.choice.proxy">
+      <spec>
+        <pwd id="mvn.proxy.pwd.id" size="20"/>
+      </spec>
+    </field>
   </panel>
   
   <panel id="persistence" order="2" border="false">