You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by cl...@apache.org on 2007/06/27 23:40:56 UTC

svn commit: r551342 - in /db/jdo/trunk: fostore20/test/jdo/org/apache/jdo/pc/ fostore20/test/jdo/org/apache/jdo/pc/appid/ fostore20/test/jdo/org/apache/jdo/pc/empdept/ fostore20/test/jdo/org/apache/jdo/pc/serializable/ model20/src/java/org/apache/jdo/i...

Author: clr
Date: Wed Jun 27 14:40:54 2007
New Revision: 551342

URL: http://svn.apache.org/viewvc?view=rev&rev=551342
Log:
Updates for JDO 2.1. Implemented new methods in runtime20, query20; changed to use 2.0 dtd in model20

Modified:
    db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/appid/package.jdo
    db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/empdept/package.jdo
    db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/package.jdo
    db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/serializable/package.jdo
    db/jdo/trunk/model20/src/java/org/apache/jdo/impl/model/jdo/xml/JDOParser.java
    db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerFactoryImpl.java
    db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java

Modified: db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/appid/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/appid/package.jdo?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/appid/package.jdo (original)
+++ db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/appid/package.jdo Wed Jun 27 14:40:54 2007
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd">
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd">
 <jdo>
   <package name="org.apache.jdo.pc.appid">
 

Modified: db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/empdept/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/empdept/package.jdo?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/empdept/package.jdo (original)
+++ db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/empdept/package.jdo Wed Jun 27 14:40:54 2007
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd">
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd">
 <jdo>
   <package name="org.apache.jdo.pc.empdept">
 

Modified: db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/package.jdo?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/package.jdo (original)
+++ db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/package.jdo Wed Jun 27 14:40:54 2007
@@ -19,7 +19,7 @@
    For testing purposes this .jdo file uses SYSTEM DOCTYPE, 
    where most of the other .jdo files use a PUBLIC DOCTYPE.
 -->
-<!DOCTYPE jdo SYSTEM "file:/javax/jdo/jdo.dtd">
+<!DOCTYPE jdo SYSTEM "file:/javax/jdo/jdo_2_0.dtd">
 <!--DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd"-->
 <jdo>
   <package name="org.apache.jdo.pc">

Modified: db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/serializable/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/serializable/package.jdo?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/serializable/package.jdo (original)
+++ db/jdo/trunk/fostore20/test/jdo/org/apache/jdo/pc/serializable/package.jdo Wed Jun 27 14:40:54 2007
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd">
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd">
 <jdo>
   <package name="org.apache.jdo.pc.serializable">
 

Modified: db/jdo/trunk/model20/src/java/org/apache/jdo/impl/model/jdo/xml/JDOParser.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/model20/src/java/org/apache/jdo/impl/model/jdo/xml/JDOParser.java?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/model20/src/java/org/apache/jdo/impl/model/jdo/xml/JDOParser.java (original)
+++ db/jdo/trunk/model20/src/java/org/apache/jdo/impl/model/jdo/xml/JDOParser.java Wed Jun 27 14:40:54 2007
@@ -275,9 +275,9 @@
         implements EntityResolver 
     {
         private static final String RECOGNIZED_PUBLIC_ID = 
-            "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN"; //NOI18N
+            "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"; //NOI18N
         private static final String RECOGNIZED_SYSTEM_ID = 
-            "file:/javax/jdo/jdo.dtd"; //NOI18N
+            "file:/javax/jdo/jdo_2_0.dtd"; //NOI18N
 
         public InputSource resolveEntity(String publicId, String systemId)
             throws SAXException, IOException 
@@ -286,7 +286,7 @@
             if (((publicId != null) && RECOGNIZED_PUBLIC_ID.equals(publicId)) ||
                 ((publicId == null) && (systemId != null) && 
                  RECOGNIZED_SYSTEM_ID.equals(systemId))) {
-                // Substitute the dtd with the one from javax.jdo.jdo.dtd,
+                // Substitute the dtd with the one from javax.jdo_2_0.dtd,
                 // but only if the publicId is equal to RECOGNIZED_PUBLIC_ID
                 // or there is no publicID and the systemID is equal to
                 // RECOGNIZED_SYSTEM_ID. 
@@ -294,7 +294,7 @@
                         new PrivilegedAction () {
                             public Object run () {
                             return getClass().getClassLoader().
-                                getResourceAsStream("javax/jdo/jdo.dtd"); //NOI18N
+                                getResourceAsStream("javax/jdo/jdo_2_0.dtd"); //NOI18N
                             }
                          }
                      );

Modified: db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerFactoryImpl.java?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerFactoryImpl.java (original)
+++ db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerFactoryImpl.java Wed Jun 27 14:40:54 2007
@@ -107,6 +107,9 @@
     private boolean nontransactionalWrite = false;
     private boolean ignoreCache = true;
     private boolean detachAllOnCommit = false;
+    private String serverTimeZoneID = null;
+    private String persistenceUnitName = null;    
+    private String transactionType = null;
     
     private int queryTimeout = 0;
     private int updateTimeout = 0;
@@ -181,7 +184,7 @@
  
     /** Collection of registered pmf instances. */
     private static Collection registeredPMFs = new HashSet();
-    
+
     /** Adds a JVM shutdown hook to close pmf instances left open by the
      * user. 
      */
@@ -632,6 +635,90 @@
         return updateTimeout;
     }
     
