cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r905616 [3/6] - in /cayenne/main/trunk/framework: cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/ cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ cayenne-jdk1.5-unpublished/src/main/java/org/apach...
Date Tue, 02 Feb 2010 13:08:18 GMT
Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAction.java Tue Feb  2 13:06:56 2010
@@ -28,13 +28,12 @@
 import javax.swing.undo.CompoundEdit;
 import javax.swing.undo.UndoableEdit;
 
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.configuration.event.DataMapEvent;
 import org.apache.cayenne.configuration.event.DataNodeEvent;
-import org.apache.cayenne.configuration.event.DomainEvent;
 import org.apache.cayenne.configuration.event.ProcedureEvent;
 import org.apache.cayenne.configuration.event.QueryEvent;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
@@ -54,7 +53,6 @@
 import org.apache.cayenne.modeler.undo.RemoveCompoundUndoableEdit;
 import org.apache.cayenne.modeler.undo.RemoveUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ApplicationProject;
 import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.AbstractQuery;
 import org.apache.cayenne.query.Query;
@@ -65,7 +63,6 @@
  */
 public class RemoveAction extends CayenneAction {
 
-    
 
     public static String getActionName() {
         return "Remove";
@@ -188,11 +185,9 @@
                             .getUndoManager()
                             .addEdit(
                                     new RemoveUndoableEdit(application, mediator
-                                            .getCurrentDataDomain(), mediator
                                             .getCurrentDataMap()));
 
-                    removeDataMap(mediator.getCurrentDataDomain(), mediator
-                            .getCurrentDataMap());
+                    removeDataMap(mediator.getCurrentDataMap());
 
                 }
             }
@@ -200,25 +195,13 @@
         else if (mediator.getCurrentDataNode() != null) {
             if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                 application.getUndoManager().addEdit(
-                        new RemoveUndoableEdit(application, mediator
-                                .getCurrentDataDomain(), mediator.getCurrentDataNode()));
+                        new RemoveUndoableEdit(application, mediator.getCurrentDataNode()));
 
-                removeDataNode(mediator.getCurrentDataDomain(), mediator
+                removeDataNode(mediator
                         .getCurrentDataNode());
             }
         }
-        else if (mediator.getCurrentDataDomain() != null) {
-            if (dialog.shouldDelete("data domain", mediator
-                    .getCurrentDataDomain()
-                    .getName())) {
-
-                application.getUndoManager().addEdit(
-                        new RemoveUndoableEdit(application, mediator
-                                .getCurrentDataDomain()));
 
-                removeDomain(mediator.getCurrentDataDomain());
-            }
-        }
         else if (mediator.getCurrentPaths() != null) { // multiple deletion
             if (dialog.shouldDelete("selected objects")) {
                 ProjectPath[] paths = mediator.getCurrentPaths();
@@ -236,34 +219,23 @@
 
     }
 
-    public void removeDomain(DataDomain domain) {
-        ApplicationProject project = (ApplicationProject) getCurrentProject();
-        ProjectController mediator = getProjectController();
-
-        project.getConfiguration().removeDomain(domain.getName());
-        mediator.fireDomainEvent(new DomainEvent(
-                Application.getFrame(),
-                domain,
-                MapEvent.REMOVE));
-    }
-
-    public void removeDataMap(DataDomain domain, DataMap map) {
+    public void removeDataMap(DataMap map) {
         ProjectController mediator = getProjectController();
-
+        DataChannelDescriptor domain =  (DataChannelDescriptor)mediator.getProject().getRootNode();
         DataMapEvent e = new DataMapEvent(Application.getFrame(), map, MapEvent.REMOVE);
-        e.setDomain(domain);
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
-        domain.removeMap(map.getName());
+        domain.getDataMaps().remove(map);
         mediator.fireDataMapEvent(e);
     }
 
-    public void removeDataNode(DataDomain domain, DataNode node) {
+    public void removeDataNode(DataNodeDescriptor node) {
         ProjectController mediator = getProjectController();
-
+        DataChannelDescriptor domain =  (DataChannelDescriptor)mediator.getProject().getRootNode();
         DataNodeEvent e = new DataNodeEvent(Application.getFrame(), node, MapEvent.REMOVE);
-        e.setDomain(domain);
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
-        domain.removeDataNode(node.getName());
+        domain.getNodeDescriptors().remove(node);
         mediator.fireDataNodeEvent(e);
     }
 
@@ -274,7 +246,7 @@
         ProjectController mediator = getProjectController();
 
         EntityEvent e = new EntityEvent(Application.getFrame(), ent, MapEvent.REMOVE);
-        e.setDomain(mediator.findDomain(map));
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
         map.removeDbEntity(ent.getName(), true);
         mediator.fireDbEntityEvent(e);
@@ -287,7 +259,7 @@
         ProjectController mediator = getProjectController();
 
         QueryEvent e = new QueryEvent(Application.getFrame(), query, MapEvent.REMOVE, map);
-        e.setDomain(mediator.findDomain(map));
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
         map.removeQuery(query.getName());
         mediator.fireQueryEvent(e);
@@ -303,7 +275,7 @@
                 Application.getFrame(),
                 procedure,
                 MapEvent.REMOVE);
-        e.setDomain(mediator.findDomain(map));
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
         map.removeProcedure(procedure.getName());
         mediator.fireProcedureEvent(e);
@@ -316,7 +288,7 @@
         ProjectController mediator = getProjectController();
 
         EntityEvent e = new EntityEvent(Application.getFrame(), entity, MapEvent.REMOVE);
-        e.setDomain(mediator.findDomain(map));
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
         map.removeObjEntity(entity.getName(), true);
         mediator.fireObjEntityEvent(e);
@@ -347,19 +319,19 @@
                 Application.getFrame(),
                 embeddable,
                 MapEvent.REMOVE);
-        e.setDomain(mediator.findDomain(map));
+        e.setDomain((DataChannelDescriptor)mediator.getProject().getRootNode());
 
         map.removeEmbeddable(embeddable.getClassName());
         mediator.fireEmbeddableEvent(e, map);
     }
 
