db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r158176 [36/79] - in incubator/jdo/trunk/ri11: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/ejb/ src/java/org/apache/jdo/enhancer/ src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/enhancer/ src/java/org/apache/jdo/impl/enhancer/classfile/ src/java/org/apache/jdo/impl/enhancer/core/ src/java/org/apache/jdo/impl/enhancer/generator/ src/java/org/apache/jdo/impl/enhancer/meta/ src/java/org/apache/jdo/impl/enhancer/meta/model/ src/java/org/apache/jdo/impl/enhancer/meta/prop/ src/java/org/apache/jdo/impl/enhancer/meta/util/ src/java/org/apache/jdo/impl/enhancer/util/ src/java/org/apache/jdo/impl/fostore/ src/java/org/apache/jdo/impl/jdoql/ src/java/org/apache/jdo/impl/jdoql/jdoqlc/ src/java/org/apache/jdo/impl/jdoql/scope/ src/java/org/apache/jdo/impl/jdoql/tree/ src/java/org/apache/jdo/impl/model/ src/java/org/apache/jdo/impl/model/java/ src/java/org/apache/jdo/impl/model/java/runtime/ src/java/org/apache/jdo/impl/model/jdo/ src/java/org/apache/jdo/impl/model/jdo/caching/ src/java/org/apache/jdo/impl/model/jdo/util/ src/java/org/apache/jdo/impl/model/jdo/xml/ src/java/org/apache/jdo/impl/pm/ src/java/org/apache/jdo/impl/sco/ src/java/org/apache/jdo/impl/state/ src/java/org/apache/jdo/jdoql/ src/java/org/apache/jdo/jdoql/tree/ src/java/org/apache/jdo/model/ src/java/org/apache/jdo/model/java/ src/java/org/apache/jdo/model/jdo/ src/java/org/apache/jdo/pm/ src/java/org/apache/jdo/sco/ src/java/org/apache/jdo/state/ src/java/org/apache/jdo/store/ src/java/org/apache/jdo/util/ test/ test/conf/ test/enhancer/ test/enhancer/sempdept/ test/enhancer/sempdept/src/ test/enhancer/sempdept/src/empdept/ test/fsuid2/ test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/ test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/ test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/ test/java/org/apache/jdo/pc/empdept/ test/java/org/apache/jdo/pc/serializable/ test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/ test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/ test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/ test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/ test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/ test/jdo/org/apache/jdo/pc/xempdept/ xdocs/
Date Sat, 19 Mar 2005 01:06:06 GMT
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/Bundle.properties?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/Bundle.properties (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/Bundle.properties Fri Mar 18 17:02:29 2005
@@ -0,0 +1,104 @@
+#
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at 
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+
+#
+# Generic messages
+#
+
+# {0} - location (class.method)
+#NOI18N
+ERR_InvalidNullFieldInstance={0}: specified Field instance is null.
+
+
+# {0} - class name
+# {1} - detailed message of the cause
+EXC_ClassLoadingError=Error during loading of class ''{0}'': {1}.
+
+#
+# ReflectionJavaType
+#
+
+# {0} - error location (class.method)
+#NOI18N
+ERR_InvalidNullClassInstance={0}: specified Class instance is null.
+
+#
+# ReflectionJavaField
+#
+# {0} - class name
+EXC_CannotGetDeclaredField=A SecurityException was thrown when trying to \
+get a declared field of class ''{0}''.  You must grant \
+java.lang.RuntimePermission("accessDeclaredMembers") to the codeBase \
+containing the JDO Reference Implementation (jdori.jar).
+
+#
+# AbstractJavaModelFactory
+#
+
+# {0} - class name
+# {1} - method name
+EXC_MethodNotSupported=Class {0} does not support method {1}.
+
+EXC_CannotCreateJavaModel=Problems during JavaModel creation.
+
+#
+# ReflectionJavaField
+#
+#NOI18N
+ERR_MissingFieldInstance={0}: cannot find reflection field instance for field {1}.
+
+
+#
+# RuntimeJavaModelFactory
+#
+
+EXC_CannotGetJDOImplHelper=A SecurityException was thrown when trying to get \
+the singleton JDOImplHelper instance. In order to get runtime metadata, you \
+must grant javax.jdo.spi.JDOPermission("getMetadata") to the codeBases \
+containing the JDO Reference Implementation (jdo.jar and jdori.jar).
+
+EXC_CannotGetRuntimeJavaModelFactory=A SecurityException was thrown when trying \
+to get the singleton RuntimeJavaModelFactory instance. In order to get runtime \
+metadata, you must grant javax.jdo.spi.JDOPermission("getMetadata") to the \
+codeBases containing the JDO Reference Implementation (jdo.jar and jdori.jar).
+
+# {0} - class instance
+EXC_CannotGetClassLoader=A SecurityException was thrown when trying to get the \
+class loader of class instance ''{0}''. In order to get runtime metadata, you \
+must grant ReflectPermission("getClassLoader") to the codeBase containing the \
+JDO Reference Implementation (jdori.jar).
+
+# {0} - key instance
+EXC_InvalidJavaModelKey=Invalid key for runtime JavaModel lookup: \
+expected ''java.lang.ClassLoader'' instance, found ''{0}'' instance.
+
+# {0} - type description instance
+EXC_InvalidTypeDesc=Invalid type description for runtime JavaType lookup: \
+expected ''java.lang.Class'' instance, found ''{0}'' instance.
+
+# {0} - JavaType instance
+EXC_InvalidJavaType=Invalid JavaType instance for getJavaClass method: \
+expected ''org.apache.jdo.impl.model.java.ReflectionJavaType'' instance, \
+found ''{0}'' instance.
+
+#
+# RuntimeJavaType
+#
+
+# {0} - error location (class.method)
+# {1} - implementation method name
+# {2} - field name
+#NOI18N
+ERR_MultipleJavaField={0}: multiple JavaField ''{1}'' for class '{2}''.

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ErrorType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ErrorType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ErrorType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ErrorType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * An instance of class ErrorType represents an erroneous type. Components
+ * such as the semantic analysis may use this type to indicate an error
+ * situtaion. It is compatible to all other types. 
+ * 
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class ErrorType
+    extends AbstractJavaType
+{
+    /** The singleton ErrorType instance. */
+    public static final ErrorType errorType = new ErrorType();
+
+    /** 
+     * Creates new a ErrorType instance. This constructor should not be 
+     * called directly; instead, the singleton instance  {@link #errorType}
+     * should be used. 
+     */
+    protected ErrorType() {}
+
+    /** 
+     * Returns true if this JavaType is compatible with the specified
+     * JavaType. This implementation always returns <code>true</code>,
+     * because ErrorType is compatible with any other type.
+     * @param javaType the type this JavaType is checked with.
+     * @return <code>true</code> if this is compatible with the specified
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isCompatibleWith(JavaType javaType)
+    {
+        return true;
+    }
+    
+    /** 
+     * Returns the name of the type.  
+     * @return type name
+     */
+    public String getName()
+    {
+        return "<error type>";
+    }
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/FloatingPointType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/FloatingPointType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/FloatingPointType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/FloatingPointType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+/**
+ * A FloatingPointType instance represents a floating point type as defined
+ * in the Java language. There are two floating point types: 
+ * <code>float</code> and <code>double</code>.
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for floating point types.
+ * 
+ * @see PredefinedType#floatType
+ * @see PredefinedType#doubleType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class FloatingPointType
+    extends PrimitiveType 
+{
+    /** Constructor. */
+    public FloatingPointType(Class clazz)
+    {
+        super(clazz);
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a floating
+     * point type. 
+     * @return <code>true</code> if this JavaType represents a floating
+     * point type; <code>false</code> otherwise.
+     */
+    public boolean isFloatingPoint() 
+    {
+        return true;
+    }
+
+    /**
+     * Returns <code>true</code> if this JavaType represents an orderable
+     * type as specified by JDO.
+     * @return <code>true</code> if this JavaType represents an orderable
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isOrderable() 
+    {
+        return true;
+    }
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/IntegralType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/IntegralType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/IntegralType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/IntegralType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+/**
+ * A IntegralType instance represents an integral type as defined in the
+ * Java language. There are five are integral types: <code>byte</code>, 
+ * <code>short</code>, <code>int</code>, <code>long</code>, and
+ * <code>char</code>.
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for integral types.
+ *
+ * @see PredefinedType#byteType
+ * @see PredefinedType#shortType
+ * @see PredefinedType#intType
+ * @see PredefinedType#longType
+ * @see PredefinedType#charType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class IntegralType
+    extends PrimitiveType 
+{
+    /** Constructor. */
+    public IntegralType(Class clazz)
+    {
+        super(clazz);
+    }
+    
+    /**
+     * Returns <code>true</code> if this JavaType represents an integral
+     * type. 
+     * @return <code>true</code> if this JavaTypre represents an integral
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isIntegral() 
+    {
+        return true;
+    }
+
+    /**
+     * Returns <code>true</code> if this JavaType represents an orderable
+     * type as specified by JDO.
+     * @return <code>true</code> if this JavaType represents an orderable
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isOrderable() 
+    {
+        return true;
+    }
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedCollectionType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedCollectionType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedCollectionType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedCollectionType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * A JDOSupportedCollectionType instance represents a JDO supported
+ * collection type. 
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for JDO supported map types.
+ * 
+ * @see PredefinedType#collectionType
+ * @see PredefinedType#setType
+ * @see PredefinedType#listType
+ * @see PredefinedType#hashSetType 
+ * @see PredefinedType#treeSetType
+ * @see PredefinedType#arrayListType
+ * @see PredefinedType#linkedListType
+ * @see PredefinedType#vectorType
+ * @see PredefinedType#stackType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class JDOSupportedCollectionType
+    extends PredefinedType
+{
+    /** 
+     * Constructor for JDOSupportedCollection types having no superclass. 
+     * These are the collection interfaces among the JDO supported 
+     * collection types. 
+     * @param clazz the Class instance representing the type.
+     */
+    public JDOSupportedCollectionType(Class clazz)
+    {
+        super(clazz);
+    }
+
+    /** 
+     * Constructor for JDOSupportedCollection types having a superclass. 
+     * These are the collection implemenatation classes among the JDO 
+     * supported collection types. 
+     * @param clazz the Class instance representing the type
+     * @param superclass JavaType instance representing the superclass.
+     */
+    public JDOSupportedCollectionType(Class clazz, JavaType superclass)
+    {
+        super(clazz, superclass);
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a JDO
+     * supported collection type. The JDO specification allows the
+     * following collection interfaces and classes as types of persistent 
+     * fields (see section 6.4.3 Persistent fields):
+     * @return <code>true</code> if this JavaType represents a JDO
+     * supported collection; <code>false</code> otherwise.
+     */
+    public boolean isJDOSupportedCollection() 
+    {
+        return true;
+    }
+
+    /**
+     * Returns <code>true</code> if this JavaType represents a trackable
+     * Java class. A JDO implementation may replace a persistent field of
+     * a trackable type with an assignment compatible instance of its own
+     * implementation of this type which notifies the owning FCO of any
+     * change of this field. 
+     * @return <code>true</code> if this JavaType represents a trackable
+     * Java class, <code>false</code> otherwise.
+     */
+    public boolean isTrackable()
+    {
+        return true;
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedMapType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedMapType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedMapType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JDOSupportedMapType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * A JDOSupportedMapType instance represents a JDO supported map type. 
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for JDO supported map types.
+ *
+ * @see PredefinedType#mapType
+ * @see PredefinedType#hashMapType
+ * @see PredefinedType#hashtableType
+ * @see PredefinedType#propertiesType
+ * @see PredefinedType#treeMapType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class JDOSupportedMapType
+    extends PredefinedType
+{
+    /** 
+     * Constructor for JDOSupportedMap types having no superclass. This is
+     * the map interface among the JDO supported map types.
+     * @param clazz the Class instance representing the type
+     */
+    public JDOSupportedMapType(Class clazz)
+    {
+        super(clazz);
+    }
+
+    /** 
+     * Constructor for JDOSupportedMap types having a superclass. These are
+     * the map implemenatation classes among the JDO supported map types.
+     * @param clazz the Class instance representing the type
+     * @param superclass JavaType instance representing the superclass.
+     */
+    public JDOSupportedMapType(Class clazz, JavaType superclass)
+    {
+        super(clazz, superclass);
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a JDO
+     * supported map type. The JDO specification allows the
+     * following map interfaces and classes as types of persistent 
+     * fields (see section 6.4.3 Persistent fields):
+     * @return <code>true</code> if this JavaTypre represents a JDO
+     * supported map; <code>false</code> otherwise.
+     */
+    public boolean isJDOSupportedMap() 
+    {
+        return true;
+    }
+
+    /**
+     * Returns <code>true</code> if this JavaType represents a trackable
+     * Java class. A JDO implementation may replace a persistent field of
+     * a trackable type with an assignment compatible instance of its own
+     * implementation of this type which notifies the owning FCO of any
+     * change of this field. 
+     * @return <code>true</code> if this JavaType represents a trackable
+     * Java class, <code>false</code> otherwise.
+     */
+    public boolean isTrackable()
+    {
+        return true;
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JavaModel-Impl.jpg
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JavaModel-Impl.jpg?view=auto&rev=158176
==============================================================================
Binary file - no diff available.

Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JavaModel-Impl.jpg
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/JavaModel-Impl.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/MutableValueClassType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/MutableValueClassType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/MutableValueClassType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/MutableValueClassType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * A MutableValueClassType instance represents a mutable class whoses
+ * values may be treated as values rather than refernces during
+ * storing. Note, MutableValueClassType instances are trackable which is
+ * the only difference in behavior to instances of the superclass
+ * ValueClassType. 
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for mutable value class types.
+ * 
+ * @see PredefinedType#dateType
+ * @see PredefinedType#sqlDateType
+ * @see PredefinedType#sqlTimeType 
+ * @see PredefinedType#sqlTimestampType
+ * @see PredefinedType#bitsetType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class MutableValueClassType
+    extends ValueClassType
+{
+    /** 
+     * Constructor.
+     * @param clazz the Class instance representing the type
+     * @param superclass JavaType instance representing the superclass.
+     * @param orderable flag indicating whether this type is orderable.
+     */
+    public MutableValueClassType(Class clazz, JavaType superclass, boolean orderable)
+    {
+        super(clazz, superclass, orderable);
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a trackable
+     * Java class. A JDO implementation may replace a persistent field of
+     * a trackable type with an assignment compatible instance of its own
+     * implementation of this type which notifies the owning FCO of any
+     * change of this field.
+     * @return <code>true</code> if this JavaType represents a trackable
+     * Java class, <code>false</code> otherwise.
+     */
+    public boolean isTrackable() 
+    {
+        return true;
+    }
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/NullType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/NullType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/NullType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/NullType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * An instance of class NullType represents the type of the null expression
+ * in Java. It is compatible to all reference types.
+ * 
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class NullType
+    extends AbstractJavaType
+{
+    /** The singleton NullType instance. */
+    public static final NullType nullType = new NullType();
+
+    /** 
+     * Creates new a NullType instance. This constructor should not be 
+     * called directly; instead, the singleton instance  {@link #nullType}
+     * should be used. 
+     */
+    protected NullType() {}
+
+    /** 
+     * Returns true if this JavaType is compatible with the specified
+     * JavaType. This implementation returns <code>true</code>, if the
+     * specified javaType is a not a primitive type, because the type of
+     * null is compatiple with all reference types.
+     * @param javaType the type this JavaType is checked with.
+     * @return <code>true</code> if this is compatible with the specified
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isCompatibleWith(JavaType javaType)
+    {
+        return !javaType.isPrimitive();
+    }
+    
+    /** 
+     * Returns the name of the type.  
+     * @return type name
+     */
+    public String getName()
+    {
+        return "<null type>";
+    }
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PredefinedType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PredefinedType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PredefinedType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PredefinedType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,249 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import java.util.*;
+import java.math.*;
+
+import org.apache.jdo.model.java.JavaType;
+
+
+/**
+ * Instances of this class represent a type that is not a persistence
+ * capable class, but is known by JDO. All JavaModel implementation will
+ * use this implementation to represnet predefined types. Predefined types
+ * include: 
+ * <ul>
+ * <li> java.lang.Object
+ * <li> void
+ * <li> primitive types
+ * <li> Java wrapper class types
+ * <li> immutable and mutable value types, such as java.lang.String,
+ * java.util.Date, etc.
+ * <li> JDO supported collection types, including their superclasses.
+ * <li> JDO supported map types, including their superclasses.
+ * </ul> 
+ * This class provides public static fields for all predefined types. These
+ * constants are convenience for direct access of a JavaType instance
+ * representing a predefined type. The class also manages a map of
+ * predefined types using the type name as key. The constructors
+ * automatically add the new created instance to this map. Please use
+ * method  {@link #getPredefinedType(String name)} to lookup a predefined
+ * type by name. Method {@link #getPredefinedTypes()} returns a view of the
+ * map of predefined types. 
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class PredefinedType
+    extends ReflectionJavaType
+{
+    /** Map of all predefined types. */
+    private static final Map predefinedTypes = new HashMap();
+
+    // ===== java.lang.Object =====
+
+    /** The JavaType instance for the class java.lang.Object. */
+    public static final PredefinedType objectType = new PredefinedType(Object.class);
+
+    // ===== void =====
+
+    /** The JavaType instance for the type void. */
+    public static final PredefinedType voidType = new PredefinedType(void.class);
+
+    // ===== primitive types ===== 
+
+    /** The JavaType instance for the primitive type boolean. */
+    public static final PrimitiveType booleanType = new PrimitiveType(boolean.class);
+    /** The JavaType instance for the integral type byte. */
+    public static final IntegralType byteType = new IntegralType(byte.class);
+    /** The JavaType instance for the integral type short. */
+    public static final IntegralType shortType = new IntegralType(short.class);
+    /** The JavaType instance for the integral type int. */
+    public static final IntegralType intType = new IntegralType(int.class);
+    /** The JavaType instance for the integral type long. */
+    public static final IntegralType longType = new IntegralType(long.class);
+    /** The JavaType instance for the integral type char. */
+    public static final IntegralType charType = new IntegralType(char.class);
+    /** The JavaType instance for the floating point type float. */
+    public static final FloatingPointType floatType = new FloatingPointType(float.class);
+    /** The JavaType instance for the floating point type double. */
+    public static final FloatingPointType doubleType = new FloatingPointType(double.class);
+
+    // ===== Value types ===== 
+
+    /** The JavaType instance for the class java.lang.Numer. */
+    public static final ValueClassType numberType = new ValueClassType(Number.class, objectType, false);
+    /** The JavaType instance for the class java.lang.String. */
+    public static final ValueClassType stringType = new ValueClassType(String.class, objectType, true);
+    /** The JavaType instance for the class java.lang.Locale. */
+    public static final ValueClassType localeType = new ValueClassType(Locale.class, objectType, false);
+    /** The JavaType instance for the class java.math.BigDecimal. */
+    public static final ValueClassType bigDecimalType = new ValueClassType(BigDecimal.class, numberType, true);
+    /** The JavaType instance for the class java.math.BigInteger. */
+    public static final ValueClassType bigIntegerType = new ValueClassType(BigInteger.class, numberType, true);
+
+    // ===== WrapperClass types ===== 
+
+    /** The JavaType instance for the class java.lang.Boolean. */
+    public static final WrapperClassType booleanClassType = new WrapperClassType(Boolean.class, objectType, false);
+    /** The JavaType instance for the class java.lang.Byte. */
+    public static final WrapperClassType byteClassType = new WrapperClassType(Byte.class, numberType, true);
+    /** The JavaType instance for the class java.lang.Short. */
+    public static final WrapperClassType shortClassType = new WrapperClassType(Short.class, numberType, true);
+    /** The JavaType instance for the class java.lang.Integer. */
+    public static final WrapperClassType integerClassType = new WrapperClassType(Integer.class, numberType, true);
+    /** The JavaType instance for the class java.lang.Long. */
+    public static final WrapperClassType longClassType = new WrapperClassType(Long.class, numberType, true);
+    /** The JavaType instance for the class java.lang.Character. */
+    public static final WrapperClassType characterClassType = new WrapperClassType(Character.class, numberType, true);
+    /** The JavaType instance for the class java.lang.Float. */
+    public static final WrapperClassType floatClassType = new WrapperClassType(Float.class, numberType, true);
+    /** The JavaType instance for the class java.lang.Double. */
+    public static final WrapperClassType doubleClassType = new WrapperClassType(Double.class, numberType, true);
+
+    // ===== Mutable value types ===== 
+
+    /** The JavaType instance for the class java.util.Date. */
+    public static final MutableValueClassType dateType = new MutableValueClassType(Date.class, objectType, true);
+    /** The JavaType instance for the class java.sql.Date. */
+    public static final MutableValueClassType sqlDateType = new MutableValueClassType(java.sql.Date.class, dateType, true);
+    /** The JavaType instance for the class java.sql.Time. */
+    public static final MutableValueClassType sqlTimeType = new MutableValueClassType(java.sql.Time.class, dateType, true);
+    /** The JavaType instance for the class java.sql.Timestamp. */
+    public static final MutableValueClassType sqlTimestampType = new MutableValueClassType(java.sql.Timestamp.class, dateType, true);
+    /** The JavaType instance for the class java.util.BitSet. */
+    public static final MutableValueClassType bitsetType = new MutableValueClassType(BitSet.class, objectType, false);
+
+    // ===== JDOSupportedCollection types ===== 
+
+    /** The JavaType instance for the interface java.util.Collection. */
+    public static final JDOSupportedCollectionType collectionType = new JDOSupportedCollectionType(Collection.class);
+    /** The JavaType instance for the interface java.util.Set. */
+    public static final JDOSupportedCollectionType setType = new JDOSupportedCollectionType(Set.class);
+    /** The JavaType instance for the interface java.util.List. */
+    public static final JDOSupportedCollectionType listType = new JDOSupportedCollectionType(List.class);
+    /** The JavaType instance for the class java.util.AbstractCollection. */
+    public static final PredefinedType abstractCollectionType = new PredefinedType(AbstractCollection.class, objectType);
+    /** The JavaType instance for the class java.util.AbstractSet. */
+    public static final PredefinedType abstractSetType = new PredefinedType(AbstractSet.class, abstractCollectionType);
+    /** The JavaType instance for the class java.util.HashSet. */
+    public static final JDOSupportedCollectionType hashSetType = new JDOSupportedCollectionType(HashSet.class, abstractSetType);
+    /** The JavaType instance for the class java.util.TreeSet. */
+    public static final JDOSupportedCollectionType treeSetType = new JDOSupportedCollectionType(TreeSet.class, abstractSetType);
+    /** The JavaType instance for the class java.util.AbstractList. */
+    public static final PredefinedType abstractListType = new PredefinedType(AbstractList.class, abstractCollectionType);
+    /** The JavaType instance for the class java.util.ArrayList. */
+    public static final JDOSupportedCollectionType arrayListType = new JDOSupportedCollectionType(ArrayList.class, abstractListType);
+    /** The JavaType instance for the class java.util.LinkedList. */
+    public static final JDOSupportedCollectionType linkedListType = new JDOSupportedCollectionType(LinkedList.class, abstractListType);
+    /** The JavaType instance for the class java.util.Vector. */
+    public static final JDOSupportedCollectionType vectorType = new JDOSupportedCollectionType(Vector.class, abstractListType);
+    /** The JavaType instance for the class java.util.Stack. */
+    public static final JDOSupportedCollectionType stackType = new JDOSupportedCollectionType(Stack.class, vectorType);
+
+    // ===== JDOSupportedMap types =====
+
+    /** The JavaType instance for the interface java.util.Map. */
+    public static final JDOSupportedMapType mapType = new JDOSupportedMapType(Map.class);
+    /** The JavaType instance for the class java.util.AbstractMap. */
+    public static final PredefinedType abstractMapType = new PredefinedType(AbstractMap.class, objectType);
+    /** The JavaType instance for the class java.util.HashMap. */
+    public static final JDOSupportedMapType hashMapType = new JDOSupportedMapType(HashMap.class, abstractMapType);
+    /** The JavaType instance for the class java.util.Dictionary. */
+    public static final PredefinedType dictionaryType = new PredefinedType(Dictionary.class, objectType);
+    /** The JavaType instance for the class java.util.Hashtable. */
+    public static final JDOSupportedMapType hashtableType = new JDOSupportedMapType(Hashtable.class, dictionaryType);
+    /** The JavaType instance for the class java.util.Properties. */
+    public static final JDOSupportedMapType propertiesType = new JDOSupportedMapType(Properties.class, hashtableType);
+    /** The JavaType instance for the class java.util.TreeMap. */
+    public static final JDOSupportedMapType treeMapType = new JDOSupportedMapType(TreeMap.class, abstractMapType);
+
+    /** 
+     * The static block sets references between the JavaType instances for
+     * primitives types and the JavaType instances for the corresponding
+     * wrapper class.
+     */
+    static
+    {
+        booleanType.setWrapperClassType(booleanClassType);
+        booleanClassType.setWrappedPrimitiveType(booleanType);
+        byteType.setWrapperClassType(byteClassType);
+        byteClassType.setWrappedPrimitiveType(byteType);
+        shortType.setWrapperClassType(shortClassType);
+        shortClassType.setWrappedPrimitiveType(shortType);
+        intType.setWrapperClassType(integerClassType);
+        integerClassType.setWrappedPrimitiveType(intType);
+        longType.setWrapperClassType(longClassType);
+        longClassType.setWrappedPrimitiveType(longType);
+        charType.setWrapperClassType(characterClassType);
+        characterClassType.setWrappedPrimitiveType(charType);
+        floatType.setWrapperClassType(floatClassType);
+        floatClassType.setWrappedPrimitiveType(floatType);
+        doubleType.setWrapperClassType(doubleClassType);
+        doubleClassType.setWrappedPrimitiveType(doubleType);
+    }
+    
+    /**
+     * Constructor taking a Class instance.
+     * It automatically adds a predefined type to the static map of all
+     * predefined types. 
+     * @param clazz the Class instance for this JavaType
+     */
+    protected PredefinedType(Class clazz)
+    {
+        this(clazz, null);
+    }
+    
+    /** 
+     * Constructor taking a Class instance and a JavaType representing the
+     * superclass of the new JavaType instance. 
+     * It automatically adds a predefined type to the static
+     * map of all predefined types.
+     * @param clazz the Class instance for this JavaType
+     * @param superclass the JavaType representing the superclass or
+     * <code>null</code> if there is no superclass.
+     */
+    protected PredefinedType(Class clazz, JavaType superclass)
+    {
+        super(clazz, superclass);
+        predefinedTypes.put(clazz.getName(), this);
+    }
+
+    /**
+     * Returns the JavaType instance for a predefined type with the
+     * specified name. The method return <code>null</code> if the specified
+     * name does not denote a predefined type. 
+     * @param name the name of the predefined type.
+     * @return the JavaType instance for the specified predefined type.
+     */
+    public static JavaType getPredefinedType(String name)
+    {
+        return (JavaType)predefinedTypes.get(name);
+    }
+
+    /** 
+     * Returns an unmodifiable view of the predefined types map. This map
+     * maps type names to JavaType instances.
+     * @return an unmodifiable view of the predefined types map.
+     */
+    public static Map getPredefinedTypes()
+    {
+        return Collections.unmodifiableMap(predefinedTypes);
+    }
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PrimitiveType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PrimitiveType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PrimitiveType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/PrimitiveType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * A PrimitiveType instance represents a primitive type as defined in the
+ * Java language. There are eight primitive types: <code>boolean</code>,
+ * <code>byte</code>, <code>short</code>, <code>int</code>,
+ * <code>long</code>, <code>char</code>, 
+ * <code>float</code>, <code>double</code>.
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for primtive types.
+ * 
+ * @see PredefinedType#booleanType
+ * @see PredefinedType#byteType
+ * @see PredefinedType#shortType
+ * @see PredefinedType#intType
+ * @see PredefinedType#longType
+ * @see PredefinedType#charType
+ * @see PredefinedType#floatType
+ * @see PredefinedType#doubleType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class PrimitiveType 
+    extends PredefinedType
+{
+    /** The JavaType of the corresponding Java wrapper class type. */
+    private WrapperClassType wrapperClassType;
+
+    /** 
+     * Constructor.
+     * @param clazz the Class instance representing the type
+     */
+    protected PrimitiveType(Class clazz)
+    {
+        super(clazz, null);
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a primitive
+     * type.
+     * @return <code>true</code> if this JavaTypre represents a primitive
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isPrimitive() 
+    {
+        return true;
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a type whoses
+     * values may be treated as values rather than refernces during
+     * storing. 
+     * @return <code>true</code> if this JavaType represents a value type;
+     * <code>false</code> otherwise.
+     */
+    public boolean isValue() 
+    {
+        return true;
+    }
+
+    // ===== Methods not defined in JavaType =====
+
+    /** 
+     * Returns the JavaType instance of the Java wrapper class that
+     * corresponds to this primitive type.
+     * @return the JavaType of the corresponding Java wrapper class.
+     */
+    public WrapperClassType getWrapperClassType()
+    {
+        return wrapperClassType;
+    }
+    
+    /** 
+     * Sets the JavaType instance of the corresponding Java wrapper class.
+     * @param wrapperClassType the JavaType representing the corresponding
+     * Java wrapper class.
+     */
+    void setWrapperClassType(WrapperClassType wrapperClassType)
+    {
+        this.wrapperClassType = wrapperClassType;
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaField.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaField.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaField.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaField.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+import org.apache.jdo.impl.model.java.AbstractJavaField;
+import org.apache.jdo.model.ModelFatalException;
+import org.apache.jdo.model.java.JavaField;
+import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.model.jdo.JDOField;
+import org.apache.jdo.util.I18NHelper;
+
+/**
+ * This class provides a basic JavaField implementation using a reflection
+ * Field instance. The implementation supports lazy initialization of the
+ * wrapped reflection field instance (see 
+ * {@link #ReflectionJavaField(String fieldName, JavaType declaringClass)}.
+ * <p>
+ * Note, this implementation is not connected to a JavaModelFactory, thus
+ * it can only support predefined types as field types.
+ * @see PredefinedType
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class ReflectionJavaField
+    extends AbstractJavaField
+{
+    /** The wrapped java.lang.reflect.Field instance. */
+    private Field field;
+
+    /** The type of the field. */
+    protected JavaType type;
+
+    /** I18N support */
+    private final static I18NHelper msg = 
+        I18NHelper.getInstance(ReflectionJavaField.class);
+
+    /** 
+     * Constructor taking a reflection field representation. The specifie
+     * field must not be <code>null</code>. 
+     * @param field the java.lang.reflect.Field instance
+     * @param declaringClass the JavaType of the declaring class or interface.
+     */
+    protected ReflectionJavaField(Field field, JavaType declaringClass)
+    {
+        super((field == null) ? null : field.getName(), declaringClass);
+        if (field == null)
+            throw new ModelFatalException(msg.msg(
+                "ERR_InvalidNullFieldInstance", "ReflectionJavaField.<init>")); //NOI18N
+        this.field = field;
+    }
+    
+    /** 
+     * Constructor taking the field name. This constructor allows lazy
+     * initialization of the field reference. 
+     * @param fieldName the name of the field.
+     * @param declaringClass the JavaType of the declaring class or interface.
+     */
+    protected ReflectionJavaField(String fieldName, JavaType declaringClass)
+    {
+        super(fieldName, declaringClass);
+    }
+
+    /**
+     * Returns the Java language modifiers for the field represented by
+     * this JavaField, as an integer. The java.lang.reflect.Modifier class
+     * should be used to decode the modifiers. 
+     * @return the Java language modifiers for this JavaField
+     * @see java.lang.reflect.Modifier
+     */
+    public int getModifiers()
+    {
+        ensureInitializedField();
+        return field.getModifiers();
+    }
+
+    /**
+     * Returns the JavaType representation of the field type.
+     * @return field type
+     */
+    public JavaType getType()
+    {
+        if (type == null) {
+            ensureInitializedField();
+            String typeName = field.getType().getName();
+            // Note, this only checks for predefined types!
+            type = PredefinedType.getPredefinedType(typeName);
+        }
+        return type;
+    }
+    
+    // ===== Methods not defined in JavaField =====
+
+    /** 
+     * Returns the java.lang.reflect.Field that is wrapped by this
+     * JavaField.
+     * @return the java.lang.reflect.Field instance.
+     */
+    protected Field getField()
+    {
+        ensureInitializedField();
+        return this.field;
+    }
+
+    /**
+     * Helper method to retrieve the java.lang.reflect.Field for this
+     * JavaField.
+     * @param clazz the Class instance of the declaring class or interface
+     * @param fieldName the field name
+     */
+    public static Field getDeclaredFieldPrivileged(final Class clazz, 
+                                                   final String fieldName)
+    {
+        if ((clazz == null) || (fieldName == null))
+            return null;
+
+        return (Field) AccessController.doPrivileged(
+            new PrivilegedAction() {
+                public Object run () {
+                    try {
+                        return clazz.getDeclaredField(fieldName);
+                    }
+                    catch (SecurityException ex) {
+                        throw new ModelFatalException(
+                            msg.msg("EXC_CannotGetDeclaredField", //NOI18N
+                                    clazz.getName()), ex); 
+                    }
+                    catch (NoSuchFieldException ex) {
+                        return null; // do nothing, just return null
+                    }
+                    catch (LinkageError ex) {
+                        throw new ModelFatalException(msg.msg(
+                           "EXC_ClassLoadingError", clazz.getName(), //NOI18N
+                           ex.toString()));
+                    }
+                }
+            }
+            );
+    }
+
+    // ===== Internal helper methods =====
+    
+    /**
+     * This method makes sure the reflection field is set.
+     */
+    protected void ensureInitializedField()
+    {
+        if (this.field == null) {
+            this.field = getDeclaredFieldPrivileged(
+                ((ReflectionJavaType)getDeclaringClass()).getJavaClass(),
+                getName());
+            if (field == null) {
+                throw new ModelFatalException(msg.msg(
+                    "ERR_MissingFieldInstance", //NOI18N
+                    "ReflectionJavaField.ensureInitializedField", getName())); //NOI18N
+            }
+        }
+    }
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ReflectionJavaType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import java.lang.reflect.Field;
+
+import org.apache.jdo.model.ModelFatalException;
+import org.apache.jdo.model.java.JavaField;
+import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.util.I18NHelper;
+
+
+
+/**
+ * This class provides a basic JavaType implementation using a reflection
+ * Class instance.
+ * <p> 
+ * Note, ReflectionJavaType must not be used for array types, since it inherits
+ * the default implemention of methods isArray and getArrayComponentType
+ * from its superclass AbstractJavaType.
+ * 
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class ReflectionJavaType
+    extends AbstractJavaType
+{
+    /** The java.lang.Class instance for this ReflectionJavaType. */
+    protected Class clazz;
+
+    /** The superclass JavaType. */
+    protected JavaType superclass;
+
+    /** I18N support */
+    private static I18NHelper msg = 
+        I18NHelper.getInstance(ReflectionJavaType.class);
+
+    /**
+     * Constructor. The specified java.lang.Class instance must not be
+     * <code>null</code>. The 
+     * @param clazz the Class instance representing the type
+     * @param superclass JavaType instance representing the superclass.
+     */
+    public ReflectionJavaType(Class clazz, JavaType superclass)
+    {
+        if (clazz == null)
+            throw new ModelFatalException(msg.msg(
+                "ERR_InvalidNullClassInstance", "ReflectionJavaType.<init>")); //NOI18N
+        this.clazz = clazz;
+        this.superclass = superclass;
+    }
+    
+    /** 
+     * Determines if this JavaType object represents an interface type.
+     * @return <code>true</code> if this object represents an interface type; 
+     * <code>false</code> otherwise.
+     */
+    public boolean isInterface()
+    {
+        return clazz.isInterface();
+    }
+    
+    /** 
+     * Returns true if this JavaType is compatible with the specified
+     * JavaType. 
+     * @param javaType the type this JavaType is checked with.
+     * @return <code>true</code> if this is compatible with the specified
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isCompatibleWith(JavaType javaType)
+    {
+        if (javaType == null)
+            return false;
+        
+        if (javaType instanceof ReflectionJavaType) {
+            ReflectionJavaType otherType = (ReflectionJavaType)javaType;
+            return otherType.getJavaClass().isAssignableFrom(clazz);
+        }
+        
+        return false;
+    }
+
+    /**
+     * Returns the name of the type. If this type represents a class or
+     * interface, the name is fully qualified.
+     * @return type name
+     */
+    public String getName()
+    {
+        return clazz.getName();
+    }
+
+    /**
+     * Returns the Java language modifiers for the field represented by
+     * this JavaType, as an integer. The java.lang.reflect.Modifier class
+     * should be used to decode the modifiers. 
+     * @return the Java language modifiers for this JavaType
+     */
+    public int getModifiers() 
+    { 
+        return clazz.getModifiers(); 
+    }
+
+    /** 
+     * Returns the JavaType representing the superclass of the entity
+     * represented by this JavaType. If this JavaType represents either the 
+     * Object class, an interface, a primitive type, or <code>void</code>, 
+     * then <code>null</code> is returned. If this object represents an
+     * array class then the JavaType instance representing the Object class
+     * is returned.  
+     * @return the superclass of the class represented by this JavaType.
+     */
+    public JavaType getSuperclass()
+    {
+        return superclass;
+    }
+
+    /**
+     * Returns a JavaField instance that reflects the field with the
+     * specified name of the class or interface represented by this
+     * JavaType instance. The method returns <code>null</code>, if the
+     * class or interface (or one of its superclasses) does not have a
+     * field with that name.
+     * @param fieldName the name of the field 
+     * @return the JavaField instance for the specified field in this class
+     * or <code>null</code> if there is no such field.
+     */
+    public JavaField getJavaField(String fieldName) 
+    { 
+        Field field = 
+            ReflectionJavaField.getDeclaredFieldPrivileged(clazz, fieldName);
+        if (field != null) {
+            return new ReflectionJavaField(field, this);
+        }
+        
+        // check superclass, if available and other than Object
+        JavaType superclass = getSuperclass();
+        if ((superclass != null) && (superclass != PredefinedType.objectType)) {
+            return superclass.getJavaField(fieldName);
+        }
+        
+        return null;
+    }
+
+    // ===== Methods not defined in JavaType =====
+
+    /**
+     * Returns the java.lang.Class instance wrapped by this JavaType.
+     * @return the Class instance for this JavaType.
+     */
+    public Class getJavaClass()
+    {
+        return clazz;
+    }
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ValueClassType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ValueClassType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ValueClassType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/ValueClassType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * A ValueClassType instance represents a class whoses values may be treated
+ * as values rather than refernces during storing. 
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for value class types.
+ * 
+ * @see PredefinedType#numberType
+ * @see PredefinedType#stringType
+ * @see PredefinedType#localeType 
+ * @see PredefinedType#bigDecimalType
+ * @see PredefinedType#bigIntegerType
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class ValueClassType 
+    extends PredefinedType
+{
+    /** The orderable property. */
+    private boolean orderable;
+
+    /** 
+     * Constructor.
+     * @param clazz the Class instance representing the type
+     * @param superclass JavaType instance representing the superclass.
+     * @param orderable flag indicating whether this type is orderable.
+     */
+    public ValueClassType(Class clazz, JavaType superclass, boolean orderable)
+    {
+        super(clazz, superclass);
+        this.orderable = orderable;
+    }
+
+    /** 
+     * Returns <code>true</code> if this JavaType represents a type whoses
+     * values may be treated as values rather than refernces during
+     * storing.
+     * @return <code>true</code> if this JavaType represents a value type;
+     * <code>false</code> otherwise.
+     */
+    public boolean isValue() 
+    {
+        return true;
+    }
+
+    /**
+     * Returns <code>true</code> if this JavaType represents an orderable
+     * type as specified by JDO.
+     * @return <code>true</code> if this JavaType represents an orderable
+     * type; <code>false</code> otherwise.
+     */
+    public boolean isOrderable()
+    {
+        return orderable;
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/WrapperClassType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/WrapperClassType.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/WrapperClassType.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/WrapperClassType.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java;
+
+import org.apache.jdo.model.java.JavaType;
+
+/**
+ * A WrapperClassType instance represents a Java wrapper class type. 
+ * There are eight Java wrapper class types: 
+ * <code>java.lang.Boolean</code>, <code>java.lang.Byte</code>, 
+ * <code>java.lang.Short</code>, <code>java.lang.Integer</code>, 
+ * <code>java.lang.Long</code>, <code>java.lang.Character</code>, 
+ * <code>java.lang.Float</code>, <code>java.lang.Double</code>.
+ * 
+ * <p>
+ * Class PredefinedType provides public static final variables referring
+ * to the JavaType representation for wrapper class types.
+ * 
+ * @see PredefinedType#booleanClassType
+ * @see PredefinedType#byteClassType
+ * @see PredefinedType#shortClassType
+ * @see PredefinedType#integerClassType
+ * @see PredefinedType#longClassType 
+ * @see PredefinedType#characterClassType
+ * @see PredefinedType#floatClassType
+ * @see PredefinedType#doubleClassType 
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class WrapperClassType 
+    extends ValueClassType
+{
+    /** */
+    private PrimitiveType wrappedPrimitiveType;
+
+    /** */
+    protected WrapperClassType(Class clazz, JavaType superclass, boolean orderable)
+    {
+        super(clazz, superclass, orderable);
+    }
+
+    /** */
+    public boolean isWrapperClass()
+    {
+        return true;
+    }
+
+    // ===== Methods not defined in JavaType =====
+
+    /** */
+    public PrimitiveType getWrappedPrimitiveType()
+    {
+        return wrappedPrimitiveType;
+    }
+    
+    /** */
+    void setWrappedPrimitiveType(PrimitiveType wrappedPrimitiveType)
+    {
+        this.wrappedPrimitiveType = wrappedPrimitiveType;
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/package.html Fri Mar 18 17:02:29 2005
@@ -0,0 +1,46 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>JavaModel core implementation package.</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#ffffff">
+<p>This package contains classes that are for use across all kinds of
+  JavaModel implementations. An environment specific JavaModel implementation
+  should reuse this core functionality by providing subclasses of
+  <a href="AbstractJavaModelFactory.html">AbstractJavaModelFactory</a>,   
+  <a href="AbstractJavaModel.html">AbstractJavaModel</a>,   
+  <a href="AbstractJavaType.html">AbstractJavaType</a>, and   
+  <a href="AbstractJavaField.html">AbstractJavaField</a>. 
+</p>
+<p> A runtime JavaModel implementation should extent classes
+  <a href="ReflectionJavaType.html">ReflectionJavaType</a> and
+  <a href="ReflectionJavaField.html">ReflectionJavaField</a>, 
+  since they provide a basic implementation using Java Metadata from reflection.  
+</p>
+<p> All environment specific JavaModel implementations are not supposed to
+have their own JavaType implementation for predefined types such as primitives
+and their Java  wrapper classes, immutable and mutable value types, JDO supported
+collection  and map types. Instead class 
+<a href="PredefinedType.html">PredefinedType</a> 
+provides an environment independent implementation. 
+</p>
+<br>
+</body>
+</html>

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RegisterClassListener.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java.runtime;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.jdo.spi.RegisterClassEvent;
+import javax.jdo.spi.JDOImplHelper;
+import javax.jdo.spi.PersistenceCapable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaField;
+import org.apache.jdo.model.java.JavaModel;
+import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.model.jdo.JDOClass;
+import org.apache.jdo.model.jdo.JDOField;
+import org.apache.jdo.model.jdo.JDOModel;
+import org.apache.jdo.model.jdo.PersistenceModifier;
+
+/**
+ * The Model listener gets notified whenever a persistence-capable class gets 
+ * registered with the JDOImplHelper at runtime.
+ *
+ * @author Michael Bouschen
+ */
+public class RegisterClassListener
+    implements javax.jdo.spi.RegisterClassListener
+{
+    /** The corresponding JDOImplHelper instance. */
+    JDOImplHelper helper;
+
+    /** The JavaModel factory. */
+    RuntimeJavaModelFactory javaModelFactory;
+
+    /** Logger. */
+    private static Log logger =
+        LogFactory.getFactory().getInstance("org.apache.jdo.impl.model.jdo"); // NOI18N
+
+    /** 
+     * Constructor. 
+     * @param helper the JDOImplHelper instance.
+     * @param javaModelFactory the JavaModel factory.
+     */
+    public RegisterClassListener(JDOImplHelper helper, 
+                                 RuntimeJavaModelFactory javaModelFactory)
+    {
+        this.helper = helper;
+        this.javaModelFactory = javaModelFactory;
+    }
+
+    /**
+     * This method gets called when a persistence-capable class is registered.
+     * @param event a RegisterClassEvent instance describing the registered 
+     * class plus metatdata.
+     */
+    public void registerClass(RegisterClassEvent event)
+    {
+        if (logger.isDebugEnabled())
+            logger.debug("RegisterClassListener.registerClass " + //NOI18N
+                         event.getRegisteredClass());
+        try {
+            updateJDOClass(createJDOClass(event.getRegisteredClass()),
+                           event.getFieldNames(), 
+                           event.getFieldTypes(),
+                           event.getFieldFlags(),
+                           event.getPersistenceCapableSuperclass());
+        }
+        catch (ModelException ex) {
+            // ignore error message
+            logger.error("Problems updating JDOModel", ex); //NOI18N
+            System.out.println("caught " + ex); //NOI18N
+        }
+    }
+    
+    /** 
+     * Internal method to update the corresponding JDOClass instance with the 
+     * runtime meta data.
+     * @param pcClass the class object of the persistence-capable class
+     */
+    private JDOClass createJDOClass(Class pcClass)
+        throws ModelException
+    {
+        String pcClassName = pcClass.getName();
+        ClassLoader classLoader = 
+            javaModelFactory.getClassLoaderPrivileged(pcClass);
+        JavaModel javaModel = javaModelFactory.getJavaModel(classLoader);
+        JDOModel jdoModel = javaModel.getJDOModel();
+        // do not load XML here, this will be done on first request
+        JDOClass jdoClass = jdoModel.createJDOClass(pcClassName, false);
+        JavaType javaType = javaModel.getJavaType(pcClass);
+        jdoClass.setJavaType(javaType);
+        return jdoClass;
+    }
+
+    /** 
+     * Internal method to update the specified JDOClass instance with the 
+     * runtime meta data.
+     * @param jdoClass the jdoClass instance to be updated
+     * @param fieldNames the names of the managed fields
+     * @param fieldTypes the types of the managed fields
+     * @param fieldFlags the jdo field flags of the managed fields
+     * @param pcSuperclass the class object of the persistence-capable 
+     * superclass
+     */
+    private void updateJDOClass(JDOClass jdoClass,
+                                String[] fieldNames, 
+                                Class[] fieldTypes,
+                                byte[] fieldFlags,
+                                Class pcSuperclass)
+        throws ModelException
+    {
+        // handle superclass
+        if (pcSuperclass != null) {
+            ClassLoader classLoader = 
+                javaModelFactory.getClassLoaderPrivileged(pcSuperclass);
+            JavaModel superJavaModel = 
+                javaModelFactory.getJavaModel(classLoader);
+            JDOModel superJDOModel = superJavaModel.getJDOModel();
+            // do not load XML => last arg should be false
+            JDOClass superJDOClass = 
+                superJDOModel.getJDOClass(pcSuperclass.getName(), false);
+            jdoClass.setPersistenceCapableSuperclass(superJDOClass);
+        }
+        
+        // Iterate the field names and set the corresponding field type
+        RuntimeJavaType declaringClass = (RuntimeJavaType)jdoClass.getJavaType();
+        for (int i = 0; i < fieldNames.length; i++) {
+            JDOField jdoField = jdoClass.createJDOField(fieldNames[i]);
+            updateJDOField(jdoField, fieldTypes[i], fieldFlags[i],
+                           declaringClass);
+        }
+    }
+
+    /** 
+     * Internal method to update the specified JDOField instance with the 
+     * runtime meta data.
+     * @param jdoField the jdoField instance to be updated
+     * @param fieldType the type of the field
+     * @param fieldFlags the jdo field flags
+     */
+    private void updateJDOField(JDOField jdoField,
+                                Class fieldType,
+                                byte fieldFlags,
+                                RuntimeJavaType declaringClass)
+        throws ModelException
+    {
+        // Set the persistence-modifier. A field mentioned in the runtime 
+        // metadata is a managed field. It is TRANSACTIONAL only if the 
+        // XML metadata explictily defines it as TRANSACTIONAL. 
+        // Check whether the persistence-modifier is already set which might 
+        // happen in the case the XML was read before). 
+        // If yes, leave the value as it is.
+        // If no, set it to PERSISTENT. The persistence-modifier will be 
+        // overwritten by any value explictly defined in the XML.
+        if (jdoField.getPersistenceModifier() == 
+            PersistenceModifier.UNSPECIFIED) {
+            jdoField.setPersistenceModifier(PersistenceModifier.PERSISTENT);
+        }
+        
+        // handle JavaField
+        JavaField javaField = declaringClass.createJavaField(jdoField, 
+            javaModelFactory.getJavaType(fieldType));
+        jdoField.setJavaField(javaField);
+        
+        // handle field flags
+        jdoField.setSerializable(
+            (fieldFlags & PersistenceCapable.SERIALIZABLE) > 0);
+    }
+}
+

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaField.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaField.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaField.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaField.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java.runtime;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.reflect.Field;
+
+import org.apache.jdo.impl.model.java.ReflectionJavaField;
+import org.apache.jdo.model.ModelFatalException;
+import org.apache.jdo.model.java.JavaField;
+import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.model.jdo.JDOField;
+import org.apache.jdo.util.I18NHelper;
+
+
+
+
+
+/**
+ * A reflection based JavaField implementation used at runtime.  
+ * The implementation takes <code>java.lang.reflect.Field</code> instances
+ * to get Java related metadata about fields. 
+ * 
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class RuntimeJavaField
+    extends ReflectionJavaField
+{
+    /** The corresponding JDO metadata. */
+    protected JDOField jdoField;
+
+    /** JavaModelFactory */
+    private static final RuntimeJavaModelFactory javaModelFactory =
+        (RuntimeJavaModelFactory) AccessController.doPrivileged(
+            new PrivilegedAction () {
+                public Object run () {
+                    return RuntimeJavaModelFactory.getInstance();
+                }
+            }
+        );
+
+    /** I18N support */
+    private final static I18NHelper msg =  
+        I18NHelper.getInstance("org.apache.jdo.impl.model.java.Bundle"); //NOI18N
+
+    /** 
+     * Constructor for fields w/o JDO metadata. 
+     * @param field the reflection field representation.
+     * @param declaringClass the JavaType of the class that declares the field.
+     */
+    public RuntimeJavaField(Field field, JavaType declaringClass)
+    {
+        super(field, declaringClass);
+        this.type = javaModelFactory.getJavaType(field.getType());
+    }
+    
+    /** 
+     * Constructor for fields having JDO metadata. The constructor takes
+     * the field type from the JDO metadata.
+     * @param jdoField the JDO field metadata.
+     * @param declaringClass the JavaType of the class that declares the field.
+     */
+    public RuntimeJavaField(JDOField jdoField, JavaType declaringClass)
+    {
+        this(jdoField, null, declaringClass);
+    }
+    
+    /** 
+     * Constructor for fields having JDO metadata.
+     * @param jdoField the JDO field metadata.
+     * @param type the field type.
+     * @param declaringClass the JavaType of the class that declares the field.
+     */
+    public RuntimeJavaField(JDOField jdoField, JavaType type, JavaType declaringClass)
+    {
+        super((jdoField == null) ? null : jdoField.getName(), declaringClass);
+        if (jdoField == null)
+            throw new ModelFatalException(msg.msg(
+                "ERR_InvalidNullFieldInstance", //NOI18N
+                "RuntimeJavaField.<init>")); //NOI18N
+        this.jdoField = jdoField;
+        this.type = type;
+    }
+    
+    /**
+     * Returns the JavaType representation of the field type.
+     * @return field type
+     */
+    public JavaType getType()
+    {
+        if (type == null) {
+            type = javaModelFactory.getJavaType(getField().getType());
+        }
+        return type;
+    }
+
+    /**
+     * Returns the JDOField instance if this JavaField represents a
+     * managed field of a persistence capable class. The method returns
+     * <code>null</code>, if this JavaField does not represent a managed
+     * field. 
+     * <p>
+     * The method throws a {@link org.apache.jdo.model.ModelFatalException},
+     * if there is a problem accessing the JDO meta data for this JavaField. 
+     * @return the JDOField instance if this JavaField represents a managed
+     * field; <code>null</code> otherwise.
+     */
+    public JDOField getJDOField()
+    {
+        return jdoField;
+    }
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaModel.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaModel.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaModel.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/impl/model/java/runtime/RuntimeJavaModel.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.model.java.runtime;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.io.InputStream;
+
+import org.apache.jdo.impl.model.java.AbstractJavaModel;
+import org.apache.jdo.model.ModelFatalException;
+import org.apache.jdo.model.java.JavaType;
+import org.apache.jdo.model.jdo.JDOModel;
+import org.apache.jdo.util.I18NHelper;
+
+/**
+ * A reflection based JavaModel implementation used at runtime.  
+ * The implementation takes <code>java.lang.Class</code> and
+ * <code>java.lang.reflect.Field</code> instances to get Java related
+ * metadata about types and fields. 
+ * <p>
+ * The RuntimeJavaModelFactory caches JavaModel instances per ClassLoader.
+ * The RuntimeJavaModel implementation will use this ClassLoader to lookup
+ * any type by name. This makes sure that the type name is unique.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class RuntimeJavaModel
+    extends AbstractJavaModel
+{
+    /** The ClassLoader instance used as key to cache this JavaModel. */
+    private final ClassLoader classLoader;
+
+    /** Flag passed to the Class.forName call. */
+    private final boolean initialize;
+
+    /** I18N support */
+    private final static I18NHelper msg =  
+        I18NHelper.getInstance("org.apache.jdo.impl.model.java.Bundle"); //NOI18N
+
+    /** Constructor taking the ClassLoader. */
+    public RuntimeJavaModel(ClassLoader classLoader) 
+    {
+        this(classLoader, true);
+    }
+    
+    /** */
+    protected RuntimeJavaModel(ClassLoader classLoader, boolean initialize)
+    {
+        super();
+        this.classLoader = classLoader;
+        this.initialize = initialize;
+    }
+
+    /** 
+     * The method returns the JavaType instance for the specified type
+     * name. A type name is unique within one JavaModel instance. The
+     * method returns <code>null</code> if this model instance does not
+     * know a type with the specified name.
+     * <p>
+     * Note, this method calls Class.forName with the wrapped ClassLoader,
+     * if it cannot find a JavaType with the specified name in the cache.
+     * @param name the name of the type
+     * @return a JavaType instance for the specified name or
+     * <code>null</code> if not present in this model instance.
+     */
+    public JavaType getJavaType(String name) 
+    {
+        synchronized (types) {
+            JavaType javaType = (JavaType)types.get(name);
+            if (javaType == null) {
+                try {
+                    // Note, if name denotes a pc class that has not been
+                    // loaded, Class.forName will load the class which
+                    // calls RegisterClassListener.registerClass.
+                    // This will create a new JavaType entry in the cache.
+                    javaType = getJavaType(Class.forName(name, initialize, 
+                                                         classLoader));
+                }
+                catch (ClassNotFoundException ex) {
+                    // cannot find class => return null
+                }
+                catch (LinkageError ex) {
+                    throw new ModelFatalException(msg.msg(
+                        "EXC_ClassLoadingError", name, ex.toString())); //NOI18N
+                }
+            }
+            return javaType;
+        }
+    }
+
+    /** 
+     * The method returns the JavaType instance for the type name of the
+     * specified class object. This is a convenience method for 
+     * <code>getJavaType(clazz.getName())</code>. The major difference
+     * between this method and getJavaType taking a type name is that this 
+     * method is supposed to return a non-<code>null<code> value. The
+     * specified class object describes an existing type.
+     * <p>
+     * Note, this implementation does not call the overloaded getJavaType
+     * method taking a String, because this would retrieve the Class
+     * instance for the specified type again. Instead, it checks the cache 
+     * directly. If not available it creates a new RuntimeJavaType using
+     * the specified class instance.
+     * @param clazz the Class instance representing the type
+     * @return a JavaType instance for the name of the specified class
+     * object or <code>null</code> if not present in this model instance.
+     */
+    public JavaType getJavaType(Class clazz)
+    {
+        String name = clazz.getName();
+        synchronized (types) {
+            JavaType javaType = (JavaType)types.get(name);
+            if (javaType == null) {
+                javaType = createJavaType(clazz);
+                types.put(name, javaType);
+            }
+            return javaType;
+        }
+    }
+
+    /**
+     * Finds a resource with a given name. A resource is some data that can
+     * be accessed by class code in a way that is independent of the
+     * location of the code. The name of a resource is a "/"-separated path
+     * name that identifies the resource. The method method opens the
+     * resource for reading and returns an InputStream. It returns 
+     * <code>null</code> if no resource with this name is found or if the
+     * caller doesn't have adequate privileges to get the resource.  
+     * <p>
+     * This implementation delegates the request to the wrapped
+     * ClassLoader. 
+     * @param resourceName the resource name
+     * @return an input stream for reading the resource, or <code>null</code> 
+     * if the resource could not be found or if the caller doesn't have
+     * adequate privileges to get the resource. 
+     */
+    public InputStream getInputStreamForResource(final String resourceName)
+    {
+        return (InputStream) AccessController.doPrivileged(
+            new PrivilegedAction () {
+                public Object run () {
+                    return classLoader.getResourceAsStream(resourceName);
+                }
+            }
+            );
+    }
+
+    // ===== Methods not defined in JavaModel =====
+
+    /** 
+     * Returns the ClassLoader wrapped by this RuntimeJavaModel instance.
+     * @return the ClassLoader
+     */
+    public ClassLoader getClassLoader()
+    {
+        return classLoader;
+    }
+
+    /** 
+     * Creates a new JavaType instance for the specified Class object.
+     * This method provides a hook such that RuntimeJavaModel subclasses
+     * can create instances of a different JavaType implementation. 
+     * <p>
+     * This implementation returns a RuntimeJavaType instance.
+     * @param clazz the Class instance representing the type
+     * @return a new JavaType instance
+     */
+    protected JavaType createJavaType(Class clazz)
+    {
+        return new RuntimeJavaType(clazz, getJDOModel());
+    }
+    
+}



Mime
View raw message