cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r905616 [2/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/ProjectTreeView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectTreeView.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,6 @@
 
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Enumeration;
@@ -37,8 +36,6 @@
 import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
 
-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.DataMapListener;
 import org.apache.cayenne.configuration.event.DataNodeEvent;
@@ -49,6 +46,8 @@
 import org.apache.cayenne.configuration.event.ProcedureListener;
 import org.apache.cayenne.configuration.event.QueryEvent;
 import org.apache.cayenne.configuration.event.QueryListener;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.Embeddable;
@@ -63,7 +62,6 @@
 import org.apache.cayenne.modeler.action.CopyAction;
 import org.apache.cayenne.modeler.action.CreateDataMapAction;
 import org.apache.cayenne.modeler.action.CreateDbEntityAction;
-import org.apache.cayenne.modeler.action.CreateDomainAction;
 import org.apache.cayenne.modeler.action.CreateEmbeddableAction;
 import org.apache.cayenne.modeler.action.CreateNodeAction;
 import org.apache.cayenne.modeler.action.CreateObjEntityAction;
@@ -92,10 +90,11 @@
 import org.apache.cayenne.modeler.event.QueryDisplayListener;
 import org.apache.cayenne.modeler.util.CellRenderers;
 import org.apache.cayenne.modeler.util.Comparators;
-import org.apache.cayenne.project.Project;
 import org.apache.cayenne.project.ProjectPath;
+import org.apache.cayenne.project2.Project;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.reflect.PropertyUtils;
+import org.apache.cayenne.resource.Resource;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -199,11 +198,12 @@
     }
 
     private void initFromModel(Project project) {
+        
         // build model
         ProjectTreeModel model = new ProjectTreeModel(project);
-        setRootVisible(false);
+        setRootVisible(true);
         setModel(model);
-
+        
         // expand top level
         getSelectionModel().setSelectionMode(
                 TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
@@ -246,8 +246,9 @@
 
         // Project - return the name of top file
         if (value instanceof Project) {
-            File f = ((Project) value).getMainFile();
-            return (f != null) ? f.getPath() : "";
+
+            Resource resource = ((Project) value).getConfigurationResource();
+            return (resource != null) ? resource.getURL().getPath() : "";
         }
 
         // read name property
@@ -349,7 +350,8 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        mediator.findDomain(e.getProcedure().getDataMap()),
+                       // mediator.findDomain(e.getProcedure().getDataMap()),
+                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
                         e.getProcedure().getDataMap()
                 });
 
@@ -366,7 +368,7 @@
     public void procedureChanged(ProcedureEvent e) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    mediator.findDomain(e.getProcedure().getDataMap()),
+                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
                     e.getProcedure().getDataMap(), e.getProcedure()
             };
 
@@ -379,7 +381,7 @@
     public void procedureRemoved(ProcedureEvent e) {
 
         removeNode(new Object[] {
-                mediator.findDomain(e.getProcedure().getDataMap()),
+                (DataChannelDescriptor)mediator.getProject().getRootNode(),
                 e.getProcedure().getDataMap(), e.getProcedure()
         });
     }
@@ -388,8 +390,9 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                                .getDataMap()), e.getDataMap()
+                        e.getDomain() != null ? e.getDomain() : 
+                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                                e.getDataMap()
                 });
 
         if (node == null) {
@@ -406,8 +409,9 @@
 
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                            .getDataMap()), e.getQuery()
+                    e.getDomain() != null ? e.getDomain() : 
+                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                            e.getQuery()
             };
 
             updateNode(path);
@@ -418,8 +422,9 @@
 
     public void queryRemoved(QueryEvent e) {
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                        .getDataMap()), e.getDataMap(), e.getQuery()
+                e.getDomain() != null ? e.getDomain() : 
+                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                        e.getDataMap(), e.getQuery()
         });
     }
 
@@ -437,26 +442,13 @@
         }
     }
 
-    public void domainAdded(DomainEvent e) {
-        DataDomain dataDomain = e.getDomain();
-        DefaultMutableTreeNode newNode = ProjectTreeModel.wrapProjectNode(dataDomain);
-
-        positionNode(null, newNode, Comparators.getNamedObjectComparator());
-        showNode(newNode);
-    }
-
-    public void domainRemoved(DomainEvent e) {
-        removeNode(new Object[] {
-            e.getDomain()
-        });
-    }
-
     public void dataNodeChanged(DataNodeEvent e) {
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                                .getDataNode()), e.getDataNode()
+                        e.getDomain() != null ? e.getDomain() : 
+                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                                e.getDataNode()
                 });
 
         if (node != null) {
@@ -470,10 +462,11 @@
 
                 getProjectModel().nodeChanged(node);
 
+                DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
+                
                 // check for DataMap additions/removals...
-
-                Object[] maps = e.getDataNode().getDataMaps().toArray();
-                int mapCount = maps.length;
+                Object[] mapsName = e.getDataNode().getDataMapNames().toArray();
+                int mapCount = mapsName.length;
 
                 // DataMap was linked
                 if (mapCount > node.getChildCount()) {
@@ -483,7 +476,7 @@
                         for (int j = 0; j < node.getChildCount(); j++) {
                             DefaultMutableTreeNode child = (DefaultMutableTreeNode) node
                                     .getChildAt(j);
-                            if (maps[i] == child.getUserObject()) {
+                            if (domain.getDataMap(mapsName[i].toString()) == child.getUserObject()) {
                                 found = true;
                                 break;
                             }
@@ -491,7 +484,7 @@
 
                         if (!found) {
                             DefaultMutableTreeNode newMapNode = new DefaultMutableTreeNode(
-                                    maps[i],
+                                    domain.getDataMap(mapsName[i].toString()),
                                     false);
                             positionNode(node, newMapNode, Comparators
                                     .getNamedObjectComparator());
@@ -507,7 +500,7 @@
                         child = (DefaultMutableTreeNode) node.getChildAt(j);
                         Object obj = child.getUserObject();
                         for (int i = 0; i < mapCount; i++) {
-                            if (maps[i] == obj) {
+                            if (domain.getDataMap(mapsName[i].toString()) == obj) {
                                 found = true;
                                 break;
                             }
@@ -529,16 +522,16 @@
 
         DefaultMutableTreeNode node = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                            .getDataNode())
+                    e.getDomain() != null ? e.getDomain() : 
+                        (DataChannelDescriptor)mediator.getProject().getRootNode()
                 });
 
         if (node == null) {
             return;
         }
 
-        DataNode dataNode = e.getDataNode();
-        DefaultMutableTreeNode currentNode = ProjectTreeModel.wrapProjectNode(dataNode);
+        DataNodeDescriptor dataNode = e.getDataNode();
+        DefaultMutableTreeNode currentNode = ProjectTreeFactory.wrapProjectNode(dataNode);
         positionNode(node, currentNode, Comparators.getDataDomainChildrenComparator());
         showNode(currentNode);
     }
@@ -549,16 +542,18 @@
         }
 
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                        .getDataNode()), e.getDataNode()
+                e.getDomain() != null ? e.getDomain() : 
+                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                        e.getDataNode()
         });
     }
 
     public void dataMapChanged(DataMapEvent e) {
 
         Object[] path = new Object[] {
-                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                        .getDataMap()), e.getDataMap()
+                e.getDomain() != null ? e.getDomain() : 
+                    (DataChannelDescriptor)mediator.getProject().getRootNode()
+                        , e.getDataMap()
         };
 
         updateNode(path);
@@ -572,11 +567,10 @@
     public void dataMapAdded(DataMapEvent e) {
         DefaultMutableTreeNode domainNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                            .getDataMap())
