db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r189922 - /incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java /incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection /incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo
Date Fri, 10 Jun 2005 08:23:31 GMT
Author: mbo
Date: Fri Jun 10 01:23:28 2005
New Revision: 189922

URL: http://svn.apache.org/viewcvs?rev=189922&view=rev
Log:
Set JavaModel<->JDOModel relationship on JDOModel lookup

Modified:
    incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/Bundle.properties
    incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModel.java
    incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModelFactory.java
    incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/Bundle.properties
    incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/JDOModelImplDynamic.java

Modified: incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/Bundle.properties?rev=189922&r1=189921&r2=189922&view=diff
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/Bundle.properties (original)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/Bundle.properties Fri
Jun 10 01:23:28 2005
@@ -88,9 +88,6 @@
 expected ''org.apache.jdo.impl.model.java.ReflectionJavaType'' instance, \
 found ''{0}'' instance.
 
-#NOI18N
-ERR_CannotSetJDOModel=Cannot set JDOModel for JavaModel instance.
-
 #
 # ReflectionJavaTypeIntrospector
 #

Modified: incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModel.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModel.java?rev=189922&r1=189921&r2=189922&view=diff
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModel.java
(original)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModel.java
Fri Jun 10 01:23:28 2005
@@ -21,8 +21,11 @@
 import java.io.InputStream;
 
 import org.apache.jdo.impl.model.java.AbstractJavaModel;
+import org.apache.jdo.impl.model.jdo.caching.JDOModelFactoryImplCaching;
 import org.apache.jdo.model.ModelFatalException;
 import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.model.jdo.JDOModel;
+import org.apache.jdo.model.jdo.JDOModelFactory;
 import org.apache.jdo.util.I18NHelper;
 
 /**
@@ -163,6 +166,19 @@
                 }
             }
             );
+    }
+
+    /**
+     * Returns the corresponding JDOModel instance.
+     * @return the corresponding JDOModel.
+     */
+    public JDOModel getJDOModel()
+    {
+        if (jdoModel == null) {
+            JDOModelFactory factory = JDOModelFactoryImplCaching.getInstance();
+            jdoModel = factory.getJDOModel(this);
+        }
+        return jdoModel;
     }
 
     // ===== Methods not defined in JavaModel =====

Modified: incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModelFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModelFactory.java?rev=189922&r1=189921&r2=189922&view=diff
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModelFactory.java
(original)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/java/reflection/ReflectionJavaModelFactory.java
Fri Jun 10 01:23:28 2005
@@ -23,11 +23,8 @@
 import org.apache.jdo.model.ModelFatalException;
 import org.apache.jdo.model.java.JavaModel;
 import org.apache.jdo.model.java.JavaType;
-import org.apache.jdo.model.jdo.JDOModelFactory;
-import org.apache.jdo.model.jdo.JDOModel;
 import org.apache.jdo.impl.model.java.AbstractJavaModelFactory;
 import org.apache.jdo.impl.model.java.BaseReflectionJavaType;
-import org.apache.jdo.impl.model.jdo.caching.JDOModelFactoryImplCaching;
 import org.apache.jdo.util.I18NHelper;
 
 /**
@@ -90,9 +87,6 @@
             }
         }
 
-        // set the JDOModel property in JavaModel
-        setJDOModelInternal(javaModel);
-
         return javaModel;
     }
 
@@ -205,22 +199,5 @@
     protected JavaModel newJavaModelInstance(ClassLoader classLoader) {
         return new ReflectionJavaModel(classLoader, this);
     }
-    
-    /**
-     * Sets the JDOModel instance for the specified JavaModel.
-     * @param javaModel the JavaModel
-     */
-    protected void setJDOModelInternal(JavaModel javaModel)
-    {
-        JDOModelFactory factory = JDOModelFactoryImplCaching.getInstance();
-        JDOModel jdoModel = factory.getJDOModel(javaModel);
-        // update the JDOModel property of the JavaModel
-        try {
-            javaModel.setJDOModel(jdoModel);
-        }
-        catch (ModelException ex) {
-            throw new ModelFatalException(
-                msg.msg("ERR_CannotSetJDOModel"), ex); //NOI18N
-        }
-    }
+
 }

Modified: incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/Bundle.properties?rev=189922&r1=189921&r2=189922&view=diff
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/Bundle.properties (original)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/Bundle.properties Fri
Jun 10 01:23:28 2005
@@ -14,12 +14,6 @@
 # limitations under the License.
 
 #
-# Generic messages
-#
-#NOI18N
-ERR_MissingJavaModel=Missing JavaModel.
-
-#
 # JDOModelImpl
 #
 EXC_XMLError=Error during reading XML meta data of resource ''{0}''.
@@ -27,6 +21,8 @@
 EXC_MissingJDOMetadata=Missing JDO metadata for enhanced class ''{0}''.
 #NOI18N
 ERR_MultipleJDOClassInstances=JDOModelImpl.lookupXMLMetadata: muliple JDOClass instances
for persistence-capable class ''{0}''.
+#NOI18N
+ERR_CannotSetJDOModel=Cannot set JDOModel for JavaModel instance.
 
 #
 # Assertion

Modified: incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/JDOModelImplDynamic.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/JDOModelImplDynamic.java?rev=189922&r1=189921&r2=189922&view=diff
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/JDOModelImplDynamic.java
(original)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/impl/model/jdo/JDOModelImplDynamic.java
Fri Jun 10 01:23:28 2005
@@ -139,6 +139,12 @@
         super();
         setJavaModel(javaModel);
         this.loadXMLMetadataDefault = loadXMLMetadataDefault;
+        try {
+            javaModel.setJDOModel(this);
+        }
+        catch (ModelException ex) {
+            throw new ModelFatalException(msg.msg("ERR_CannotSetJDOModel"), ex); //NOI18N
+        }
     }
 
     /** 



Mime
View raw message