You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2017/01/09 16:13:03 UTC

[1/2] activemq-artemis git commit: This closes #952

Repository: activemq-artemis
Updated Branches:
  refs/heads/master ef4efe7d3 -> 2eb51985b


This closes #952


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2eb51985
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2eb51985
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2eb51985

Branch: refs/heads/master
Commit: 2eb51985bc4ca203455ebf1160e21df83568fb8f
Parents: ef4efe7 63cf4d5
Author: Justin Bertram <jb...@apache.org>
Authored: Mon Jan 9 09:50:36 2017 -0600
Committer: Justin Bertram <jb...@apache.org>
Committed: Mon Jan 9 09:50:36 2017 -0600

----------------------------------------------------------------------
 .../artemis/tools/migrate/config/Main.java      | 37 ++++++++++----------
 1 file changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-912 Fix file configuration migration tool

Posted by jb...@apache.org.
ARTEMIS-912 Fix file configuration migration tool


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/63cf4d5a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/63cf4d5a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/63cf4d5a

Branch: refs/heads/master
Commit: 63cf4d5a601e7e44c22144cdeb98a4357f1bcf16
Parents: ef4efe7
Author: Martyn Taylor <mt...@redhat.com>
Authored: Mon Jan 9 14:48:28 2017 +0000
Committer: Justin Bertram <jb...@apache.org>
Committed: Mon Jan 9 09:50:36 2017 -0600

----------------------------------------------------------------------
 .../artemis/tools/migrate/config/Main.java      | 37 ++++++++++----------
 1 file changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/63cf4d5a/artemis-tools/src/main/java/org/apache/activemq/artemis/tools/migrate/config/Main.java
----------------------------------------------------------------------
diff --git a/artemis-tools/src/main/java/org/apache/activemq/artemis/tools/migrate/config/Main.java b/artemis-tools/src/main/java/org/apache/activemq/artemis/tools/migrate/config/Main.java
index 754dc15..692ab9e 100644
--- a/artemis-tools/src/main/java/org/apache/activemq/artemis/tools/migrate/config/Main.java
+++ b/artemis-tools/src/main/java/org/apache/activemq/artemis/tools/migrate/config/Main.java
@@ -29,7 +29,7 @@ public class Main {
          File input = new File(args[0]);
          if (input.isDirectory()) {
             System.out.println("Scanning directory: " + input.getAbsolutePath());
-            recursiveTransform(input);
+            scanAndTransform(input);
          } else {
             if (args.length != 2) {
                System.err.println("Invalid args");
@@ -37,6 +37,7 @@ public class Main {
             } else {
                try {
                   XMLConfigurationMigration migration = new XMLConfigurationMigration(input, new File(args[1]));
+                  migration.transform();
                } catch (Exception e) {
                   // Unable to process file, move on.
                }
@@ -51,30 +52,28 @@ public class Main {
       }
    }
 
-   public static void scanAndTransform(File pFile) throws Exception {
+   public static void scanAndTransform(File f) throws Exception {
       try {
-         for (File f : pFile.listFiles()) {
-            if (f.isDirectory()) {
-               scanAndTransform(f);
-            } else {
-               try {
-                  if (f.getName().endsWith("xml")) {
-                     File file = new File(f.getAbsolutePath() + ".new");
-                     XMLConfigurationMigration migration = new XMLConfigurationMigration(f, file);
-                     if (migration.transform()) {
-                        File r = new File(f.getAbsolutePath());
-                        f.renameTo(new File(f.getAbsolutePath() + ".bk"));
-                        file.renameTo(r);
-                        System.out.println(f + " converted, old file renamed as " + f.getAbsolutePath() + ".bk");
-                     }
+         if (f.isDirectory()) {
+            recursiveTransform(f);
+         } else {
+            try {
+               if (f.getName().endsWith("xml")) {
+                  File file = new File(f.getAbsolutePath() + ".new");
+                  XMLConfigurationMigration migration = new XMLConfigurationMigration(f, file);
+                  if (migration.transform()) {
+                     File r = new File(f.getAbsolutePath());
+                     f.renameTo(new File(f.getAbsolutePath() + ".bk"));
+                     file.renameTo(r);
+                     System.out.println(f + " converted, old file renamed as " + f.getAbsolutePath() + ".bk");
                   }
-               } catch (Exception e) {
-                  //Unable to process file, continue
                }
+            } catch (Exception e) {
+               //Unable to process file, continue
             }
          }
       } catch (NullPointerException e) {
-         System.out.println(pFile.getAbsoluteFile());
+         System.out.println(f.getAbsoluteFile());
       }
    }