+                    e.getDomain() != null ? e.getDomain() : (DataChannelDescriptor)mediator.getProject().getRootNode()
                 });
 
-        DefaultMutableTreeNode newMapNode = ProjectTreeModel.wrapProjectNode(e
+        DefaultMutableTreeNode newMapNode = ProjectTreeFactory.wrapProjectNode(e
                 .getDataMap());
         positionNode(domainNode, newMapNode, Comparators
                 .getDataDomainChildrenComparator());
@@ -585,17 +579,15 @@
 
     public void dataMapRemoved(DataMapEvent e) {
         DataMap map = e.getDataMap();
-        DataDomain domain = e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                .getDataMap());
-
+        DataChannelDescriptor dataChannelDescriptor = (DataChannelDescriptor)Application.getProject().getRootNode();
         removeNode(new Object[] {
-                domain, map
+                dataChannelDescriptor, map
         });
 
         // Clean up map from the nodes
-        for (DataNode dataNode : new ArrayList<DataNode>(domain.getDataNodes())) {
+        for (DataNodeDescriptor dataNode : new ArrayList<DataNodeDescriptor>(dataChannelDescriptor.getNodeDescriptors())) {
             removeNode(new Object[] {
-                    domain, dataNode, map
+                    dataChannelDescriptor, dataNode, map
             });
         }
     }
@@ -635,9 +627,9 @@
     protected void entityChanged(EntityEvent e) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                            .getEntity()
-                            .getDataMap()), e.getEntity().getDataMap(), e.getEntity()
+                    e.getDomain() != null ? e.getDomain() : 
+                        (DataChannelDescriptor)mediator.getProject().getRootNode()
+                            , e.getEntity().getDataMap(), e.getEntity()
             };
 
             updateNode(path);
@@ -656,9 +648,9 @@
 
         DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                                .getEntity()
-                                .getDataMap()), e.getEntity().getDataMap()
+                        e.getDomain() != null ? e.getDomain() :
+                            (DataChannelDescriptor)mediator.getProject().getRootNode()
+                                , e.getEntity().getDataMap()
                 });
 
         if (mapNode == null) {
@@ -681,9 +673,9 @@
 
         // remove from DataMap tree
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : mediator.findDomain(e
-                        .getEntity()
-                        .getDataMap()), e.getEntity().getDataMap(), e.getEntity()
+                e.getDomain() != null ? e.getDomain() :
+                    (DataChannelDescriptor)mediator.getProject().getRootNode()
+                        , e.getEntity().getDataMap(), e.getEntity()
         });
     }
 
@@ -790,49 +782,51 @@
         Object[] data = getUserObjects(currentNode);
         if (data.length == 0) {
             // this should clear the right-side panel
-            mediator.fireDomainDisplayEvent(new DomainDisplayEvent(this, null));
+            DomainDisplayEvent domEvent = new DomainDisplayEvent(this, null);
+            domEvent.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
+            mediator.fireDomainDisplayEvent(domEvent);
             return;
         }
 
         Object obj = data[data.length - 1];
-        if (obj instanceof DataDomain) {
+        if (obj instanceof DataChannelDescriptor) {
             mediator
-                    .fireDomainDisplayEvent(new DomainDisplayEvent(this, (DataDomain) obj));
+                    .fireDomainDisplayEvent(new DomainDisplayEvent(this, (DataChannelDescriptor) obj));
         }
         else if (obj instanceof DataMap) {
-            if (data.length == 3) {
+            if (data.length == 2) {
                 mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(
                         this,
                         (DataMap) obj,
-                        (DataDomain) data[data.length - 3],
-                        (DataNode) data[data.length - 2]));
+                        (DataChannelDescriptor) mediator.getProject().getRootNode(),
+                        (DataNodeDescriptor) data[data.length - 2]));
             }
-            else if (data.length == 2) {
+            else if (data.length == 1) {
                 mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(
                         this,
                         (DataMap) obj,
-                        (DataDomain) data[data.length - 2]));
+                        (DataChannelDescriptor) mediator.getProject().getRootNode()));
             }
         }
-        else if (obj instanceof DataNode) {
-            if (data.length == 2) {
+        else if (obj instanceof DataNodeDescriptor) {
+            if (data.length == 1) {
                 mediator.fireDataNodeDisplayEvent(new DataNodeDisplayEvent(
                         this,
-                        (DataDomain) data[data.length - 2],
-                        (DataNode) obj));
+                        (DataChannelDescriptor) mediator.getProject().getRootNode() ,
+                        (DataNodeDescriptor) obj));
             }
         }
         else if (obj instanceof Entity) {
             EntityDisplayEvent e = new EntityDisplayEvent(this, (Entity) obj);
             e.setUnselectAttributes(true);
-            if (data.length == 4) {
+            if (data.length == 3) {
                 e.setDataMap((DataMap) data[data.length - 2]);
-                e.setDomain((DataDomain) data[data.length - 4]);
-                e.setDataNode((DataNode) data[data.length - 3]);
+                e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
+                e.setDataNode((DataNodeDescriptor) data[data.length - 3]);
             }
-            else if (data.length == 3) {
+            else if (data.length == 2) {
                 e.setDataMap((DataMap) data[data.length - 2]);
-                e.setDomain((DataDomain) data[data.length - 3]);
+                e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
             }
 
             if (obj instanceof ObjEntity) {
@@ -847,7 +841,7 @@
                     this,
                     (Embeddable) obj,
                     (DataMap) data[data.length - 2],
-                    (DataDomain) data[data.length - 3]);
+                    (DataChannelDescriptor) mediator.getProject().getRootNode());
             mediator.fireEmbeddableDisplayEvent(e);
         }
         else if (obj instanceof Procedure) {
@@ -855,7 +849,7 @@
                     this,
                     (Procedure) obj,
                     (DataMap) data[data.length - 2],
-                    (DataDomain) data[data.length - 3]);
+                    (DataChannelDescriptor) mediator.getProject().getRootNode());
             mediator.fireProcedureDisplayEvent(e);
         }
         else if (obj instanceof Query) {
@@ -863,7 +857,7 @@
                     this,
                     (Query) obj,
                     (DataMap) data[data.length - 2],
-                    (DataDomain) data[data.length - 3]);
+                    (DataChannelDescriptor) mediator.getProject().getRootNode());
             mediator.fireQueryDisplayEvent(e);
         }
 