+    /**
+     * Sets the PersistenceUnitName for this PersistenceManagerFactory.
+     * This has the same semantics as the same-named property in
+     * JSR-220 PersistenceUnitInfo.
+     * @see #getPersistenceUnitName()
+     * @since 2.1
+     * @param name the PersistenceUnitName
+     */
+    public void setPersistenceUnitName(String name) {
+        assertConfigurable();
+        this.persistenceUnitName = name;
+    }
+
+    /**
+     * Gets the PersistenceUnitName for this PersistenceManagerFactory.
+     * @see #setPersistenceUnitName(String)
+     * @since 2.1
+     * @return the PersistenceUnitName
+     */
+    public String getPersistenceUnitName() {
+        return persistenceUnitName;
+    }
+
+    /**
+     * Sets the TimeZone ID of the server associated with this
+     * PersistenceManagerFactory. The parameter is a String
+     * suitable for use with TimeZone.getTimeZone(). The String
+     * must match an ID returned by TimeZone.getAvailableIDs().
+     * If the ServerTimeZoneID is not set, or set to the null String,
+     * assume that the server has the same TimeZone ID as the client.
+     * If incorrectly set, the result of PersistenceManager.getServerDate()
+     * might be incorrect.
+     * @see #getServerTimeZoneID()
+     * @see java.util.TimeZone#getTimeZone(String)
+     * @see java.util.TimeZone#getAvailableIDs()
+     * @see PersistenceManager#getServerDate()
+     * @since 2.1
+     * @param timezoneid the TimeZone ID of the server
+     * @throws JDOUserException if the parameter does not match
+     * an ID from TimeZone.getAvailableIDs()
+     */
+    public void setServerTimeZoneID(String timezoneid) {
+        assertConfigurable();
+        this.serverTimeZoneID = timezoneid;
+    }
+
+    /**
+     * Gets the TimeZone ID of the server associated with this
+     * PersistenceManagerFactory. If not set, assume that
+     * the server has the same TimeZone ID as the client.
+     * @see #setServerTimeZoneID(String)
+     * @since 2.1
+     * @return the TimeZone of the server
+     */
+    public String getServerTimeZoneID() {
+        return serverTimeZoneID;
+    }
+
+    /**
+     * Sets the TransactionType for this PersistenceManagerFactory.
+     * Permitted values are "JTA" and "RESOURCE_LOCAL".
+     * This has the same semantics as the same-named property in
+     * JSR-220 EntityManagerFactory.
+     * @see #getTransactionType()
+     * @see Constants#JTA
+     * @see Constants#RESOURCE_LOCAL
+     * @since 2.1
+     * @param name the TransactionType
+     * @throws JDOUserException if the parameter is not a permitted value
+     */
+    public void setTransactionType(String transactionType) {
+        assertConfigurable();
+        this.transactionType = transactionType;
+    }
+
+    /**
+     * Gets the TransactionType for this PersistenceManagerFactory.
+     * @see #setTransactionType(String)
+     * @since 2.1
+     * @return the TransactionType
+     */
+    public String getTransactionType() {
+        return transactionType;
+    }
     
     /**
      * Return "static" properties of this PersistenceManagerFactory.
@@ -835,6 +922,32 @@
             }
             throw e;
         }
+    }
+
+    /** Get a thread-safe instance of a proxy that dynamically binds 
+     * on each method call to an instance of <code>PersistenceManager</code>.
+     * <P>When used with a <code>PersistenceManagerFactory</code>
+     * that uses TransactionType JTA,
+     * the proxy can be used in a server to dynamically bind to an instance 
+     * from this factory associated with the thread's current transaction.
+     * In this case, the close method is ignored, as the 
+     * <code>PersistenceManager</code> is automatically closed when the
+     * transaction completes.
+     * <P>When used with a <code>PersistenceManagerFactory</code>
+     * that uses TransactionType RESOURCE_LOCAL, the proxy uses an inheritable
+     * ThreadLocal to bind to an instance of <code>PersistenceManager</code>
+     * associated with the thread. In this case, the close method executed
+     * on the proxy closes the <code>PersistenceManager</code> and then
+     * clears the ThreadLocal.
+     * Use of this method does not affect the configurability of the
+     * <code>PersistenceManagerFactory</code>.
+     *
+     * @since 2.1
+     * @return a <code>PersistenceManager</code> proxy.
+     */
+    public PersistenceManager getPersistenceManagerProxy() {
+        throw new UnsupportedOperationException(
+            "Method getPersistenceManagerProxy not yet implemented");
     }
 
     /**

Modified: db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java?view=diff&rev=551342&r1=551341&r2=551342
==============================================================================
--- db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java (original)
+++ db/jdo/trunk/runtime20/src/java/org/apache/jdo/impl/pm/PersistenceManagerImpl.java Wed Jun 27 14:40:54 2007
@@ -29,6 +29,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
@@ -1588,6 +1589,21 @@
     public Properties getProperties() {
         assertIsOpen();
         return JDORIVersion.getVendorProperties();
+    }
+
+    /**
+     * Get the Date as seen by the server. 
+     * Clients using this method can order their operations according to 
+     * a single time source. Implementations use the setting of the 
+     * server time zone to prepare a Date instance that represents 
+     * UTC time on the server. 
+     * @return a Date instance corresponding to the UTC Date 
+     * as seen by the server
+     * @since 2.1
+     */
+    public Date getServerDate() {
+        // TODO implement this in client-server mode
+        return new Date();
     }
 
     //