You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2005/05/22 19:44:23 UTC
svn commit: r171348 [6/7] - in /incubator/jdo/trunk/core20: ./ src/
src/conf/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/jdo/ src/java/org/apache/jdo/impl/
src/java/org/apache/jdo/impl/model/ src/java/org/apache/jdo/impl/model/java/
src/java/org/apache/jdo/impl/model/java/reflection/
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/model/
src/java/org/apache/jdo/model/java/ src/java/org/apache/jdo/model/jdo/
src/java/org/apache/jdo/util/
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelValidationException.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelValidationException.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelValidationException.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelValidationException.java Sun May 22 10:44:19 2005
@@ -0,0 +1,163 @@
+/*
+ * 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.model;
+
+import org.apache.jdo.util.I18NHelper;
+
+/**
+ * This exception indicates a problem during model validation.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class ModelValidationException
+ extends ModelException
+{
+ /** Constant representing an error. */
+ public static final int ERROR = 0;
+
+ /** Constant representing a warning. */
+ public static final int WARNING = 1;
+
+ /**
+ * This field holds the type -- one of {@link #ERROR} or {@link #WARNING}
+ */
+ private int type;
+
+ /**
+ * This field holds the offending object -- the one being validated
+ * when the problem occurred
+ */
+ private Object offendingObject;
+
+ /** I18N support */
+ private static I18NHelper msg =
+ I18NHelper.getInstance(ModelValidationException.class);
+
+ /**
+ * Creates new <code>ModelValidationException</code> of type
+ * {@link #ERROR} with <code>null</code> as the offending object and
+ * no detail message.
+ */
+ public ModelValidationException()
+ {
+ this(ERROR, null, null);
+ }
+
+ /**
+ * Constructs a <code>ModelValidationException</code> of type
+ * {@link #ERROR} with <code>null</code> as the offending object and
+ * with the specified detail message.
+ * @param message the detail message.
+ */
+ public ModelValidationException(String message)
+ {
+ this(ERROR, null, message);
+ }
+
+ /**
+ * Constructs a <code>ModelValidationException</code> of type
+ * {@link #ERROR} with the specified offending object and no
+ * detail message.
+ * @param offendingObject the offending object.
+ */
+ public ModelValidationException (Object offendingObject)
+ {
+ this(ERROR, offendingObject, null);
+ }
+
+ /**
+ * Constructs a <code>ModelValidationException</code> of type
+ * {@link #ERROR} with the specified offending object and detail
+ * message .
+ * @param offendingObject the offending object.
+ * @param message the detail message.
+ */
+ public ModelValidationException (Object offendingObject, String message)
+ {
+ this(ERROR, offendingObject, message);
+ }
+
+ /**
+ * Constructs a <code>ModelValidationException</code> of the specified
+ * type with the specified detail message and offending object.
+ * @param errorType the type -- one of {@link #ERROR} or
+ * {@link #WARNING}.
+ * @param offendingObject the offending object.
+ * @param message the detail message.
+ */
+ public ModelValidationException(int errorType, Object offendingObject,
+ String message)
+ {
+ super(message);
+ this.type = errorType;
+ this.offendingObject = offendingObject;
+ }
+
+ /**
+ * Get the offending object -- the one being validated when the problem
+ * occurred.
+ */
+ public Object getOffendingObject ()
+ {
+ return offendingObject;
+ }
+
+ /**
+ * Get the type -- one of {@link #ERROR} or {@link #WARNING}.
+ */
+ public int getType()
+ {
+ return type;
+ }
+
+ /**
+ * Returns the error message string of this throwable object.
+ * @return the error message string of this
+ * <code>ModelValidationException</code>, prepended with the warning string
+ * if the type is {@link #WARNING}
+ *
+ */
+ public String getMessage ()
+ {
+ String message = super.getMessage();
+ if ((WARNING == getType()) &&
+ (message != null) && (message.length() > 0)) {
+ message = msg.msg("MSG_OffendingObject") + message; //NOI18N
+ }
+ return message;
+ }
+ /**
+ * The <code>String</code> representation includes the name of the class,
+ * the descriptive comment (if any),
+ * and the <code>String</code> representation of the cause (if any).
+ * @return the <code>String</code>.
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(super.toString());
+ // include offending object information
+ if (offendingObject != null) {
+ sb.append("\n"); //NOI18N
+ sb.append(msg.msg("MSG_OffendingObject")); //NOI18N
+ sb.append(offendingObject.toString());
+ }
+ return sb.toString();
+ }
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelVetoException.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelVetoException.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelVetoException.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/ModelVetoException.java Sun May 22 10:44:19 2005
@@ -0,0 +1,66 @@
+/*
+ * 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.model;
+
+/**
+ * This exception indicates a problem during model update.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public class ModelVetoException
+ extends ModelException
+{
+ /**
+ * Creates new <code>ModelVetoException</code> without detail message.
+ */
+ public ModelVetoException()
+ {
+ }
+
+ /**
+ * Constructs a <code>ModelVetoException</code> with the specified
+ * detail message.
+ * @param msg the detail message.
+ */
+ public ModelVetoException(String msg)
+ {
+ super(msg);
+ }
+
+ /**
+ * Constructs a new <code>ModelVetoException</code> with the specified
+ * cause.
+ * @param cause the cause <code>Throwable</code>.
+ */
+ public ModelVetoException(Throwable cause)
+ {
+ super("", cause);
+ }
+
+ /**
+ * Constructs a new <code>ModelVetoException</code> with the specified
+ * detail message and cause.
+ * @param msg the detail message.
+ * @param cause the cause <code>Throwable</code>.
+ */
+ public ModelVetoException(String msg, Throwable cause)
+ {
+ super(msg, cause);
+ }
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaField.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaField.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaField.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaField.java Sun May 22 10:44:19 2005
@@ -0,0 +1,85 @@
+/*
+ * 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.model.java;
+
+import org.apache.jdo.model.jdo.JDOField;
+
+/**
+ * A JavaField instance represents a field declared by a class. It allows
+ * to get detailed information about the field such as name, modifiers,
+ * type, declaring class and the JDO meta data for the field (if
+ * available).
+ * <p>
+ * Different environments (runtime, enhancer, development) will have
+ * different JavaType implementations to provide answers to the various
+ * methods.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public interface JavaField
+{
+ /**
+ * Returns the name of the field.
+ * @return field name
+ */
+ public String getName();
+
+ /**
+ * 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();
+
+ /**
+ * Returns the JavaType representation of the field type.
+ * @return field type
+ */
+ public JavaType getType();
+
+ /**
+ * Returns the JavaType instance representing the class or interface
+ * that declares the field represented by this JavaField instance.
+ * @return the JavaType instance of the declaring class.
+ */
+ public JavaType getDeclaringClass();
+
+ /**
+ * Returns the corresponding JDOField instance, if the JDOModel
+ * provides any JDO metadata for the field represented by this
+ * JavaField. If there is no corresponding JDOField representation, the
+ * method returns <code>null</code>.
+ * <p>
+ * A <code>null</code> result means the declaring class is not
+ * persistence capable or the field represented by this JavaField is
+ * not managed. Note, a non-<code>null</code> result does not
+ * necessarily mean the field is managed. The JDO metadata might define
+ * the persistence-modifier of this field as <code>none</code>. Then
+ * the JDOModel provides a JDOField instance which is returned by this
+ * method. You can call method
+ * {@link org.apache.jdo.model.jdo.JDOField#isManaged()} on a
+ * non-<code>null</code> result to verify that this JavaField
+ * represents a managed field.
+ * @return the corresponding JDOField instance (if available);
+ * <code>null</code> otherwise.
+ */
+ public JDOField getJDOField();
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel-API.jpg
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel-API.jpg?rev=171348&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel-API.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.java Sun May 22 10:44:19 2005
@@ -0,0 +1,115 @@
+/*
+ * 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.model.java;
+
+import java.io.InputStream;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.jdo.JDOModel;
+
+
+/**
+ * A JavaModel instance bundles a number of JavaType instances and provides
+ * methods to retrieve JavaType instance by their name. A type name must be
+ * unique must be unique within a JavaModel instance. If the JavaType
+ * represents a class or an interface its type name is the fully qualified
+ * name. The model supports multiple classes or interfaces having the same
+ * fully qualified name by different JavaModel instances.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public interface JavaModel
+{
+ /**
+ * 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.
+ * @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);
+
+ /**
+ * 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.
+ * @param clazz the Class instance representing the type
+ * @return a JavaType instance for the name of the specified class
+ * object.
+ */
+ public JavaType getJavaType(Class clazz);
+
+ /**
+ * 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.
+ * @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(String resourceName);
+
+ /**
+ * Returns the parent JavaModel instance of this JavaModel.
+ * @return the parent JavaModel
+ */
+ public JavaModel getParent();
+
+ /**
+ * Set the parent JavaModel for this JavaModel. The method
+ * automatically adds this JavaModel to the collection of children
+ * of the specified parent JavaModel.
+ * @param parent the parent JavaModel
+ * @exception ModelException if impossible
+ */
+ public void setParent(JavaModel parent)
+ throws ModelException;
+
+ /**
+ * Returns a collection of child JavaModel instances in the form
+ * of an array. All instances from the returned array have this
+ * JavaModel instance as parent.
+ * @return the child JavaModel instances
+ */
+ public JavaModel[] getChildren();
+
+ /**
+ * Returns the corresponding JDOModel instance.
+ * @return the corresponding JDOModel.
+ */
+ public JDOModel getJDOModel();
+
+ /**
+ * Sets the corresponding JDOModel instance.
+ * @param jdoModel the JDOModel instance
+ * @exception ModelException if impossible
+ */
+ public void setJDOModel(JDOModel jdoModel)
+ throws ModelException;
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.mdl
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.mdl?rev=171348&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModel.mdl
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModelFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModelFactory.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModelFactory.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaModelFactory.java Sun May 22 10:44:19 2005
@@ -0,0 +1,91 @@
+/*
+ * 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.model.java;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.ModelFatalException;
+
+/**
+ * The JavaModelFactory is the interface to use to obtain JavaModel
+ * instances. It defines methods to create and retrieve JavaModel
+ * instances. Furthermore it defines a convenience method to retrieve a
+ * JavaType by an implementation specific type description.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public interface JavaModelFactory
+{
+ /**
+ * Creates a new empty JavaModel instance. A factory implementation may
+ * use the specified key when caching the new JavaModel instance.
+ * <p>
+ * Each JavaModelFactory imposes its own restrictions for the keys to
+ * cache JavaModel instances. Some implementations will allow only keys
+ * of a certain type. Some implementations will prohibit
+ * <code>null</code> keys. Attempting to use an ineligible key will
+ * result in a {@link org.apache.jdo.model.ModelException}. This means
+ * the specified key is of an inappropriate type for this
+ * JavaModelFactory or if the key is <code>null</code> and this
+ * JavaModelFactory does not support <code>null</code> keys.
+ * @param key the key that may be used to cache the returned JavaModel
+ * instance.
+ * @return a new JavaModel instance.
+ * @exception ModelException if impossible; the key is of an
+ * inappropriate type or the key is <code>null</code> and this
+ * JavaModelFactory does not support <code>null</code> keys.
+ */
+ public JavaModel createJavaModel(Object key)
+ throws ModelException;
+
+ /**
+ * Returns the JavaModel instance for the specified key.
+ * <p>
+ * The method throws a {@link org.apache.jdo.model.ModelFatalException},
+ * if the specified key is of an inappropriate type for this
+ * JavaModelFactory or if the key is <code>null</code> and this
+ * JavaModelFactory does not support <code>null</code> keys.
+ * @param key the key used to cache the returned JavaModel instance.
+ * @return a JavaModel instance for the specified key.
+ * @exception ModelFatalException the key is of an inappropriate type
+ * or the key is <code>null</code> and this JavaModelFactory does not
+ * support <code>null</code> keys.
+ */
+ public JavaModel getJavaModel(Object key)
+ throws ModelFatalException;
+
+ /**
+ * Returns a JavaType instance for the specified type description
+ * (optional operation). This method is a convenience method and a
+ * short cut for <code>getJavaModel(key).getJavaType(typeName)</code>.
+ * If the factory supports this method, it needs to be able to get the
+ * key for the JavaModel lookup and the type name for the JavaType
+ * lookup from the specified typeDesc. An example for such an type
+ * description is the java.lang.Class instance in the runtime
+ * environment.
+ * <p>
+ * The method throws a {@link org.apache.jdo.model.ModelFatalException},
+ * if this factory does not support this short cut or if it does not
+ * support the specified type description.
+ * @param typeDesc the type description.
+ * @return a JavaType instance for the specified type.
+ * @exception ModelFatalException this factory does not support this
+ * short cut or does not support the specified type description.
+ */
+ public JavaType getJavaType(Object typeDesc)
+ throws ModelFatalException;
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaType.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaType.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/JavaType.java Sun May 22 10:44:19 2005
@@ -0,0 +1,286 @@
+/*
+ * 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.model.java;
+
+import org.apache.jdo.model.ModelFatalException;
+import org.apache.jdo.model.jdo.JDOClass;
+
+
+/**
+ * A JavaType instance represents a type as defined in the Java
+ * language. The interface defines interrogative methods to check whether a
+ * type is primitive, an interface or array, is a JDO supported collection
+ * or map, is a value or trackable class, is a persistence capable class,
+ * etc. Furthermore it defines methods to get detailed information about
+ * the type such as name, modifiers, superclass and the JDO meta data if
+ * this type represent a persistence capable class.
+ * <p>
+ * Different environments (runtime, enhancer, development) will have
+ * different JavaType implementations to provide answers to the various
+ * methods.
+ *
+ * @author Michael Bouschen
+ * @since JDO 1.0.1
+ */
+public interface JavaType
+{
+ /**
+ * Returns <code>true</code> if this JavaType represents a primitive
+ * type.
+ * <p>
+ * 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>.
+ * @return <code>true</code> if this JavaType represents a primitive
+ * type; <code>false</code> otherwise.
+ */
+ public boolean isPrimitive();
+
+ /**
+ * Returns <code>true</code> if this JavaType represents an integral
+ * type.
+ * <p>
+ * There are five are integral types: <code>byte</code>,
+ * <code>short</code>, <code>int</code>, <code>long</code>, and
+ * <code>char</code>.
+ * @return <code>true</code> if this JavaType represents an integral
+ * type; <code>false</code> otherwise.
+ */
+ public boolean isIntegral();
+
+ /**
+ * Returns <code>true</code> if this JavaType represents a floating
+ * point type.
+ * <p>
+ * There are two are floating point types:
+ * <code>float</code> and <code>double</code>.
+ * @return <code>true</code> if this JavaType represents a floating
+ * point type; <code>false</code> otherwise.
+ */
+ public boolean isFloatingPoint();
+
+ /**
+ * 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();
+
+ /**
+ * Determines if this JavaType object represents an array type.
+ * @return <code>true</code> if this object represents an array type;
+ * <code>false</code> otherwise.
+ */
+ public boolean isArray();
+
+ /**
+ * Returns <code>true</code> if this JavaType represents a Java wrapper
+ * class type.
+ * <p>
+ * 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>.
+ * @return <code>true</code> if this JavaType represents a Java wrapper
+ * class type; <code>false</code> otherwise.
+ */
+ public boolean isWrapperClass();
+
+ /**
+ * 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):
+ * <ul>
+ * <li><code>java.util.Collection</code>, <code>java.util.Set</code>,
+ * <code>java.util.List</code>
+ * <li><code>java.util.HashSet</code>, <code>java.util.TreeSet</code>
+ * <li><code>java.util.ArrayList</code>, <code>java.util.LinkedList</code>
+ * <li><code>java.util.Vector</code>, <code>java.util.Stack</code>
+ * </ul>
+ * @return <code>true</code> if this JavaType represents a JDO
+ * supported collection; <code>false</code> otherwise.
+ */
+ public boolean isJDOSupportedCollection();
+
+ /**
+ * 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):
+ * <ul>
+ * <li><code>java.util.Map</code>
+ * <li><code>java.util.HashMap</code>, <code>java.util.TreeMap</code>
+ * <li> <code>java.util.Hashtable</code>, <code>java.util.Properties</code>
+ * </ul>
+ * @return <code>true</code> if this JavaType represents a JDO
+ * supported map; <code>false</code> otherwise.
+ */
+ public boolean isJDOSupportedMap();
+
+ /**
+ * 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.
+ * <p>
+ * The following types are trackable types:
+ * <ul>
+ * <li>JDO supported collection types
+ * <li>JDO supported map types
+ * <li><code>java.util.Date</code>, <code>java.sql.Date</code>,
+ * <code>java.sql.Time</code>, <code>java.sql.Timestamp</code>
+ * <li><code>java.util.BitSet</code>
+ * </ul>
+ * @return <code>true</code> if this JavaType represents a trackable
+ * Java class, <code>false</code> otherwise.
+ */
+ public boolean isTrackable();
+
+ /**
+ * Returns <code>true</code> if this JavaType represents a type whose
+ * values may be treated as values rather than references during
+ * storing. A value type is either a primitive type or a type a JDO
+ * implementation may treat as SCO and the type is not one the
+ * following types: array, JDO supported collection and JDO supported
+ * map.
+ * <p>
+ * The following classes are value types:
+ * <ul>
+ * <li>primitive types
+ * <li>Java wrapper class types
+ * <li><code>java.lang.Number</code>, <code>java.lang.String</code>
+ * <li><code>java.util.Locale</code>
+ * <li><code>java.math.BigDecimal</code>, <code>java.math.BigInteger</code>
+ * <li><code>java.util.Date</code>, <code>java.sql.Date</code>,
+ * <code>java.sql.Time</code>, <code>java.sql.Timestamp</code>
+ * <li><code>java.util.BitSet</code>
+ * </ul>
+ * @return <code>true</code> if this JavaType represents a value type;
+ * <code>false</code> otherwise.
+ */
+ public boolean isValue();
+
+ /**
+ * Returns <code>true</code> if this JavaType represents an orderable
+ * type as specified in JDO.
+ * <p>
+ * The following types are orderable:
+ * <ul>
+ * <li>primitive types except <code>boolean</code>
+ * <li>Java wrapper class types except <code>java.lang.Boolean</code>
+ * <li><code>java.lang.String</code>
+ * <li><code>java.math.BigDecimal</code>, <code>java.math.BigInteger</code>
+ * <li><code>java.util.Date</code>, <code>java.sql.Date</code>,
+ * <code>java.sql.Time</code>, <code>java.sql.Timestamp</code>
+ * </ul>
+ * Note, this method does not check whether this JavaType implements
+ * the Comparable interface.
+ * @return <code>true</code> if this JavaType represents an orderable
+ * type; <code>false</code> otherwise.
+ */
+ public boolean isOrderable();
+
+ /**
+ * Returns <code>true</code> if this JavaType represents a persistence
+ * capable class.
+ * <p>
+ * A {@link org.apache.jdo.model.ModelFatalException} indicates a
+ * problem accessing the JDO meta data for this JavaType.
+ * @return <code>true</code> if this JavaType represents a persistence
+ * capable class; <code>false</code> otherwise.
+ * @exception ModelFatalException if there is a problem accessing the
+ * JDO metadata
+ */
+ public boolean isPersistenceCapable()
+ throws ModelFatalException;
+
+ /**
+ * 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);
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+
+ /**
+ * 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();
+
+ /**
+ * Returns the JDOClass instance if this JavaType represents a
+ * persistence capable class. The method returns <code>null</code>,
+ * if this JavaType does not represent a persistence capable class.
+ * <p>
+ * A {@link org.apache.jdo.model.ModelFatalException} indicates a
+ * problem accessing the JDO meta data for this JavaType.
+ * @return the JDOClass instance if this JavaType represents a
+ * persistence capable class; <code>null</code> otherwise.
+ * @exception ModelFatalException if there is a problem accessing the
+ * JDO metadata
+ */
+ public JDOClass getJDOClass()
+ throws ModelFatalException;
+
+ /**
+ * Returns the JavaType representing the component type of an array.
+ * If this JavaType does not represent an array type this method
+ * returns <code>null</code>.
+ * @return the JavaType representing the component type of this
+ * JavaType if this class is an array; <code>null</code> otherwise.
+ */
+ public JavaType getArrayComponentType();
+
+ /**
+ * 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 name 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 name);
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/package.html?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/package.html (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/java/package.html Sun May 22 10:44:19 2005
@@ -0,0 +1,28 @@
+<!--
+ 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 API package.</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package defines the JavaModel API.
+ It provides interfaces for environment independent (development, enhancer,
+ runtime) Java metadata access.
+</body>
+</html>
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOArray.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOArray.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOArray.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOArray.java Sun May 22 10:44:19 2005
@@ -0,0 +1,58 @@
+/*
+ * 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.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaType;
+
+
+/**
+ * A JDOArray instance represents the JDO relationship metadata
+ * of a array relationship field.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOArray
+ extends JDORelationship
+{
+ /**
+ * Determines whether the values of the elements should be stored
+ * if possible as part of the instance instead of as their own instances
+ * in the datastore.
+ * @return <code>true</code> if the elements should be stored as part of
+ * the instance; <code>false</code> otherwise
+ */
+ public boolean isEmbeddedElement();
+
+ /**
+ * Set whether the values of the elements should be stored
+ * if possible as part of the instance instead of as their own instances
+ * in the datastore.
+ * @param embeddedElement flag indicating whether the elements should be
+ * stored as part of the instance
+ * @exception ModelException if impossible
+ */
+ public void setEmbeddedElement(boolean embeddedElement)
+ throws ModelException;
+
+ /**
+ * Get the type representation of the array component type.
+ * @return the array component type
+ */
+ public JavaType getElementType();
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOClass.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOClass.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOClass.java Sun May 22 10:44:19 2005
@@ -0,0 +1,511 @@
+/*
+ * 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.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaType;
+
+
+/**
+ * A JDOClass instance represents the JDO metadata of a persistence-capable
+ * class.
+ *
+ * @author Michael Bouschen
+ * @version 1.1
+ */
+public interface JDOClass
+ extends JDOMember
+{
+ /**
+ * Get the JDO identity type of this JDOClass.
+ * The identity type of the least-derived persistence-capable class defines
+ * the identity type for all persistence-capable classes that extend it.
+ * The identity type of the least-derived persistence-capable class is
+ * defaulted to {@link JDOIdentityType#APPLICATION} if objectid-class is
+ * specified, and {@link JDOIdentityType#DATASTORE}, if not.
+ * @return the JDO identity type, one of
+ * {@link JDOIdentityType#APPLICATION},
+ * {@link JDOIdentityType#DATASTORE}, or
+ * {@link JDOIdentityType#NONDURABLE}
+ */
+ public int getIdentityType();
+
+ /**
+ * Set the object identity type of this JDOClass.
+ * @param identityType an integer indicating the JDO identity type, one of:
+ * {@link JDOIdentityType#APPLICATION},
+ * {@link JDOIdentityType#DATASTORE}, or
+ * {@link JDOIdentityType#NONDURABLE}
+ * @exception ModelException if impossible
+ */
+ public void setIdentityType(int identityType)
+ throws ModelException;
+
+ /**
+ * Get the JavaType representation of the object identity class
+ * (primary key class) for this JDOClass.
+ * @return the JavaType representation of the object identity class.
+ */
+ public JavaType getObjectIdClass();
+
+ /**
+ * Set the JavaType representation of the object identity class
+ * (primary key class) for this JDOClass.
+ * @param objectIdClass the JavaType representation of the
+ * object identity class.
+ * @exception ModelException if impossible
+ */
+ public void setObjectIdClass(JavaType objectIdClass)
+ throws ModelException;
+
+ /**
+ * Get the fully qualified name of the object identity class
+ * (primary key class) declared for this JDOClass.
+ * Please note, this method returns a non null class name, only if the
+ * JDO metadata defines an objectIdClass for exactly the pc class
+ * represented by this JDOClass. If there is no objectIdClass defines for
+ * this JDOClass, but any of the pc-superclasses defines an objectIdClass,
+ * this method returns <code>null</code>. This is different from method
+ * {@link #getObjectIdClass} which returns a non-null value, if the
+ * superclass defines a objectIdClass.
+ * @return the name of the object identity class.
+ */
+ public String getDeclaredObjectIdClassName();
+
+ /**
+ * Set the fully qualified name of the object identity class
+ * (primary key class) declared for this JDOClass.
+ * @param declaredObjectIdClassName the name of the object identity class
+ * @exception ModelException if impossible
+ */
+ public void setDeclaredObjectIdClassName(String declaredObjectIdClassName)
+ throws ModelException;
+
+ /**
+ * Determines whether an extent must be managed for the
+ * persistence-capable class described by this JDOClass.
+ * @return <code>true</true> if this class must manage an extent;
+ * <code>false</code> otherwise
+ */
+ public boolean requiresExtent();
+
+ /**
+ * Set whether an extent must be managed for the
+ * persistence-capable class described by this JDOClass.
+ * @param requiresExtent <code>true</code> if this class must manage
+ * an extent; <code>false</code> otherwise
+ * @exception ModelException if impossible
+ */
+ public void setRequiresExtent(boolean requiresExtent)
+ throws ModelException;
+
+ /**
+ * Get the fully qualified class name of the persistence-capable superclass
+ * of the persistence-capable class described by this JDOClass. If this
+ * class does not have a persistence-capable superclass then
+ * <code>null</code> is returned.
+ * @return the fully qualified name of the persistence-capable superclass
+ * or <code>null</code> if there is no persistence-capable superclass
+ */
+ public String getPersistenceCapableSuperclassName();
+
+ /**
+ * Set the fully qualified class name of the persistence-capable superclass
+ * of the persistence-capable class described by this JDOClass.
+ * @param pcSuperclassName the fully qualified name of the
+ * persistence-capable superclass
+ * @exception ModelException if impossible
+ */
+ public void setPersistenceCapableSuperclassName(String pcSuperclassName)
+ throws ModelException;
+
+ /**
+ * Provides the JavaType representaion corresponding to this JDOClass.
+ * <p>
+ * Note the difference between Object.getClass) and this method. The
+ * former returns the class of the object in hand, this returns the class
+ * of the object represented by this meta data.
+ * @return the JavaType object corresponding to this JDOClass.
+ */
+ public JavaType getJavaType();
+
+ /**
+ * Set the JavaType representation corresponding to this JDOClass.
+ * @param javaType the JavaType representation for this JDOClass.
+ * @exception ModelException if impossible
+ */
+ public void setJavaType(JavaType javaType)
+ throws ModelException;
+
+ /**
+ * Determines whether the XML metadata for the class represented by this
+ * JDOClass has been loaded.
+ * @return <code>true</code> if XML metadata is loaded;
+ * <code>false</code> otherwise
+ */
+ public boolean isXMLMetadataLoaded();
+
+ /**
+ * Sets the flag indicating that the class XML metadata for this
+ * JDOClass is loaded to <code>true</code>.
+ */
+ public void setXMLMetadataLoaded();
+
+ /**
+ * Remove the supplied member from the collection of members maintained by
+ * this JDOClass.
+ * @param member the member to be removed
+ * @exception ModelException if impossible
+ */
+ public void removeDeclaredMember(JDOMember member)
+ throws ModelException;
+
+ /**
+ * Returns the collection of JDOMember instances declared by this JDOClass
+ * in form of an array.
+ * @return the members declared by this JDOClass
+ */
+ public JDOMember[] getDeclaredMembers();
+
+ /**
+ * Returns the declaring JDOModel of this JDOClass.
+ * @return the JDOModel that owns this JDOClass
+ */
+ public JDOModel getDeclaringModel();
+
+ /**
+ * Set the declaring JDOModel for this JDOClass.
+ * @param model the declaring JDOModel of this JDOClass
+ */
+ public void setDeclaringModel(JDOModel model);
+
+ /**
+ * Returns the JDOClass instance for the persistence-capable superclass
+ * of this JDOClass. If this class does not have a persistence-capable
+ * superclass then <code>null</code> is returned.
+ * @return the JDClass instance of the persistence-capable superclass
+ * or <code>null</code> if there is no persistence-capable superclass
+ */
+ public JDOClass getPersistenceCapableSuperclass();
+
+ /**
+ * Set the JDOClass for the persistence-capable superclass
+ * of this JDOClass.
+ * @param pcSuperclass the JDClass instance of the persistence-capable
+ * superclass
+ * @exception ModelException if impossible
+ */
+ public void setPersistenceCapableSuperclass(JDOClass pcSuperclass)
+ throws ModelException;
+
+ /**
+ * Returns the JDOPackage instance corresponding to the package name
+ * of this JDOClass.
+ * @return the JDOPackage instance of this JDOClass.
+ */
+ public JDOPackage getJDOPackage();
+
+ /**
+ * Sets the JDOPackage instance corresponding to the package name
+ * of this JDOClass.
+ * @param jdoPackage the JDOPackage of this JDOClass.
+ */
+ public void setJDOPackage(JDOPackage jdoPackage);
+
+ /**
+ * This method returns a JDOField instance for the field with the specified
+ * name. If this JDOClass already declares such a field, the existing
+ * JDOField instance is returned. Otherwise, it creates a new JDOField
+ * instance, sets its declaringClass and returns the new instance.
+ * @param name the name of the field
+ * @exception ModelException if impossible
+ */
+ public JDOField createJDOField(String name)
+ throws ModelException;
+
+ /**
+ * This method returns a JDOClass instance representing an inner class of
+ * this JDOClass If this JDOClass already declares such an inner class,
+ * the existing JDOClass instance is returned. Otherwise, it creates a new
+ * JDOClass instance, sets its declaringClass and returns the new instance.
+ * @param name the name of the inner class
+ * @exception ModelException if impossible
+ */
+ public JDOClass createJDOClass(String name)
+ throws ModelException;
+
+ /**
+ * Returns the collection of JDOClass instances declared by this JDOClass.
+ * @return the classes declared by this JDOClass
+ */
+ public JDOClass[] getDeclaredClasses();
+
+ /**
+ * Returns the collection of JDOField instances declared by this JDOClass
+ * in the form of an array. This does not include inherited fields.
+ * @return the fields declared by this JDOClass
+ */
+ public JDOField[] getDeclaredFields();
+
+ /**
+ * Returns the collection of managed JDOField instances declared by this
+ * JDOClass in the form of an array. The returned array does not include
+ * inherited fields. A field is a managed field, if it has the
+ * persistence-modifier {@link PersistenceModifier#PERSISTENT} or
+ * {@link PersistenceModifier#TRANSACTIONAL}. The position of the fields
+ * in the returned array equals their relative field number as returned by
+ * {@link JDOField#getRelativeFieldNumber()}. The following holds true for
+ * any field in the returned array:
+ * <ul>
+ * <li> <code>getDeclaredManagedFields()[i].getRelativeFieldNumber()
+ * == i</code>
+ * <li> <code>getDeclaredManagedFields()[field.getRelativeFieldNumber()]
+ * == field</code>
+ * </ul>
+ * @return the managed fields declared by this JDOClass
+ */
+ public JDOField[] getDeclaredManagedFields();
+
+ /**
+ * Returns the collection of managed JDOField instances of this JDOClass
+ * in the form of an array. The returned array includes inherited fields.
+ * A field is a managed field, if it has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT} or
+ * {@link PersistenceModifier#TRANSACTIONAL}. The position of the fields
+ * in the returned array equals their absolute field number as returned by
+ * {@link JDOField#getFieldNumber()}. The following holds true for any
+ * field in the returned array:
+ * <ul>
+ * <li> <code>getManagedFields()[i].getFieldNumber() == i</code>
+ * <li> <code>getManagedFields()[field.getFieldNumber()] == field</code>
+ * </ul>
+ * @return the managed fields of this JDOClass
+ */
+ public JDOField[] getManagedFields();
+
+ /**
+ * Returns the collection of persistent JDOField instances of this JDOClass
+ * in the form of an array. The returned array includes inherited fields.
+ * A field is a persistent field, if it has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT}.
+ * Please note, the position of the fields in the returned array might not
+ * equal their absolute field number as returned by
+ * {@link JDOField#getFieldNumber()}.
+ * @return the persistent fields of this JDOClass
+ */
+ public JDOField[] getPersistentFields();
+
+ /**
+ * Returns the collection of identifying fields of this JDOClass in the form
+ * of an array. The method returns the JDOField instances defined as
+ * primary key fields (see {@link JDOField#isPrimaryKey}).
+ * @return the identifying fields of this JDOClass
+ */
+ public JDOField[] getPrimaryKeyFields();
+
+ /**
+ * Returns the collection of persistent relationship fields of this JDOClass
+ * in the form of an array. The method returns the JDOField instances
+ * defined as relationship (method {@link JDOField#getRelationship} returns
+ * a non null value) and having the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT}.
+ * @return the persistent relationship fields of this JDOClass
+ */
+ public JDOField[] getPersistentRelationshipFields();
+
+ /**
+ * Returns the collection of default fetch group fields of this JDOClass
+ * in the form of an array. The method returns the JDOField instances
+ * defined as part of the default fetch group
+ * (method {@link JDOField#isDefaultFetchGroup} returns <code>true</code>.
+ * @return the default fetch group fields of this JDOClass
+ * @since 1.1
+ */
+ public JDOField[] getDefaultFetchGroupFields();
+
+ /**
+ * Returns an array of absolute field numbers of the managed fields of this
+ * JDOClass. The returned array includes field numbers of inherited fields.
+ * A field is a managed field, if it has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT} or
+ * {@link PersistenceModifier#TRANSACTIONAL}.
+ * Only managed fields have a valid field number, thus the field number in
+ * the returned array equals its index:
+ * <br>
+ * <code>getManagedFields()[i] == i</code>
+ */
+ public int[] getManagedFieldNumbers();
+
+ /**
+ * Returns an array of absolute field numbers of the persistent fields of
+ * this JDOClass. The returned array includes field numbers of inherited
+ * fields. A persistent field has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT}.
+ */
+ public int[] getPersistentFieldNumbers();
+
+ /**
+ * Returns an array of absolute field numbers of the identifying fields
+ * of this JDOClass. A field number is included in the returned array,
+ * iff the corresponding JDOField instance is defined as primary key field
+ * (see {@link JDOField#isPrimaryKey}).
+ * @return array of numbers of the identifying fields
+ */
+ public int[] getPrimaryKeyFieldNumbers();
+
+ /**
+ * Returns an array of absolute field numbers of the non identifying,
+ * persistent fields of this JDOClass. A field number is included in the
+ * returned array, iff the corresponding JDOField instance is persistent and
+ * not a not a primary key field (see {@link JDOField#isPrimaryKey}).
+ * A field is a persistent field, if it has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT} or
+ * (see {@link JDOField#getPersistenceModifier}).
+ * @return array of numbers of the non identifying, persistent fields
+ */
+ public int[] getPersistentNonPrimaryKeyFieldNumbers();
+
+ /**
+ * Returns an array of absolute field numbers of persistent relationship
+ * fields of this JDOClass. A field number is included in the returned
+ * array, iff the corresponding JDOField instance is a relationship (method
+ * {@link JDOField#getRelationship} returns a non null value) and has the
+ * persistence-modifier {@link PersistenceModifier#PERSISTENT}.
+ * @return the field numbers of the persistent relationship fields
+ */
+ public int[] getPersistentRelationshipFieldNumbers();
+
+ /**
+ * Returns an array of absolute field numbers of persistent, serializable
+ * fields of this JDOClass. A field number is included in the returned
+ * array, iff the corresponding JDOField instance is serializable (method
+ * {@link JDOField#isSerializable} returns <code>true</code>) and has the
+ * persistence-modifier {@link PersistenceModifier#PERSISTENT}.
+ * @return the field numbers of serializable fields
+ */
+ public int[] getPersistentSerializableFieldNumbers();
+
+ /**
+ * Returns JDOField metadata for a particular managed field specified by
+ * field name. It returns <code>null</code> if the specified name does not
+ * denote a managed field of this JDOClass. The field name may be
+ * unqualified and or qualified (see {@link #getField(String fieldName)}).
+ * @param fieldName the name of the managed field for which field metadata
+ * is needed.
+ * @return JDOField metadata for the managed field or <code>null</code>
+ * if there is no such field.
+ */
+ public JDOField getManagedField(String fieldName);
+
+ /**
+ * Returns JDOField metadata for a particular field specified by field name.
+ * It returns <code>null</code> if the specified name does not denote a
+ * field of this JDOClass.
+ * <p>
+ * The method supports lookup by unqualified and by qualified field name.
+ * <ul>
+ * <li> In the case of an unqualified field name the method starts checking
+ * this JDOClass for a field with the specified name. If this class does not
+ * define such a field, it checks the inheritance hierarchy starting with
+ * its direct persistence-capable superclass. The method finds the first
+ * field with the specified name in a bootom-up lookup of the inheritance
+ * hierarchy. Hidden fields are not visible.
+ * <li> In the case of a qualified field name the method assumes a fully
+ * qualified class name (called qualifier class) as the field qualifier.
+ * The qualifier class must be a either this class or a persistence-capable
+ * superclass (direct or indirect) of this class. Then the method searches
+ * the field definition in the inheritance hierarchy staring with the
+ * qualifier class. Any field declarations with the same name in subclasses
+ * of the qualifier class are not considered. This form allows accessing
+ * fields hidden by subclasses. The method returns <code>null</code> if the
+ * qualifier class does not denote a valid class or if the qualifier class
+ * is not a persistence-capable superclass of this class.
+ * </ul>
+ * @param fieldName the unqualified or qualified name of field for which
+ * field metadata is needed.
+ * @return JDOField metadata for the field or <code>null</code>
+ * if there is no such field.
+ */
+ public JDOField getField(String fieldName);
+
+ /**
+ * Provides metadata for a particular field specified by the absolute field
+ * number. The field number must be a valid absolute field number for this
+ * JDOClass: <code>0 <= fieldNumber < this.getManagedFields().length</code>
+ * If the field number is valid the returned JDoField instance denotes a
+ * managed field, meaning the field has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT} or
+ * {@link PersistenceModifier#TRANSACTIONAL}. If the field number is not
+ * valid then the method returns <code>null</code>.
+ * @param fieldNumber the number for which field metadata is needed.
+ * @return JDOField metadata for the field or <code>null</code>
+ * if there is no such field.
+ */
+ public JDOField getField(int fieldNumber);
+
+ /**
+ * Returns JDOField metadata for a particular declared field specified by
+ * field name. Please note, the method does not return inherited fields.
+ * The field name must not be qualified by a class name. The method returns
+ * <code>null</code> if the field name does not denote a field declared by
+ * JDOClass.
+ * @param fieldName the unqualified name of field for which field metadata
+ * is needed.
+ * @return JDOField metadata for the field or <code>null</code>
+ * if there is no such field declared by this JDOClass.
+ */
+ public JDOField getDeclaredField(String fieldName);
+
+ /**
+ * Returns the number of managed fields declared in the class represented
+ * by this JDOClass. This does not include inherited fields.
+ * @return number of declared managed fields
+ */
+ public int getDeclaredManagedFieldCount();
+
+ /**
+ * Returns the number of inherited managed fields for the class
+ * represented by this JDOClass.
+ * @return number of inherited managed fields
+ */
+ public int getInheritedManagedFieldCount();
+
+ /**
+ * Returns the number of managed fields for the class represented by this
+ * JDOClass. The value returned by this method is equal to
+ * <code>getDeclaredManagedFieldCount() +
+ * getInheritedManagedFieldCount()</code>.
+ * @return number of managed fields
+ */
+ public int getManagedFieldCount();
+
+ /**
+ * Returns the package name including a terminating dot if this class has a
+ * package. The method returns the empty string if this class is in the
+ * default package.
+ * @return package prefix for this class.
+ */
+ public String getPackagePrefix();
+
+ /**
+ * Returns the least-derived (topmost) persistence-capable class in the
+ * hierarchy of this JDOClass. It returns this JDOClass if it has no
+ * persistence-capable superclass.
+ * @return the topmost persistence-capable class in the hierarchy.
+ */
+ public JDOClass getPersistenceCapableRootClass();
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOCollection.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOCollection.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOCollection.java Sun May 22 10:44:19 2005
@@ -0,0 +1,80 @@
+/*
+ * 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.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaType;
+
+
+/**
+ * A JDOCollection instance represents the JDO relationship metadata
+ * of a collection relationship field.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOCollection
+ extends JDORelationship
+{
+ /**
+ * Determines whether the values of the elements should be stored if
+ * possible as part of the instance instead of as their own instances
+ * in the datastore.
+ * @return <code>true</code> if the elements should be stored as part of
+ * the instance; <code>false</code> otherwise
+ */
+ public boolean isEmbeddedElement();
+
+ /**
+ * Set whether the values of the elements should be stored if possible as
+ * part of the instance instead of as their own instances in the datastore.
+ * @param embeddedElement <code>true</code> if elements should be stored
+ * as part of the instance
+ * @exception ModelException if impossible
+ */
+ public void setEmbeddedElement(boolean embeddedElement)
+ throws ModelException;
+
+ /**
+ * Get the type representation of the collection elements.
+ * @return the element type
+ */
+ public JavaType getElementType();
+
+ /**
+ * Set the type representation of the collection elements.
+ * @param elementType the type representation of the collection elements
+ * @exception ModelException if impossible
+ */
+ public void setElementType(JavaType elementType)
+ throws ModelException;
+
+ /**
+ * Get the type of collection elements as string.
+ * @return the element type as string
+ */
+ public String getElementTypeName();
+
+ /**
+ * Set string representation of the type of collection elements.
+ * @param elementTypeName a string representation of the type of elements in
+ * the collection.
+ * @exception ModelException if impossible
+ */
+ public void setElementTypeName(String elementTypeName)
+ throws ModelException;
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOElement.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOElement.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOElement.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOElement.java Sun May 22 10:44:19 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.model.jdo;
+
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
+
+import org.apache.jdo.model.ModelException;
+
+/**
+ * This is the super interface for JDO metadata elements,
+ * such as JDOClass, JDOField and JDORelationship.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOElement
+{
+ /**
+ * Remove the supplied vendor extension from the collection of extensions
+ * maintained by this JDOElement.
+ * @exception ModelException if impossible
+ */
+ public void removeJDOExtension(JDOExtension vendorExtension)
+ throws ModelException;
+
+ /**
+ * Returns the collection of vendor extensions for this JDOElement
+ * in the form of an array.
+ * @return the vendor extensions for this JDOClass
+ */
+ public JDOExtension[] getJDOExtensions();
+
+ /**
+ * Creates a new JDOExtension instance and attaches it to the specified
+ * JDOElement object.
+ * @exception ModelException if impossible
+ */
+ public JDOExtension createJDOExtension()
+ throws ModelException;
+
+ /**
+ * Add a property change listener.
+ * @param l the listener to add
+ * @exception ModelException if impossible
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ throws ModelException;
+
+ /**
+ * Remove a property change listener.
+ * @param l the listener to remove
+ * @exception ModelException if impossible
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ throws ModelException;
+
+ /**
+ * Add a vetoable change listener.
+ * @param l the listener to add
+ * @exception ModelException if impossible
+ */
+ public void addVetoableChangeListener(VetoableChangeListener l)
+ throws ModelException;
+
+ /**
+ * Remove a vetoable change listener.
+ * @param l the listener to remove
+ * @exception ModelException if impossible
+ */
+ public void removeVetoableChangeListener(VetoableChangeListener l)
+ throws ModelException;
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOExtension.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOExtension.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOExtension.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOExtension.java Sun May 22 10:44:19 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.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+
+/**
+ * A JDOExtension instance represents a JDO vendor specific extension.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOExtension
+{
+ /**
+ * Returns the vendor name of this vendor extension.
+ */
+ public String getVendorName();
+
+ /**
+ * Sets the vendor name for this vendor extension.
+ * @exception ModelException if impossible
+ */
+ public void setVendorName(String vendorName)
+ throws ModelException;
+
+ /**
+ * Returns the key of this vendor extension.
+ */
+ public String getKey();
+
+ /**
+ * Sets the key for this vendor extension.
+ * @exception ModelException if impossible
+ */
+ public void setKey(String key)
+ throws ModelException;
+
+ /**
+ * Returns the value of this vendor extension.
+ */
+ public Object getValue();
+
+ /**
+ * Sets the value for this vendor extension.
+ * @exception ModelException if impossible
+ */
+ public void setValue(Object value)
+ throws ModelException;
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOField.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOField.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOField.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOField.java Sun May 22 10:44:19 2005
@@ -0,0 +1,285 @@
+/*
+ * 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.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaField;
+import org.apache.jdo.model.java.JavaType;
+
+
+/**
+ * A JDOField instance represents the JDO metadata of a managed field
+ * of a persistence-capable class.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOField
+ extends JDOMember
+{
+ /**
+ * Get the persistence modifier of this JDOField.
+ * @return the persistence modifier, one of
+ * {@link PersistenceModifier#UNSPECIFIED},
+ * {@link PersistenceModifier#NONE},
+ * {@link PersistenceModifier#PERSISTENT},
+ * {@link PersistenceModifier#TRANSACTIONAL},
+ * {@link PersistenceModifier#POSSIBLY_PERSISTENT}.
+ */
+ public int getPersistenceModifier();
+
+ /**
+ * Set the persistence modifier for this JDOField.
+ * @param persistenceModifier an integer indicating the persistence
+ * modifier, one of: {@link PersistenceModifier#UNSPECIFIED},
+ * {@link PersistenceModifier#NONE},
+ * {@link PersistenceModifier#PERSISTENT},
+ * {@link PersistenceModifier#TRANSACTIONAL},
+ * {@link PersistenceModifier#POSSIBLY_PERSISTENT}.
+ * @exception ModelException if impossible
+ */
+ public void setPersistenceModifier (int persistenceModifier)
+ throws ModelException;
+
+ /**
+ * Determines whether this JDOField is a key field or not.
+ * @return <code>true</code> if the field is a key field,
+ * <code>false</code> otherwise
+ */
+ public boolean isPrimaryKey();
+
+ /**
+ * Set whether this JDOField is a key field or not.
+ * @param primaryKey if <code>true</code>, the JDOField is marked
+ * as a key field; otherwise, it is not
+ * @exception ModelException if impossible
+ */
+ public void setPrimaryKey(boolean primaryKey)
+ throws ModelException;
+
+ /**
+ * Gets the null value treatment indicator of this JDOField.
+ * @return the null value treatment of this JDOField, one of
+ * {@link NullValueTreatment#NONE}, {@link NullValueTreatment#EXCEPTION} or
+ * {@link NullValueTreatment#DEFAULT}
+ */
+ public int getNullValueTreatment();
+
+ /**
+ * Sets the null value treatment indicator for this JDOField.
+ * @param nullValueTreament an integer indicating the null value treatment,
+ * one of: {@link NullValueTreatment#NONE},
+ * {@link NullValueTreatment#EXCEPTION} or
+ * {@link NullValueTreatment#DEFAULT}
+ * @exception ModelException if impossible
+ */
+ public void setNullValueTreatment(int nullValueTreament)
+ throws ModelException;
+
+ /**
+ * Determines whether this JDOField is part of the default fetch group or
+ * not.
+ * @return <code>true</code> if the field is part of the default fetch
+ * group, <code>false</code> otherwise
+ */
+ public boolean isDefaultFetchGroup();
+
+ /**
+ * Set whether this JDOField is part of the default fetch group or not.
+ * @param defaultFetchGroup if <code>true</code>, the JDOField is marked
+ * as beeing part of the default fetch group; otherwise, it is not
+ * @exception ModelException if impossible
+ */
+ public void setDefaultFetchGroup(boolean defaultFetchGroup)
+ throws ModelException;
+
+ /**
+ * Determines whether the field should be stored if possible as part of
+ * the instance instead of as its own instance in the datastore.
+ * @return <code>true</code> if the field is stored as part of the instance;
+ * <code>false</code> otherwise
+ */
+ public boolean isEmbedded();
+
+ /**
+ * Set whether the field should be stored if possible as part of
+ * the instance instead of as its own instance in the datastore.
+ * @param embedded <code>true</code> if the field is stored as part of the
+ * instance; <code>false</code> otherwise
+ * @exception ModelException if impossible
+ */
+ public void setEmbedded(boolean embedded)
+ throws ModelException;
+
+ /**
+ * Determines whether this JDOField is serializable or not.
+ * @return <code>true</code> if the field is serializable,
+ * <code>false</code> otherwise
+ */
+ public boolean isSerializable();
+
+ /**
+ * Set whether this JDOField is serializable or not.
+ * @param serializable if <code>true</code>, the JDOField is serializable;
+ * otherwise, it is not
+ * @exception ModelException if impossible
+ */
+ public void setSerializable(boolean serializable)
+ throws ModelException;
+
+ /**
+ * Get the corresponding Java field representation for this JDOField.
+ * @return the corresponding Java field representation
+ */
+ public JavaField getJavaField();
+
+ /**
+ * Sets the corresponding Java field representation for this JDOField.
+ * @param javaField the corresponding Java field representation
+ * @exception ModelException if impossible
+ */
+ public void setJavaField (JavaField javaField)
+ throws ModelException;
+
+ /**
+ * Get the relationship information for this JDOField. The method
+ * returns null if the field is not part of a relationship
+ * (e.g. it is a primitive type field).
+ * @return relationship info of this JDOField or <code>null</code> if
+ * this JDOField is not a relationship
+ */
+ public JDORelationship getRelationship();
+
+ /**
+ * Set the relationship information for this JDOField.
+ * @param relationship the JDORelationship instance
+ * @exception ModelException if impossible
+ */
+ public void setRelationship(JDORelationship relationship)
+ throws ModelException;
+
+ /**
+ * Creates and returns a new JDOReference instance.
+ * This method automatically binds the new JDOReference to this JDOField.
+ * It throws a ModelException, if this JDOField is already bound to
+ * another JDORelationship instance. Otherwise the following holds true:
+ * <ul>
+ * <li> Method {@link #getRelationship} returns the new created instance
+ * <li> <code>this.getRelationship().getDeclaringField() == this</code>
+ * </ul>
+ * @return a new JDOReference instance bound to this JDOField
+ * @exception ModelException if impossible
+ */
+ public JDOReference createJDOReference()
+ throws ModelException;
+
+ /**
+ * Creates and returns a new JDOCollection instance.
+ * This method automatically binds the new JDOCollection to this JDOField.
+ * It throws a ModelException, if this JDOField is already bound to
+ * another JDORelationship instance. Otherwise the following holds true:
+ * <ul>
+ * <li> Method {@link #getRelationship} returns the new created instance
+ * <li> <code>this.getRelationship().getDeclaringField() == this</code>
+ * </ul>
+ * @return a new JDOCollection instance bound to this JDOField
+ * @exception ModelException if impossible
+ */
+ public JDOCollection createJDOCollection()
+ throws ModelException;
+
+ /**
+ * Creates and returns a new JDOArray instance.
+ * This method automatically binds the new JDOArray to this JDOField.
+ * It throws a ModelException, if this JDOField is already bound to
+ * another JDORelationship instance. Otherwise the following holds true:
+ * <ul>
+ * <li> Method {@link #getRelationship} returns the new created instance
+ * <li> <code>this.getRelationship().getDeclaringField() == this</code>
+ * </ul>
+ * @return a new JDOArray instance bound to this JDOField
+ * @exception ModelException if impossible
+ */
+ public JDOArray createJDOArray()
+ throws ModelException;
+
+ /**
+ * Creates and returns a new JDOMap instance.
+ * This method automatically binds the new JDOMap to this JDOField.
+ * It throws a ModelException, if this JDOField is already bound to
+ * another JDORelationship instance. Otherwise the following holds true:
+ * <ul>
+ * <li> Method {@link #getRelationship} returns the new created instance
+ * <li> <code>this.getRelationship().getDeclaringField() == this</code>
+ * </ul>
+ * @return a new JDOMap instance bound to this JDOField
+ * @exception ModelException if impossible
+ */
+ public JDOMap createJDOMap()
+ throws ModelException;
+
+ /**
+ * Convenience method to check the persistence modifier from this JDOField.
+ * @return <code>true</code> if this field has the
+ * {@link PersistenceModifier#PERSISTENT} modifier; <code>false</code>
+ * otherwise
+ */
+ public boolean isPersistent();
+
+ /**
+ * Convenience method to check the persistence modifier from this JDOField.
+ * @return <code>true</code> if this field has the
+ * {@link PersistenceModifier#TRANSACTIONAL} modifier; <code>false</code>
+ * otherwise
+ */
+ public boolean isTransactional();
+
+ /**
+ * Convenience method to check the persistence modifier from this JDOField.
+ * A field is a managed field, if it has the persistence-modifier
+ * {@link PersistenceModifier#PERSISTENT} or
+ * {@link PersistenceModifier#TRANSACTIONAL}.
+ * @return <code>true</code> if this field is a managed field;
+ * <code>false</code> otherwise
+ */
+ public boolean isManaged();
+
+ /**
+ * Convenience method to check whether this field is a relationship field.
+ * @return <code>true</code> if this field is a relationship;
+ * <code>false</code> otherwise
+ */
+ public boolean isRelationship();
+
+ /**
+ * Get the JavaType representation of the type of the field.
+ * @return JavaType representation of the type of this field.
+ */
+ public JavaType getType();
+
+ /**
+ * Returns the absolute field number of this JDOField.
+ * @return the absolute field number
+ */
+ public int getFieldNumber();
+
+ /**
+ * Returns the relative field number of this JDOField.
+ * @return the relative field number
+ */
+ public int getRelativeFieldNumber();
+
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOIdentityType.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOIdentityType.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOIdentityType.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOIdentityType.java Sun May 22 10:44:19 2005
@@ -0,0 +1,79 @@
+/*
+ * 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.model.jdo;
+
+/**
+ * This interface provides constants denoting the identity type
+ * of a persistence-capable class.
+ *
+ * @author Michael Bouschen
+ */
+public class JDOIdentityType
+{
+ /** Constant representing an unspecified jdo identity */
+ public static final int UNSPECIFIED = 0;
+
+ /** Constant representing jdo identity managed by the database. */
+ public static final int DATASTORE = 1;
+
+ /** Constant representing jdo identity managed by the application. */
+ public static final int APPLICATION = 2;
+
+ /** Constant representing unmanaged jdo identity. */
+ public static final int NONDURABLE = 4;
+
+ /**
+ * Returns a string representation of the specified identity type constant.
+ * @param jdoIdentityType the JDO identity type, one of
+ * {@link #APPLICATION}, {@link #DATASTORE}, or {@link #NONDURABLE}
+ * @return the string representation of the JDOIdentityType constant
+ */
+ public static String toString(int jdoIdentityType) {
+ switch ( jdoIdentityType) {
+ case DATASTORE :
+ return "datastore"; //NOI18N
+ case APPLICATION :
+ return "application"; //NOI18N
+ case NONDURABLE:
+ return "nondurable"; //NOI18N
+ default:
+ return "UNSPECIFIED"; //NOI18N
+ }
+ }
+
+ /**
+ * Returns the JDOIdentityType constant, one of {@link #APPLICATION},
+ * {@link #DATASTORE}, or {@link #NONDURABLE} for the specified string.
+ * @param jdoIdentityType the string representation of the
+ * JDO identity type
+ * @return the JDO identity type
+ **/
+ public static int toJDOIdentityType(String jdoIdentityType)
+ {
+ if ((jdoIdentityType == null) || (jdoIdentityType.length() == 0))
+ return UNSPECIFIED;
+
+ if ("datastore".equals(jdoIdentityType)) //NOI18N
+ return DATASTORE;
+ else if ("application".equals(jdoIdentityType)) //NOI18N
+ return APPLICATION;
+ else if ("nondurable".equals(jdoIdentityType)) //NOI18N
+ return NONDURABLE;
+ else
+ return UNSPECIFIED;
+ }
+}
Added: incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOMap.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOMap.java?rev=171348&view=auto
==============================================================================
--- incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOMap.java (added)
+++ incubator/jdo/trunk/core20/src/java/org/apache/jdo/model/jdo/JDOMap.java Sun May 22 10:44:19 2005
@@ -0,0 +1,124 @@
+/*
+ * 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.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaType;
+
+
+/**
+ * A JDOMap instance represents the JDO relationship metadata
+ * (the treatment of keys and values) of a map relationship field.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOMap
+ extends JDORelationship
+{
+ /**
+ * Determines whether the keys of the map should be stored if possible as
+ * part of the instance instead of as their own instances in the datastore.
+ * @return <code>true</code> if the keys are stored as part of this instance;
+ * <code>false</code> otherwise
+ */
+ public boolean isEmbeddedKey();
+
+ /**
+ * Set whether the keys of the map should be stored if possible as part
+ * of the instance instead of as their own instances in the datastore.
+ * @param embeddedKey <code>true</code> if the keys are stored as part of
+ * this instance; <code>false</code> otherwise
+ * @exception ModelException if impossible
+ */
+ public void setEmbeddedKey(boolean embeddedKey)
+ throws ModelException;
+
+ /**
+ * Get the type representation of the keys for this JDOMap.
+ * @return the type of the keys of this JDOMap
+ */
+ public JavaType getKeyType();
+
+ /**
+ * Set the type representation of the keys for this JDOMap.
+ * @param keyType the type representation of the keys
+ * @exception ModelException if impossible
+ */
+ public void setKeyType(JavaType keyType)
+ throws ModelException;
+
+ /**
+ * Get the string representation of the type of the keys for this JDOMap.
+ * @return the key type as string
+ */
+ public String getKeyTypeName();
+
+ /**
+ * Set string representation of the type of the keys for this JDOMap.
+ * @param keyTypeName the name of the key type
+ * @exception ModelException if impossible
+ */
+ public void setKeyTypeName(String keyTypeName)
+ throws ModelException;
+
+ /**
+ * Determines whether the values of the map should be stored if possible as
+ * part of the instance instead of as their own instances in the datastore.
+ * @return <code>true</code> if the values are stored as part of this
+ * instance; <code>false</code> otherwise
+ */
+ public boolean isEmbeddedValue();
+
+ /**
+ * Set whether the values of the map should be stored if possible as part
+ * of the instance instead of as their own instances in the datastore.
+ * @param embeddedValue <code>true</code> if the values are stored as part
+ * of this instance; <code>false</code> otherwise
+ * @exception ModelException if impossible
+ */
+ public void setEmbeddedValue(boolean embeddedValue)
+ throws ModelException;
+
+ /**
+ * Get the type representation of the values for this JDOMap.
+ * @return the type of the values of this JDOMap
+ */
+ public JavaType getValueType();
+
+ /**
+ * Set the type representation of the values for this JDOMap.
+ * @param valueType the type representation of the values
+ * @exception ModelException if impossible
+ */
+ public void setValueType(JavaType valueType)
+ throws ModelException;
+
+ /**
+ * Get the string representation of the type of the values for this JDOMap.
+ * @return the key value as string
+ */
+ public String getValueTypeName();
+
+ /**
+ * Set string representation of the type of the values for this JDOMap.
+ * @param valueTypeName the name of the value type
+ * @exception ModelException if impossible
+ */
+ public void setValueTypeName(String valueTypeName)
+ throws ModelException;
+
+}