@@ -920,7 +914,6 @@
     private JPopupMenu createJPopupMenu() {
         JPopupMenu popup = new JPopupMenu();
 
-        popup.add(buildMenu(CreateDomainAction.getActionName()));
         popup.add(buildMenu(CreateNodeAction.getActionName()));
         popup.add(buildMenu(CreateDataMapAction.getActionName()));
 
@@ -984,7 +977,9 @@
 
         DefaultMutableTreeNode mapNode = getProjectModel().getNodeForObjectPath(
                 new Object[] {
-                        e.getDomain() != null ? e.getDomain() : mediator.findDomain(map),
+                        e.getDomain() != null ? e.getDomain() : 
+                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                            //mediator.findDomain(map),
                         map
                 });
 
@@ -1000,7 +995,8 @@
     public void embeddableChanged(EmbeddableEvent e, DataMap map) {
         if (e.isNameChange()) {
             Object[] path = new Object[] {
-                    e.getDomain() != null ? e.getDomain() : mediator.findDomain(map),
+                    e.getDomain() != null ? e.getDomain() :
+                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
                     map, e.getEmbeddable()
             };
 
@@ -1017,7 +1013,9 @@
 
         // remove from DataMap tree
         removeNode(new Object[] {
-                e.getDomain() != null ? e.getDomain() : mediator.findDomain(map), map,
+                e.getDomain() != null ? e.getDomain() : 
+                    (DataChannelDescriptor)mediator.getProject().getRootNode(),
+                    map,
                 e.getEmbeddable()
         });
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectWatchdog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectWatchdog.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectWatchdog.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ProjectWatchdog.java Tue Feb  2 13:06:56 2010
@@ -19,16 +19,17 @@
 package org.apache.cayenne.modeler;
 
 import java.io.File;
-import java.util.List;
+import java.util.Iterator;
 
 import javax.swing.JOptionPane;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.action.OpenProjectAction;
 import org.apache.cayenne.modeler.action.SaveAction;
 import org.apache.cayenne.modeler.dialog.FileDeletedDialog;
 import org.apache.cayenne.modeler.util.FileWatchdog;
-import org.apache.cayenne.project.Project;
-import org.apache.cayenne.project.ProjectFile;
+import org.apache.cayenne.project2.Project;
 
 /**
  * ProjectWatchdog class is responsible for tracking changes in cayenne.xml and other
@@ -61,14 +62,19 @@
         removeAllFiles();
 
         Project project = mediator.getProject();
+
         if (project != null // project opened
-                && project.getProjectDirectory() != null) // not new project
+                && project.getConfigurationResource() != null) // not new project
         {
-            String projectPath = project.getProjectDirectory().getPath() + File.separator;
+            String projectPath = project.getConfigurationResource().getURL().getPath() + File.separator;
+            addFile(projectPath);
 
-            List<ProjectFile> files = project.buildFileList();
-            for (ProjectFile pr : files)
-                addFile(projectPath + pr.getLocation());
+            Iterator<DataMap> it = ((DataChannelDescriptor)project.getRootNode()).getDataMaps().iterator();
+            while (it.hasNext()) {
+                DataMap dm = it.next();
+                addFile(dm.getConfigurationSource().getURL().getPath());
+            }
+            
         }
 
         resumeWatching();
@@ -82,10 +88,10 @@
              * Currently we are reloading all project
              */
             if (mediator.getProject() != null) {
+                
+                File fileDirectory = new File(mediator.getProject().getConfigurationResource().getURL().getPath());
                 ((OpenProjectAction) Application.getInstance().getAction(
-                        OpenProjectAction.getActionName())).openProject(mediator
-                        .getProject()
-                        .getMainFile());
+                        OpenProjectAction.getActionName())).openProject(fileDirectory);
             }
 
         }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateAttributeAction.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,7 @@
 
 import java.awt.event.ActionEvent;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -95,13 +95,13 @@
             ObjAttribute attr = (ObjAttribute) NamedObjectFactory.createObject(
                     ObjAttribute.class,
                     objEntity);
-
-            createObjAttribute(mediator.getCurrentDataDomain(), mediator
+            
+            createObjAttribute(mediator
                     .getCurrentDataMap(), objEntity, attr);
 
             application.getUndoManager().addEdit(
                     new CreateAttributeUndoableEdit(
-                            mediator.getCurrentDataDomain(),
+                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
                             mediator.getCurrentDataMap(),
                             objEntity,
                             attr));
@@ -113,12 +113,13 @@
                     DbAttribute.class,
                     dbEntity);
 
-            createDbAttribute(mediator.getCurrentDataDomain(), mediator
+            createDbAttribute(
+                    mediator
                     .getCurrentDataMap(), dbEntity, attr);
 
             application.getUndoManager().addEdit(
                     new CreateAttributeUndoableEdit(
-                            mediator.getCurrentDataDomain(),
+                            (DataChannelDescriptor)mediator.getProject().getRootNode(),
                             mediator.getCurrentDataMap(),
                             dbEntity,
                             attr));
@@ -148,20 +149,19 @@
                 embeddable,
                 attr,
                 mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain());
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
 
         mediator.fireEmbeddableAttributeDisplayEvent(e);
     }
 
     public void createObjAttribute(
-            DataDomain domain,
             DataMap map,
             ObjEntity objEntity,
             ObjAttribute attr) {
 
         ProjectController mediator = getProjectController();
         objEntity.addAttribute(attr);
-        fireObjAttributeEvent(this, mediator, domain, map, objEntity, attr);
+        fireObjAttributeEvent(this, mediator, map, objEntity, attr);
     }
 
     /**
@@ -170,7 +170,6 @@
     static void fireObjAttributeEvent(
             Object src,
             ProjectController mediator,
-            DataDomain domain,
             DataMap map,
             ObjEntity objEntity,
             ObjAttribute attr) {
@@ -180,6 +179,8 @@
                 attr,
                 objEntity,
                 MapEvent.ADD));
+        
+        DataChannelDescriptor domain = (DataChannelDescriptor)mediator.getProject().getRootNode();
 
         AttributeDisplayEvent ade = new AttributeDisplayEvent(
                 src,
@@ -192,13 +193,12 @@
     }
 
     public void createDbAttribute(
-            DataDomain domain,
             DataMap map,
             DbEntity dbEntity,
             DbAttribute attr) {
         dbEntity.addAttribute(attr);
         ProjectController mediator = getProjectController();
-        fireDbAttributeEvent(this, mediator, domain, map, dbEntity, attr);
+        fireDbAttributeEvent(this, mediator, map, dbEntity, attr);
     }
 
     /**
@@ -207,7 +207,6 @@
     static void fireDbAttributeEvent(
             Object src,
             ProjectController mediator,
-            DataDomain domain,
             DataMap map,
             DbEntity dbEntity,
             DbAttribute attr) {
@@ -222,7 +221,7 @@
                 attr,
                 dbEntity,
                 map,
-                domain);
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
 
         mediator.fireDbAttributeDisplayEvent(ade);
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDataMapAction.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,7 @@
 
 import java.awt.event.ActionEvent;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
@@ -29,6 +29,7 @@
 import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.project.NamedObjectFactory;
 import org.apache.cayenne.project.ProjectPath;
+import org.apache.cayenne.resource.Resource;
 
 /**
  * Action that creates new DataMap in the project.
@@ -51,14 +52,15 @@
     }
 
     /** Calls addDataMap() or creates new data map if no data node selected. */
-    public void createDataMap(DataDomain domain, DataMap map) {
+    public void createDataMap(DataMap map) {
         ProjectController mediator = getProjectController();
         mediator.addDataMap(this, map);
     }
 
     public void performAction(ActionEvent e) {
         ProjectController mediator = getProjectController();
-        DataDomain currentDomain = mediator.getCurrentDataDomain();
+       
+        DataChannelDescriptor currentDomain =  (DataChannelDescriptor)mediator.getProject().getRootNode();
 
         // use domain name as DataMap base, as map names must be unique across the
         // project...
@@ -67,7 +69,15 @@
                 currentDomain,
                 currentDomain.getName() + "Map");
 
-        createDataMap(currentDomain, map);
+        // set configuration source for new dataMap 
+        Resource baseResource = currentDomain.getConfigurationSource();
+
+        Resource dataMapResource = baseResource
+                .getRelativeResource(map.getName());
+        
+        map.setConfigurationSource(dataMapResource);
+        
+        createDataMap(map);
 
         application.getUndoManager().addEdit(
                 new CreateDataMapUndoableEdit(currentDomain, map));
@@ -81,6 +91,6 @@
             return false;
         }
 
