Author: rfelden
Date: Wed Jul 18 17:56:08 2007
New Revision: 7

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D7&repname=3Df=
ix_apply
Log:
now working on an installed but not yet configured jahia

Modified:
    branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/controller=
/MyController.java
    branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.=
java
    branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/views/View=
Adapter.java
    branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/=
MainWindow.java

Modified: branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/cont=
roller/MyController.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/jahia/fixapp=
lier/src/main/java/org/jahia/fixapplier/controller/MyController.java&rev=3D=
7&repname=3Dfix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/controller=
/MyController.java (original)
+++ branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/controller=
/MyController.java Wed Jul 18 17:56:08 2007
@@ -472,7 +472,7 @@
 =

         // do the job...
         replaceCoreFiles();
-        deleteRemovedPaths() ;
+        deleteRemovedFiles() ;
 =

         // log the patching
         addToHistory() ;
@@ -483,9 +483,11 @@
     public void threadedPatch() {
         new Thread() {
             public void run() {
+                view.enableHourglass();
                 // first check if a zip file is currently selected
                 if (dataModel.getZippedFix() =3D=3D null) {
                     printUI("no zipped fix selected");
+                    view.disableHourglass();
                     return ;
                 }
 =

@@ -498,21 +500,24 @@
                 // then check if the patch has already been applied
                 if (dataModel.checkForExisting()) {
                     printUI("fix already applied") ;
+                    view.disableHourglass();
                     return ;
                 }
 =

                 // finally check if the project to patch is selected
                 if (dataModel.getProject() =3D=3D null || !dataModel.getPr=
oject().exists()) {
                     printUI("no project selected");
+                    view.disableHourglass();
                     return ;
                 }
 =

                 // do the job...
                 replaceCoreFiles();
-                deleteRemovedPaths() ;
+                deleteRemovedFiles() ;
 =

                 // log the patching
                 addToHistory() ;
+                view.disableHourglass();                =

              }
         }.start() ;
     }
@@ -545,11 +550,11 @@
         // file processing
         } else {
             // jahia specific treatment
-            if (neu.getName().equals("jahia.skeleton")) {
+            /*if (neu.getName().equals("jahia.skeleton")) {
                 jahiaSkeletonTreatment(neu);
                 return ;
             }
-            else if (neu.getName().endsWith(".old")) {
+            else*/ if (neu.getName().endsWith(".old")) {
                 return ;
             }
             String targetPath =3D StringUtils.replaceFirstToken(neu.getAbs=
olutePath(), dataModel.temp().getAbsolutePath() + File.separator + "output"=
, dataModel.getProject().getAbsolutePath()) ;
@@ -560,9 +565,26 @@
             =

             File parentPath =3D destination.getParentFile() ;
             parentPath.mkdirs() ;
-            Tools.copy(neu, destination) ;
-            out(neu.getName() + " replaced");
-            printUI("   " + neu.getName() + " replaced");
+
+            // this concerns a maven dependency update
+            if (dataModel.getFix().getMavenDependencies().contains(neu.get=
Name())) {
+                File[] list =3D parentPath.listFiles() ;
+                for (int i =3D 0; i < list.length; i++) {
+                    if (StringUtils.cleanAfterLastToken(list[i].getName(),=
 "-", false)
+                            .equals(StringUtils.cleanAfterLastToken(neu.ge=
tName(), "-", false))) {
+                        // delete old versions
+                        Tools.recDel(list[i]) ;
+                        Tools.copy(neu, destination) ;
+                        printUI(list[i].getName() + " replaced with " + ne=
u.getName());
+                        out(list[i].getName() + " replaced with " + neu.ge=
tName()) ;
+                        break ;
+                    }
+                }
+            } else {
+                Tools.copy(neu, destination) ;
+                out(neu.getName() + " copied");
+                printUI("   " + neu.getName() + " copied");
+            }
         }
     }
 =

@@ -638,9 +660,9 @@
     }
 =

     /**
-     * Remove the paths that are marked for deletion.
+     * Remove the files that are marked for deletion.
      */
