syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [3/5] syncope git commit: [SYNCOPE-620] installer
Date Fri, 13 Feb 2015 11:26:49 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java
new file mode 100644
index 0000000..8b8115b
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/OrmXml.java
@@ -0,0 +1,381 @@
+/*
+ * 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 class OrmXml {
+
+    public static final String PATH_DIR = "core/src/main/resources/META-INF";
+
+    public static final String PATH_COMPLETE = PATH_DIR + "/orm.xml";
+
+    public static final String ORACLE_ORM = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--\n"
+            + "Licensed to the Apache Software Foundation (ASF) under one\n"
+            + "or more contributor license agreements.  See the NOTICE file\n"
+            + "distributed with this work for additional information\n"
+            + "regarding copyright ownership.  The ASF licenses this file\n"
+            + "to you under the Apache License, Version 2.0 (the\n"
+            + "\"License\"); you may not use this file except in compliance\n"
+            + "with the License.  You may obtain a copy of the License at\n" + "\n"
+            + "  http://www.apache.org/licenses/LICENSE-2.0\n" + "\n"
+            + "Unless required by applicable law or agreed to in writing,\n"
+            + "software distributed under the License is distributed on an\n"
+            + "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
+            + "KIND, either express or implied.  See the License for the\n"
+            + "specific language governing permissions and limitations\n" + "under the License.\n" + "\n" + "-->\n"
+            + "<entity-mappings  xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n"
+            + "                  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+            + "                  xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm \n"
+            + "                                      http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\"\n"
+            + "                  version=\"2.0\">\n" + "\n" + "  <persistence-unit-metadata>\n"
+            + "    <persistence-unit-defaults>\n" + "      <entity-listeners>\n"
+            + "        <entity-listener class=\"org.apache.syncope.core.persistence.validation.entity.EntityValidationListener\">\n"
+            + "          <pre-persist method-name=\"validate\"/>\n"
+            + "          <pre-update method-name=\"validate\"/>\n" + "        </entity-listener>\n"
+            + "      </entity-listeners>\n" + "    </persistence-unit-defaults>\n" + "  </persistence-unit-metadata>\n"
+            + "  \n"
+            + "  <table-generator name=\"SEQ_UAttrValue\" pk-column-value=\"SEQ_UAttrValue\" initial-value=\"100\"/>\n"
+            + "  <table-generator name=\"SEQ_RAttrValue\" pk-column-value=\"SEQ_RAttrValue\" initial-value=\"100\"/>\n"
+            + "  <table-generator name=\"SEQ_MAttrValue\" pk-column-value=\"SEQ_MAttrValue\" initial-value=\"100\"/>\n"
+            + "  <table-generator name=\"SEQ_CAttrValue\" pk-column-value=\"SEQ_CAttrValue\" initial-value=\"100\"/>\n"
+            + "\n" + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.SyncopeUser\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_SyncopeUser\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_SyncopeUser\" pk-column-value=\"SEQ_SyncopeUser\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.SyncopeRole\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_SyncopeRole\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_SyncopeRole\" pk-column-value=\"SEQ_SyncopeRole\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.Membership\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_Membership\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Membership\" pk-column-value=\"SEQ_Membership\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UMapping\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_UMapping\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_UMapping\" pk-column-value=\"SEQ_UMapping\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RMapping\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_RMapping\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_RMapping\" pk-column-value=\"SEQ_RMapping\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UMappingItem\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_UMappingItem\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_UMappingItem\" pk-column-value=\"SEQ_UMappingItem\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RMappingItem\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_RMappingItem\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_RMappingItem\" pk-column-value=\"SEQ_RMappingItem\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.ConnInstance\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_ConnInstance\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_ConnInstance\" pk-column-value=\"SEQ_ConnInstance\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_UAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_UAttr\" pk-column-value=\"SEQ_UAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_RAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_RAttr\" pk-column-value=\"SEQ_RAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_MAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_MAttr\" pk-column-value=\"SEQ_MAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_CAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_CAttr\" pk-column-value=\"SEQ_CAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrValue\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrUniqueValue\">\n" + "    <table>\n"
+            + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>dateValue</column-name>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>doubleValue</column-name>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrValue\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrUniqueValue\">\n" + "    <table>\n"
+            + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>dateValue</column-name>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>doubleValue</column-name>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrValue\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrUniqueValue\">\n"
+            + "    <table>\n" + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>dateValue</column-name>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>doubleValue</column-name>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrValue\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrUniqueValue\">\n" + "    <table>\n"
+            + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>dateValue</column-name>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>doubleValue</column-name>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Task\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_Task\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Task\" pk-column-value=\"SEQ_Task\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.TaskExec\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_TaskExec\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_TaskExec\" pk-column-value=\"SEQ_TaskExec\" initial-value=\"10\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Policy\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_Policy\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Policy\" pk-column-value=\"SEQ_Policy\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "    \n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Report\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_Report\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Report\" pk-column-value=\"SEQ_Report\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.ReportExec\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_ReportExec\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_ReportExec\" pk-column-value=\"SEQ_ReportExec\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.ReportletConfInstance\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_ReportletConfInstance\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_ReportletConfInstance\" pk-column-value=\"SEQ_ReportletConfInstance\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Notification\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_Notification\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Notification\" pk-column-value=\"SEQ_Notification\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.SecurityQuestion\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_SecurityQuestion\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_SecurityQuestion\" pk-column-value=\"SEQ_SecurityQuestion\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>  \n" + "</entity-mappings>\n" + "";
+
+    public static final String SQLSERVER_ORM = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--\n"
+            + "Licensed to the Apache Software Foundation (ASF) under one\n"
+            + "or more contributor license agreements.  See the NOTICE file\n"
+            + "distributed with this work for additional information\n"
+            + "regarding copyright ownership.  The ASF licenses this file\n"
+            + "to you under the Apache License, Version 2.0 (the\n"
+            + "\"License\"); you may not use this file except in compliance\n"
+            + "with the License.  You may obtain a copy of the License at\n" + "\n"
+            + "  http://www.apache.org/licenses/LICENSE-2.0\n" + "\n"
+            + "Unless required by applicable law or agreed to in writing,\n"
+            + "software distributed under the License is distributed on an\n"
+            + "\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
+            + "KIND, either express or implied.  See the License for the\n"
+            + "specific language governing permissions and limitations\n" + "under the License.\n" + "\n" + "-->\n"
+            + "<entity-mappings  xmlns=\"http://java.sun.com/xml/ns/persistence/orm\"\n"
+            + "                  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+            + "                  xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence/orm \n"
+            + "                                      http://java.sun.com/xml/ns/persistence/orm_2_0.xsd\"\n"
+            + "                  version=\"2.0\">\n" + "  \n" + "  <persistence-unit-metadata>\n"
+            + "    <persistence-unit-defaults>\n" + "      <entity-listeners>\n"
+            + "        <entity-listener class=\"org.apache.syncope.core.persistence.validation.entity.EntityValidationListener\">\n"
+            + "          <pre-persist method-name=\"validate\"/>\n"
+            + "          <pre-update method-name=\"validate\"/>\n" + "        </entity-listener>\n"
+            + "      </entity-listeners>\n" + "    </persistence-unit-defaults>\n" + "  </persistence-unit-metadata>\n"
+            + "  \n"
+            + "  <table-generator name=\"SEQ_UAttrValue\" pk-column-value=\"SEQ_UAttrValue\" initial-value=\"100\"/>\n"
+            + "  <table-generator name=\"SEQ_RAttrValue\" pk-column-value=\"SEQ_RAttrValue\" initial-value=\"100\"/>\n"
+            + "  <table-generator name=\"SEQ_MAttrValue\" pk-column-value=\"SEQ_MAttrValue\" initial-value=\"100\"/>\n"
+            + "  <table-generator name=\"SEQ_CAttrValue\" pk-column-value=\"SEQ_CAttrValue\" initial-value=\"100\"/>\n"
+            + "\n" + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.SyncopeUser\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_SyncopeUser\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_SyncopeUser\" pk-column-value=\"SEQ_SyncopeUser\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.SyncopeRole\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_SyncopeRole\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_SyncopeRole\" pk-column-value=\"SEQ_SyncopeRole\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.Membership\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_Membership\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Membership\" pk-column-value=\"SEQ_Membership\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UMapping\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_UMapping\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_UMapping\" pk-column-value=\"SEQ_UMapping\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RMapping\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_RMapping\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_RMapping\" pk-column-value=\"SEQ_RMapping\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UMappingItem\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_UMappingItem\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_UMappingItem\" pk-column-value=\"SEQ_UMappingItem\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RMappingItem\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_RMappingItem\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_RMappingItem\" pk-column-value=\"SEQ_RMappingItem\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.ConnInstance\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_ConnInstance\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_ConnInstance\" pk-column-value=\"SEQ_ConnInstance\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_UAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_UAttr\" pk-column-value=\"SEQ_UAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_RAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_RAttr\" pk-column-value=\"SEQ_RAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_MAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_MAttr\" pk-column-value=\"SEQ_MAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttr\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_CAttr\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_CAttr\" pk-column-value=\"SEQ_CAttr\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "      \n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrValue\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.user.UAttrUniqueValue\">\n" + "    <table>\n"
+            + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>dateValue</column-name>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>doubleValue</column-name>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_UAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrValue\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.role.RAttrUniqueValue\">\n" + "    <table>\n"
+            + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>dateValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>doubleValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_RAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrValue\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.membership.MAttrUniqueValue\">\n"
+            + "    <table>\n" + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>dateValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>doubleValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_MAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrValue\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.conf.CAttrUniqueValue\">\n" + "    <table>\n"
+            + "      <unique-constraint>\n" + "        <column-name>booleanValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>dateValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>stringValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>doubleValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n"
+            + "      <unique-constraint>\n" + "        <column-name>longValue</column-name>\n"
+            + "        <column-name>schema_name</column-name>\n" + "      </unique-constraint>\n" + "    </table>\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_CAttrValue\" strategy=\"TABLE\"/>\n" + "      </id>\n"
+            + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Task\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_Task\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Task\" pk-column-value=\"SEQ_Task\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.TaskExec\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_TaskExec\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_TaskExec\" pk-column-value=\"SEQ_TaskExec\" initial-value=\"10\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "    \n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Policy\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_Policy\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Policy\" pk-column-value=\"SEQ_Policy\" initial-value=\"1000\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n" + "\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Report\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n" + "        <generated-value generator=\"SEQ_Report\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Report\" pk-column-value=\"SEQ_Report\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.ReportExec\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_ReportExec\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_ReportExec\" pk-column-value=\"SEQ_ReportExec\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.ReportletConfInstance\">\n"
+            + "    <attributes>\n" + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_ReportletConfInstance\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_ReportletConfInstance\" pk-column-value=\"SEQ_ReportletConfInstance\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.Notification\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_Notification\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_Notification\" pk-column-value=\"SEQ_Notification\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>\n"
+            + "  <entity class=\"org.apache.syncope.core.persistence.beans.SecurityQuestion\">\n" + "    <attributes>\n"
+            + "      <id name=\"id\">\n"
+            + "        <generated-value generator=\"SEQ_SecurityQuestion\" strategy=\"TABLE\"/>\n"
+            + "        <table-generator name=\"SEQ_SecurityQuestion\" pk-column-value=\"SEQ_SecurityQuestion\" initial-value=\"100\"/>\n"
+            + "      </id>\n" + "    </attributes>\n" + "  </entity>  \n" + "</entity-mappings>\n" + "";
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
new file mode 100644
index 0000000..49c05f3
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
@@ -0,0 +1,37 @@
+/*
+ * 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 class ParentPom {
+    
+    public static final String PLACEHOLDER = "</project>";
+
+    public static final String REPOSITORY =
+            "  <repositories>\n"
+            + "  <repository>\n"
+            + "    <id>ASF</id>\n"
+            + "    <url>https://repository.apache.org/content/repositories/snapshots/</url>\n"
+            + "    <snapshots>\n"
+            + "      <enabled>true</enabled>\n"
+            + "    </snapshots>\n"
+            + "  </repository>\n"
+            + "</repositories>\n"
+            + "</project>\n";
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceContextEMFactoryXml.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceContextEMFactoryXml.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceContextEMFactoryXml.java
new file mode 100644
index 0000000..a64ea36
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceContextEMFactoryXml.java
@@ -0,0 +1,31 @@
+/*
+ * 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 class PersistenceContextEMFactoryXml {
+
+    public static final String PLACEHOLDER = "<entry key=\"openjpa.MetaDataFactory\"\n"
+            + "               value=\"jpa(URLs=vfs:${project.build.directory}/cargo/configurations/wildfly8x/"
+            + "deployments/${project.build.finalName}.war/WEB-INF/classes/, Resources=META-INF/orm.xml)\"/>";
+
+    public static final String JBOSS =
+            "<entry key=\"openjpa.MetaDataFactory\" value=\"jpa(URLs=vfs:/content/${project.build.finalName}.war/"
+            + "WEB-INF/classes/, Resources=META-INF/orm.xml)\"/>";
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceProperties.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceProperties.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceProperties.java
new file mode 100644
index 0000000..ba560df
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/files/PersistenceProperties.java
@@ -0,0 +1,94 @@
+/*
+ * 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 class PersistenceProperties {
+
+    public static final String HEADER = "# Licensed to the Apache Software Foundation (ASF) under one\n"
+            + "# or more contributor license agreements.  See the NOTICE file\n"
+            + "# distributed with this work for additional information\n"
+            + "# regarding copyright ownership.  The ASF licenses this file\n"
+            + "# to you under the Apache License, Version 2.0 (the\n"
+            + "# \"License\"); you may not use this file except in compliance\n"
+            + "# with the License.  You may obtain a copy of the License at\n" + "#\n"
+            + "#   http://www.apache.org/licenses/LICENSE-2.0\n" + "#\n"
+            + "# Unless required by applicable law or agreed to in writing,\n"
+            + "# software distributed under the License is distributed on an\n"
+            + "# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n"
+            + "# KIND, either express or implied.  See the License for the\n"
+            + "# specific language governing permissions and limitations\n" + "# under the License.\n";
+
+    public static final String POSTGRES = ""
+            + "jpa.driverClassName=org.postgresql.Driver\n"
+            + "jpa.url=%s\n"
+            + "jpa.username=%s\n"
+            + "jpa.password=%s\n"
+            + "jpa.dialect=org.apache.openjpa.jdbc.sql.PostgresDictionary\n"
+            + "jpa.pool.validationQuery=SELECT 1\n"
+            + "jpa.orm=META-INF/spring-orm.xml\n"
+            + "quartz.jobstore=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate\n"
+            + "quartz.sql=tables_postgres.sql\n"
+            + "audit.sql=audit.sql\n"
+            + "database.schema=\n";
+
+    public static final String MYSQL = ""
+            + "jpa.driverClassName=com.mysql.jdbc.Driver\n"
+            + "jpa.url=%s\n"
+            + "jpa.username=%s\n"
+            + "jpa.password=%s\n"
+            + "jpa.dialect=org.apache.openjpa.jdbc.sql.MySQLDictionary\n"
+            + "jpa.pool.validationQuery=SELECT 1\n"
+            + "jpa.orm=META-INF/spring-orm.xml\n"
+            + "quartz.jobstore=org.quartz.impl.jdbcjobstore.StdJDBCDelegate\n"
+            + "audit.sql=audit.sql\n"
+            + "database.schema=\n";
+
+    public static final String ORACLE = "jpa.driverClassName=oracle.jdbc.OracleDriver\n"
+            + "jpa.url=%s\n"
+            + "jpa.username=%s\n"
+            + "jpa.password=%s\n"
+            + "jpa.dialect=org.apache.openjpa.jdbc.sql.OracleDictionary\n"
+            + "jpa.pool.validationQuery=SELECT 1 FROM DUAL\n"
+            + "jpa.orm=META-INF/spring-orm-oracle.xml\n"
+            + "#note: other connection pool settings can also be configured here, see persistenceContext.xml\n"
+            + "quartz.jobstore=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate\n"
+            + "quartz.scheduler.idleWaitTime=5000\n"
+            + "quartz.sql=tables_oracle.sql\n"
+            + "audit.sql=audit_oracle.sql\n"
+            + "database.schema=%s\n";
+
+    public static final String SQLSERVER = "jpa.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver\n"
+            + "jpa.url=%s\n"
+            + "jpa.username=%s\n"
+            + "jpa.password=%s\n"
+            + "jpa.dialect=org.apache.openjpa.jdbc.sql.SQLServerDictionary\n" 
+            + "jpa.pool.validationQuery=SELECT 1\n"
+            + "jpa.orm=META-INF/spring-orm-sqlserver.xml\n"
+            + "#note: other connection pool settings can also be configured here, see persistenceContext.xml\n"
+            + "quartz.jobstore=org.quartz.impl.jdbcjobstore.MSSQLDelegate\n" 
+            + "quartz.scheduler.idleWaitTime=5000\n"
+            + "quartz.sql=tables_sqlServer.sql\n" 
+            + "audit.sql=audit_sqlserver.sql\n" 
+            + "database.schema=";
+
+    public static final String QUARTZ_INNO_DB = "quartz.sql=tables_mysql_innodb.sql";
+
+    public static final String QUARTZ = "quartz.sql=tables_mysql.sql";
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
new file mode 100644
index 0000000..0c7bdea
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
@@ -0,0 +1,134 @@
+/*
+ * 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.processes;
+
+import org.apache.syncope.installer.utilities.FileSystemUtils;
+import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+import org.apache.syncope.installer.files.ParentPom;
+import org.apache.syncope.installer.utilities.InstallLog;
+import org.apache.syncope.installer.utilities.MavenUtils;
+import org.xml.sax.SAXException;
+
+public class ArchetypeProcess extends BaseProcess {
+
+    public void run(final AbstractUIProcessHandler handler, final String[] args) {
+        final String installPath = args[0];
+        final String mavenDir = args[1];
+        final String groupId = args[2];
+        final String artifactId = args[3];
+        final String secretKey = args[4];
+        final String anonymousKey = args[5];
+        final String confDirectory = args[6];
+        final String logsDirectory = args[7];
+        final String bundlesDirectory = args[8];
+        final String modelerDirectory = args[9];
+        final String syncopeVersion = args[10];
+        final String syncopeAdminPassword = args[11];
+        final boolean isProxyEnabled = Boolean.valueOf(args[12]);
+        final String proxyHost = args[13];
+        final String proxyPort = args[14];
+        final String proxyUser = args[15];
+        final String proxyPwd = args[16];
+        final boolean mavenProxyAutoconf = Boolean.valueOf(args[17]);
+        
+        setSyncopeInstallDir(installPath, artifactId);
+
+        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());
+        }
+        handler.logOutput("########################## IMPORTANT ##########################", true);
+        handler.logOutput("See " + InstallLog.getInstance().getFileAbsolutePath() + " for the maven logs", true);
+        handler.logOutput("########################## IMPORTANT ##########################", true);
+        mavenUtils.archetypeGenerate(
+                syncopeVersion, groupId, artifactId, secretKey, anonymousKey, installPath, customMavenProxySettings);
+
+        if (syncopeVersion.contains("SNAPSHOT")) {
+            final File pomFile =
+                    new File(syncopeInstallDir + properties.getProperty("pomFile"));
+            String contentPomFile = fileSystemUtils.readFile(pomFile);
+            fileSystemUtils.writeToFile(pomFile, contentPomFile.replace(ParentPom.PLACEHOLDER, ParentPom.REPOSITORY));
+        }
+
+        fileSystemUtils.createDirectory(confDirectory);
+        fileSystemUtils.createDirectory(logsDirectory);
+        fileSystemUtils.createDirectory(bundlesDirectory);
+        fileSystemUtils.createDirectory(modelerDirectory);
+        
+        fileSystemUtils.copyFileFromResources("/" + properties.getProperty("modelerPomFile"),
+                modelerDirectory + "/" + properties.getProperty("pomFile"), handler);
+
+        fileSystemUtils.copyFile(
+                syncopeInstallDir
+                + properties.getProperty("consoleResDirectory")
+                + "/" + properties.getProperty("tokenValueMapFile"),
+                modelerDirectory + "/" + properties.getProperty("tokenValueMapFile"));
+
+        final Properties modelerProperties = new Properties();
+        modelerProperties.setProperty("modeler.directory", modelerDirectory);
+        mavenUtils.mvnCleanPackageWithProperties(modelerDirectory, modelerProperties, customMavenProxySettings);
+
+        final Properties syncopeProperties = new Properties();
+        syncopeProperties.setProperty("conf.directory", confDirectory);
+        syncopeProperties.setProperty("log.directory", logsDirectory);
+        syncopeProperties.setProperty("bundles.directory", bundlesDirectory);
+        mavenUtils.mvnCleanPackageWithProperties(
+                installPath + "/" + artifactId, syncopeProperties, customMavenProxySettings);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/BaseProcess.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/BaseProcess.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/BaseProcess.java
new file mode 100644
index 0000000..e11ef54
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/BaseProcess.java
@@ -0,0 +1,54 @@
+/*
+ * 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.processes;
+
+import static org.apache.syncope.installer.processes.ArchetypeProcess.properties;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.apache.commons.io.IOUtils;
+
+public class BaseProcess {
+
+    protected final static Properties properties = new Properties();
+
+    protected String syncopeInstallDir;
+
+    private static InputStream is = null;
+
+    static {
+        try {
+            is = BaseProcess.class.getResourceAsStream("/installer.properties");
+            properties.load(is);
+        } catch (final IOException e) {
+        } finally {
+            IOUtils.closeQuietly(is);
+        }
+    }
+
+    protected void setSyncopeInstallDir(final String installPath, final String artifactId) {
+        final StringBuilder path = new StringBuilder();
+        path.append(installPath);
+        path.append("/");
+        path.append(artifactId);
+        path.append("/");
+        syncopeInstallDir = path.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
new file mode 100644
index 0000000..4ccc0d2
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/ContainerProcess.java
@@ -0,0 +1,322 @@
+/*
+ * 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.processes;
+
+import org.apache.syncope.installer.utilities.FileSystemUtils;
+import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+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;
+import org.apache.syncope.installer.enums.Containers;
+import org.apache.syncope.installer.files.ConsoleProperties;
+import org.apache.syncope.installer.files.GlassfishCoreWebXml;
+import org.apache.syncope.installer.files.PersistenceContextEMFactoryXml;
+import org.apache.syncope.installer.utilities.InstallLog;
+import org.apache.syncope.installer.utilities.MavenUtils;
+import org.xml.sax.SAXException;
+
+public class ContainerProcess extends BaseProcess {
+
+    private final static String HTTP = "http";
+
+    private final static String HTTPS = "https";
+
+    private final static String DEFAULT_HOST = "localhost";
+
+    private final static String DEFAULT_PORT = "8080";
+
+    private String installPath;
+
+    private String mavenDir;
+
+    private String artifactId;
+
+    private String tomcatUser;
+
+    private String tomcatPassword;
+
+    private boolean tomcatSsl;
+
+    private String tomcatHost;
+
+    private String tomcatPort;
+
+    private String glassfishDir;
+
+    private boolean glassfishSsl;
+
+    private String glassfishHost;
+
+    private String glassfishPort;
+
+    private String confDirectory;
+
+    private String logsDirectory;
+
+    private String bundlesDirectory;
+
+    private boolean withDataSource;
+
+    private boolean jbossSsl;
+
+    private String jbossHost;
+
+    private String jbossPort;
+
+    private String jbossJdbcModuleName;
+
+    private String jbossAdminUsername;
+
+    private String jbossAdminPassword;
+
+    private String jbossManagementPort;
+
+    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];
+        mavenDir = args[1];
+        artifactId = args[2];
+        final Containers selectedContainer = Containers.fromContainerName(args[3]);
+        tomcatSsl = Boolean.valueOf(args[4]);
+        tomcatHost = args[5];
+        tomcatPort = args[6];
+        tomcatUser = args[7];
+        tomcatPassword = args[8];
+        glassfishSsl = Boolean.valueOf(args[9]);
+        glassfishHost = args[10];
+        glassfishPort = args[11];
+        glassfishDir = args[12];
+        confDirectory = args[13];
+        logsDirectory = args[14];
+        bundlesDirectory = args[15];
+        withDataSource = Boolean.valueOf(args[16]);
+        jbossSsl = Boolean.valueOf(args[17]);
+        jbossHost = args[18];
+        jbossPort = args[19];
+        jbossJdbcModuleName = args[20];
+        jbossAdminUsername = args[21];
+        jbossAdminPassword = args[22];
+        jbossManagementPort = args[23];
+        isProxyEnabled = Boolean.valueOf(args[24]);
+        proxyHost = args[25];
+        proxyPort = args[26];
+        proxyUser = args[27];
+        proxyPwd = args[28];
+        mavenProxyAutoconf = Boolean.valueOf(args[28]);
+
+        final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
+
+        handler.logOutput("Configure web.xml file according to " + selectedContainer + " properties", true);
+        InstallLog.getInstance().info("Configure web.xml file according to " + selectedContainer + " properties");
+
+        setSyncopeInstallDir(installPath, artifactId);
+
+        if (withDataSource) {
+            switch (selectedContainer) {
+                case GLASSFISH:
+                    final File glassfishCoreWebXmlFile =
+                            new File(syncopeInstallDir + properties.getProperty("glassfishCoreWebXmlFile"));
+                    final String contentGlassfishWebXmlFile = fileSystemUtils.readFile(glassfishCoreWebXmlFile);
+                    fileSystemUtils.writeToFile(glassfishCoreWebXmlFile,
+                            contentGlassfishWebXmlFile.replace(GlassfishCoreWebXml.PLACEHOLDER,
+                                    GlassfishCoreWebXml.DATA_SOURCE));
+                    break;
+
+                default:
+            }
+        }
+
+        final File consolePropertiesFile = new File(syncopeInstallDir
+                + properties.getProperty("consoleResDirectory")
+                + File.separator + properties.getProperty("consolePropertiesFile"));
+        final String contentConsolePropertiesFile = fileSystemUtils.readFile(consolePropertiesFile);
+
+        final String scheme;
+        final String host;
+        final String port;
+        switch (selectedContainer) {
+            case TOMCAT:
+                scheme = tomcatSsl ? HTTPS : HTTP;
+                host = tomcatHost;
+                port = tomcatPort;
+                break;
+            case JBOSS:
+                scheme = jbossSsl ? HTTPS : HTTP;
+                host = jbossHost;
+                port = jbossPort;
+                persistenceContextEMFactory(fileSystemUtils, handler);
+                break;
+            case GLASSFISH:
+                scheme = glassfishSsl ? HTTPS : HTTP;
+                host = glassfishHost;
+                port = glassfishPort;
+                break;
+            default:
+                scheme = HTTP;
+                host = DEFAULT_HOST;
+                port = DEFAULT_PORT;
+        }
+
+        fileSystemUtils.writeToFile(consolePropertiesFile,
+                contentConsolePropertiesFile.replace(ConsoleProperties.PLACEHOLDER,
+                        String.format(ConsoleProperties.CONSOLE, scheme, host, port)));
+
+        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());
+        }
+
+        final Properties mvnProperties = new Properties();
+        mvnProperties.setProperty("conf.directory", confDirectory);
+        mvnProperties.setProperty("log.directory", logsDirectory);
+        mvnProperties.setProperty("bundles.directory", bundlesDirectory);
+        mavenUtils.mvnCleanPackageWithProperties(
+                installPath + "/" + artifactId, mvnProperties, customMavenProxySettings);
+
+        if (isProxyEnabled && mavenProxyAutoconf) {
+            FileSystemUtils.delete(customMavenProxySettings);
+        }
+
+        switch (selectedContainer) {
+            case TOMCAT:
+                final Tomcat tomcat = new Tomcat(
+                        tomcatSsl, tomcatHost, tomcatPort, installPath, artifactId, tomcatUser, tomcatPassword,
+                        handler);
+                boolean deployCoreResult = tomcat.deployCore();
+                if (deployCoreResult) {
+                    handler.logOutput("Core successfully deployed ", true);
+                    InstallLog.getInstance().info("Core successfully deployed ");
+                } else {
+                    final String messageError = "Deploy core on Tomcat failed";
+                    handler.emitError(messageError, messageError);
+                    InstallLog.getInstance().error(messageError);
+                }
+
+                boolean deployConsoleResult = tomcat.deployConsole();
+                if (deployConsoleResult) {
+                    handler.logOutput("Console successfully deployed ", true);
+                    InstallLog.getInstance().info("Console successfully deployed ");
+                } else {
+                    final String messageError = "Deploy console on Tomcat failed";
+                    handler.emitError(messageError, messageError);
+                    InstallLog.getInstance().error(messageError);
+                }
+                break;
+            case JBOSS:
+                final JBoss jBoss = new JBoss(
+                        jbossSsl, jbossHost, jbossManagementPort, jbossAdminUsername,
+                        jbossAdminPassword, installPath, artifactId, handler);
+
+                boolean deployCoreJboss = jBoss.deployCore();
+                if (deployCoreJboss) {
+                    handler.logOutput("Core successfully deployed ", true);
+                    InstallLog.getInstance().info("Core successfully deployed ");
+                } else {
+                    final String messageError = "Deploy core on JBoss failed";
+                    handler.emitError(messageError, messageError);
+                    InstallLog.getInstance().error(messageError);
+                }
+
+                boolean deployConsoleJBoss = jBoss.deployConsole();
+                if (deployConsoleJBoss) {
+                    handler.logOutput("Console successfully deployed ", true);
+                    InstallLog.getInstance().info("Console successfully deployed ");
+                } else {
+                    final String messageError = "Deploy console on JBoss failed";
+                    handler.emitError(messageError, messageError);
+                    InstallLog.getInstance().error(messageError);
+                }
+                break;
+            case GLASSFISH:
+                final String createJavaOptCommand = "sh " + glassfishDir + Glassfish.CREATE_JAVA_OPT_COMMAND;
+                fileSystemUtils.exec(createJavaOptCommand, null);
+
+                final Glassfish glassfish = new Glassfish(installPath, artifactId);
+
+                fileSystemUtils.exec("sh " + glassfishDir
+                        + Glassfish.DEPLOY_COMMAND + glassfish.deployCore(), null);
+                fileSystemUtils.exec("sh " + glassfishDir
+                        + Glassfish.DEPLOY_COMMAND + glassfish.deployConsole(), null);
+                break;
+        }
+    }
+
+    private void persistenceContextEMFactory(
+            final FileSystemUtils fileSystemUtils, final AbstractUIProcessHandler handler) {
+        fileSystemUtils.copyFileFromResources("/jboss/persistenceContextEMFactory.xml",
+                syncopeInstallDir
+                + properties.getProperty("persistenceContextEMFactoryFile"), handler);
+        final File persistenceContextEMFactoryFile = new File(
+                syncopeInstallDir + properties.getProperty("persistenceContextEMFactoryFile"));
+        final String contentPersistenceContextEMFactory = fileSystemUtils.readFile(persistenceContextEMFactoryFile);
+        fileSystemUtils.writeToFile(
+                persistenceContextEMFactoryFile,
+                contentPersistenceContextEMFactory.replace(PersistenceContextEMFactoryXml.PLACEHOLDER,
+                        PersistenceContextEMFactoryXml.JBOSS));
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
new file mode 100644
index 0000000..16a6057
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
@@ -0,0 +1,93 @@
+/*
+ * 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.processes;
+
+import org.apache.syncope.installer.utilities.FileSystemUtils;
+import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
+import java.io.File;
+import org.apache.syncope.installer.enums.DBs;
+import org.apache.syncope.installer.files.PersistenceProperties;
+import org.apache.syncope.installer.utilities.InstallLog;
+
+public class PersistenceProcess extends BaseProcess {
+
+    private String installPath;
+
+    private String artifactId;
+
+    private DBs dbSelected;
+
+    private String persistenceUrl;
+
+    private String persistenceUser;
+
+    private String persistencePassword;
+
+    private boolean mysqlInnoDB;
+
+    private String oracleTableSpace;
+
+    public void run(final AbstractUIProcessHandler handler, final String[] args) {
+
+        installPath = args[0];
+        artifactId = args[1];
+        dbSelected = DBs.fromDbName(args[2]);
+        persistenceUrl = args[3];
+        persistenceUser = args[4];
+        persistencePassword = args[5];
+        mysqlInnoDB = Boolean.valueOf(args[6]);
+        oracleTableSpace = args[7];
+
+        final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
+        final StringBuilder persistenceProperties = new StringBuilder(PersistenceProperties.HEADER);
+        setSyncopeInstallDir(installPath, artifactId);
+
+        handler.logOutput("Configure persistence file according to " + dbSelected + " properties", true);
+        InstallLog.getInstance().info("Configure persistence file according to " + dbSelected + " properties");
+
+        switch (dbSelected) {
+            case POSTGRES:
+                persistenceProperties.append(String.format(
+                        PersistenceProperties.POSTGRES, persistenceUrl, persistenceUser, persistencePassword));
+                break;
+            case MYSQL:
+                persistenceProperties.append(String.format(
+                        PersistenceProperties.MYSQL, persistenceUrl, persistenceUser, persistencePassword));
+                if (mysqlInnoDB) {
+                    persistenceProperties.append(PersistenceProperties.QUARTZ_INNO_DB);
+                } else {
+                    persistenceProperties.append(PersistenceProperties.QUARTZ);
+                }
+                break;
+            case ORACLE:
+                persistenceProperties.append(String.format(
+                        PersistenceProperties.ORACLE, persistenceUrl, persistenceUser, persistencePassword,
+                        oracleTableSpace));
+                break;
+            case SQLSERVER:
+                persistenceProperties.append(String.format(
+                        PersistenceProperties.SQLSERVER, persistenceUrl, persistenceUser, persistencePassword));
+                break;
+        }
+
+        fileSystemUtils.writeToFile(new File(
+                syncopeInstallDir + properties.getProperty("persistencePropertiesFile")),
+                persistenceProperties.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java
new file mode 100644
index 0000000..41982f8
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/DriverLoader.java
@@ -0,0 +1,102 @@
+/*
+ * 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.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 final class DriverLoader extends URLClassLoader {
+
+    private final static String POSTGRES_JAR = 
+            "http://repo1.maven.org/maven2/postgresql/postgresql/9.1-901.jdbc4/postgresql-9.1-901.jdbc4.jar";
+
+    private final static String MYSQL_JAR =
+            "http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar";
+
+    private static final String POSTGRES_CLASS_DRIVER = "org.postgresql.Driver";
+
+    private static final String MYSQL_CLASS_DRIVER = "com.mysql.jdbc.Driver";
+
+    private DriverLoader(final URL[] urls) {
+        super(urls);
+        addURL(urls[0]);
+    }
+
+    private static DriverLoader driverLoader;
+
+    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, isProxyEnabled, proxyHost, proxyPort,
+                        proxyUser, proxyPwd);
+                break;
+            case MYSQL:
+                driver = downloadDriver(MYSQL_JAR, MYSQL_CLASS_DRIVER, isProxyEnabled, proxyHost, proxyPort,
+                        proxyUser, proxyPwd);
+                break;
+            case SQLSERVER:
+                break;
+            case ORACLE:
+                break;
+            default:
+                break;
+        }
+        return driver;
+    }
+
+    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 {
+            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) {
+        } catch (InstantiationException ex) {
+        } catch (IllegalAccessException ex) {
+        } catch (MalformedURLException ex) {
+        }
+
+        return driver;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/f5017841/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
----------------------------------------------------------------------
diff --git a/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java b/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
new file mode 100644
index 0000000..7e9f7b8
--- /dev/null
+++ b/syncope620/installer/src/main/java/org/apache/syncope/installer/utilities/FileSystemUtils.java
@@ -0,0 +1,171 @@
+/*
+ * 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.utilities;
+
+import com.izforge.izpack.panels.process.AbstractUIProcessHandler;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+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 java.net.URL;
+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 {
+
+    private final AbstractUIProcessHandler handler;
+
+    public FileSystemUtils(final AbstractUIProcessHandler handler) {
+        this.handler = handler;
+    }
+
+    public void createDirectory(final String directoryPath) {
+        final File directory = new File(directoryPath);
+        if (!directory.exists()) {
+            directory.mkdirs();
+        }
+    }
+
+    public void copyFile(final String sourceFilePath, final String targetFilePath) {
+        try {
+            FileUtils.copyFile(new File(sourceFilePath), new File(targetFilePath));
+        } catch (final IOException ex) {
+            final String errorMessage =
+                    "Error copy file " + sourceFilePath + " to " + targetFilePath;
+            handler.emitError(errorMessage, errorMessage);
+            InstallLog.getInstance().error(errorMessage);
+        }
+    }
+
+    public void exec(final String cmd, final String path) {
+        try {
+            handler.logOutput("Executing " + cmd, true);
+            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());
+        } catch (final IOException ex) {
+            final String errorMessage = "Error executing " + cmd + ": " + ex.getMessage();
+            handler.emitError(errorMessage, errorMessage);
+            InstallLog.getInstance().error(errorMessage);
+        }
+    }
+
+    private void readResponse(final InputStream inputStream) throws
+            IOException {
+        final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line = reader.readLine();
+        while (line != null) {
+            line = reader.readLine();
+            final String content = line == null ? "" : line;
+            handler.logOutput(content, false);
+            InstallLog.getInstance().info(content);
+        }
+        inputStream.close();
+    }
+
+    public void writeToFile(final File file, final String content) {
+        try {
+            final FileWriter fw = new FileWriter(file.getAbsoluteFile());
+            final BufferedWriter bw = new BufferedWriter(fw);
+            bw.write(content);
+            bw.close();
+        } catch (final IOException ex) {
+            final String errorMessage = "Error writing file " + file.getAbsolutePath() + ": " + ex.getMessage();
+            handler.emitError(errorMessage, errorMessage);
+            InstallLog.getInstance().error(errorMessage);
+        }
+    }
+
+    public String readFile(final File file) {
+        String content = "";
+        try {
+            content = FileUtils.readFileToString(file);
+        } catch (IOException ex) {
+            final String errorMessage = "Error reading file " + file.getAbsolutePath() + ": " + ex.getMessage();
+            handler.emitError(errorMessage, errorMessage);
+            InstallLog.getInstance().error(errorMessage);
+        }
+        return content;
+    }
+
+    public void appendToFile(final File file, final String content) {
+        try {
+            if (!file.exists()) {
+                file.createNewFile();
+            }
+            final PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
+            out.println(content);
+            out.close();
+        } catch (IOException ex) {
+            final String errorMessage = "Error writing file " + file.getAbsolutePath() + ": " + ex.getMessage();
+            handler.emitError(errorMessage, errorMessage);
+            InstallLog.getInstance().error(errorMessage);
+        }
+    }
+
+    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);
+    }
+
+    public void copyFileFromResources(final String filePath,
+            final String destination, final AbstractUIProcessHandler handler) {
+        try {
+            final URL url = getClass().getResource(filePath);
+            final File dest = new File(destination);
+            FileUtils.copyURLToFile(url, dest);
+        } catch (IOException ex) {
+            final String errorMessage = "Error copy file " + filePath;
+            handler.emitError(errorMessage, errorMessage);
+            InstallLog.getInstance().error(errorMessage);
+        }
+    }
+}


Mime
View raw message