cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r761544 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access: DataNode.java dbsync/CreateIfNoSchemaStrategy.java dbsync/SchemaUpdateStrategy.java dbsync/SkipSchemaUpdateStrategy.java
Date Fri, 03 Apr 2009 07:22:35 GMT
Author: aadamchik
Date: Fri Apr  3 07:22:34 2009
New Revision: 761544

URL: http://svn.apache.org/viewvc?rev=761544&view=rev
Log:
CAY-1193 Auto load schema on startup

some javadocs and minor cleanup

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/CreateIfNoSchemaStrategy.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SchemaUpdateStrategy.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SkipSchemaUpdateStrategy.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java?rev=761544&r1=761543&r2=761544&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNode.java
Fri Apr  3 07:22:34 2009
@@ -245,7 +245,11 @@
         Connection connection = null;
 
         try {
-            getSchemaUpdateStrategy().updateSchema(this);
+            
+            if (schemaUpdateStrategy != null) {
+                schemaUpdateStrategy.updateSchema(this);
+            }
+            
             connection = this.getDataSource().getConnection();
         }
         catch (Exception globalEx) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/CreateIfNoSchemaStrategy.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/CreateIfNoSchemaStrategy.java?rev=761544&r1=761543&r2=761544&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/CreateIfNoSchemaStrategy.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/CreateIfNoSchemaStrategy.java
Fri Apr  3 07:22:34 2009
@@ -47,23 +47,14 @@
         return currentSchema;
     }
 
-    /**
-     * @since 3.0
-     */
     public CreateIfNoSchemaStrategy() {
         currentSchema = this;
     }
 
-    /**
-     * @since 3.0
-     */
     public void updateSchema(DataNode dataNode) {
         getSchema().generateUpdateSchema(dataNode);
     }
 
-    /**
-     * @since 3.0
-     */
     public void generateUpdateSchema(DataNode dataNode) {
 
         Map<String, Boolean> nameTables = getNameTablesInDB(dataNode);
@@ -105,8 +96,8 @@
         }
     }
 
-    /*
-     * Returns all the table names in database
+    /**
+     * Returns all the table names in database.
      */
     protected Map<String, Boolean> getNameTablesInDB(DataNode dataNode) {
         String tableLabel = dataNode.getAdapter().tableTypeForTable();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SchemaUpdateStrategy.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SchemaUpdateStrategy.java?rev=761544&r1=761543&r2=761544&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SchemaUpdateStrategy.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SchemaUpdateStrategy.java
Fri Apr  3 07:22:34 2009
@@ -21,6 +21,8 @@
 import org.apache.cayenne.access.DataNode;
 
 /**
+ * A strategy for auto generating a database schema on the application startup.
+ * 
  * @since 3.0
  */
 public interface SchemaUpdateStrategy {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SkipSchemaUpdateStrategy.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SkipSchemaUpdateStrategy.java?rev=761544&r1=761543&r2=761544&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SkipSchemaUpdateStrategy.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/dbsync/SkipSchemaUpdateStrategy.java
Fri Apr  3 07:22:34 2009
@@ -21,6 +21,9 @@
 import org.apache.cayenne.access.DataNode;
 
 /**
+ * A SchemaUpdateStrategy that does nothing. This is usually the default strategy, as in
+ * most cases DB schema management is outside the scope of Cayenne.
+ * 
  * @since 3.0
  */
 public class SkipSchemaUpdateStrategy implements SchemaUpdateStrategy {



Mime
View raw message