-    private void deleteRemovedPaths() {
+    private void deleteRemovedFiles() {
         ArrayList paths =3D dataModel.getFix().getRemovedFiles() ;
         for (java.util.Iterator it =3D paths.iterator(); it.hasNext();) {
             String path =3D (String) it.next();

Modified: branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/mode=
l/Fix.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/jahia/fixapp=
lier/src/main/java/org/jahia/fixapplier/model/Fix.java&rev=3D7&repname=3Dfi=
x_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.=
java (original)
+++ branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/model/Fix.=
java Wed Jul 18 17:56:08 2007
@@ -35,6 +35,7 @@
     private Timestamp date ;
     private ArrayList coreFiles;
     private ArrayList removedFiles ;
+    private ArrayList mavenDependencies ;
     private ArrayList otherFiles ;
     private String description ;
 =

@@ -50,6 +51,7 @@
         description =3D "" ;
         coreFiles =3D new ArrayList();
         removedFiles =3D new ArrayList() ;
+        mavenDependencies =3D new ArrayList() ;
         otherFiles =3D new ArrayList() ;
     }
 =

@@ -182,6 +184,14 @@
         return otherFiles ;
     }
 =

+    public void addMavenDependency(String file) {
+        mavenDependencies.add(file);
+    }
+
+    public ArrayList getMavenDependencies() {
+        return mavenDependencies;
+    }
+
     public String toString() {
         StringBuffer core =3D new StringBuffer() ;
         core.append("core files:") ;
@@ -210,6 +220,7 @@
                "description: "+  description + "\n" +
                 (coreFiles.isEmpty() ? "" : core.toString()) +
                 (removedFiles.isEmpty() ? "" : "\n" + remove.toString()) +
+                (mavenDependencies.isEmpty() ? "" : remove.toString() + "\=
n") +
                 (otherFiles.isEmpty() ? "" : "\n" + other.toString()) ;
     }
 =

@@ -235,6 +246,11 @@
             fix.addRemovedFile(((Element) removedFile).getText());
         }
 =

+        for (java.util.Iterator it3 =3D root.getChild("mavenDependencies")=
.getChildren("mavenDependency").iterator(); it3.hasNext();) {
+            Object removedFile =3D it3.next();
+            fix.addMavenDependency(((Element) removedFile).getText());
+        }
+
         for (java.util.Iterator it1 =3D root.getChild("otherFiles").getChi=
ldren("file").iterator(); it1.hasNext();) {
             Object otherFile =3D it1.next();
             fix.addOtherFile(((Element) otherFile).getText());

Modified: branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/view=
s/ViewAdapter.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/jahia/fixapp=
lier/src/main/java/org/jahia/fixapplier/views/ViewAdapter.java&rev=3D7&repn=
ame=3Dfix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/views/View=
Adapter.java (original)
+++ branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/views/View=
Adapter.java Wed Jul 18 17:56:08 2007
@@ -19,9 +19,11 @@
 =

     public void rebuild(boolean appcast) {}
 =

-    public void onAppcastRetrieved(Appcast appcast) {
+    public void onAppcastRetrieved(Appcast appcast) {}
 =

-    }
+    public void enableHourglass() {}
+
+    public void disableHourglass() {}
 =

 =

 =


Modified: branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/view=
s/gui/MainWindow.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/jahia/fixapp=
lier/src/main/java/org/jahia/fixapplier/views/gui/MainWindow.java&rev=3D7&r=
epname=3Dfix_apply
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/=
MainWindow.java (original)
+++ branches/jahia/fixapplier/src/main/java/org/jahia/fixapplier/views/gui/=
MainWindow.java Wed Jul 18 17:56:08 2007
@@ -8,6 +8,7 @@
 import javax.swing.*;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.awt.*;
 import java.util.ResourceBundle;
 =

 /**
@@ -86,4 +87,13 @@
             appcastPane.onAppcastRetrieved(appcast);
         }
     }
+
+    public void enableHourglass() {
+        frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)) ;
+    }
+
+    public void disableHourglass() {
+        frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)) ;
+    }
+    =

 }

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to