-        return path.firstInstanceOf(DataDomain.class) != null;
+        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateDbEntityAction.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.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.event.EntityEvent;
@@ -77,8 +78,7 @@
     static void fireDbEntityEvent(Object src, ProjectController mediator, DbEntity entity) {
         mediator.fireDbEntityEvent(new EntityEvent(src, entity, MapEvent.ADD));
         EntityDisplayEvent displayEvent = new EntityDisplayEvent(src, entity, mediator
-                .getCurrentDataMap(), mediator.getCurrentDataNode(), mediator
-                .getCurrentDataDomain());
+                .getCurrentDataMap(), mediator.getCurrentDataNode(),  (DataChannelDescriptor)mediator.getProject().getRootNode());
         displayEvent.setMainTabFocus(true);
         mediator.fireDbEntityDisplayEvent(displayEvent);
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateEmbeddableAction.java Tue Feb  2 13:06:56 2010
@@ -20,6 +20,7 @@
 
 import java.awt.event.ActionEvent;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.map.event.EmbeddableEvent;
@@ -81,7 +82,7 @@
                 src,
                 embeddable,
                 dataMap,
-                mediator.getCurrentDataDomain());
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
         displayEvent.setMainTabFocus(true);
         mediator.fireEmbeddableDisplayEvent(displayEvent);
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateNodeAction.java Tue Feb  2 13:06:56 2010
@@ -21,13 +21,11 @@
 
 import java.awt.event.ActionEvent;
 
-import javax.sql.DataSource;
-
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.dbsync.SkipSchemaUpdateStrategy;
 import org.apache.cayenne.conf.DriverDataSourceFactory;
 import org.apache.cayenne.configuration.event.DataNodeEvent;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.conn.DataSourceInfo;
 import org.apache.cayenne.map.event.MapEvent;
 import org.apache.cayenne.modeler.Application;
@@ -35,9 +33,7 @@
 import org.apache.cayenne.modeler.event.DataNodeDisplayEvent;
 import org.apache.cayenne.modeler.undo.CreateNodeUndoableEdit;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.modeler.util.ModelerDbAdapter;
 import org.apache.cayenne.project.NamedObjectFactory;
-import org.apache.cayenne.project.ProjectDataSource;
 import org.apache.cayenne.project.ProjectPath;
 
 /**
@@ -67,15 +63,15 @@
      * @see org.apache.cayenne.modeler.util.CayenneAction#performAction(ActionEvent)
      */
     public void performAction(ActionEvent e) {
-        DataNode node = buildDataNode();
-        createDataNode(getProjectController().getCurrentDataDomain(), node);
+        DataNodeDescriptor node = buildDataNode();
+        createDataNode(node);
         application.getUndoManager().addEdit(
-                new CreateNodeUndoableEdit(application, getProjectController()
-                        .getCurrentDataDomain(), node));
+                new CreateNodeUndoableEdit(application,node));
     }
 
-    public void createDataNode(DataDomain domain, DataNode node) {
-        domain.addNode(node);
+    public void createDataNode(DataNodeDescriptor node) {
+        DataChannelDescriptor domain = (DataChannelDescriptor)getProjectController().getProject().getRootNode();
+        domain.getNodeDescriptors().add(node);
         getProjectController().fireDataNodeEvent(
                 new DataNodeEvent(this, node, MapEvent.ADD));
         getProjectController().fireDataNodeDisplayEvent(
@@ -90,27 +86,26 @@
             return false;
         }
 
-        return path.firstInstanceOf(DataDomain.class) != null;
+        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
     }
 
     /**
      * Creates a new DataNode, adding to the current domain, but doesn't send any events.
      */
-    public DataNode buildDataNode() {
+    public DataNodeDescriptor buildDataNode() {
         ProjectController mediator = getProjectController();
-        DataDomain domain = mediator.getCurrentDataDomain();
+        DataChannelDescriptor domain =  (DataChannelDescriptor)mediator.getProject().getRootNode();
 
         // use domain name as DataNode base, as node names must be unique across the
         // project...
-        DataNode node = buildDataNode(domain);
-
-        ProjectDataSource src = new ProjectDataSource(new DataSourceInfo());
-        node.setDataSource(src);
-        node.setAdapter(new ModelerDbAdapter(src));
+        DataNodeDescriptor node =  buildDataNode(domain);
 
+        DataSourceInfo src = new DataSourceInfo();
+        node.setDataSourceDescriptor(src);
+        
         // by default create JDBC Node
-        node.setDataSourceFactory(DriverDataSourceFactory.class.getName());
-        node.setSchemaUpdateStrategyName(SkipSchemaUpdateStrategy.class.getName());
+        node.setDataSourceFactoryType(DriverDataSourceFactory.class.getName());
+        node.setSchemaUpdateStrategyType(SkipSchemaUpdateStrategy.class.getName());
 
         return node;
     }
@@ -118,17 +113,19 @@
     /**
      * A factory method that makes a new DataNode.
      */
-    DataNode buildDataNode(DataDomain domain) {
-        String name = NamedObjectFactory.createName(DataNode.class, domain, domain
+    DataNodeDescriptor buildDataNode(DataChannelDescriptor domain) {
+        String name = NamedObjectFactory.createName(DataNodeDescriptor.class, domain, domain
                 .getName()
                 + "Node");
 
+        
         // ensure that DataNode exposes DataSource directly, so that UI widgets could work
         // with it.
-        return new DataNode(name) {
+        return new DataNodeDescriptor(name) 
+        {
 
-            public DataSource getDataSource() {
-                return dataSource;
+            public DataSourceInfo getDataSourceDescriptor() {
+                return dataSourceDescriptor;
             }
         };
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateObjEntityAction.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.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.ObjEntity;
@@ -143,7 +144,7 @@
                 entity,
                 dataMap,
                 mediator.getCurrentDataNode(),
-                mediator.getCurrentDataDomain());
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
         displayEvent.setMainTabFocus(true);
         mediator.fireObjEntityDisplayEvent(displayEvent);
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureAction.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.configuration.event.ProcedureEvent;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Procedure;
@@ -76,7 +77,7 @@
                 src,
                 procedure,
                 mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain()));
+                (DataChannelDescriptor)mediator.getProject().getRootNode()));
     }
 
     public void createProcedure(DataMap map, Procedure procedure) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateProcedureParameterAction.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.configuration.event.ProcedureParameterEvent;
 import org.apache.cayenne.map.Procedure;
 import org.apache.cayenne.map.ProcedureParameter;
@@ -91,7 +92,7 @@
                     parameter,
                     procedure,
                     mediator.getCurrentDataMap(),
-                    mediator.getCurrentDataDomain()));
+                    (DataChannelDescriptor)mediator.getProject().getRootNode()));
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateQueryAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateQueryAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateQueryAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateQueryAction.java Tue Feb  2 13:06:56 2010
@@ -21,7 +21,7 @@
 
 import java.awt.event.ActionEvent;
 
-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;
@@ -62,7 +62,7 @@
         new QueryTypeController(getProjectController()).startup();
     }
     
-    public void createQuery(DataDomain domain, DataMap dataMap, Query query) {
+    public void createQuery(DataChannelDescriptor domain, DataMap dataMap, Query query) {
         dataMap.addQuery(query);
         // notify listeners
         fireQueryEvent(this, getProjectController(), domain, dataMap, query);
@@ -71,7 +71,7 @@
     /**
      * Fires events when a query was added
      */
-    public static void fireQueryEvent(Object src, ProjectController mediator, DataDomain domain,
+    public static void fireQueryEvent(Object src, ProjectController mediator, DataChannelDescriptor domain,
             DataMap dataMap, Query query) {
         mediator.fireQueryEvent(new QueryEvent(src, query, MapEvent.ADD, dataMap));
         mediator.fireQueryDisplayEvent(new QueryDisplayEvent(src, query, dataMap, domain));

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/CreateRelationshipAction.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.DbEntity;
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.Entity;
@@ -126,7 +127,7 @@
                 rel,
                 objEntity,
                 mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain());
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
 
         mediator.fireObjRelationshipDisplayEvent(rde);
     }
@@ -160,7 +161,7 @@
                 rel,
                 dbEntity,
                 mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain());
+                (DataChannelDescriptor)mediator.getProject().getRootNode());
 
         mediator.fireDbRelationshipDisplayEvent(rde);
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DBWizardAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DBWizardAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DBWizardAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DBWizardAction.java Tue Feb  2 13:06:56 2010
@@ -19,16 +19,17 @@
 
 package org.apache.cayenne.modeler.action;
 
