cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r988535 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler: ./ action/ dialog/autorelationship/ dialog/db/ dialog/pref/ pref/ util/
Date Tue, 24 Aug 2010 13:28:05 GMT
Author: aadamchik
Date: Tue Aug 24 13:28:04 2010
New Revision: 988535

URL: http://svn.apache.org/viewvc?rev=988535&view=rev
Log:
generics cleanup, no other changes

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerController.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ClassLoadingService.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/FileClassLoadingService.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/action/ImportEOModelAction.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsController.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderHelper.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderOptionsDialog.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/TableSelectorController.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/DataSourcePreferences.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/ComponentGeometry.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DBConnectionInfo.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerController.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/CayenneModelerController.java
Tue Aug 24 13:28:04 2010
@@ -118,7 +118,7 @@ public class CayenneModelerController ex
     }
 
     private boolean processDropAction(Transferable transferable) {
-        List fileList;
+        List<File> fileList;
         try {
             fileList = (List) transferable.getTransferData(DataFlavor.javaFileListFlavor);
         }
@@ -126,7 +126,7 @@ public class CayenneModelerController ex
             return false;
         }
 
-        File transferFile = (File) fileList.get(0);
+        File transferFile = fileList.get(0);
 
         if (transferFile.isFile()) {
             

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ClassLoadingService.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ClassLoadingService.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ClassLoadingService.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ClassLoadingService.java
Tue Aug 24 13:28:04 2010
@@ -17,12 +17,10 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.modeler;
 
 /**
  * An interface defining a service for locating external Java resources.
- * 
  */
 public interface ClassLoadingService {
 
@@ -30,10 +28,11 @@ public interface ClassLoadingService {
      * Returns Java ClassLoader that knows how to load all classes configured for this
      * service.
      */
-    public ClassLoader getClassLoader();
+    ClassLoader getClassLoader();
 
     /**
      * Returns a class for given class name.
      */
-    public Class loadClass(String className) throws ClassNotFoundException;
+    <T> Class<T> loadClass(Class<T> interfaceType, String className)
+            throws ClassNotFoundException;
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/FileClassLoadingService.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/FileClassLoadingService.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/FileClassLoadingService.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/FileClassLoadingService.java
Tue Aug 24 13:28:04 2010
@@ -45,8 +45,9 @@ public class FileClassLoadingService imp
     /**
      * Returns class for a given name, loading it if needed from configured locations.
      */
-    public synchronized Class loadClass(String className) throws ClassNotFoundException {
-        return nonNullClassLoader().loadClass(className);
+    @SuppressWarnings("all")
+    public synchronized <T> Class<T> loadClass(Class<T> interfaceType,
String className) throws ClassNotFoundException {
+        return (Class<T>) nonNullClassLoader().loadClass(className);
     }
 
     /**

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=988535&r1=988534&r2=988535&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 Aug 24 13:28:04 2010
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.modeler.action;
 
 import java.awt.Component;
@@ -40,6 +39,7 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.server.JNDIDataSourceFactory;
 import org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory;
 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;
@@ -77,7 +77,7 @@ public class ImportEOModelAction extends
     public ImportEOModelAction(Application application) {
         super(getActionName(), application);
     }
-    
+
     public String getIconName() {
         return "icon-eomodel.gif";
     }
@@ -160,9 +160,9 @@ public class ImportEOModelAction extends
                         (String) connection.get("driver"));
                 if (cayenneAdapter != null) {
                     try {
-                        Class adapterClass = getApplication()
+                        Class<DbAdapter> adapterClass = getApplication()
                                 .getClassLoadingService()
-                                .loadClass(cayenneAdapter);
+                                .loadClass(DbAdapter.class, cayenneAdapter);
                         node.setAdapterType(adapterClass.toString());
                     }
                     catch (Throwable ex) {
@@ -170,12 +170,12 @@ public class ImportEOModelAction extends
                     }
                 }
 
-                node.setDataSourceFactoryType(XMLPoolingDataSourceFactory.class.getName());
+                node
+                        .setDataSourceFactoryType(XMLPoolingDataSourceFactory.class
+                                .getName());
 
                 DataSourceInfo dsi = node.getDataSourceDescriptor();
-                
-                
-                
+
                 dsi.setDataSourceUrl(keyAsString(connection, "URL"));
                 dsi.setJdbcDriver(keyAsString(connection, "driver"));
                 dsi.setPassword(keyAsString(connection, "password"));
@@ -186,10 +186,15 @@ public class ImportEOModelAction extends
             getProjectController().fireDataNodeEvent(
                     new DataNodeEvent(this, node, MapEvent.ADD));
             getProjectController().fireDataNodeDisplayEvent(
-                    new DataNodeDisplayEvent(this, (DataChannelDescriptor)getProjectController().getProject().getRootNode(),
node));
+                    new DataNodeDisplayEvent(
+                            this,
+                            (DataChannelDescriptor) getProjectController()
+                                    .getProject()
+                                    .getRootNode(),
+                            node));
         }
     }
-    
+
     // CAY-246 - if user name or password is all numeric, it will
     // be returned as number, so we can't cast dictionary keys to String
     private String keyAsString(Map map, String key) {
@@ -258,9 +263,11 @@ public class ImportEOModelAction extends
                 entityEvent.setId(MapEvent.REMOVE);
                 mediator.fireDbEntityEvent(entityEvent);
             }
-            
+
             // queries
-            Collection addedQueries = CollectionUtils.subtract(newQueries, originalQueries);
+            Collection addedQueries = CollectionUtils.subtract(
+                    newQueries,
+                    originalQueries);
             it = addedQueries.iterator();
             while (it.hasNext()) {
                 Query q = (Query) it.next();
@@ -269,22 +276,27 @@ public class ImportEOModelAction extends
                 mediator.fireQueryEvent(queryEvent);
             }
 
-            Collection removedQueries = CollectionUtils.subtract(originalQueries, newQueries);
+            Collection removedQueries = CollectionUtils.subtract(
+                    originalQueries,
+                    newQueries);
             it = removedQueries.iterator();
             while (it.hasNext()) {
-            	Query q = (Query) it.next();
+                Query q = (Query) it.next();
                 queryEvent.setQuery(q);
                 queryEvent.setId(MapEvent.REMOVE);
                 mediator.fireQueryEvent(queryEvent);
             }
 
             mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(Application
-                    .getFrame(), map, (DataChannelDescriptor)mediator.getProject().getRootNode(),
mediator
-                    .getCurrentDataNode()));
+                    .getFrame(), map, (DataChannelDescriptor) mediator
+                    .getProject()
+                    .getRootNode(), mediator.getCurrentDataNode()));
         }
         else {
             // fix DataMap name, as there maybe a map with the same name already
-            DataChannelDescriptor domain = (DataChannelDescriptor)mediator.getProject().getRootNode();
+            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/dialog/autorelationship/InferRelationshipsController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsController.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/autorelationship/InferRelationshipsController.java
Tue Aug 24 13:28:04 2010
@@ -72,7 +72,7 @@ public class InferRelationshipsControlle
                     .getInstance()
                     .getClassLoadingService();
 
-            return (NamingStrategy) classLoader.loadClass(strategyClass).newInstance();
+            return classLoader.loadClass(NamingStrategy.class, strategyClass).newInstance();
         }
         catch (Throwable th) {
             logObj.error("Error in " + getClass().getName(), th);

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=988535&r1=988534&r2=988535&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 Aug 24 13:28:04 2010
@@ -62,7 +62,9 @@ public class DbLoaderHelper {
 
     // TODO: this is a temp hack... need to delegate to DbAdapter, or configurable in
     // preferences...
-    private static final Collection EXCLUDED_TABLES = Arrays.asList("AUTO_PK_SUPPORT", "auto_pk_support");
+    private static final Collection<String> EXCLUDED_TABLES = Arrays.asList(
+            "AUTO_PK_SUPPORT",
+            "auto_pk_support");
 
     static DbLoaderMergeDialog mergeDialog;
 
@@ -80,12 +82,12 @@ public class DbLoaderHelper {
     protected boolean loadProcedures;
     protected boolean meaningfulPk;
     protected String procedureNamePattern;
-    protected List schemas;
+    protected List<String> schemas;
 
     protected String loadStatusNote;
-    
+
     /**
-     * Obj Entities which were added to project during reverse engineering 
+     * ObjEntities which were added to project during reverse engineering
      */
     protected List<ObjEntity> addedObjEntities;
 
@@ -136,8 +138,9 @@ public class DbLoaderHelper {
         stoppingReverseEngineering = false;
 
         // load schemas...
-        LongRunningTask loadSchemasTask = new LoadSchemasTask(Application
-                .getFrame(), "Loading Schemas");
+        LongRunningTask loadSchemasTask = new LoadSchemasTask(
+                Application.getFrame(),
+                "Loading Schemas");
 
         loadSchemasTask.startAndWait();
 
@@ -176,12 +179,13 @@ public class DbLoaderHelper {
         this.meaningfulPk = dialog.isMeaningfulPk();
         this.procedureNamePattern = dialog.getProcedureNamePattern();
         this.addedObjEntities = new ArrayList<ObjEntity>();
-        
+
         this.loader.setNamingStrategy(dialog.getNamingStrategy());
 
         // load DataMap...
-        LongRunningTask loadDataMapTask = new LoadDataMapTask(Application
-                .getFrame(), "Reengineering DB");
+        LongRunningTask loadDataMapTask = new LoadDataMapTask(
+                Application.getFrame(),
+                "Reengineering DB");
         loadDataMapTask.startAndWait();
     }
 
@@ -191,8 +195,11 @@ public class DbLoaderHelper {
         SwingUtilities.invokeLater(new Runnable() {
 
             public void run() {
-                JOptionPane.showMessageDialog(Application.getFrame(), th
-                        .getMessage(), message, JOptionPane.ERROR_MESSAGE);
+                JOptionPane.showMessageDialog(
+                        Application.getFrame(),
+                        th.getMessage(),
+                        message,
+                        JOptionPane.ERROR_MESSAGE);
             }
         });
     }
@@ -240,8 +247,7 @@ public class DbLoaderHelper {
                 entity.getDataMap().removeDbEntity(entity.getName());
             }
             else if (existingMap) {
-                mediator
-                        .fireDbEntityEvent(new EntityEvent(this, entity, MapEvent.ADD));
+                mediator.fireDbEntityEvent(new EntityEvent(this, entity, MapEvent.ADD));
             }
         }
 
@@ -271,8 +277,10 @@ public class DbLoaderHelper {
             checkCanceled();
 
             if (existingMap) {
-                mediator.fireObjEntityEvent(new EntityEvent(Application
-                        .getFrame(), entity, MapEvent.REMOVE));
+                mediator.fireObjEntityEvent(new EntityEvent(
+                        Application.getFrame(),
+                        entity,
+                        MapEvent.REMOVE));
             }
         }
 
@@ -356,7 +364,9 @@ public class DbLoaderHelper {
 
             if (!existingMap) {
                 dataMap = (DataMap) NamedObjectFactory.createObject(DataMap.class, null);
-                dataMap.setName(NamedObjectFactory.createName(DataMap.class, (DataChannelDescriptor)mediator.getProject().getRootNode()));
+                dataMap.setName(NamedObjectFactory.createName(
+                        DataMap.class,
+                        (DataChannelDescriptor) mediator.getProject().getRootNode()));
                 dataMap.setDefaultSchema(schemaName);
             }
 
@@ -369,9 +379,9 @@ public class DbLoaderHelper {
             try {
                 loader.setCreatingMeaningfulPK(meaningfulPk);
                 loader.loadDataMapFromDB(schemaName, tableNamePattern, dataMap);
-                
+
                 /**
-                 * Update default rules for relationships 
+                 * Update default rules for relationships
                  */
                 for (ObjEntity addedObjEntity : addedObjEntities) {
                     DeleteRuleUpdater.updateObjEntity(addedObjEntity);
@@ -408,11 +418,10 @@ public class DbLoaderHelper {
                         Application.getFrame(),
                         dataMap,
                         MapEvent.CHANGE));
-                mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(
-                        Application.getFrame(),
-                        dataMap,
-                        (DataChannelDescriptor)mediator.getProject().getRootNode(),
-                        mediator.getCurrentDataNode()));
+                mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(Application
+                        .getFrame(), dataMap, (DataChannelDescriptor) mediator
+                        .getProject()
+                        .getRootNode(), mediator.getCurrentDataNode()));
             }
             else {
                 mediator.addDataMap(Application.getFrame(), dataMap);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderOptionsDialog.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderOptionsDialog.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderOptionsDialog.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/db/DbLoaderOptionsDialog.java
Tue Aug 24 13:28:04 2010
@@ -54,6 +54,7 @@ import com.jgoodies.forms.layout.FormLay
  * Dialog for selecting database reverse-engineering parameters.
  */
 public class DbLoaderOptionsDialog extends CayenneDialog {
+
     private static final Log logObj = LogFactory.getLog(DbLoaderOptionsDialog.class);
 
     public static final int CANCEL = 0;
@@ -68,20 +69,20 @@ public class DbLoaderOptionsDialog exten
     protected JLabel procedureLabel;
     protected JButton selectButton;
     protected JButton cancelButton;
-    
+
     /**
      * Combobox for naming strategy
      */
     protected JComboBox strategyCombo;
-    
+
     protected NamingStrategy strategy;
-    
+
     protected int choice;
 
     /**
      * Creates and initializes new ChooseSchemaDialog.
      */
-    public DbLoaderOptionsDialog(Collection schemas, String dbUserName,
+    public DbLoaderOptionsDialog(Collection<String> schemas, String dbUserName,
             boolean loadProcedures) {
         super(Application.getFrame(), "Reengineer DB Schema: Select Options");
 
@@ -105,7 +106,7 @@ public class DbLoaderOptionsDialog exten
         tableNamePatternField = new JTextField();
         procNamePatternField = new JTextField();
         loadProcedures = new JCheckBox();
-        meaningfulPk = new JCheckBox(); 
+        meaningfulPk = new JCheckBox();
         strategyCombo = new JComboBox();
         strategyCombo.setEditable(true);
 
@@ -121,8 +122,8 @@ public class DbLoaderOptionsDialog exten
         builder.append("Load Procedures:", loadProcedures);
         procedureLabel = builder.append("Procedure Name Pattern:", procNamePatternField);
         builder.append("Naming Strategy:", strategyCombo);
-        builder.append("Meaningful PK",meaningfulPk);
-        
+        builder.append("Meaningful PK", meaningfulPk);
+
         JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
         buttons.add(cancelButton);
         buttons.add(selectButton);
@@ -167,8 +168,10 @@ public class DbLoaderOptionsDialog exten
         this.procNamePatternField.setText(DbLoader.WILDCARD);
         this.procNamePatternField.setEnabled(shouldLoadProcedures);
         this.procedureLabel.setEnabled(shouldLoadProcedures);
-        
-        Vector<String> arr = NamingStrategyPreferences.getInstance().getLastUsedStrategies();
+
+        Vector<String> arr = NamingStrategyPreferences
+                .getInstance()
+                .getLastUsedStrategies();
         strategyCombo.setModel(new DefaultComboBoxModel(arr));
 
         boolean showSchemaSelector = schemas != null && !schemas.isEmpty();
@@ -197,27 +200,34 @@ public class DbLoaderOptionsDialog exten
 
     private void processSelect() {
         try {
-            ClassLoadingService classLoader = Application.getInstance().getClassLoadingService();
+            ClassLoadingService classLoader = Application
+                    .getInstance()
+                    .getClassLoadingService();
             String strategyClass = (String) strategyCombo.getSelectedItem();
-            
-            this.strategy = (NamingStrategy) classLoader.loadClass(strategyClass).newInstance();
-            
+
+            this.strategy = classLoader
+                    .loadClass(NamingStrategy.class, strategyClass)
+                    .newInstance();
+
             /**
              * Be user-friendly and update preferences with specified strategy
              */
-            NamingStrategyPreferences.getInstance().addToLastUsedStrategies(strategyClass);
+            NamingStrategyPreferences
+                    .getInstance()
+                    .addToLastUsedStrategies(strategyClass);
         }
         catch (Throwable th) {
             logObj.error("Error in " + getClass().getName(), th);
-     
-            JOptionPane.showMessageDialog(this,
+
+            JOptionPane.showMessageDialog(
+                    this,
                     "Naming Strategy Initialization Error: " + th.getMessage(),
                     "Naming Strategy Initialization Error",
                     JOptionPane.ERROR_MESSAGE);
-                    
+
             return;
         }
-        
+
         choice = SELECT;
         setVisible(false);
     }
@@ -246,7 +256,7 @@ public class DbLoaderOptionsDialog exten
     public boolean isLoadingProcedures() {
         return loadProcedures.isSelected();
     }
-    
+
     public boolean isMeaningfulPk() {
         return meaningfulPk.isSelected();
     }
@@ -258,7 +268,7 @@ public class DbLoaderOptionsDialog exten
         return "".equals(procNamePatternField.getText()) ? null : procNamePatternField
                 .getText();
     }
-    
+
     /**
      * Returns configured naming strategy
      */

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=988535&r1=988534&r2=988535&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 Aug 24 13:28:04 2010
@@ -30,7 +30,6 @@ 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.Entity;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.modeler.util.CayenneController;
 import org.apache.cayenne.project.Project;
@@ -51,7 +50,7 @@ public class TableSelectorController ext
     protected DbEntity table;
     protected List<DbEntity> tables;
     protected int permanentlyExcludedCount;
-    protected Map excludedTables;
+    protected Map<String, DbEntity> excludedTables;
     protected List<DbEntity> selectableTablesList;
 
     protected Map<String, String> validationMessages;
@@ -59,14 +58,12 @@ public class TableSelectorController ext
     public TableSelectorController(ProjectController parent) {
         super(parent);
         this.view = new TableSelectorView();
-        this.excludedTables = new HashMap();
-        this.selectableTablesList = new ArrayList();
+        this.excludedTables = new HashMap<String, DbEntity>();
+        this.selectableTablesList = new ArrayList<DbEntity>();
         this.validationMessages = new HashMap<String, String>();
         initController();
     }
 
-    // ----- properties -----
-
     public Component getView() {
         return view;
     }
@@ -81,11 +78,11 @@ public class TableSelectorController ext
     /**
      * Returns DbEntities that are excluded from DB generation.
      */
-    public Collection getExcludedTables() {
+    public Collection<DbEntity> getExcludedTables() {
         return excludedTables.values();
     }
 
-    public List getTables() {
+    public List<DbEntity> getTables() {
         return tables;
     }
 
@@ -169,7 +166,7 @@ public class TableSelectorController ext
      * ValidationInfo objects describing the problems.
      */
     public void updateTables(DataMap dataMap) {
-        this.tables = new ArrayList(dataMap.getDbEntities());
+        this.tables = new ArrayList<DbEntity>(dataMap.getDbEntities());
 
         excludedTables.clear();
         validationMessages.clear();
@@ -190,19 +187,19 @@ public class TableSelectorController ext
         if (validationResult.getFailures().size() > 0) {
 
             for (ValidationFailure nextProblem : validationResult.getFailures()) {
-                Entity failedEntity = null;
+                DbEntity failedEntity = null;
 
                 if (nextProblem.getSource() instanceof DbAttribute) {
                     DbAttribute failedAttribute = (DbAttribute) nextProblem.getSource();
-                    failedEntity = failedAttribute.getEntity();
+                    failedEntity = (DbEntity) failedAttribute.getEntity();
                 }
                 else if (nextProblem.getSource() instanceof DbRelationship) {
                     DbRelationship failedRelationship = (DbRelationship) nextProblem
                             .getSource();
-                    failedEntity = failedRelationship.getSourceEntity();
+                    failedEntity = (DbEntity) failedRelationship.getSourceEntity();
                 }
                 else if (nextProblem.getSource() instanceof DbEntity) {
-                    failedEntity = (Entity) nextProblem.getSource();
+                    failedEntity = (DbEntity) nextProblem.getSource();
                 }
 
                 if (failedEntity == null) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/DataSourcePreferences.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/DataSourcePreferences.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/DataSourcePreferences.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/pref/DataSourcePreferences.java
Tue Aug 24 13:28:04 2010
@@ -284,8 +284,10 @@ public class DataSourcePreferences exten
                 classLoader.setPathFiles(CollectionUtils.collect(details, transformer));
             }
 
-            Class driverClass = classLoader.loadClass(currentDataSource.getJdbcDriver());
-            Driver driver = (Driver) driverClass.newInstance();
+            Class<Driver> driverClass = classLoader.loadClass(
+                    Driver.class,
+                    currentDataSource.getJdbcDriver());
+            Driver driver = driverClass.newInstance();
 
             // connect via Cayenne DriverDataSource - it addresses some driver issues...
             Connection c = new DriverDataSource(

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/ComponentGeometry.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/ComponentGeometry.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/ComponentGeometry.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/ComponentGeometry.java
Tue Aug 24 13:28:04 2010
@@ -39,7 +39,7 @@ public class ComponentGeometry extends C
     public static final String X_PROPERTY = "x";
     public static final String Y_PROPERTY = "y";
     
-    public ComponentGeometry(Class className, String path) {
+    public ComponentGeometry(Class<?> className, String path) {
         setCurrentNodeForPreference(className, path);
     };
     

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DBConnectionInfo.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DBConnectionInfo.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DBConnectionInfo.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DBConnectionInfo.java
Tue Aug 24 13:28:04 2010
@@ -41,7 +41,7 @@ public class DBConnectionInfo extends Ca
     public static final String URL_PROPERTY = "url";
     public static final String USER_NAME_PROPERTY = "userName";
     private static final String DB_CONNECTION_INFO = "dbConnectionInfo";
-    
+
     public static final String ID_PK_COLUMN = "id";
 
     private String nodeName;
@@ -186,7 +186,7 @@ public class DBConnectionInfo extends Ca
         }
 
         try {
-            return (DbAdapter) classLoader.loadClass(adapterClassName).newInstance();
+            return classLoader.loadClass(DbAdapter.class, adapterClassName).newInstance();
         }
         catch (Throwable th) {
             th = Util.unwindException(th);
@@ -214,7 +214,7 @@ public class DBConnectionInfo extends Ca
         Driver driver;
 
         try {
-            driver = (Driver) classLoader.loadClass(getJdbcDriver()).newInstance();
+            driver = classLoader.loadClass(Driver.class, getJdbcDriver()).newInstance();
         }
         catch (Throwable th) {
             th = Util.unwindException(th);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java?rev=988535&r1=988534&r2=988535&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneController.java
Tue Aug 24 13:28:04 2010
@@ -36,7 +36,6 @@ import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.KeyStroke;
 
-import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.pref.FSPath;
 import org.apache.cayenne.swing.BoundComponent;



Mime
View raw message