-    public void removeDataMapFromDataNode(DataNode node, DataMap map) {
+    public void removeDataMapFromDataNode(DataNodeDescriptor node, DataMap map) {
         ProjectController mediator = getProjectController();
 
         DataNodeEvent e = new DataNodeEvent(Application.getFrame(), node);
-        e.setDomain(mediator.findDomain(node));
+        e.setDomain( (DataChannelDescriptor)mediator.getProject().getRootNode());
 
-        node.removeDataMap(map.getName());
+        node.getDataMapNames().remove(map.getName());
 
         // Force reloading of the data node in the browse view
         mediator.fireDataNodeEvent(e);
@@ -376,13 +348,14 @@
 
         Object lastObject = path.getObject();
 
-        if (lastObject instanceof DataDomain) {
+        if (lastObject instanceof DataChannelDescriptor) {
             return true;
         }
-        else if (lastObject instanceof DataMap) {
+        else 
+        if (lastObject instanceof DataMap) {
             return true;
         }
-        else if (lastObject instanceof DataNode) {
+        else if (lastObject instanceof DataNodeDescriptor) {
             return true;
         }
         else if (lastObject instanceof Entity) {
@@ -419,35 +392,29 @@
 
         UndoableEdit undo = null;
 
-        if (lastObject instanceof DataDomain) {
-            undo = new RemoveUndoableEdit(application, (DataDomain) lastObject);
-            removeDomain((DataDomain) lastObject);
-        }
-        else if (lastObject instanceof DataMap) {
+        if (lastObject instanceof DataMap) {
             Object parent = path.getObjectParent();
 
-            if (parent instanceof DataDomain) {
+            if (parent instanceof DataChannelDescriptor) {
                 undo = new RemoveUndoableEdit(
                         application,
-                        (DataDomain) parent,
                         (DataMap) lastObject);
 
-                removeDataMap((DataDomain) parent, (DataMap) lastObject);
+                removeDataMap((DataMap) lastObject);
             }
             else { // if(parent instanceof DataNode)
                 undo = new RemoveUndoableEdit(
                         application,
-                        (DataNode) parent,
+                        (DataNodeDescriptor) parent,
                         (DataMap) lastObject);
 
-                removeDataMapFromDataNode((DataNode) parent, (DataMap) lastObject);
+                removeDataMapFromDataNode((DataNodeDescriptor) parent, (DataMap) lastObject);
             }
         }
-        else if (lastObject instanceof DataNode) {
-            undo = new RemoveUndoableEdit(application, (DataDomain) path
-                    .getObjectParent(), (DataNode) lastObject);
+        else if (lastObject instanceof DataNodeDescriptor) {
+            undo = new RemoveUndoableEdit(application, (DataNodeDescriptor) lastObject);
 
-            removeDataNode((DataDomain) path.getObjectParent(), (DataNode) lastObject);
+            removeDataNode((DataNodeDescriptor) lastObject);
         }
         else if (lastObject instanceof DbEntity) {
             undo = new RemoveUndoableEdit(

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RemoveAttributeAction.java Tue Feb  2 13:06:56 2010
@@ -21,6 +21,7 @@
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
@@ -117,7 +118,7 @@
 
                 application.getUndoManager().addEdit(
                         new RemoveAttributeUndoableEdit(
-                                mediator.getCurrentDataDomain(),
+                                (DataChannelDescriptor)mediator.getProject().getRootNode(),
                                 mediator.getCurrentDataMap(),
                                 entity,
                                 attribs));
@@ -140,7 +141,7 @@
 
                     application.getUndoManager().addEdit(
                             new RemoveAttributeUndoableEdit(
-                                    mediator.getCurrentDataDomain(),
+                                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
                                     mediator.getCurrentDataMap(),
                                     entity,
                                     attribs));

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RevertAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RevertAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RevertAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/RevertAction.java Tue Feb  2 13:06:56 2010
@@ -20,13 +20,13 @@
 package org.apache.cayenne.modeler.action;
 
 import java.awt.event.ActionEvent;
+import java.io.File;
 
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.CayenneModelerController;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ApplicationProject;
-import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project2.Project;
 
 /**
  */
@@ -49,23 +49,24 @@
             return;
         }
 
-        boolean isNew = project.isLocationUndefined();
-
+       boolean isNew = project.getConfigurationResource() == null; 
+        
         CayenneModelerController controller = getApplication().getFrameController();
 
         // close ... don't use OpenProjectAction close method as it will ask for save, we
         // don't want that here
         controller.projectClosedAction();
 
+        File fileDirectory = new File(project.getConfigurationResource().getURL().getPath());
         // reopen existing
-        if (!isNew && project.getMainFile().isFile()) {
+        if (!isNew && fileDirectory.isFile()) {
             OpenProjectAction openAction = (OpenProjectAction) controller
                     .getApplication()
                     .getAction(OpenProjectAction.getActionName());
-            openAction.openProject(project.getMainFile());
+            openAction.openProject(fileDirectory);
         }
         // create new
-        else if (!(project instanceof ApplicationProject)) {
+        else if (!(project instanceof Project)) {
             throw new CayenneRuntimeException("Only ApplicationProjects are supported.");
         }
         else {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAction.java Tue Feb  2 13:06:56 2010
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.modeler.action;
 
 import java.awt.Toolkit;
@@ -26,7 +25,9 @@
 import javax.swing.KeyStroke;
 
 import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.project.Project;
+import org.apache.cayenne.pref.Domain;
+import org.apache.cayenne.project2.Project;
+import org.apache.cayenne.project2.ProjectSaver;
 
 /**
  * An action that saves a project using to its default location.
@@ -42,14 +43,42 @@
     }
 
     public KeyStroke getAcceleratorKey() {
-        return KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
+        return KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit
+                .getDefaultToolkit()
+                .getMenuShortcutKeyMask());
     }
 
     public String getIconName() {
         return "icon-save.gif";
     }
 
-    protected boolean chooseDestination(Project p) {
-        return (p.isLocationUndefined()) ? super.chooseDestination(p) : true;
+    @Override
+    protected boolean saveAll() throws Exception {
+        Project p = getCurrentProject();
+        // obtain preference object before save, when the project path may change.....
+        Domain preference = getProjectController().getPreferenceDomainForProject();
+
+        if (p.getConfigurationResource() == null) {
+            return super.saveAll();
+        }
+
+        getProjectController().getProjectWatcher().pauseWatching();
+
+        ProjectSaver saver = getApplication().getInjector().getInstance(
+                ProjectSaver.class);
+        saver.save(p);
+
+        preference.rename(p.getConfigurationResource().getURL().getPath());
+
+        getApplication().getFrameController().addToLastProjListAction(
+                p.getConfigurationResource().getURL().getPath());
+        Application.getFrame().fireRecentFileListChanged();
+
+        /**
+         * Reset the watcher now
+         */
+        getProjectController().getProjectWatcher().reconfigure();
+
+        return true;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/SaveAsAction.java Tue Feb  2 13:06:56 2010
@@ -23,6 +23,8 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.File;
+import java.net.URL;
+import java.util.List;
 
 import javax.swing.JOptionPane;
 import javax.swing.KeyStroke;
@@ -33,9 +35,12 @@
 import org.apache.cayenne.modeler.dialog.validator.ValidatorDialog;
 import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.pref.Domain;
-import org.apache.cayenne.project.Project;
 import org.apache.cayenne.project.ProjectPath;
-import org.apache.cayenne.project.validator.Validator;
+import org.apache.cayenne.project.validator.ValidationInfo;
+import org.apache.cayenne.project2.Project;
+import org.apache.cayenne.project2.ProjectSaver;
+import org.apache.cayenne.project2.validate.ConfigurationValidationVisitor;
+import org.apache.cayenne.resource.URLResource;
 
 /**
  * A "Save As" action that allows user to pick save location.
@@ -75,26 +80,32 @@
         // obtain preference object before save, when the project path may change.....
         Domain preference = getProjectController().getPreferenceDomainForProject();
 
-        if (!chooseDestination(p)) {
+        File projectDir = fileChooser.newProjectDir(Application.getFrame(), p);
+        if (projectDir == null) {
             return false;
         }
         
-        if (p.getMainFile().exists() && !p.getMainFile().canWrite()) {
+        if (projectDir.exists() && !projectDir.canWrite()) {
             JOptionPane.showMessageDialog(Application.getFrame(),
-                    "Can't save project - unable to write to file \"" + p.getMainFile().getPath() + "\"",
+                    "Can't save project - unable to write to file \"" + projectDir.getPath() + "\"",
                     "Can't Save Project", JOptionPane.OK_OPTION);
             return false;
         }
         
         getProjectController().getProjectWatcher().pauseWatching();
         
-        p.save();
+        URL url = projectDir.toURL();
+        
+        URLResource res = new URLResource(url);
+        ///!!!!!!!!!!!!!!!!!!! SAVE AS!!!!!!!!!!!!!!
+        ProjectSaver saver = getApplication().getInjector().getInstance(ProjectSaver.class);
+        saver.saveAs(p, res);
 
         // update preferences domain key
-        preference.rename(p.getMainFile().getAbsolutePath());
-
+        preference.rename(projectDir.getPath());
+        
         getApplication().getFrameController().addToLastProjListAction(
-                p.getMainFile().getAbsolutePath());
+                p.getConfigurationResource().getURL().getPath());
         Application.getFrame().fireRecentFileListChanged();
 
         /**
@@ -105,16 +116,6 @@
         return true;
     }
 
-    protected boolean chooseDestination(Project p) {
-        File projectDir = fileChooser.newProjectDir(Application.getFrame(), p);
-        if (projectDir == null) {
-            return false;
-        }
-
-        p.setProjectDirectory(projectDir);
-        return true;
-    }
-
     /**
      * This method is synchronized to prevent problems on double-clicking "save".
      */
@@ -123,8 +124,10 @@
     }
 
     public synchronized void performAction(int warningLevel) {
-        Validator val = getCurrentProject().getValidator();
-        int validationCode = val.validate();
+        
+        ConfigurationValidationVisitor validatVisitor = new ConfigurationValidationVisitor(getCurrentProject());
+        List<ValidationInfo> object = (List<ValidationInfo>) getCurrentProject().getRootNode().acceptVisitor(validatVisitor);
+        int validationCode = validatVisitor.getMaxSeverity();
 
         // If no serious errors, perform save.
         if (validationCode < ValidationDisplayHandler.ERROR) {
@@ -142,7 +145,7 @@
 
         // If there were errors or warnings at validation, display them
         if (validationCode >= warningLevel) {
-            ValidatorDialog.showDialog(Application.getFrame(), val);
+            ValidatorDialog.showDialog(Application.getFrame(), object);
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ValidateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ValidateAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ValidateAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ValidateAction.java Tue Feb  2 13:06:56 2010
@@ -23,6 +23,7 @@
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
+import java.util.List;
 
 import javax.swing.KeyStroke;
 
@@ -30,9 +31,10 @@
 import org.apache.cayenne.modeler.dialog.validator.ValidationDisplayHandler;
 import org.apache.cayenne.modeler.dialog.validator.ValidatorDialog;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.Project;
 import org.apache.cayenne.project.ProjectPath;
-import org.apache.cayenne.project.validator.Validator;
+import org.apache.cayenne.project.validator.ValidationInfo;
+import org.apache.cayenne.project2.Project;
+import org.apache.cayenne.project2.validate.ConfigurationValidationVisitor;
 
 /**
  * UI action that performs full project validation.
@@ -58,15 +60,18 @@
 	 * Validates project for possible conflicts and incomplete mappings.
 	 */
 	public void performAction(ActionEvent e) {
-		Validator val = getCurrentProject().getValidator();
-		int validationCode = val.validate();
 
+        ConfigurationValidationVisitor validatVisitor = new ConfigurationValidationVisitor(getCurrentProject());
+        List<ValidationInfo> object = (List<ValidationInfo>) getCurrentProject().getRootNode().acceptVisitor(validatVisitor);
+        int validationCode = validatVisitor.getMaxSeverity();
+        
+        
 		// If there were errors or warnings at validation, display them
 		if (validationCode >= ValidationDisplayHandler.WARNING) {
-			ValidatorDialog.showDialog(Application.getFrame(), val);
+			ValidatorDialog.showDialog(Application.getFrame(), object);
 		}
 		else {
-			ValidatorDialog.showValidationSuccess(Application.getFrame(), val);
+			ValidatorDialog.showValidationSuccess(Application.getFrame());
 		}
 	}
 	

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/FindDialog.java Tue Feb  2 13:06:56 2010
@@ -36,7 +36,7 @@
 import javax.swing.JTable;
 import javax.swing.tree.TreePath;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
@@ -60,6 +60,8 @@
 import org.apache.cayenne.modeler.event.QueryDisplayEvent;
 import org.apache.cayenne.modeler.event.RelationshipDisplayEvent;
 import org.apache.cayenne.modeler.util.CayenneController;
+import org.apache.cayenne.query.AbstractQuery;
+import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.Query;
 
 /**
@@ -90,64 +92,55 @@
         Iterator it = paths.iterator();
         int index = 0;
         while (it.hasNext()) {
-            Object[] path = (Object[]) it.next();
+            Object path = it.next();
 
-            if (path[path.length - 1] instanceof ObjEntity) {
-                objEntityNames.put(
-                        new Integer(index++),
-                        ((ObjEntity) path[path.length - 1]).getName());
-            }
-
-            if (path[path.length - 1] instanceof DbEntity) {
-                dbEntityNames.put(
-                        new Integer(index++),
-                        ((DbEntity) path[path.length - 1]).getName());
-            }
-
-            if (path[path.length - 1] instanceof Query) {
-                queryNames.put(new Integer(index++), ((Query) path[path.length - 1])
-                        .getName());
-            }
-
-            if (path[path.length - 1] instanceof Embeddable) {
-                
-                String name = ((Embeddable) path[path.length - 1]).getClassName();
-                embeddableNames.put(
-                        new Integer(index++),
-                        name);
-            }
-            
-            if (path[path.length - 1] instanceof EmbeddableAttribute) {
-                
-                Object parentObject = ((EmbeddableAttribute) path[path.length - 1]).getEmbeddable();
-                String parName = getParentName(path, parentObject);
-                embeddableAttributeNames.put(new Integer(index++), parName
+            if (path instanceof ObjEntity) {
+                objEntityNames.put(new Integer(index++), ((ObjEntity) path).getName());
+            }
+
+            else if (path instanceof DbEntity) {
+                dbEntityNames.put(new Integer(index++), ((DbEntity) path).getName());
+            }
+
+            else if (path instanceof Query) {
+                queryNames.put(new Integer(index++), ((Query) path).getName());
+            }
+
+            else if (path instanceof Embeddable) {
+                String name = ((Embeddable) path).getClassName();
+                embeddableNames.put(new Integer(index++), name);
+            }
+
+            else if (path instanceof EmbeddableAttribute) {
+                Embeddable parentObject = ((EmbeddableAttribute) path).getEmbeddable();
+                embeddableAttributeNames.put(new Integer(index++), parentObject
+                        .getClassName()
                         + "."
-                        + ((EmbeddableAttribute) path[path.length - 1]).getName());
+                        + ((EmbeddableAttribute) path).getName());
             }
-            if (path[path.length - 1] instanceof Attribute) {
-                Object parentObject = ((Attribute) path[path.length - 1]).getParent();
-                attrNames.put(new Integer(index++), getParentName(path, parentObject)
+            else if (path instanceof Attribute) {
+                Object parentObject = ((Attribute) path).getParent();
+                attrNames.put(new Integer(index++), getParentName(parentObject)
                         + "."
-                        + ((Attribute) path[path.length - 1]).getName());
+                        + ((Attribute) path).getName());
             }
 
-            if (path[path.length - 1] instanceof Relationship) {
-                Object parentObject = ((Relationship) path[path.length - 1]).getParent();
+            else if (path instanceof Relationship) {
+                Object parentObject = ((Relationship) path).getParent();
 
                 /*
                  * relationships are different from attributes in that they do not
                  * correctly return the owning entity when inheritance is involved.
                  * Hopefully this will be reconciled in the future relases
                  */
-                String parentName = getParentName(path, parentObject);
-                if (!parentObject.equals(path[path.length - 2])) {
-                    parentName = ((ObjEntity) path[path.length - 2]).getName();
-                }
+                String parentName = getParentName(parentObject);
+                // if (!parentObject.equals(path)) {
+                // parentName = ((ObjEntity) path[path.length - 2]).getName();
+                // }
 
                 relatNames.put(new Integer(index++), parentName
                         + "."
-                        + ((Relationship) path[path.length - 1]).getName());
+                        + ((Relationship) path).getName());
             }
         }
 
@@ -196,133 +189,155 @@
         table.getSelectionModel().setSelectionInterval(0, 0);
     }
 
-    public static void jumpToResult(Object[] path) {
-    	EditorView editor = ((CayenneModelerFrame) Application.getInstance()
+    public static void jumpToResult(Object path) {
+        EditorView editor = ((CayenneModelerFrame) Application
+                .getInstance()
                 .getFrameController()
                 .getView()).getView();
-    	
-        if (path[path.length - 1] instanceof Entity) {
+        DataChannelDescriptor domain = (DataChannelDescriptor) getApplication()
+                .getInstance()
+                .getProject()
+                .getRootNode();
+        if (path instanceof Entity) {
 
+            Object[] o = new Object[3];
+            o[0] = domain;
+            o[1] = ((Entity) path).getDataMap();
+            o[2] = (Entity) path;
             /** Make selection in a project tree, open correspondent entity tab */
             editor.getProjectTreeView().getSelectionModel().setSelectionPath(
-                    buildTreePath(path, editor));
+                    buildTreePath(o, editor));
             EntityDisplayEvent event = new EntityDisplayEvent(
                     editor.getProjectTreeView(),
-                    (Entity) path[path.length - 1],
-                    (DataMap) path[path.length - 2],
-                    (DataDomain) path[path.length - 3]);
+                    (Entity) path,
+                    ((Entity) path).getDataMap(),
+                    domain);
             event.setMainTabFocus(true);
 
-            if (path[path.length - 1] instanceof ObjEntity)
+            if (path instanceof ObjEntity)
                 editor.getObjDetailView().currentObjEntityChanged(event);
-            if (path[path.length - 1] instanceof DbEntity)
+            if (path instanceof DbEntity)
                 editor.getDbDetailView().currentDbEntityChanged(event);
         }
-        
-        if (path[path.length - 1] instanceof Query) {
+        else if (path instanceof Query) {
+
+            DataMap dmForQuery = null;
+
+            if (path instanceof EJBQLQuery) {
+                dmForQuery = ((EJBQLQuery) path).getDataMap();
+            }
+            if (path instanceof AbstractQuery) {
+                dmForQuery = ((AbstractQuery) path).getDataMap();
+            }
+
+            Object[] o = new Object[3];
+            o[0] = domain;
+            o[1] = dmForQuery;
+            o[2] = (Query) path;
 
             /** Make selection in a project tree, open correspondent entity tab */
             editor.getProjectTreeView().getSelectionModel().setSelectionPath(
-                    buildTreePath(path, editor));
+                    buildTreePath(o, editor));
             QueryDisplayEvent event = new QueryDisplayEvent(
                     editor.getProjectTreeView(),
-                    (Query) path[path.length - 1],
-                    (DataMap) path[path.length - 2],
-                    (DataDomain) path[path.length - 3]);
+                    (Query) path,
+                    (DataMap) dmForQuery,
+                    domain);
 
             editor.currentQueryChanged(event);
         }
-        
-        if (path[path.length - 1] instanceof Embeddable) {
+
+        else if (path instanceof Embeddable) {
+
+            Object[] o = new Object[3];
+            o[0] = domain;
+            o[1] = ((Embeddable) path).getDataMap();
+            o[2] = (Embeddable) path;
 
             /** Make selection in a project tree, open correspondent entity tab */
             editor.getProjectTreeView().getSelectionModel().setSelectionPath(
-                    buildTreePath(path, editor));
-            EmbeddableDisplayEvent event = new EmbeddableDisplayEvent(
-                    editor.getProjectTreeView(),
-                    (Embeddable) path[path.length - 1],
-                    (DataMap) path[path.length - 2],
-                    (DataDomain) path[path.length - 3]);
+                    buildTreePath(o, editor));
+            EmbeddableDisplayEvent event = new EmbeddableDisplayEvent(editor
+                    .getProjectTreeView(), (Embeddable) path, ((Embeddable) path)
+                    .getDataMap(), domain);
             event.setMainTabFocus(true);
 
             editor.currentEmbeddableChanged(event);
         }
-        
-        if (path[path.length - 1] instanceof EmbeddableAttribute) {
+
+        else if (path instanceof EmbeddableAttribute) {
 
             /** Make selection in a project tree, open correspondent embeddable tab */
-            Object[] o = new Object[path.length - 1];
-            for (int i = 0; i < path.length - 1; i++)
-                o[i] = path[i];
+            Object[] o = new Object[3];
+            o[0] = domain;
+            o[1] = ((EmbeddableAttribute) path).getEmbeddable().getDataMap();
+            o[2] = ((EmbeddableAttribute) path).getEmbeddable();
+
             editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                     buildTreePath(o, editor));
-            
+
             EmbeddableAttributeDisplayEvent event = new EmbeddableAttributeDisplayEvent(
                     editor.getProjectTreeView(),
-                    (Embeddable) path[path.length - 2],
-                    (EmbeddableAttribute) path[path.length - 1],
-                    (DataMap) path[path.length - 3],
-                    (DataDomain) path[path.length - 4]);
+                    ((EmbeddableAttribute) path).getEmbeddable(),
+                    (EmbeddableAttribute) path,
+                    ((EmbeddableAttribute) path).getEmbeddable().getDataMap(),
+                    domain);
             event.setMainTabFocus(true);
 
             editor.getEmbeddableView().currentEmbeddableAttributeChanged(event);
         }
-        
-        if (path[path.length - 1] instanceof Attribute
-                || path[path.length - 1] instanceof Relationship) {
+
+        else if (path instanceof Attribute || path instanceof Relationship) {
 
             /** Make selection in a project tree, open correspondent attributes tab */
-            Object[] o = new Object[path.length - 1];
-            for (int i = 0; i < path.length - 1; i++)
-                o[i] = path[i];
+            Object[] o = new Object[3];
+            o[0] = domain;
+            if (path instanceof Attribute) {
+                o[1] = ((Attribute) path).getEntity().getDataMap();
+                o[2] = ((Attribute) path).getEntity();
+            }
+            else {
+                o[1] = ((Relationship) path).getSourceEntity().getDataMap();
+                o[2] = ((Relationship) path).getSourceEntity();
+            }
             editor.getProjectTreeView().getSelectionModel().setSelectionPath(
                     buildTreePath(o, editor));
 
-            if (path[path.length - 1] instanceof DbAttribute) {
-                AttributeDisplayEvent event = new AttributeDisplayEvent(
-                        editor.getProjectTreeView(),
-                        (Attribute) path[path.length - 1],
-                        (Entity) path[path.length - 2],
-                        (DataMap) path[path.length - 3],
-                        (DataDomain) path[path.length - 4]);
+            if (path instanceof DbAttribute) {
+                AttributeDisplayEvent event = new AttributeDisplayEvent(editor
+                        .getProjectTreeView(), (Attribute) path, ((Attribute) path)
+                        .getEntity(), ((Attribute) path).getEntity().getDataMap(), domain);
                 event.setMainTabFocus(true);
                 editor.getDbDetailView().currentDbAttributeChanged(event);
             }
 
-            if (path[path.length - 1] instanceof ObjAttribute) {
-                AttributeDisplayEvent event = new AttributeDisplayEvent(
-                        editor.getProjectTreeView(),
-                        (Attribute) path[path.length - 1],
-                        (Entity) path[path.length - 2],
-                        (DataMap) path[path.length - 3],
-                        (DataDomain) path[path.length - 4]);
+            if (path instanceof ObjAttribute) {
+                AttributeDisplayEvent event = new AttributeDisplayEvent(editor
+                        .getProjectTreeView(), (Attribute) path, ((Attribute) path)
+                        .getEntity(), ((Attribute) path).getEntity().getDataMap(), domain);
                 event.setMainTabFocus(true);
                 editor.getObjDetailView().currentObjAttributeChanged(event);
             }
 
-            if (path[path.length - 1] instanceof DbRelationship) {
-                RelationshipDisplayEvent event = new RelationshipDisplayEvent(
-                        editor.getProjectTreeView(),
-                        (Relationship) path[path.length - 1],
-                        (Entity) path[path.length - 2],
-                        (DataMap) path[path.length - 3],
-                        (DataDomain) path[path.length - 4]);
+            if (path instanceof DbRelationship) {
+                RelationshipDisplayEvent event = new RelationshipDisplayEvent(editor
+                        .getProjectTreeView(), (Relationship) path, ((Relationship) path)
+                        .getSourceEntity(), ((Relationship) path)
+                        .getSourceEntity()
+                        .getDataMap(), domain);
                 event.setMainTabFocus(true);
                 editor.getDbDetailView().currentDbRelationshipChanged(event);
             }
+            if (path instanceof ObjRelationship) {
+                RelationshipDisplayEvent event = new RelationshipDisplayEvent(editor
+                        .getProjectTreeView(), (Relationship) path, ((Relationship) path)
+                        .getSourceEntity(), ((Relationship) path)
+                        .getSourceEntity()
+                        .getDataMap(), domain);
+                event.setMainTabFocus(true);
+                editor.getObjDetailView().currentObjRelationshipChanged(event);
+            }
         }
-
-        if (path[path.length - 1] instanceof ObjRelationship) {
-            RelationshipDisplayEvent event = new RelationshipDisplayEvent(
-                    editor.getProjectTreeView(),
-                    (Relationship) path[path.length - 1],
-                    (Entity) path[path.length - 2],
-                    (DataMap) path[path.length - 3],
-                    (DataDomain) path[path.length - 4]);
-            event.setMainTabFocus(true);
-            editor.getObjDetailView().currentObjRelationshipChanged(event);
-        }
-
     }
 
     private class JumpToResultActionListener implements MouseListener {
@@ -333,7 +348,7 @@
             JLabel label = (JLabel) table.getModel().getValueAt(selectedLine, 0);
             Integer index = (Integer) FindDialogView.getLabelAndObjectIndex().get(label);
 
-            Object[] path = (Object[]) paths.get(index);
+            Object path = paths.get(index);
             jumpToResult(path);
         }
 
@@ -348,6 +363,7 @@
 
         public void mouseReleased(MouseEvent e) {
         }
+
     }
 
     private class JumpToResultsKeyListener implements KeyListener {
@@ -398,7 +414,7 @@
         return new TreePath(mutableTreeNodes);
     }
 
-    private String getParentName(Object[] path, Object parentObject) {
+    private String getParentName(Object parentObject) {
         String nameParent = null;
 
         if (parentObject instanceof ObjEntity) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/datadomain/CacheSyncConfigController.java Tue Feb  2 13:06:56 2010
@@ -22,9 +22,9 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DataRowStore;
 import org.apache.cayenne.configuration.event.DomainEvent;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -75,7 +75,9 @@
      * model to update subviews on model changes.
      */
     public void startup() {
-        DataDomain domain = eventController.getCurrentDataDomain();
+        
+        DataChannelDescriptor domain = (DataChannelDescriptor)eventController.getProject().getRootNode();
+        
         String factory = (String) domain.getProperties().get(
                 DataRowStore.EVENT_BRIDGE_FACTORY_PROPERTY);
 
@@ -157,7 +159,7 @@
             SPanel card = (SPanel) existingCards.get(topModel.getFactoryLabel());
             CacheSyncConfigModel model = (CacheSyncConfigModel) card.getShownModel();
 
-            DataDomain domain = eventController.getCurrentDataDomain();
+            DataChannelDescriptor domain = (DataChannelDescriptor)eventController.getProject().getRootNode();
 
             logObj.warn("domain properties BEFORE: " + domain.getProperties());
             model.storeProperties(domain.getProperties());
@@ -241,7 +243,7 @@
             model = new CacheSyncConfigModel();
         }
 
-        model.setMap(new HashMap(eventController.getCurrentDataDomain().getProperties()));
+        model.setMap(new HashMap(((DataChannelDescriptor)eventController.getProject().getRootNode()).getProperties()));
         model.setFactoryClass(factory);
         model.addModelChangeListener(this);
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DBGeneratorOptions.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DBGeneratorOptions.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DBGeneratorOptions.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DBGeneratorOptions.java Tue Feb  2 13:06:56 2010
@@ -254,7 +254,7 @@
         fc.setDialogType(JFileChooser.SAVE_DIALOG);
         fc.setDialogTitle("Save SQL Script");
 
-        File projectDir = Application.getProject().getProjectDirectory();
+        File projectDir = new File(Application.getProject().getConfigurationResource().getURL().getPath());
 
         if (projectDir != null) {
             fc.setCurrentDirectory(projectDir);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java Tue Feb  2 13:06:56 2010
@@ -34,6 +34,7 @@
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.DbLoader;
 import org.apache.cayenne.access.DbLoaderDelegate;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.event.DataMapEvent;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.map.DataMap;
@@ -355,8 +356,7 @@
 
             if (!existingMap) {
                 dataMap = (DataMap) NamedObjectFactory.createObject(DataMap.class, null);
-                dataMap.setName(NamedObjectFactory.createName(DataMap.class, mediator
-                        .getCurrentDataDomain()));
+                dataMap.setName(NamedObjectFactory.createName(DataMap.class, (DataChannelDescriptor)mediator.getProject().getRootNode()));
                 dataMap.setDefaultSchema(schemaName);
             }
 
@@ -411,7 +411,7 @@
                 mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(
                         Application.getFrame(),
                         dataMap,
-                        mediator.getCurrentDataDomain(),
+                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
                         mediator.getCurrentDataNode()));
             }
             else {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/MergerOptions.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/MergerOptions.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/MergerOptions.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/MergerOptions.java Tue Feb  2 13:06:56 2010
@@ -33,9 +33,8 @@
 import javax.swing.WindowConstants;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
-
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
@@ -61,7 +60,8 @@
 import org.apache.cayenne.modeler.event.RelationshipDisplayEvent;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
 import org.apache.cayenne.modeler.util.CayenneController;
-import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project2.Project;
+import org.apache.cayenne.resource.Resource;
 import org.apache.cayenne.swing.BindingBuilder;
 import org.apache.cayenne.swing.ObjectBinding;
 import org.apache.cayenne.validation.ValidationResult;
@@ -260,8 +260,8 @@
         final ProjectController c = getProjectController();
         
         final Object src = this;
-        final DataDomain domain = getProjectController().getCurrentDataDomain();
-        final DataNode node = getProjectController().getCurrentDataNode();
+        final DataChannelDescriptor domain = (DataChannelDescriptor)getProjectController().getProject().getRootNode();
+        final DataNodeDescriptor node = getProjectController().getCurrentDataNode();
 
         final ModelMergeDelegate delegate = new ModelMergeDelegate (){
 
@@ -413,11 +413,11 @@
         JFileChooser fc = new JFileChooser();
         fc.setDialogType(JFileChooser.SAVE_DIALOG);
         fc.setDialogTitle("Save SQL Script");
-
-        File projectDir = Application.getProject().getProjectDirectory();
+        
+        Resource projectDir = Application.getProject().getConfigurationResource();
 
         if (projectDir != null) {
-            fc.setCurrentDirectory(projectDir);
+            fc.setCurrentDirectory(new File(projectDir.getURL().getPath()));//projectDir);
         }
 
         if (fc.showSaveDialog(getView()) == JFileChooser.APPROVE_OPTION) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/TableSelectorController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/TableSelectorController.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/TableSelectorController.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/TableSelectorController.java Tue Feb  2 13:06:56 2010
@@ -22,7 +22,6 @@
 import java.awt.Component;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,7 +35,7 @@
 import org.apache.cayenne.modeler.dialog.validator.ValidationDisplayHandler;
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.project.validator.ValidationInfo;
-import org.apache.cayenne.project.validator.Validator;
+import org.apache.cayenne.project2.validate.ConfigurationValidationVisitor;
 import org.apache.cayenne.swing.BindingBuilder;
 import org.apache.cayenne.swing.ObjectBinding;
 import org.apache.cayenne.swing.TableBindingBuilder;
@@ -55,7 +54,6 @@
     protected List<DbEntity> selectableTablesList;
 
     protected Map validationMessages;
-  
 
     public TableSelectorController(ProjectController parent) {
         super(parent);
@@ -181,13 +179,18 @@
         // TODO: this is inefficient.. we need targeted validation
         // instead of doing it on the whole project
 
-        Validator validator = ((ProjectController) getParent())
+        ConfigurationValidationVisitor validatVisitor = new ConfigurationValidationVisitor(
+                ((ProjectController) getParent()).getProject());
+        List<ValidationInfo> object = (List<ValidationInfo>) getApplication()
                 .getProject()
-                .getValidator();
-        int validationCode = validator.validate();
+                .getRootNode()
+                .acceptVisitor(validatVisitor);
+        
+        int validationCode = validatVisitor.getMaxSeverity();
+
         if (validationCode >= ValidationDisplayHandler.WARNING) {
 
-            for (ValidationInfo nextProblem : validator.validationResults()) {
+            for (ValidationInfo nextProblem : object) {
                 Entity failedEntity = null;
 
                 if (nextProblem.getValidatedObject() instanceof DbAttribute) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialog.java Tue Feb  2 13:06:56 2010
@@ -41,6 +41,7 @@
 import javax.swing.table.TableColumn;
 import javax.swing.tree.TreePath;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -610,8 +611,7 @@
                 MapEvent.CHANGE));
 
         EntityDisplayEvent event = new EntityDisplayEvent(this, mediator
-                .getCurrentObjEntity(), mediator.getCurrentDataMap(), mediator
-                .getCurrentDataDomain());
+                .getCurrentObjEntity(), mediator.getCurrentDataMap(), (DataChannelDescriptor)mediator.getProject().getRootNode());
 
         mediator.fireObjEntityDisplayEvent(event);
 
@@ -623,7 +623,7 @@
                 attributeSaved,
                 mediator.getCurrentObjEntity(),
                 mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain());
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
 
         mediator.fireObjAttributeDisplayEvent(eventAttr);
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/query/QueryTypeController.java Tue Feb  2 13:06:56 2010
@@ -19,7 +19,7 @@
 
 package org.apache.cayenne.modeler.dialog.query;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.event.QueryEvent;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.event.MapEvent;
@@ -49,13 +49,13 @@
 
 	protected ProjectController mediator;
 	protected DataMap dataMap;
-	protected DataDomain domain;
+	protected DataChannelDescriptor domain;
 	protected Query query;
 
 	public QueryTypeController(ProjectController mediator) {
 		this.mediator = mediator;
 		this.dataMap = mediator.getCurrentDataMap();
-		this.domain = mediator.getCurrentDataDomain();
+		this.domain = (DataChannelDescriptor)mediator.getProject().getRootNode();
 	}
 
 	@Override
@@ -113,7 +113,7 @@
 				new CreateQueryUndoableEdit(domain, dataMap, query));
 
 		// notify listeners
-		fireQueryEvent(this, mediator, domain, dataMap, query);
+		fireQueryEvent(this, mediator,dataMap, query);
 		shutdown();
 	}
 
@@ -121,10 +121,10 @@
 	 * Fires events when a query was added
 	 */
 	public static void fireQueryEvent(Object src, ProjectController mediator,
-			DataDomain domain, DataMap dataMap, Query query) {
+			DataMap dataMap, Query query) {
 		mediator.fireQueryEvent(new QueryEvent(src, query, MapEvent.ADD,
 				dataMap));
 		mediator.fireQueryDisplayEvent(new QueryDisplayEvent(src, query,
-				dataMap, domain));
+				dataMap, (DataChannelDescriptor)mediator.getProject().getRootNode()));
 	}
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/AttributeErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/AttributeErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/AttributeErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/AttributeErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -22,7 +22,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
@@ -66,7 +66,7 @@
         }
 
         if (len >= 4) {
-            domain = (DataDomain) path[len - 4];
+            domain = (DataChannelDescriptor) path[len - 4];
         }
 
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataMapErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -22,7 +22,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.event.DataMapDisplayEvent;
@@ -50,7 +50,7 @@
         }
 
         if (len >= 2) {
-            domain = (DataDomain) path[len - 2];
+            domain = (DataChannelDescriptor) path[len - 2];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataNodeErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataNodeErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataNodeErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DataNodeErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -22,8 +22,8 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.event.DataNodeDisplayEvent;
 import org.apache.cayenne.project.validator.ValidationInfo;
@@ -33,7 +33,7 @@
  * 
  */
 public class DataNodeErrorMsg extends ValidationDisplayHandler {
-	protected DataNode node;
+	protected DataNodeDescriptor node;
 
     /**
      * Constructor for DataNodeErrorMsg.
@@ -45,11 +45,11 @@
         int len = path.length;
 
         if (len >= 1) {
-            node = (DataNode) path[len - 1];
+            node = (DataNodeDescriptor) path[len - 1];
         }
 
         if (len >= 2) {
-            domain = (DataDomain) path[len - 2];
+            domain = (DataChannelDescriptor) path[len - 2];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DomainErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DomainErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DomainErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/DomainErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -22,7 +22,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.event.DomainDisplayEvent;
 import org.apache.cayenne.project.validator.ValidationInfo;
@@ -44,7 +44,7 @@
         int len = path.length;
 
         if (len >= 1) {
-            domain = (DataDomain) path[len - 1];
+            domain = (DataChannelDescriptor) path[len - 1];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableAttributeErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableAttributeErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableAttributeErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableAttributeErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -20,7 +20,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.map.EmbeddableAttribute;
@@ -52,7 +52,7 @@
         }
 
         if (len >= 4) {
-            domain = (DataDomain) path[len - 4];
+            domain = (DataChannelDescriptor) path[len - 4];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EmbeddableErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -20,7 +20,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.modeler.ProjectController;
@@ -49,7 +49,7 @@
         }
 
         if (len >= 3) {
-            domain = (DataDomain) path[len - 3];
+            domain = (DataChannelDescriptor) path[len - 3];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EntityErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EntityErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EntityErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/EntityErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -22,7 +22,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Entity;
@@ -58,7 +58,7 @@
         }
 
         if (len >= 3) {
-            domain = (DataDomain) path[len - 3];
+            domain = (DataChannelDescriptor) path[len - 3];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.modeler.ProjectController;
@@ -38,7 +38,9 @@
 
     public void displayField(ProjectController mediator, JFrame frame) {
 		ProjectPath path = super.validationInfo.getPath();
-		DataDomain domain = path.firstInstanceOf(DataDomain.class);
+		
+		DataChannelDescriptor domain = (DataChannelDescriptor)mediator.getProject().getRootNode(); 
+		
 		DataMap map = path.firstInstanceOf(DataMap.class);
 		Procedure procedure = path.firstInstanceOf(Procedure.class);
 	

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureParameterErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureParameterErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureParameterErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ProcedureParameterErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.map.ProcedureParameter;
@@ -41,7 +41,9 @@
 
     public void displayField(ProjectController mediator, JFrame frame) {
         ProjectPath path = super.validationInfo.getPath();
-        DataDomain domain = path.firstInstanceOf(DataDomain.class);
+        
+        DataChannelDescriptor domain = (DataChannelDescriptor)mediator.getProject().getRootNode();
+        
         DataMap map = path.firstInstanceOf(DataMap.class);
         Procedure procedure = path.firstInstanceOf(Procedure.class);
         ProcedureParameter procedureParameter = path

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/QueryErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/QueryErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/QueryErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/QueryErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.event.QueryDisplayEvent;
@@ -40,7 +40,7 @@
 
     public void displayField(ProjectController mediator, JFrame frame) {
         ProjectPath path = super.validationInfo.getPath();
-        DataDomain domain = path.firstInstanceOf(DataDomain.class);
+        DataChannelDescriptor domain = (DataChannelDescriptor)mediator.getProject().getRootNode();
         DataMap map = path.firstInstanceOf(DataMap.class);
         Query query = path.firstInstanceOf(Query.class);
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/RelationshipErrorMsg.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/RelationshipErrorMsg.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/RelationshipErrorMsg.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/RelationshipErrorMsg.java Tue Feb  2 13:06:56 2010
@@ -22,7 +22,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Entity;
@@ -65,7 +65,7 @@
         }
 
         if (len >= 4) {
-            domain = (DataDomain) path[len - 4];
+            domain = (DataChannelDescriptor) path[len - 4];
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidationDisplayHandler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidationDisplayHandler.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidationDisplayHandler.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidationDisplayHandler.java Tue Feb  2 13:06:56 2010
@@ -21,8 +21,7 @@
 
 import javax.swing.JFrame;
 
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Embeddable;
@@ -32,6 +31,7 @@
 import org.apache.cayenne.map.ProcedureParameter;
 import org.apache.cayenne.map.Relationship;
 import org.apache.cayenne.modeler.ProjectController;
+import org.apache.cayenne.modeler.pref.DataNodeDefaults;
 import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.project.validator.ValidationInfo;
 import org.apache.cayenne.query.Query;
@@ -51,7 +51,7 @@
     public static final int ERROR = ValidationInfo.ERROR;
 
     protected ValidationInfo validationInfo;
-    protected DataDomain domain;
+    protected DataChannelDescriptor domain;
 
     public static ValidationDisplayHandler getErrorMsg(ValidationInfo result) {
         Object validatedObj = result.getValidatedObject();
@@ -72,13 +72,13 @@
         else if (validatedObj instanceof Entity) {
             msg = new EntityErrorMsg(result);
         }
-        else if (validatedObj instanceof DataNode) {
+        else if (validatedObj instanceof DataNodeDefaults) {
             msg = new DataNodeErrorMsg(result);
         }
         else if (validatedObj instanceof DataMap) {
             msg = new DataMapErrorMsg(result);
         }
-        else if (validatedObj instanceof DataDomain) {
+        else if (validatedObj instanceof DataChannelDescriptor) {
             msg = new DomainErrorMsg(result);
         }
         else if (validatedObj instanceof Procedure) {
@@ -118,11 +118,11 @@
         return validationInfo.getSeverity();
     }
 
-    public DataDomain getDomain() {
+    public DataChannelDescriptor getDomain() {
         return domain;
     }
 
-    public void setDomain(DataDomain domain) {
+    public void setDomain(DataChannelDescriptor domain) {
         this.domain = domain;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidatorDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidatorDialog.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidatorDialog.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/validator/ValidatorDialog.java Tue Feb  2 13:06:56 2010
@@ -46,7 +46,6 @@
 import org.apache.cayenne.modeler.action.ValidateAction;
 import org.apache.cayenne.modeler.util.CayenneDialog;
 import org.apache.cayenne.project.validator.ValidationInfo;
-import org.apache.cayenne.project.validator.Validator;
 
 import com.jgoodies.forms.builder.PanelBuilder;
 import com.jgoodies.forms.layout.CellConstraints;
@@ -68,22 +67,18 @@
     protected JButton refreshButton;
     protected List validationObjects;
 
-    public static synchronized void showDialog(
-            CayenneModelerFrame editor,
-            Validator validator) {
-
+    public static synchronized void showDialog(CayenneModelerFrame frame, List<ValidationInfo> object) {
         if (instance == null) {
-            instance = new ValidatorDialog(editor);
+            instance = new ValidatorDialog(frame);
             instance.centerWindow();
         }
 
-        instance.refreshFromModel(validator);
+        instance.refreshFromModel(object);
         instance.setVisible(true);
     }
 
     public static synchronized void showValidationSuccess(
-            CayenneModelerFrame editor,
-            Validator val) {
+            CayenneModelerFrame editor) {
 
         if (instance != null) {
             instance.dispose();
@@ -183,8 +178,8 @@
         });
     }
 
-    protected void refreshFromModel(Validator validator) {
-        validationObjects = validator.validationResults();
+    protected void refreshFromModel(List<ValidationInfo> object) {
+        validationObjects = object;
         problemsTable.setModel(new ValidatorTableModel());
     }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataDomainView.java Tue Feb  2 13:06:56 2010
@@ -35,8 +35,8 @@
 import org.apache.cayenne.access.DataRowStore;
 import org.apache.cayenne.cache.MapQueryCacheFactory;
 import org.apache.cayenne.cache.OSQueryCacheFactory;
-import org.apache.cayenne.conf.Configuration;
 import org.apache.cayenne.configuration.event.DomainEvent;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.dialog.datadomain.CacheSyncConfigController;
@@ -46,7 +46,6 @@
 import org.apache.cayenne.modeler.util.ProjectUtil;
 import org.apache.cayenne.modeler.util.TextAdapter;
 import org.apache.cayenne.pref.Domain;
-import org.apache.cayenne.project.ApplicationProject;
 import org.apache.cayenne.util.Util;
 import org.apache.cayenne.validation.ValidationException;
 
@@ -255,7 +254,10 @@
      */
     protected void setDomainProperty(String property, String value, String defaultValue) {
 
-        DataDomain domain = projectController.getCurrentDataDomain();
+        DataChannelDescriptor domain = (DataChannelDescriptor) projectController
+                .getProject()
+                .getRootNode();
+
         if (domain == null) {
             return;
         }
@@ -281,7 +283,11 @@
     }
 
     public String getDomainProperty(String property, String defaultValue) {
-        DataDomain domain = projectController.getCurrentDataDomain();
+
+        DataChannelDescriptor domain = (DataChannelDescriptor) projectController
+                .getProject()
+                .getRootNode();
+
         if (domain == null) {
             return null;
         }
@@ -299,7 +305,7 @@
      * selected domain.
      */
     public void currentDomainChanged(DomainDisplayEvent e) {
-        DataDomain domain = e.getDomain();
+        DataChannelDescriptor domain = e.getDomain();
         if (null == domain) {
             return;
         }
@@ -343,26 +349,18 @@
             throw new ValidationException("Enter name for DataDomain");
         }
 
-        Configuration configuration = ((ApplicationProject) Application.getProject())
-                .getConfiguration();
-        
-        DataDomain domain = projectController.getCurrentDataDomain();
-
-        DataDomain matchingDomain = configuration.getDomain(newName);
-
-        if (matchingDomain == null) {
-            Domain prefs = projectController.getPreferenceDomainForDataDomain();
-
-            DomainEvent e = new DomainEvent(this, domain, domain.getName());
-            ProjectUtil.setDataDomainName(configuration, domain, newName);
-            prefs.rename(newName);
-            projectController.fireDomainEvent(e);
-        }
-        else if (matchingDomain != domain) {
-            throw new ValidationException("There is another DataDomain named '"
-                    + newName
-                    + "'. Use a different name.");
-        }
+        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor) Application
+                .getProject()
+                .getRootNode();
+        Domain prefs = projectController.getPreferenceDomainForDataDomain();
+
+        DomainEvent e = new DomainEvent(
+                this,
+                dataChannelDescriptor,
+                dataChannelDescriptor.getName());
+        ProjectUtil.setDataDomainName(dataChannelDescriptor, newName);
+        prefs.rename(newName);
+        projectController.fireDomainEvent(e);
     }
 
     void setCacheSize(String text) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/DataMapView.java Tue Feb  2 13:06:56 2010
@@ -32,11 +32,10 @@
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
-import org.apache.cayenne.conf.Configuration;
 import org.apache.cayenne.configuration.event.DataMapEvent;
 import org.apache.cayenne.configuration.event.DataNodeEvent;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.modeler.Application;
@@ -53,7 +52,6 @@
 import org.apache.cayenne.modeler.util.Comparators;
 import org.apache.cayenne.modeler.util.ProjectUtil;
 import org.apache.cayenne.modeler.util.TextAdapter;
-import org.apache.cayenne.project.ApplicationProject;
 import org.apache.cayenne.util.Util;
 import org.apache.cayenne.validation.ValidationException;
 
@@ -291,7 +289,8 @@
 
         quoteSQLIdentifiers.setSelected(map.isQuotingSQLIdentifiers());
         // rebuild data node list
-        Object nodes[] = eventController.getCurrentDataDomain().getDataNodes().toArray();
+        
+        Object nodes[] = ((DataChannelDescriptor) eventController.getProject().getRootNode()).getNodeDescriptors().toArray();
 
         // add an empty item to the front
         Object[] objects = new Object[nodes.length + 1];
@@ -307,8 +306,8 @@
 
         // find selected node
         for (int i = 0; i < nodes.length; i++) {
-            DataNode node = (DataNode) nodes[i];
-            if (node.getDataMaps().contains(map)) {
+            DataNodeDescriptor node = (DataNodeDescriptor) nodes[i];
+            if (node.getDataMapNames().contains(map.getName())) {
                 model.setSelectedItem(node);
                 break;
             }
@@ -505,25 +504,11 @@
 
         // search for matching map name across domains, as currently they have to be
         // unique globally
-        Configuration config = ((ApplicationProject) Application.getProject())
-                .getConfiguration();
-
-        DataMap matchingMap = null;
-
-        for (DataDomain domain : config.getDomains()) {
-            DataMap nextMap = domain.getMap(newName);
-
-            if (nextMap == map) {
-                continue;
-            }
+        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor)Application.getProject().getRootNode();
 
-            if (nextMap != null) {
-                matchingMap = nextMap;
-                break;
-            }
-        }
+        DataMap matchingMap = dataChannelDescriptor.getDataMap(newName);
 
-        if (matchingMap != null) {
+        if (matchingMap != null && !matchingMap.equals(map)) {
 
             // there is an entity with the same name
             throw new ValidationException("There is another DataMap named '"
@@ -537,17 +522,17 @@
         // completely new name, set new name for domain
         DataMapDefaults pref = eventController.getDataMapPreferences("");
         DataMapEvent e = new DataMapEvent(this, map, map.getName());
-        ProjectUtil.setDataMapName(eventController.getCurrentDataDomain(), map, newName);
+        ProjectUtil.setDataMapName((DataChannelDescriptor)eventController.getProject().getRootNode(), map, newName);
         pref.rename(newName);
         eventController.fireDataMapEvent(e);
     }
 
     void setDataNode() {
-        DataNode node = (DataNode) nodeSelector.getSelectedItem();
+        DataNodeDescriptor node = (DataNodeDescriptor) nodeSelector.getSelectedItem();
         DataMap map = eventController.getCurrentDataMap();
 
         // no change?
-        if (node != null && node.getDataMaps().contains(map)) {
+        if (node != null && node.getDataMapNames().contains(map.getName())) {
             return;
         }
 
@@ -555,12 +540,12 @@
 
         // unlink map from any nodes
 
-        for (DataNode nextNode : eventController.getCurrentDataDomain().getDataNodes()) {
+        for (DataNodeDescriptor nextNode : ((DataChannelDescriptor)eventController.getProject().getRootNode()).getNodeDescriptors()) {
 
             // Theoretically only one node may contain a datamap at each given time.
             // Being paranoid, we will still scan through all.
-            if (nextNode != node && nextNode.getDataMaps().contains(map)) {
-                nextNode.removeDataMap(map.getName());
+            if (nextNode != node && nextNode.getDataMapNames().contains(map.getName())) {
+                nextNode.getDataMapNames().remove(map.getName());
 
                 // announce DataNode change
                 eventController.fireDataNodeEvent(new DataNodeEvent(this, nextNode));
@@ -571,17 +556,12 @@
 
         // link to a selected node
         if (node != null) {
-            node.addDataMap(map);
+            node.getDataMapNames().add(map.getName());
             hasChanges = true;
 
             // announce DataNode change
             eventController.fireDataNodeEvent(new DataNodeEvent(this, node));
         }
-
-        if (hasChanges) {
-            // TODO: maybe reindexing is an overkill in the modeler?
-            eventController.getCurrentDataDomain().reindexNodes();
-        }
     }
 
     void updateDefaultSchema() {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryScriptsTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryScriptsTab.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryScriptsTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/EjbqlQueryScriptsTab.java Tue Feb  2 13:06:56 2010
@@ -30,12 +30,13 @@
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.event.QueryEvent;
+import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.modeler.ProjectController;
-import org.apache.cayenne.modeler.undo.JTextFieldUndoListener;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
-import org.apache.cayenne.project.validator.EJBQLQueryValidator;
-import org.apache.cayenne.project.validator.EJBQLQueryValidator.PositionException;
+import org.apache.cayenne.project2.validate.EJBQLQueryValidator;
+import org.apache.cayenne.project2.validate.EJBQLQueryValidator.PositionException;
 import org.apache.cayenne.query.EJBQLQuery;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.swing.components.textpane.JCayenneTextPane;
@@ -46,7 +47,7 @@
     protected ProjectController mediator;
     protected JCayenneTextPane scriptArea;
     private boolean updateDisabled;
-    protected EJBQLQueryValidator ejbqlQueryValidator = new EJBQLQueryValidator();
+    protected EJBQLQueryValidator  ejbqlQueryValidator = new EJBQLQueryValidator();
 
     public EjbqlQueryScriptsTab(ProjectController mediator) {
         this.mediator = mediator;
@@ -215,7 +216,7 @@
     void validateEJBQL() {
         PositionException positionException = ejbqlQueryValidator.validateEJBQL(
                 getQuery(),
-                mediator.getCurrentDataDomain());
+                new EntityResolver(((DataChannelDescriptor)mediator.getProject().getRootNode()).getDataMaps()));
         if (positionException != null) {
             if (positionException.getBeginLine() != null
                     || positionException.getBeginColumn() != null



Mime
View raw message