-import org.apache.cayenne.access.DataNode;
+import java.util.Collection;
+
 import org.apache.cayenne.conf.DriverDataSourceFactory;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.pref.DBConnectionInfo;
 import org.apache.cayenne.modeler.pref.DataNodeDefaults;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.modeler.util.ModelerDbAdapter;
-import org.apache.cayenne.project.ProjectDataSource;
 
 /**
  */
@@ -40,15 +41,21 @@
 
     // ==== Guessing user preferences... *****
 
-    protected DataNode getPreferredNode() {
+    protected DataNodeDescriptor getPreferredNode() {
         ProjectController projectController = getProjectController();
-        DataNode node = projectController.getCurrentDataNode();
+        DataNodeDescriptor node = projectController.getCurrentDataNode();
 
         // try a node that belongs to the current DataMap ...
         if (node == null) {
             DataMap map = projectController.getCurrentDataMap();
             if (map != null) {
-                node = projectController.getCurrentDataDomain().lookupDataNode(map);
+                Collection<DataNodeDescriptor> nodes = ((DataChannelDescriptor)projectController.getProject().getRootNode()).getNodeDescriptors();
+                for(DataNodeDescriptor n:nodes){
+                    if(n.getDataMapNames().contains(map.getName())){
+                        node = n;
+                        break;
+                    }
+                }
             }
         }
 
@@ -59,9 +66,9 @@
         if (nodeInfo == null) {
 
             // only driver nodes have meaningful connection info set
-            DataNode node = getPreferredNode();
+            DataNodeDescriptor node = getPreferredNode();
             return (node != null && DriverDataSourceFactory.class.getName().equals(
-                    node.getDataSourceFactory())) ? "DataNode Connection Info" : null;
+                    node.getDataSourceFactoryType())) ? "DataNode Connection Info" : null;
         }
 
         return nodeInfo.getNodeName();
@@ -71,7 +78,7 @@
      * Determines the most reasonable default DataSource choice.
      */
     protected DBConnectionInfo preferredDataSource() {
-        DataNode node = getPreferredNode();
+        DataNodeDescriptor node = getPreferredNode();
 
         // no current node...
         if (node == null) {
@@ -98,20 +105,16 @@
         }
 
         // extract data from the node
-        if (!DriverDataSourceFactory.class.getName().equals(node.getDataSourceFactory())) {
+        if (!DriverDataSourceFactory.class.getName().equals(node.getDataSourceFactoryType())) {
             return null;
         }
 
         // create transient object..
         DBConnectionInfo nodeInfo = new DBConnectionInfo();
 
-        nodeInfo.copyFrom(((ProjectDataSource) node.getDataSource()).getDataSourceInfo());
+        nodeInfo.copyFrom(node.getDataSourceDescriptor());
 
-        nodeInfo.setDbAdapter(null);
-        if (node.getAdapter() instanceof ModelerDbAdapter) {
-            nodeInfo.setDbAdapter(((ModelerDbAdapter) node.getAdapter())
-                    .getAdapterClassName());
-        }
+        nodeInfo.setDbAdapter(node.getAdapterType());
 
         return nodeInfo;
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/DbEntitySyncAction.java Tue Feb  2 13:06:56 2010
@@ -22,6 +22,7 @@
 import java.awt.event.ActionEvent;
 import java.util.Iterator;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.event.EntityEvent;
@@ -80,8 +81,8 @@
                 return;
             }
 
-            DbEntitySyncUndoableEdit undoableEdit = new DbEntitySyncUndoableEdit(mediator
-                    .getCurrentDataDomain(), mediator.getCurrentDataMap());
+            DbEntitySyncUndoableEdit undoableEdit = new DbEntitySyncUndoableEdit((DataChannelDescriptor)mediator.getProject().getRootNode()
+                    , mediator.getCurrentDataMap());
 
             while (it.hasNext()) {
                 ObjEntity entity = (ObjEntity) it.next();

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/FindAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/FindAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/FindAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/FindAction.java Tue Feb  2 13:06:56 2010
@@ -27,17 +27,19 @@
 
 import javax.swing.JTextField;
 
-import org.apache.cayenne.map.Attribute;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.map.EmbeddableAttribute;
-import org.apache.cayenne.map.Entity;
+import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.map.Relationship;
+import org.apache.cayenne.map.ObjRelationship;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.FindDialog;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.Query;
 
 public class FindAction extends CayenneAction {
@@ -62,23 +64,93 @@
         if (!source.getText().trim().equals("")) {
             Pattern pattern = Pattern.compile(source.getText().trim(), Pattern.CASE_INSENSITIVE);
 
-            Iterator it = getProjectController().getProject().treeNodes();
+            Iterator<DataMap> it = ((DataChannelDescriptor)getProjectController().getProject().getRootNode()).getDataMaps().iterator();
+            
             while(it.hasNext()) {
-                ProjectPath path = (ProjectPath) it.next();
                 
-                Object o = path.getObject();
-                if ((o instanceof ObjEntity || o instanceof DbEntity) && matchFound(((Entity) o).getName(), pattern))
-                    paths.add(path.getPath());
-                else if (o instanceof Attribute && matchFound(((Attribute) o).getName(), pattern))
-                    paths.add(path.getPath());
-                else if (o instanceof Relationship && matchFound(((Relationship) o).getName(), pattern))
-                    paths.add(path.getPath());
-                else if (o instanceof Query && matchFound(((Query) o).getName(), pattern))
-                    paths.add(path.getPath());
-                else if (o instanceof Embeddable && matchFound(((Embeddable) o).getClassName(), pattern))
-                    paths.add(path.getPath());
-                else if (o instanceof EmbeddableAttribute && matchFound(((EmbeddableAttribute) o).getName(), pattern))
-                    paths.add(path.getPath());
+                  DataMap dm = it.next();
+                 
+                  Iterator<Query> querIterator = dm.getQueries().iterator();
+                  
+                  while(querIterator.hasNext()) {
+                      Query q = querIterator.next();
+                      if(matchFound(q.getName(), pattern)){
+                          paths.add(q);
+                      }
+                  }
+                  
+                  Iterator<Embeddable> embIterator = dm.getEmbeddables().iterator();
+                  
+                  while(embIterator.hasNext()) {
+                      Embeddable emb = embIterator.next();
+                      if(matchFound(emb.getClassName(), pattern)){
+                          paths.add(emb);
+                      }
+                      
+                      Iterator<EmbeddableAttribute> attrIterator = emb.getAttributes().iterator();
+                      
+                      while(attrIterator.hasNext()) {
+                          EmbeddableAttribute attr = attrIterator.next();
+                          if(matchFound(attr.getName(), pattern)){
+                              paths.add(attr);
+                          }
+                      }
+                  }
+                  
+                  
+                  Iterator<DbEntity> dbEntIterator = dm.getDbEntities().iterator();
+                  
+                  while(dbEntIterator.hasNext()) {
+                      DbEntity ent = dbEntIterator.next();
+                      if(matchFound(ent.getName(), pattern)){
+                          paths.add(ent);
+                      }
+                      
+                      Iterator<DbAttribute> attrIterator = ent.getAttributes().iterator();
+                      
+                      while(attrIterator.hasNext()) {
+                          DbAttribute attr = attrIterator.next();
+                          if(matchFound(attr.getName(), pattern)){
+                              paths.add(attr);
+                          }
+                      }
+                      
+                      Iterator<DbRelationship> relIterator = ent.getRelationships().iterator();
+                      
+                      while(relIterator.hasNext()) {
+                          DbRelationship rel = relIterator.next();
+                          if(matchFound(rel.getName(), pattern)){
+                              paths.add(rel);
+                          }
+                      }
+                  }
+                  
+                  Iterator<ObjEntity> entIterator = dm.getObjEntities().iterator();
+                  
+                  while(entIterator.hasNext()) {
+                      ObjEntity ent = entIterator.next();
+                      if(matchFound(ent.getName(), pattern)){
+                          paths.add(ent);
+                      }
+                      
+                      Iterator<ObjAttribute> attrIterator = ent.getAttributes().iterator();
+                      
+                      while(attrIterator.hasNext()) {
+                          ObjAttribute attr = attrIterator.next();
+                          if(matchFound(attr.getName(), pattern)){
+                              paths.add(attr);
+                          }
+                      }
+                      
+                      Iterator<ObjRelationship> relIterator = ent.getRelationships().iterator();
+                      
+                      while(relIterator.hasNext()) {
+                          ObjRelationship rel = relIterator.next();
+                          if(matchFound(rel.getName(), pattern)){
+                              paths.add(rel);
+                          }
+                      }
+                  }
             }
         }
      
@@ -91,7 +163,7 @@
             Iterator it = paths.iterator();
             int index = 0;
             if (it.hasNext()) {
-                Object[] path = (Object[]) it.next();
+                Object path = it.next();
                 FindDialog.jumpToResult(path);
             }   
         }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDBAction.java Tue Feb  2 13:06:56 2010
@@ -24,7 +24,7 @@
 
 import javax.swing.SwingUtilities;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.db.ConnectionWizard;
@@ -104,6 +104,6 @@
             return false;
         }
 
-        return path.firstInstanceOf(DataDomain.class) != null;
+        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDataMapAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDataMapAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDataMapAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportDataMapAction.java Tue Feb  2 13:06:56 2010
@@ -26,7 +26,7 @@
 import javax.swing.JFileChooser;
 import javax.swing.JOptionPane;
 
-import org.apache.cayenne.access.DataDomain;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.MapLoader;
 import org.apache.cayenne.modeler.Application;
@@ -80,7 +80,7 @@
             };
 
             DataMap newMap = mapLoader.loadDataMap(dataMapFile.getAbsolutePath());
