cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1505116 - in /cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler: ProjectController.java ProjectFileChangeTracker.java action/OpenProjectAction.java action/SaveAction.java action/SaveAsAction.java
Date Sat, 20 Jul 2013 09:50:16 GMT
Author: aadamchik
Date: Sat Jul 20 09:50:16 2013
New Revision: 1505116

URL: http://svn.apache.org/r1505116
Log:
CAY-1852  Straighten thread model and synchronization in the Modeler

refactoring 'ProjectWatchdog'

Modified:
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java?rev=1505116&r1=1505115&r2=1505116&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectController.java
Sat Jul 20 09:50:16 2013
@@ -238,7 +238,7 @@ public class ProjectController extends C
      * Project files watcher. When project file is changed, user will be asked
      * to confirm loading the changes
      */
-    private ProjectFileChangeTracker watchdog;
+    private ProjectFileChangeTracker fileChangeTracker;
 
     public ProjectController(CayenneModelerController parent) {
         super(parent);
@@ -269,18 +269,18 @@ public class ProjectController extends C
             if (project == null) {
                 this.entityResolver = null;
 
-                if (watchdog != null) {
-                    watchdog.interrupt();
-                    watchdog = null;
+                if (fileChangeTracker != null) {
+                    fileChangeTracker.interrupt();
+                    fileChangeTracker = null;
                 }
             } else {
-                if (watchdog == null) {
-                    watchdog = new ProjectFileChangeTracker(this);
-                    watchdog.setDaemon(true);
-                    watchdog.start();
+                if (fileChangeTracker == null) {
+                    fileChangeTracker = new ProjectFileChangeTracker(this);
+                    fileChangeTracker.setDaemon(true);
+                    fileChangeTracker.start();
                 }
 
-                watchdog.reconfigure();
+                fileChangeTracker.reconfigure();
 
                 entityResolver = new EntityResolver(
                         ((DataChannelDescriptor) currentProject.getRootNode()).getDataMaps());
@@ -1615,11 +1615,8 @@ public class ProjectController extends C
         }
     }
 
-    /**
-     * @return the project files' watcher
-     */
-    public ProjectFileChangeTracker getProjectWatcher() {
-        return watchdog;
+    public ProjectFileChangeTracker getFileChangeTracker() {
+        return fileChangeTracker;
     }
 
     /**

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java?rev=1505116&r1=1505115&r2=1505116&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectFileChangeTracker.java
Sat Jul 20 09:50:16 2013
@@ -56,9 +56,6 @@ public class ProjectFileChangeTracker ex
     protected boolean paused;
     protected ProjectController mediator;
 
-    /**
-     * Creates new watchdog for a specified project
-     */
     public ProjectFileChangeTracker(ProjectController mediator) {
 
         this.files = new ConcurrentHashMap<String, FileInfo>();

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java?rev=1505116&r1=1505115&r2=1505116&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
Sat Jul 20 09:50:16 2013
@@ -165,8 +165,8 @@ public class OpenProjectAction extends P
                     if (upgraded != null) {
                         Project project = openProjectResourse(upgraded, controller);
 
-                        getProjectController().getProjectWatcher().pauseWatching();
-                        getProjectController().getProjectWatcher().reconfigure();
+                        getProjectController().getFileChangeTracker().pauseWatching();
+                        getProjectController().getFileChangeTracker().reconfigure();
 
                         // if project file name changed
                         // need upgrade all

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java?rev=1505116&r1=1505115&r2=1505116&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
Sat Jul 20 09:50:16 2013
@@ -63,7 +63,7 @@ public class SaveAction extends SaveAsAc
 
             String oldPath = p.getConfigurationResource().getURL().getPath();
 
-            getProjectController().getProjectWatcher().pauseWatching();
+            getProjectController().getFileChangeTracker().pauseWatching();
 
             ProjectSaver saver = getApplication().getInjector().getInstance(
                     ProjectSaver.class);
@@ -92,7 +92,7 @@ public class SaveAction extends SaveAsAc
             /**
              * Reset the watcher now
              */
-            getProjectController().getProjectWatcher().reconfigure();
+            getProjectController().getFileChangeTracker().reconfigure();
         }
 
         return true;

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java?rev=1505116&r1=1505115&r2=1505116&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
Sat Jul 20 09:50:16 2013
@@ -91,7 +91,7 @@ public class SaveAsAction extends Cayenn
             return false;
         }
 
-        getProjectController().getProjectWatcher().pauseWatching();
+        getProjectController().getFileChangeTracker().pauseWatching();
 
         URL url = projectDir.toURL();
 
@@ -144,7 +144,7 @@ public class SaveAsAction extends Cayenn
         /**
          * Reset the watcher now
          */
-        getProjectController().getProjectWatcher().reconfigure();
+        getProjectController().getFileChangeTracker().reconfigure();
 
         return true;
     }



Mime
View raw message