You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by ma...@apache.org on 2015/12/15 18:08:24 UTC

[3/4] syncope git commit: Camel option, SYNCOPE-637

Camel option, SYNCOPE-637


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/335d7f61
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/335d7f61
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/335d7f61

Branch: refs/heads/master
Commit: 335d7f61ab7e60a4f87cd76ac179eda4f318d30c
Parents: e215871
Author: Massimiliano Perrone <ma...@tirasa.net>
Authored: Tue Dec 15 15:49:23 2015 +0100
Committer: Massimiliano Perrone <ma...@tirasa.net>
Committed: Tue Dec 15 18:08:02 2015 +0100

----------------------------------------------------------------------
 installer/pom.xml                               |  6 +++
 .../apache/syncope/installer/files/CorePom.java | 54 ++++++++++++++++++++
 .../syncope/installer/files/ParentPom.java      | 25 +++------
 .../installer/processes/ArchetypeProcess.java   | 27 ++++++++--
 .../installer/processes/PersistenceProcess.java | 18 ++-----
 .../src/main/resources/izpack/userInputSpec.xml |  6 +--
 6 files changed, 100 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/335d7f61/installer/pom.xml
----------------------------------------------------------------------
diff --git a/installer/pom.xml b/installer/pom.xml
index 7bfc0cf..c69b4b4 100644
--- a/installer/pom.xml
+++ b/installer/pom.xml
@@ -189,6 +189,12 @@ under the License.
         </includes>
       </resource>
       <resource>
+        <directory>${basedir}/../fit/core-reference/src/main/resources/all</directory>
+        <includes>
+          <include>provisioning.properties</include>
+        </includes>
+      </resource>
+      <resource>
         <directory>${basedir}</directory>
         <targetPath>META-INF</targetPath>
         <includes>