-            DataDomain domain = getProjectController().getCurrentDataDomain();
+            DataChannelDescriptor domain = (DataChannelDescriptor)getProjectController().getProject().getRootNode();
 
             if (newMap.getName() != null) {
                 newMap.setName(NamedObjectFactory.createName(

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java Tue Feb  2 13:06:56 2010
@@ -33,14 +33,13 @@
 import javax.swing.JFileChooser;
 import javax.swing.filechooser.FileFilter;
 
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.conf.DriverDataSourceFactory;
 import org.apache.cayenne.conf.JNDIDataSourceFactory;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.configuration.event.DataNodeEvent;
 import org.apache.cayenne.configuration.event.QueryEvent;
 import org.apache.cayenne.conn.DataSourceInfo;
-import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Entity;
 import org.apache.cayenne.map.event.EntityEvent;
@@ -55,7 +54,6 @@
 import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.FileFilters;
 import org.apache.cayenne.project.NamedObjectFactory;
-import org.apache.cayenne.project.ProjectDataSource;
 import org.apache.cayenne.project.ProjectPath;
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.wocompat.EOModelProcessor;
@@ -148,12 +146,12 @@
 
             // this should make created node current, resulting in the new map being added
             // to the node automatically once it is loaded
-            DataNode node = nodeBuilder.buildDataNode();
+            DataNodeDescriptor node = nodeBuilder.buildDataNode();
 
             // configure node...
             if ("JNDI".equalsIgnoreCase(adapter)) {
-                node.setDataSourceFactory(JNDIDataSourceFactory.class.getName());
-                node.setDataSourceLocation((String) connection.get("serverUrl"));
+                node.setDataSourceFactoryType(JNDIDataSourceFactory.class.getName());
+                node.setParameters((String) connection.get("serverUrl"));
             }
             else {
                 // guess adapter from plugin or driver
@@ -166,17 +164,16 @@
                         Class adapterClass = getApplication()
                                 .getClassLoadingService()
                                 .loadClass(cayenneAdapter);
-                        node.setAdapter((DbAdapter) adapterClass.newInstance());
+                        node.setAdapterType(adapterClass.toString());
                     }
                     catch (Throwable ex) {
                         // ignore...
                     }
                 }
 
-                node.setDataSourceFactory(DriverDataSourceFactory.class.getName());
+                node.setDataSourceFactoryType(DriverDataSourceFactory.class.getName());
 
-                DataSourceInfo dsi = ((ProjectDataSource) node.getDataSource())
-                        .getDataSourceInfo();
+                DataSourceInfo dsi = node.getDataSourceDescriptor();
                 
                 
                 
@@ -190,8 +187,7 @@
             getProjectController().fireDataNodeEvent(
                     new DataNodeEvent(this, node, MapEvent.ADD));
             getProjectController().fireDataNodeDisplayEvent(
-                    new DataNodeDisplayEvent(this, getProjectController()
-                            .getCurrentDataDomain(), node));
+                    new DataNodeDisplayEvent(this, (DataChannelDescriptor)getProjectController().getProject().getRootNode(), node));
         }
     }
     
@@ -210,7 +206,7 @@
             return false;
         }
 
-        return path.firstInstanceOf(DataDomain.class) != null;
+        return path.firstInstanceOf(DataChannelDescriptor.class) != null;
     }
 
     /**
@@ -295,12 +291,12 @@
             }
 
             mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(Application
-                    .getFrame(), map, mediator.getCurrentDataDomain(), mediator
+                    .getFrame(), map, (DataChannelDescriptor)mediator.getProject().getRootNode(), mediator
                     .getCurrentDataNode()));
         }
         else {
             // fix DataMap name, as there maybe a map with the same name already
-            DataDomain domain = mediator.getCurrentDataDomain();
+            DataChannelDescriptor domain = (DataChannelDescriptor)mediator.getProject().getRootNode();
             map.setName(NamedObjectFactory.createName(DataMap.class, domain, map
                     .getName()));
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/NewProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/NewProjectAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/NewProjectAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/NewProjectAction.java Tue Feb  2 13:06:56 2010
@@ -25,14 +25,13 @@
 
 import javax.swing.KeyStroke;
 
-import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.conf.Configuration;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.CayenneModelerController;
 import org.apache.cayenne.modeler.event.DomainDisplayEvent;
-import org.apache.cayenne.modeler.util.ModelerUtil;
-import org.apache.cayenne.project.ApplicationProject;
 import org.apache.cayenne.project.NamedObjectFactory;
+import org.apache.cayenne.project2.Project;
 
 /**
  */
@@ -65,16 +64,18 @@
         }
 
         Configuration config = buildProjectConfiguration(null);
-        ApplicationProject project = ModelerUtil.createModelerProject(null, config, getProjectController());
+        
+        DataChannelDescriptor domain = new DataChannelDescriptor();
+        
+        String name = NamedObjectFactory.createName(
+                DataChannelDescriptor.class,
+                domain);
+        
+        domain.setName(name);
+        
+        Project project = new Project(domain);
 
-        // stick a DataDomain
-        DataDomain domain = (DataDomain) NamedObjectFactory.createObject(
-                DataDomain.class,
-                config);
-        domain.getEntityResolver().setIndexedByClass(false);
-        config.addDomain(domain);
-
-        controller.projectOpenedAction(project);
+        controller.projectOpenedAction(project, config);
 
         // select default domain
         getProjectController().fireDomainDisplayEvent(

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ObjEntitySyncAction.java Tue Feb  2 13:06:56 2010
@@ -25,6 +25,7 @@
 
 import javax.swing.KeyStroke;
 
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.event.EntityEvent;
 import org.apache.cayenne.map.event.MapEvent;
@@ -88,7 +89,7 @@
                         this,
                         entity,
                         entity.getDataMap(),
-                        mediator.getCurrentDataDomain()));
+                        (DataChannelDescriptor)mediator.getProject().getRootNode()));
             }
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/OpenProjectAction.java Tue Feb  2 13:06:56 2010
@@ -23,17 +23,23 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.File;
+import java.net.URL;
 
 import javax.swing.JOptionPane;
 import javax.swing.KeyStroke;
 
 import org.apache.cayenne.conf.Configuration;
 import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.CayenneModelerController;
 import org.apache.cayenne.modeler.dialog.ErrorDebugDialog;
-import org.apache.cayenne.modeler.util.ModelerUtil;
-import org.apache.cayenne.project.ApplicationProject;
-import org.apache.cayenne.project.Project;
-import org.apache.cayenne.project.ProjectException;
+import org.apache.cayenne.project2.Project;
+import org.apache.cayenne.project2.ProjectLoader;
+import org.apache.cayenne.project2.upgrade.ProjectUpgrader;
+import org.apache.cayenne.project2.upgrade.UpgradeHandler;
+import org.apache.cayenne.project2.upgrade.UpgradeMetaData;
+import org.apache.cayenne.project2.upgrade.UpgradeType;
+import org.apache.cayenne.resource.Resource;
+import org.apache.cayenne.resource.URLResource;
 import org.apache.cayenne.swing.control.FileMenuItem;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -74,13 +80,13 @@
         if (getProjectController() != null && !checkSaveOnClose()) {
             return;
         }
-       
+
         File f = null;
         if (e.getSource() instanceof FileMenuItem) {
             FileMenuItem menu = (FileMenuItem) e.getSource();
             f = menu.getFile();
         }
-        else if(e.getSource() instanceof File) {
+        else if (e.getSource() instanceof File) {
             f = (File) e.getSource();
         }
 
@@ -102,31 +108,43 @@
 
             openProject(f);
         }