http://git-wip-us.apache.org/repos/asf/syncope/blob/335d7f61/installer/src/main/java/org/apache/syncope/installer/files/CorePom.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/CorePom.java b/installer/src/main/java/org/apache/syncope/installer/files/CorePom.java
new file mode 100644
index 0000000..54f5685
--- /dev/null
+++ b/installer/src/main/java/org/apache/syncope/installer/files/CorePom.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.files;
+
+public final class CorePom {
+
+    public static final String SWAGGER_PLACEHOLDER = "</dependencies>";
+
+    public static final String SWAGGER_CONTENT_TO_ADD = "  <dependency>\n"
+            + "      <groupId>org.apache.syncope.ext</groupId>\n"
+            + "      <artifactId>syncope-ext-swagger-ui</artifactId>\n"
+            + "      <version>${syncope.version}</version>\n"
+            + "    </dependency>\n"
+            + "  </dependencies>\n";
+
+    public static final String CAMEL_PLACEHOLDER = "</dependencies>";
+
+    public static final String CAMEL_CONTENT_TO_ADD = "  <dependency>\n"
+            + "      <groupId>org.apache.syncope.ext.camel</groupId>\n"
+            + "      <artifactId>syncope-ext-camel-rest-cxf</artifactId>\n"
+            + "      <version>${syncope.version}</version>\n"
+            + "    </dependency>\n"
+            + "    <dependency>\n"
+            + "      <groupId>org.apache.syncope.ext.camel</groupId>\n"
+            + "      <artifactId>syncope-ext-camel-persistence-jpa</artifactId>\n"
+            + "      <version>${syncope.version}</version>\n"
+            + "    </dependency>\n"
+            + "    <dependency>\n"
+            + "      <groupId>org.apache.syncope.ext.camel</groupId>\n"
+            + "      <artifactId>syncope-ext-camel-provisioning</artifactId>\n"
+            + "      <version>${syncope.version}</version>\n"
+            + "    </dependency>\n"
+            + "  </dependencies>\n";
+
+    private CorePom() {
+        // private constructor for static utility class
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/335d7f61/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java b/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
index 867b925..4f23ca7 100644
--- a/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
+++ b/installer/src/main/java/org/apache/syncope/installer/files/ParentPom.java
@@ -20,26 +20,17 @@ package org.apache.syncope.installer.files;
 
 public final class ParentPom {
 
-    public static final String SWAGGER_PLACEHOLDER = "<dependencies>";
-
-    public static final String SWAGGER_CONTENT_TO_ADD = "<dependencies>\n"
-            + "    <dependency>\n"
-            + "      <groupId>org.apache.syncope.ext</groupId>\n"
-            + "      <artifactId>syncope-ext-swagger-ui</artifactId>\n"
-            + "      <version>${syncope.version}</version>\n"
-            + "    </dependency>\n";
-
     public static final String REPOSITORY_PLACEHOLDER = "</project>";
 
     public static final String REPOSITORY_CONTENT_TO_ADD = "  <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"
+            + "    <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";
 
     private ParentPom() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/335d7f61/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java b/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
index 30a7270..9c3f184 100644
--- a/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
+++ b/installer/src/main/java/org/apache/syncope/installer/processes/ArchetypeProcess.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.util.Properties;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
+import org.apache.syncope.installer.files.CorePom;
 import org.apache.syncope.installer.files.ParentPom;
 import org.apache.syncope.installer.utilities.InstallLog;
 import org.apache.syncope.installer.utilities.MavenUtils;
@@ -95,6 +96,13 @@ public class ArchetypeProcess extends BaseProcess {
         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.REPOSITORY_PLACEHOLDER, ParentPom.REPOSITORY_CONTENT_TO_ADD));
+        }
+        
         if (swagger) {
             final File pomFile = new File(
                     syncopeInstallDir
@@ -103,11 +111,24 @@ public class ArchetypeProcess extends BaseProcess {
                     + File.separator
                     + PROPERTIES.getProperty("pomFile"));
             String contentPomFile = fileSystemUtils.readFile(pomFile);
-            contentPomFile = contentPomFile.replace(
-                    ParentPom.REPOSITORY_PLACEHOLDER, ParentPom.REPOSITORY_CONTENT_TO_ADD);
-            contentPomFile = contentPomFile.replace(ParentPom.SWAGGER_PLACEHOLDER, ParentPom.SWAGGER_CONTENT_TO_ADD);
+            contentPomFile = contentPomFile.replace(CorePom.SWAGGER_PLACEHOLDER, CorePom.SWAGGER_CONTENT_TO_ADD);
+
+            fileSystemUtils.writeToFile(pomFile, contentPomFile);
+        }
+        
+        if (camel) {
+            final File pomFile = new File(
+                    syncopeInstallDir
+                    + File.separator
+                    + "core"
+                    + File.separator
+                    + PROPERTIES.getProperty("pomFile"));
+            String contentPomFile = fileSystemUtils.readFile(pomFile);
+            contentPomFile = contentPomFile.replace(CorePom.CAMEL_PLACEHOLDER, CorePom.CAMEL_CONTENT_TO_ADD);
 
             fileSystemUtils.writeToFile(pomFile, contentPomFile);
+            fileSystemUtils.copyFileFromResources("/provisioning.properties",
+                syncopeInstallDir + PROPERTIES.getProperty("provisioningPropertiesFile"), handler);
         }
 
         fileSystemUtils.createDirectory(confDirectory);

http://git-wip-us.apache.org/repos/asf/syncope/blob/335d7f61/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
----------------------------------------------------------------------
diff --git a/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java b/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
index 8090173..a36b759 100644
--- a/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
+++ b/installer/src/main/java/org/apache/syncope/installer/processes/PersistenceProcess.java
@@ -55,15 +55,16 @@ public class PersistenceProcess extends BaseProcess {
         mysqlInnoDB = Boolean.valueOf(args[6]);
         schema = args[7];
 
-        StringBuilder masterProperties = new StringBuilder(MasterProperties.HEADER);
+        final StringBuilder masterProperties = new StringBuilder(MasterProperties.HEADER);
         setSyncopeInstallDir(installPath, artifactId);
 
-        FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
+        final FileSystemUtils fileSystemUtils = new FileSystemUtils(handler);
         final File provisioningFile = new File(
                 syncopeInstallDir + PROPERTIES.getProperty("provisioningPropertiesFile"));
 
-        final StringBuilder provisioningProperties
-                = new StringBuilder(removeLastTwoLine(fileSystemUtils.readFile(provisioningFile)));
+        final String provisioningFileString = fileSystemUtils.readFile(provisioningFile);
+        final StringBuilder provisioningProperties = new StringBuilder(
+                provisioningFileString.substring(0, provisioningFileString.indexOf("quartz.jobstore")));
         handler.logOutput("Configure persistence for " + dbSelected, false);
         InstallLog.getInstance().info("Configure persistence for " + dbSelected);
 
@@ -111,13 +112,4 @@ public class PersistenceProcess extends BaseProcess {
                 syncopeInstallDir + PROPERTIES.getProperty("masterPropertiesFile")),
                 masterProperties.toString());
     }
-
-    private String removeLastTwoLine(final String string) {
-        int truncateIndex = string.length();
-
-        for (int i = 0; i < 3; i++) {
-            truncateIndex = string.lastIndexOf('\n', truncateIndex - 1);
-        }
-        return string.substring(0, truncateIndex);
-    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/335d7f61/installer/src/main/resources/izpack/userInputSpec.xml
----------------------------------------------------------------------
diff --git a/installer/src/main/resources/izpack/userInputSpec.xml b/installer/src/main/resources/izpack/userInputSpec.xml
index 72648b0..0691f2f 100644
--- a/installer/src/main/resources/izpack/userInputSpec.xml
+++ b/installer/src/main/resources/izpack/userInputSpec.xml
@@ -109,12 +109,12 @@ under the License.
     <field type="check" variable="options.swagger">
       <spec id="options.swagger.id" true="true" false="false" set="false"/>
     </field>
-    <field type="check" variable="options.activiti.workflow.adapter">
-      <spec id="options.activiti.workflow.adapter.id" true="true" false="false" set="false"/>
-    </field>
     <field type="check" variable="options.camel">
       <spec id="options.camel.id" true="true" false="false" set="false"/>
     </field>
+    <field type="check" variable="options.activiti.workflow.adapter">
+      <spec id="options.activiti.workflow.adapter.id" true="true" false="false" set="false"/>
+    </field>
   </panel>
   
   <panel id="persistence" order="3" border="false">