-        
+
         application.getUndoManager().discardAllEdits();
     }
 
     /** Opens specified project file. File must already exist. */
     public void openProject(File file) {
-
         try {
             if (!file.exists()) {
-                JOptionPane.showMessageDialog(Application.getFrame(),
-                        "Can't open project - file \"" + file.getPath() + "\" does not exist",
-                        "Can't Open Project", JOptionPane.OK_OPTION);
+                JOptionPane.showMessageDialog(
+                        Application.getFrame(),
+                        "Can't open project - file \""
+                                + file.getPath()
+                                + "\" does not exist",
+                        "Can't Open Project",
+                        JOptionPane.OK_OPTION);
                 return;
             }
-            
-            getApplication().getFrameController().addToLastProjListAction(
-                    file.getAbsolutePath());
+
+            CayenneModelerController controller = Application
+                    .getInstance()
+                    .getFrameController();
+            controller.addToLastProjListAction(file.getAbsolutePath());
 
             Configuration config = buildProjectConfiguration(file);
-            ApplicationProject project = ModelerUtil.createModelerProject(file, config, getProjectController());
-            getProjectController().setProject(project);
 
-            // if upgrade was canceled
-            int upgradeStatus = project.getUpgradeStatus();
-            if (upgradeStatus > 0) {
+            URL url = file.toURL();
+            Resource rootSource = new URLResource(url);
+
+            ProjectUpgrader upgrader = getApplication().getInjector().getInstance(
+                    ProjectUpgrader.class);
+            UpgradeHandler handler = upgrader.getUpgradeHandler(rootSource);
+            UpgradeMetaData md = handler.getUpgradeMetaData();
+
+            Project project = getApplication().getInjector().getInstance(
+                    ProjectLoader.class).loadProject(rootSource);
+
+            if (UpgradeType.DOWNGRADE_NEEDED == md.getUpgradeType()) {
                 JOptionPane
                         .showMessageDialog(
                                 Application.getFrame(),
@@ -135,16 +153,39 @@
                                 JOptionPane.OK_OPTION);
                 closeProject(false);
             }
-            else if (upgradeStatus < 0) {
-                if (processUpgrades(project)) {
-                    getApplication().getFrameController().projectOpenedAction(project);
-                }
-                else {
-                    closeProject(false);
+            else if (UpgradeType.UPGRADE_NEEDED == md.getUpgradeType()) {
+                if (processUpgrades(md)) {
+                    // perform upgrade
+                    logObj.info("Will upgrade project "
+                            + project.getConfigurationResource().getURL().getPath());
+                    Resource upgraded = handler.performUpgrade();
+                    if (upgraded != null) {
+                        project = getApplication().getInjector().getInstance(
+                                ProjectLoader.class).loadProject(upgraded);
+
+                        controller.projectOpenedAction(project, config);
+
+                        getProjectController().getProjectWatcher().pauseWatching();
+                        getProjectController().getProjectWatcher().reconfigure();
+
+                        // if project file name changed
+                        // need upgrade all
+                        if (!file.getAbsolutePath().equals(
+                                project.getConfigurationResource().getURL().getPath())) {
+                            controller.changePathInLastProjListAction(file
+                                    .getAbsolutePath(), project
+                                    .getConfigurationResource()
+                                    .getURL()
+                                    .getPath());
+                        }
+                    }
+                    else {
+                        closeProject(false);
+                    }
                 }
             }
             else {
-                getApplication().getFrameController().projectOpenedAction(project);
+                controller.projectOpenedAction(project, config);
             }
         }
         catch (Exception ex) {
@@ -153,24 +194,18 @@
         }
     }
 
-    protected boolean processUpgrades(Project project) throws ProjectException {
-        // must really concat all messages, this is a temp hack...
-        String msg = project.getUpgradeMessages().get(0);
+    protected boolean processUpgrades(UpgradeMetaData md) {
         // need an upgrade
         int returnCode = JOptionPane.showConfirmDialog(
                 Application.getFrame(),
-                "Project needs an upgrade to a newer version. " + msg + ". Upgrade?",
+                "Project needs an upgrade to a newer version. "
+                        + md.getSupportedVersion()
+                        + ". Upgrade?",
                 "Upgrade Needed",
                 JOptionPane.YES_NO_OPTION);
         if (returnCode == JOptionPane.NO_OPTION) {
             return false;
         }
-
-        // perform upgrade
-        logObj.info("Will upgrade project " + project.getMainFile());
-        getProjectController().getProjectWatcher().pauseWatching();
-        project.upgrade();
-        getProjectController().getProjectWatcher().reconfigure();
         return true;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/PasteAction.java Tue Feb  2 13:06:56 2010
@@ -31,8 +31,8 @@
 import javax.swing.JOptionPane;
 import javax.swing.KeyStroke;
 
-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.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -104,7 +104,8 @@
             if (content != null && currentObject != null) {
                 
                 PasteCompoundUndoableEdit undoableEdit = new PasteCompoundUndoableEdit();
-                DataDomain domain = getProjectController().getCurrentDataDomain();
+                
+                DataChannelDescriptor domain = (DataChannelDescriptor)getProjectController().getProject().getRootNode();
                 DataMap map = getProjectController().getCurrentDataMap();
                 
                 if (content instanceof List) {
@@ -130,13 +131,13 @@
     }
     
     private void paste(Object where, Object content) {
-    	paste(where, content, getProjectController().getCurrentDataDomain(), getProjectController().getCurrentDataMap()); 
+    	paste(where, content, (DataChannelDescriptor)getProjectController().getProject().getRootNode(), getProjectController().getCurrentDataMap()); 
     }
 
     /**
      * Pastes single object
      */
-    public void paste(Object where, Object content, DataDomain domain, DataMap map) {
+    public void paste(Object where, Object content, DataChannelDescriptor domain, DataMap map) {
         final ProjectController mediator = getProjectController();
       
 
@@ -148,7 +149,7 @@
             where = mediator.getCurrentDataMap();
         }
 
-        if ((where instanceof DataDomain || where instanceof DataNode)
+        if ((where instanceof DataChannelDescriptor || where instanceof DataNodeDescriptor)
                 && content instanceof DataMap) {
             // paste DataMap to DataDomain or DataNode
             DataMap dataMap = ((DataMap) content);
@@ -312,8 +313,7 @@
                 query.setDataMap(dataMap);
 
                 dataMap.addQuery(query);
-                QueryTypeController.fireQueryEvent(this, mediator, mediator
-                        .getCurrentDataDomain(), dataMap, query);
+                QueryTypeController.fireQueryEvent(this, mediator, dataMap, query);
             }
             else if (content instanceof Procedure) {
                 // paste Procedure to DataMap
@@ -347,7 +347,7 @@
 
                 dbEntity.addAttribute(attr);
                 CreateAttributeAction
-                        .fireDbAttributeEvent(this, mediator, domain, mediator.getCurrentDataMap(), dbEntity, attr);
+                        .fireDbAttributeEvent(this, mediator, mediator.getCurrentDataMap(), dbEntity, attr);
             }
             else if (content instanceof DbRelationship) {
                 DbRelationship rel = (DbRelationship) content;
@@ -380,7 +380,8 @@
                 objEntity.addAttribute(attr);
                 CreateAttributeAction.fireObjAttributeEvent(
                         this,
-                        mediator, domain, mediator.getCurrentDataMap(), 
+                        mediator,
+                        mediator.getCurrentDataMap(),
                         objEntity,
                         attr);
             }
@@ -509,7 +510,7 @@
              * Checking all avaliable pairs source-pasting object
              */
 
-            return ((currentObject instanceof DataDomain || currentObject instanceof DataNode) && content instanceof DataMap)
+            return ((currentObject instanceof DataChannelDescriptor || currentObject instanceof DataNodeDescriptor) && content instanceof DataMap)
                     ||
 
                     (currentObject instanceof DataMap && isTreeLeaf(content))
@@ -565,14 +566,14 @@
      */
     class DataMapNameChecker implements FreeNameChecker {
 
-        DataDomain domain;
+        DataChannelDescriptor domain;
 
-        public DataMapNameChecker(DataDomain domain) {
+        public DataMapNameChecker(DataChannelDescriptor domain) {
             this.domain = domain;
         }
 
         public boolean isNameFree(String name) {
-            return domain.getMap(name) == null;
+            return domain.getDataMap(name) == null;
         }
     }
 
@@ -581,16 +582,16 @@
      */
     class DbEntityNameChecker implements FreeNameChecker {
 
-        DataDomain domain;
+        DataChannelDescriptor domain;
 
-        public DbEntityNameChecker(DataDomain domain) {
+        public DbEntityNameChecker(DataChannelDescriptor domain) {
             this.domain = domain;
         }
 
         public boolean isNameFree(String name) {
             /**
              * Name mast be unique through all DataDomain, for EntityResolver to work
-             * correctly
+             * correctlys
              */
             for (DataMap map : domain.getDataMaps()) {
                 if (map.getDbEntity(name) != null) {
@@ -607,9 +608,9 @@
      */
     class ObjEntityNameChecker implements FreeNameChecker {
 
-        DataDomain domain;
+        DataChannelDescriptor domain;
 
-        public ObjEntityNameChecker(DataDomain domain) {
+        public ObjEntityNameChecker(DataChannelDescriptor domain) {
             this.domain = domain;
         }
 
@@ -630,9 +631,9 @@
 
     class EmbeddableNameChecker implements FreeNameChecker {
 
-        DataDomain domain;
+        DataChannelDescriptor domain;
 
-        public EmbeddableNameChecker(DataDomain domain) {
+        public EmbeddableNameChecker(DataChannelDescriptor domain) {
             this.domain = domain;
         }
 
@@ -656,9 +657,9 @@
      */
     class ProcedureNameChecker implements FreeNameChecker {
 
-        DataDomain domain;
+        DataChannelDescriptor domain;
 
-        public ProcedureNameChecker(DataDomain domain) {
+        public ProcedureNameChecker(DataChannelDescriptor domain) {
             this.domain = domain;
         }
 
@@ -682,9 +683,9 @@
      */
     class QueryNameChecker implements FreeNameChecker {
 
-        DataDomain domain;
+        DataChannelDescriptor domain;
 
-        public QueryNameChecker(DataDomain domain) {
+        public QueryNameChecker(DataChannelDescriptor domain) {
             this.domain = domain;
         }
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectAction.java Tue Feb  2 13:06:56 2010
@@ -28,7 +28,6 @@
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.dialog.UnsavedChangesDialog;
 import org.apache.cayenne.modeler.util.CayenneAction;
-import org.apache.cayenne.project.ProjectConfiguration;
 import org.apache.cayenne.project.ProjectPath;
 
 /**
@@ -65,10 +64,7 @@
      * @since 1.2
      */
     protected Configuration buildProjectConfiguration(File projectFile) {
-        ProjectConfiguration config = new ModelerProjectConfiguration(projectFile);
-        config.setLoaderDelegate(new ModelerProjectLoadDelegate(config));
-        config.setSaverDelegate(new ModelerProjectSaveDelegate(config));
-        return config;
+        return new ModelerProjectConfiguration(projectFile);
     }
 
     /** Returns true if successfully closed project, false otherwise. */

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectOpener.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectOpener.java?rev=905616&r1=905615&r2=905616&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectOpener.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ProjectOpener.java Tue Feb  2 13:06:56 2010
@@ -26,12 +26,11 @@
 import javax.swing.filechooser.FileFilter;
 
 import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.conf.Configuration;
+import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.dialog.OverwriteDialog;
 import org.apache.cayenne.modeler.util.FileFilters;
-import org.apache.cayenne.project.ApplicationProject;
-import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project2.Project;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -47,9 +46,14 @@
      * Selects a directory to store the project.
      */
     File newProjectDir(Frame f, Project p) {
-        if (p instanceof ApplicationProject) {
+        if (p instanceof Project) {
+            StringBuilder nameProject = new StringBuilder("cayenne");
+            if(((DataChannelDescriptor)p.getRootNode()).getName()!=null){
+                nameProject.append("-").append(((DataChannelDescriptor)p.getRootNode()).getName());
+            }
+            nameProject.append(".xml");
             // configure for application project
-            return newProjectDir(f, Configuration.DEFAULT_DOMAIN_FILE, FileFilters
+            return newProjectDir(f, nameProject.toString(), FileFilters
                     .getApplicationFilter());
         }
         else {



Mime
View raw message