From jdo-commits-return-250-apmail-db-jdo-commits-archive=www.apache.org@db.apache.org Sat Mar 19 05:30:41 2005 Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 91388 invoked from network); 19 Mar 2005 05:30:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Mar 2005 05:30:41 -0000 Received: (qmail 4159 invoked by uid 500); 19 Mar 2005 05:30:41 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Delivered-To: moderator for jdo-commits@db.apache.org Received: (qmail 90507 invoked by uid 99); 19 Mar 2005 01:12:56 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Message-ID: <20050319010612.28282.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Sat, 19 Mar 2005 01:06:12 -0000 Subject: svn commit: r158176 [55/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/ To: jdo-commits@db.apache.org From: mbo@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/Jav= aModel.mdl ---------------------------------------------------------------------------= --- svn:executable =3D * Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/JavaMode= lFactory.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/java/JavaModelFactory.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/JavaModelFa= ctory.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/JavaModelFa= ctory.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,91 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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.=20 + *=20 + * @author Michael Bouschen + * @since JDO 1.0.1 + */ +public interface JavaModelFactory=20 +{ + /** + * Creates a new empty JavaModel instance. A factory implementation may + * use the specified key when caching the new JavaModel instance.=20 + *

+ * 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 + * null 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 null and this=20 + * JavaModelFactory does not support null keys. + * @param key the key that may be used to cache the returned JavaModel + * instance.=20 + * @return a new JavaModel instance. + * @exception ModelException if impossible; the key is of an + * inappropriate type or the key is null and this + * JavaModelFactory does not support null keys. + */ + public JavaModel createJavaModel(Object key) + throws ModelException; + + /** + * Returns the JavaModel instance for the specified key. + *

+ * 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 null and this + * JavaModelFactory does not support null 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 null and this JavaModelFactory does not + * support null 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 getJavaModel(key).getJavaType(typeName).=20 + * 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.=20 + *

+ * The method throws a {@link org.apache.jdo.model.ModelFatalException= },=20 + * 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/ri11/src/java/org/apache/jdo/model/java/JavaType= .java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/java/JavaType.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/JavaType.ja= va (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/JavaType.ja= va Fri Mar 18 17:02:29 2005 @@ -0,0 +1,286 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 + * the type such as name, modifiers, superclass and the JDO meta data if + * this type represent a persistence capable class. + *

+ * Different environments (runtime, enhancer, development) will have=20 + * different JavaType implementations to provide answers to the various + * methods.=20 + *=20 + * @author Michael Bouschen + * @since JDO 1.0.1 + */ +public interface JavaType=20 +{ + /**=20 + * Returns true if this JavaType represents a primitive + * type.=20 + *

+ * There are eight primitive types: boolean, + * byte, short, int, + * long, char,=20 + * float, double. + * @return true if this JavaType represents a primitive + * type; false otherwise. + */ + public boolean isPrimitive(); + + /**=20 + * Returns true if this JavaType represents an integral + * type.=20 + *

+ * There are five are integral types: byte,=20 + * short, int, long, and + * char. + * @return true if this JavaType represents an integral + * type; false otherwise. + */ + public boolean isIntegral(); +=20 + /** + * Returns true if this JavaType represents a floating + * point type.=20 + *

+ * There are two are floating point types: + * float and double. + * @return true if this JavaType represents a floating + * point type; false otherwise. + */ + public boolean isFloatingPoint(); + + /**=20 + * Determines if this JavaType object represents an interface type. + * @return true if this object represents an interface ty= pe;=20 + * false otherwise. + */ + public boolean isInterface(); + =20 + /**=20 + * Determines if this JavaType object represents an array type. + * @return true if this object represents an array type;=20 + * false otherwise. + */ + public boolean isArray(); + + /**=20 + * Returns true if this JavaType represents a Java wrapper + * class type.=20 + *

+ * There are eight Java wrapper class types:=20 + * java.lang.Boolean, java.lang.Byte,=20 + * java.lang.Short, java.lang.Integer,=20 + * java.lang.Long, java.lang.Character,=20 + * java.lang.Float, java.lang.Double. + * @return true if this JavaType represents a Java wrapper + * class type; false otherwise. + */ + public boolean isWrapperClass(); +=20 + /**=20 + * Returns true if this JavaType represents a JDO + * supported collection type. The JDO specification allows the + * following collection interfaces and classes as types of persistent=20 + * fields (see section 6.4.3 Persistent fields): + *

    + *
  • java.util.Collection, java.util.Set,=20 + * java.util.List + *
  • java.util.HashSet, java.util.TreeSet + *
  • java.util.ArrayList, java.util.LinkedList + *
  • java.util.Vector, java.util.Stack + *
=20 + * @return true if this JavaType represents a JDO + * supported collection; false otherwise. + */ + public boolean isJDOSupportedCollection(); + =20 + /**=20 + * Returns true if this JavaType represents a JDO + * supported map type. The JDO specification allows the + * following map interfaces and classes as types of persistent=20 + * fields (see section 6.4.3 Persistent fields): + *
    + *
  • java.util.Map + *
  • java.util.HashMap, java.util.TreeMap + *
  • java.util.Hashtable, java.util.Properties=20 + *
=20 + * @return true if this JavaType represents a JDO + * supported map; false otherwise. + */ + public boolean isJDOSupportedMap(); + + /** + * Returns true 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.=20 + *

+ * The following types are trackable types: + *

    + *
  • JDO supported collection types + *
  • JDO supported map types + *
  • java.util.Date, java.sql.Date,=20 + * java.sql.Time, java.sql.Timestamp + *
  • java.util.BitSet + *
=20 + * @return true if this JavaType represents a trackable + * Java class, false otherwise. + */ + public boolean isTrackable(); + =20 + /**=20 + * Returns true 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.=20 + *

+ * The following classes are value types: + *

    + *
  • primitive types + *
  • Java wrapper class types + *
  • java.lang.Number, java.lang.String + *
  • java.util.Locale + *
  • java.math.BigDecimal, java.math.BigInteger + *
  • java.util.Date, java.sql.Date,=20 + * java.sql.Time, java.sql.Timestamp + *
  • java.util.BitSet + *
=20 + * @return true if this JavaType represents a value type; + * false otherwise. + */ + public boolean isValue(); + + /** + * Returns true if this JavaType represents an orderable + * type as specified in JDO. + *

+ * The following types are orderable: + *

    + *
  • primitive types except boolean + *
  • Java wrapper class types except java.lang.Boolean + *
  • java.lang.String + *
  • java.math.BigDecimal, java.math.BigInteger + *
  • java.util.Date, java.sql.Date,=20 + * java.sql.Time, java.sql.Timestamp + *
=20 + * Note, this method does not check whether this JavaType implements + * the Comparable interface. + * @return true if this JavaType represents an orderable + * type; false otherwise. + */ + public boolean isOrderable(); + + /**=20 + * Returns true if this JavaType represents a persistence + * capable class. + *

+ * A {@link org.apache.jdo.model.ModelFatalException} indicates a + * problem accessing the JDO meta data for this JavaType. + * @return true if this JavaType represents a persistence + * capable class; false 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.=20 + * @param javaType the type this JavaType is checked with. + * @return true if this is compatible with the specified + * type; false otherwise. + */ + public boolean isCompatibleWith(JavaType javaType); + =20 + /** + * 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.=20 + * @return the Java language modifiers for this JavaType + */ + public int getModifiers(); + + /**=20 + * Returns the JavaType representing the superclass of the entity + * represented by this JavaType. If this JavaType represents either th= e=20 + * Object class, an interface, a primitive type, or void,=20 + * then null is returned. If this object represents an + * array class then the JavaType instance representing the Object class + * is returned. =20 + * @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 null,=20 + * if this JavaType does not represent a persistence capable class. + *

+ * 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; null otherwise. + * @exception ModelFatalException if there is a problem accessing the + * JDO metadata + */ + public JDOClass getJDOClass() + throws ModelFatalException; + =20 + /**=20 + * Returns the JavaType representing the component type of an array.=20 + * If this JavaType does not represent an array type this method + * returns null. + * @return the JavaType representing the component type of this + * JavaType if this class is an array; null otherwise.=20 + */=20 + 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 null, 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=20 + * @return the JavaField instance for the specified field in this class + * or null if there is no such field. + */ + public JavaField getJavaField(String name); + +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/package.= html URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/java/package.html?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/package.htm= l (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/java/package.htm= l Fri Mar 18 17:02:29 2005 @@ -0,0 +1,28 @@ + + + + +JavaModel API package. + + + + +

This package defines the JavaModel API.=20 + It provides interfaces for environment independent (development, enhance= r,=20 + runtime) Java metadata access.=20 + + Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOArray.= java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOArray.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOArray.jav= a (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOArray.jav= a Fri Mar 18 17:02:29 2005 @@ -0,0 +1,58 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 + * of a array relationship field. + * + * @author Michael Bouschen + */ +public interface JDOArray + extends JDORelationship=20 +{ + /** + * Determines whether the values of the elements should be stored=20 + * if possible as part of the instance instead of as their own instanc= es=20 + * in the datastore. + * @return true if the elements should be stored as part = of=20 + * the instance; false otherwise + */ + public boolean isEmbeddedElement(); + =20 + /** + * Set whether the values of the elements should be stored=20 + * if possible as part of the instance instead of as their own instanc= es=20 + * in the datastore. + * @param embeddedElement flag indicating whether the elements should = be=20 + * stored as part of the instance + * @exception ModelException if impossible + */ + public void setEmbeddedElement(boolean embeddedElement) + throws ModelException; + + /**=20 + * Get the type representation of the array component type.=20 + * @return the array component type + */ + public JavaType getElementType(); + +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOClass.= java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOClass.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOClass.jav= a (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOClass.jav= a Fri Mar 18 17:02:29 2005 @@ -0,0 +1,488 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 + extends JDOMember=20 +{ + /**=20 + * Get the JDO identity type of this JDOClass. + * The identity type of the least-derived persistence-capable class de= fines + * the identity type for all persistence-capable classes that extend i= t=2E + * The identity type of the least-derived persistence-capable class is + * defaulted to {@link JDOIdentityType#APPLICATION} if objectid-class = is=20 + * specified, and {@link JDOIdentityType#DATASTORE}, if not.=20 + * @return the JDO identity type, one of=20 + * {@link JDOIdentityType#APPLICATION},=20 + * {@link JDOIdentityType#DATASTORE}, or=20 + * {@link JDOIdentityType#NONDURABLE} + */ + public int getIdentityType(); + + /**=20 + * Set the object identity type of this JDOClass. + * @param identityType an integer indicating the JDO identity type, on= e of: + * {@link JDOIdentityType#APPLICATION},=20 + * {@link JDOIdentityType#DATASTORE}, or=20 + * {@link JDOIdentityType#NONDURABLE} + * @exception ModelException if impossible + */ + public void setIdentityType(int identityType) + throws ModelException; + + /**=20 + * Get the JavaType representation of the object identity class=20 + * (primary key class) for this JDOClass.=20 + * @return the JavaType representation of the object identity class. + */ + public JavaType getObjectIdClass(); + + /**=20 + * Set the JavaType representation of the object identity class=20 + * (primary key class) for this JDOClass.=20 + * @param objectIdClass the JavaType representation of the=20 + * object identity class. + * @exception ModelException if impossible + */ + public void setObjectIdClass(JavaType objectIdClass) + throws ModelException; + + /**=20 + * Get the fully qualified name of the object identity class=20 + * (primary key class) declared for this JDOClass.=20 + * Please note, this method returns a non null class name, only if the=20 + * JDO metadata defines an objectIdClass for exactly the pc class=20 + * represented by this JDOClass. If there is no objectIdClass defines = for=20 + * this JDOClass, but any of the pc-superclasses defines an objectIdCl= ass,=20 + * this method returns null. This is different from method + * {@link #getObjectIdClass} which returns a non-null value, if the=20 + * superclass defines a objectIdClass. + * @return the name of the object identity class. + */ + public String getDeclaredObjectIdClassName(); + + /**=20 + * Set the fully qualified name of the object identity class=20 + * (primary key class) declared for this JDOClass.=20 + * @param declaredObjectIdClassName the name of the object identity cl= ass + * @exception ModelException if impossible + */ + public void setDeclaredObjectIdClassName(String declaredObjectIdClassN= ame) + throws ModelException; + + /** + * Determines whether an extent must be managed for the=20 + * persistence-capable class described by this JDOClass. + * @return true if this class must manage an extent;=20 + * false otherwise + */ + public boolean requiresExtent(); + =20 + /** + * Set whether an extent must be managed for the=20 + * persistence-capable class described by this JDOClass. + * @param requiresExtent true if this class must manage=20 + * an extent; false otherwise + * @exception ModelException if impossible + */ + public void setRequiresExtent(boolean requiresExtent) + throws ModelException; + + /** + * Get the fully qualified class name of the persistence-capable super= class=20 + * of the persistence-capable class described by this JDOClass. If thi= s=20 + * class does not have a persistence-capable superclass then=20 + * null is returned. + * @return the fully qualified name of the persistence-capable supercl= ass=20 + * or null if there is no persistence-capable superclass=20 + */ + public String getPersistenceCapableSuperclassName(); + =20 + /** + * Set the fully qualified class name of the persistence-capable super= class=20 + * of the persistence-capable class described by this JDOClass. + * @param pcSuperclassName the fully qualified name of the=20 + * persistence-capable superclass=20 + * @exception ModelException if impossible + */ + public void setPersistenceCapableSuperclassName(String pcSuperclassNam= e) + throws ModelException; + + /** + * Provides the JavaType representaion corresponding to this JDOClass. + *

+ * Note the difference between Object.getClass) and this method. The + * former returns the class of the object in hand, this returns the cl= ass + * 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; + + /**=20 + * Remove the supplied member from the collection of members maintaine= d by + * this JDOClass. + * @param member the member to be removed + * @exception ModelException if impossible + */ + public void removeDeclaredMember(JDOMember member) + throws ModelException; + + /**=20 + * Returns the collection of JDOMember instances declared by this JDOC= lass=20 + * 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); + =20 + /** + * Returns the JDOClass instance for the persistence-capable superclas= s=20 + * of this JDOClass. If this class does not have a persistence-capable=20 + * superclass then null is returned. + * @return the JDClass instance of the persistence-capable superclass + * or null if there is no persistence-capable superclass=20 + */ + public JDOClass getPersistenceCapableSuperclass(); + =20 + /** + * Set the JDOClass for the persistence-capable superclass=20 + * 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=20 + * of this JDOClass.=20 + * @return the JDOPackage instance of this JDOClass. + */ + public JDOPackage getJDOPackage(); + + /** + * Sets the JDOPackage instance corresponding to the package name=20 + * 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 spec= ified=20 + * name. If this JDOClass already declares such a field, the existing=20 + * JDOField instance is returned. Otherwise, it creates a new JDOField=20 + * 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=20 + * this JDOClass If this JDOClass already declares such an inner class= ,=20 + * the existing JDOClass instance is returned. Otherwise, it creates a= new=20 + * JDOClass instance, sets its declaringClass and returns the new inst= ance. + * @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 JDOCl= ass. =20 + * @return the classes declared by this JDOClass + */ + public JDOClass[] getDeclaredClasses(); + + /** + * Returns the collection of JDOField instances declared by this JDOCl= ass=20 + * 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 th= is + * JDOClass in the form of an array. The returned array does not inclu= de=20 + * inherited fields. A field is a managed field, if it has the=20 + * persistence-modifier {@link PersistenceModifier#PERSISTENT} or=20 + * {@link PersistenceModifier#TRANSACTIONAL}. The position of the fiel= ds=20 + * in the returned array equals their relative field number as returne= d by=20 + * {@link JDOField#getRelativeFieldNumber()}. The following holds true= for=20 + * any field in the returned array:=20 + *

    + *
  • getDeclaredManagedFields()[i].getRelativeFieldNumber()=20 + * =3D=3D i + *
  • getDeclaredManagedFields()[field.getRelativeFieldNumber(= )]=20 + * =3D=3D field + *
=20 + * @return the managed fields declared by this JDOClass + */ + public JDOField[] getDeclaredManagedFields(); + =20 + /** + * Returns the collection of managed JDOField instances of this JDOCla= ss=20 + * in the form of an array. The returned array includes inherited fiel= ds. + * A field is a managed field, if it has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT} or=20 + * {@link PersistenceModifier#TRANSACTIONAL}. The position of the fiel= ds=20 + * in the returned array equals their absolute field number as returne= d by=20 + * {@link JDOField#getFieldNumber()}. The following holds true for any=20 + * field in the returned array:=20 + *
    + *
  • getManagedFields()[i].getFieldNumber() =3D=3D i + *
  • getManagedFields()[field.getFieldNumber()] =3D=3D field<= /code> + *
=20 + * @return the managed fields of this JDOClass + */ + public JDOField[] getManagedFields(); + + /** + * Returns the collection of persistent JDOField instances of this JDO= Class=20 + * in the form of an array. The returned array includes inherited fiel= ds. + * A field is a persistent field, if it has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT}. + * Please note, the position of the fields in the returned array might= not=20 + * equal their absolute field number as returned by=20 + * {@link JDOField#getFieldNumber()}. + * @return the persistent fields of this JDOClass + */ + public JDOField[] getPersistentFields(); + + /** + * Returns the collection of identifying fields of this JDOClass in th= e form + * of an array. The method returns the JDOField instances defined as=20 + * 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 JD= OClass + * in the form of an array. The method returns the JDOField instances=20 + * defined as relationship (method {@link JDOField#getRelationship} re= turns + * a non null value) and having the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT}. + * @return the persistent relationship fields of this JDOClass + */ + public JDOField[] getPersistentRelationshipFields(); + + /** + * Returns the collection of default fetch group fields of this JDOCla= ss + * in the form of an array. The method returns the JDOField instances=20 + * defined as part of the default fetch group=20 + * (method {@link JDOField#isDefaultFetchGroup} returns true. + * @return the default fetch group fields of this JDOClass + * @since 1.1 + */ + public JDOField[] getDefaultFetchGroupFields();=20 + + /** + * Returns an array of absolute field numbers of the managed fields of= this + * JDOClass. The returned array includes field numbers of inherited fi= elds. + * A field is a managed field, if it has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT} or=20 + * {@link PersistenceModifier#TRANSACTIONAL}.=20 + * Only managed fields have a valid field number, thus the field numbe= r in=20 + * the returned array equals its index: + *
+ * getManagedFields()[i] =3D=3D i + */ + public int[] getManagedFieldNumbers(); + + /** + * Returns an array of absolute field numbers of the persistent fields= of=20 + * this JDOClass. The returned array includes field numbers of inherit= ed=20 + * fields. A persistent field has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT}. + */ + public int[] getPersistentFieldNumbers(); + + /** + * Returns an array of absolute field numbers of the identifying field= s=20 + * of this JDOClass. A field number is included in the returned array,=20 + * 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,=20 + * persistent fields of this JDOClass. A field number is included in t= he=20 + * returned array, iff the corresponding JDOField instance is persiste= nt and=20 + * not a not a primary key field (see {@link JDOField#isPrimaryKey}). + * A field is a persistent field, if it has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT} or=20 + * (see {@link JDOField#getPersistenceModifier}).=20 + * @return array of numbers of the non identifying, persistent fields + */ + public int[] getPersistentNonPrimaryKeyFieldNumbers(); + =20 + /** + * Returns an array of absolute field numbers of persistent relationsh= ip=20 + * fields of this JDOClass. A field number is included in the returned=20 + * array, iff the corresponding JDOField instance is a relationship (m= ethod=20 + * {@link JDOField#getRelationship} returns a non null value) and has = the=20 + * 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, serializa= ble=20 + * fields of this JDOClass. A field number is included in the returned=20 + * array, iff the corresponding JDOField instance is serializable (met= hod=20 + * {@link JDOField#isSerializable} returns true) and has = the=20 + * 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=20 + * field name. It returns null if the specified name does= not=20 + * denote a managed field of this JDOClass. The field name may be=20 + * unqualified and or qualified (see {@link #getField(String fieldName= )}). + * @param fieldName the name of the managed field for which field meta= data + * is needed. + * @return JDOField metadata for the managed field or null + * if there is no such field. + */ + public JDOField getManagedField(String fieldName); + =20 + /** + * Returns JDOField metadata for a particular field specified by field= name. + * It returns null if the specified name does not denote = a=20 + * field of this JDOClass. + *

+ * The method supports lookup by unqualified and by qualified field na= me.=20 + *

    + *
  • In the case of an unqualified field name the method starts che= cking=20 + * this JDOClass for a field with the specified name. If this class do= es not + * define such a field, it checks the inheritance hierarchy starting w= ith=20 + * its direct persistence-capable superclass. The method finds the fir= st=20 + * field with the specified name in a bootom-up lookup of the inherita= nce=20 + * hierarchy. Hidden fields are not visible. + *
  • In the case of a qualified field name the method assumes a ful= ly=20 + * qualified class name (called qualifier class) as the field qualifie= r=2E=20 + * The qualifier class must be a either this class or a persistence-ca= pable=20 + * superclass (direct or indirect) of this class. Then the method sear= ches=20 + * the field definition in the inheritance hierarchy staring with the=20 + * qualifier class. Any field declarations with the same name in subcl= asses + * of the qualifier class are not considered. This form allows accessi= ng=20 + * fields hidden by subclasses. The method returns null i= f the=20 + * qualifier class does not denote a valid class or if the qualifier c= lass=20 + * is not a persistence-capable superclass of this class. + *
+ * @param fieldName the unqualified or qualified name of field for whi= ch=20 + * field metadata is needed. + * @return JDOField metadata for the field or null + * if there is no such field. + */ + public JDOField getField(String fieldName); + =20 + /** + * Provides metadata for a particular field specified by the absolute = field=20 + * number. The field number must be a valid absolute field number for = this=20 + * JDOClass: 0 <=3D fieldNumber < this.getManagedFields().length= + * If the field number is valid the returned JDoField instance denotes= a=20 + * managed field, meaning the field has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT} or=20 + * {@link PersistenceModifier#TRANSACTIONAL}. If the field number is n= ot=20 + * valid then the method returns null. + * @param fieldNumber the number for which field metadata is needed. + * @return JDOField metadata for the field or null + * if there is no such field. + */ + public JDOField getField(int fieldNumber); + + /**=20 + * Returns JDOField metadata for a particular declared field specified= by=20 + * field name. Please note, the method does not return inherited fiel= ds. + * The field name must not be qualified by a class name. The method re= turns + * null if the field name does not denote a field declare= d by=20 + * JDOClass. + * @param fieldName the unqualified name of field for which field meta= data=20 + * is needed. + * @return JDOField metadata for the field or null + * if there is no such field declared by this JDOClass. + */ + public JDOField getDeclaredField(String fieldName); + + /** + * Returns the number of managed fields declared in this class. =20 + * This does not include inherited fields. + * @return number of declared fields in the Class represented by this=20 + * JDOClass + */ + public int getDeclaredManagedFieldCount(); + + /** + * Returns the number of inherited fields for this class. =20 + * @return number of inherited fields + */ + public int getInheritedManagedFieldCount(); + + /** + * Returns the package name including a terminating dot if this class = has a=20 + * package. The method returns the empty string if this class is in th= e=20 + * default package. + * @return package prefix for this class. + */ + public String getPackagePrefix(); + + /** + * Returns the least-derived (topmost) persistence-capable class in th= e=20 + * hierarchy of this JDOClass. It returns this JDOClass if it has no=20 + * persistence-capable superclass. + * @return the topmost persistence-capable class in the hierarchy. + */ + public JDOClass getPersistenceCapableRootClass(); +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOCollec= tion.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOCollection.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOCollectio= n=2Ejava (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOCollectio= n=2Ejava Fri Mar 18 17:02:29 2005 @@ -0,0 +1,80 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 + * of a collection relationship field.=20 + * + * @author Michael Bouschen + */ +public interface JDOCollection + extends JDORelationship=20 +{ + /** + * Determines whether the values of the elements should be stored if=20 + * possible as part of the instance instead of as their own instances=20 + * in the datastore. + * @return true if the elements should be stored as part = of=20 + * the instance; false otherwise + */ + public boolean isEmbeddedElement(); + =20 + /** + * Set whether the values of the elements should be stored if possible= as=20 + * part of the instance instead of as their own instances in the datas= tore. + * @param embeddedElement true if elements should be stor= ed=20 + * as part of the instance + * @exception ModelException if impossible + */ + public void setEmbeddedElement(boolean embeddedElement) + throws ModelException; + + /**=20 + * Get the type representation of the collection elements.=20 + * @return the element type + */ + public JavaType getElementType(); + + /**=20 + * Set the type representation of the collection elements. + * @param elementType the type representation of the collection elemen= ts + * @exception ModelException if impossible + */ + public void setElementType(JavaType elementType) + throws ModelException; + + /**=20 + * Get the type of collection elements as string. + * @return the element type as string + */ + public String getElementTypeName(); + + /**=20 + * Set string representation of the type of collection elements. + * @param elementTypeName a string representation of the type of eleme= nts in + * the collection.=20 + * @exception ModelException if impossible + */ + public void setElementTypeName(String elementTypeName) + throws ModelException; + +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOElemen= t=2Ejava URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOElement.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOElement.j= ava (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOElement.j= ava Fri Mar 18 17:02:29 2005 @@ -0,0 +1,87 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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,=20 + * such as JDOClass, JDOField and JDORelationship. + * + * @author Michael Bouschen + */ +public interface JDOElement=20 +{ + /** + * Remove the supplied vendor extension from the collection of extensi= ons=20 + * 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 specifie= d=20 + * JDOElement object. + * @exception ModelException if impossible + */ + public JDOExtension createJDOExtension() + throws ModelException; + + /**=20 + * Add a property change listener. + * @param l the listener to add + * @exception ModelException if impossible + */ + public void addPropertyChangeListener(PropertyChangeListener l) + throws ModelException; + + /**=20 + * Remove a property change listener. + * @param l the listener to remove + * @exception ModelException if impossible + */ + public void removePropertyChangeListener(PropertyChangeListener l) + throws ModelException; + + /**=20 + * Add a vetoable change listener. + * @param l the listener to add + * @exception ModelException if impossible + */ + public void addVetoableChangeListener(VetoableChangeListener l) + throws ModelException; + + /**=20 + * 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/ri11/src/java/org/apache/jdo/model/jdo/JDOExtens= ion.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOExtension.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOExtension= .java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOExtension= .java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,63 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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. + *=20 + * @author Michael Bouschen + */ +public interface JDOExtension=20 +{ + /** + * 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; + =20 + /** + * 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; + =20 + /** + * 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/ri11/src/java/org/apache/jdo/model/jdo/JDOField.= java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOField.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOField.jav= a (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOField.jav= a Fri Mar 18 17:02:29 2005 @@ -0,0 +1,285 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 + * of a persistence-capable class. + * + * @author Michael Bouschen + */ +public interface JDOField=20 + extends JDOMember=20 +{ + /** + * Get the persistence modifier of this JDOField. + * @return the persistence modifier, one of=20 + * {@link PersistenceModifier#UNSPECIFIED},=20 + * {@link PersistenceModifier#NONE},=20 + * {@link PersistenceModifier#PERSISTENT}, + * {@link PersistenceModifier#TRANSACTIONAL}, + * {@link PersistenceModifier#POSSIBLY_PERSISTENT}. + */ + public int getPersistenceModifier(); + + /**=20 + * Set the persistence modifier for this JDOField. + * @param persistenceModifier an integer indicating the persistence=20 + * modifier, one of: {@link PersistenceModifier#UNSPECIFIED},=20 + * {@link PersistenceModifier#NONE},=20 + * {@link PersistenceModifier#PERSISTENT}, + * {@link PersistenceModifier#TRANSACTIONAL}, + * {@link PersistenceModifier#POSSIBLY_PERSISTENT}. + * @exception ModelException if impossible + */ + public void setPersistenceModifier (int persistenceModifier) + throws ModelException; + =20 + /**=20 + * Determines whether this JDOField is a key field or not. =20 + * @return true if the field is a key field,=20 + * false otherwise + */ + public boolean isPrimaryKey(); + + /**=20 + * Set whether this JDOField is a key field or not. + * @param primaryKey if true, the JDOField is marked=20 + * 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=20 + * {@link NullValueTreatment#NONE}, {@link NullValueTreatment#EXCEPTIO= N} or + * {@link NullValueTreatment#DEFAULT} + */ + public int getNullValueTreatment(); + + /** + * Sets the null value treatment indicator for this JDOField. + * @param nullValueTreament an integer indicating the null value treat= ment,=20 + * one of: {@link NullValueTreatment#NONE},=20 + * {@link NullValueTreatment#EXCEPTION} or=20 + * {@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=20 + * not. + * @return true if the field is part of the default fetch=20 + * group, false otherwise + */ + public boolean isDefaultFetchGroup(); + + /** + * Set whether this JDOField is part of the default fetch group or not. + * @param defaultFetchGroup if true, the JDOField is mark= ed =20 + * 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 true if the field is stored as part of the ins= tance; + * false 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 true if the field is stored as part of= the=20 + * instance; false otherwise + * @exception ModelException if impossible + */ + public void setEmbedded(boolean embedded) + throws ModelException; + =20 + /** + * Determines whether this JDOField is serializable or not. =20 + * @return true if the field is serializable, + * false otherwise + */ + public boolean isSerializable(); + + /**=20 + * Set whether this JDOField is serializable or not. + * @param serializable if true, the JDOField is serializa= ble; + * 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=20 + * returns null if the field is not part of a relationship=20 + * (e.g. it is a primitive type field). + * @return relationship info of this JDOField or null if=20 + * 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.=20 + * This method automatically binds the new JDOReference to this JDOFie= ld.=20 + * It throws a ModelException, if this JDOField is already bound to=20 + * another JDORelationship instance. Otherwise the following holds tru= e: + *
    + *
  • Method {@link #getRelationship} returns the new created instan= ce + *
  • this.getRelationship().getDeclaringField() =3D=3D this + *
=20 + * @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.=20 + * This method automatically binds the new JDOCollection to this JDOFi= eld.=20 + * It throws a ModelException, if this JDOField is already bound to=20 + * another JDORelationship instance. Otherwise the following holds tru= e: + *
    + *
  • Method {@link #getRelationship} returns the new created instan= ce + *
  • this.getRelationship().getDeclaringField() =3D=3D this + *
=20 + * @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.=20 + * This method automatically binds the new JDOArray to this JDOField.=20 + * It throws a ModelException, if this JDOField is already bound to=20 + * another JDORelationship instance. Otherwise the following holds tru= e: + *
    + *
  • Method {@link #getRelationship} returns the new created instan= ce + *
  • this.getRelationship().getDeclaringField() =3D=3D this + *
=20 + * @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.=20 + * This method automatically binds the new JDOMap to this JDOField.=20 + * It throws a ModelException, if this JDOField is already bound to=20 + * another JDORelationship instance. Otherwise the following holds tru= e: + *
    + *
  • Method {@link #getRelationship} returns the new created instan= ce + *
  • this.getRelationship().getDeclaringField() =3D=3D this + *
=20 + * @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 JDOF= ield. + * @return true if this field has the =20 + * {@link PersistenceModifier#PERSISTENT} modifier; false=20 + * otherwise + */ + public boolean isPersistent(); + + /** + * Convenience method to check the persistence modifier from this JDOF= ield. + * @return true if this field has the =20 + * {@link PersistenceModifier#TRANSACTIONAL} modifier; false=20 + * otherwise + */ + public boolean isTransactional(); + + /** + * Convenience method to check the persistence modifier from this JDOF= ield. + * A field is a managed field, if it has the persistence-modifier=20 + * {@link PersistenceModifier#PERSISTENT} or + * {@link PersistenceModifier#TRANSACTIONAL}. + * @return true if this field is a managed field;=20 + * false otherwise =20 + */ + public boolean isManaged(); + + /** + * Convenience method to check whether this field is a relationship fi= eld. + * @return true if this field is a relationship;=20 + * false 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/ri11/src/java/org/apache/jdo/model/jdo/JDOIdenti= tyType.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOIdentityType.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOIdentityT= ype.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOIdentityT= ype.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,79 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 +{ + /** Constant representing an unspecified jdo identity */ + public static final int UNSPECIFIED =3D 0; + + /** Constant representing jdo identity managed by the database. */ + public static final int DATASTORE =3D 1; + + /** Constant representing jdo identity managed by the application. */ + public static final int APPLICATION =3D 2; + + /** Constant representing unmanaged jdo identity. */ + public static final int NONDURABLE =3D 4; + =20 + /** + * Returns a string representation of the specified identity type cons= tant. + * @param jdoIdentityType the JDO identity type, one of=20 + * {@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 + } + } + =20 + /** + * Returns the JDOIdentityType constant, one of {@link #APPLICATION},=20 + * {@link #DATASTORE}, or {@link #NONDURABLE} for the specified string. + * @param jdoIdentityType the string representation of the=20 + * JDO identity type + * @return the JDO identity type + **/ + public static int toJDOIdentityType(String jdoIdentityType) + { + if ((jdoIdentityType =3D=3D null) || (jdoIdentityType.length() =3D= =3D 0)) + return UNSPECIFIED; +=20 + 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/ri11/src/java/org/apache/jdo/model/jdo/JDOMap.ja= va URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOMap.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOMap.java = (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOMap.java = Fri Mar 18 17:02:29 2005 @@ -0,0 +1,124 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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=20 + * (the treatment of keys and values) of a map relationship field.=20 + * + * @author Michael Bouschen + */ +public interface JDOMap + extends JDORelationship=20 +{ + /** + * Determines whether the keys of the map should be stored if possible= as=20 + * part of the instance instead of as their own instances in the datas= tore. + * @return true if the keys are stored as part of this in= stance; + * false otherwise + */ + public boolean isEmbeddedKey(); + =20 + /** + * Set whether the keys of the map should be stored if possible as par= t=20 + * of the instance instead of as their own instances in the datastore. + * @param embeddedKey true if the keys are stored as part= of + * this instance; false 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 =20 + */ + 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 JDOM= ap. + * @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 possib= le as=20 + * part of the instance instead of as their own instances in the datas= tore. + * @return true if the values are stored as part of this=20 + * instance; false otherwise + */ + public boolean isEmbeddedValue(); + =20 + /** + * Set whether the values of the map should be stored if possible as p= art=20 + * of the instance instead of as their own instances in the datastore. + * @param embeddedValue true if the values are stored as = part=20 + * of this instance; false 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 =20 + */ + 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 JD= OMap. + * @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; + +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOMember= .java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOMember.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOMember.ja= va (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOMember.ja= va Fri Mar 18 17:02:29 2005 @@ -0,0 +1,59 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +package org.apache.jdo.model.jdo; + +import org.apache.jdo.model.ModelException; + +/** + * This is the super interface for named JDO metadata elements,=20 + * such as JDOClass and JDOField. + * + * @author Michael Bouschen + */ +public interface JDOMember + extends JDOElement, Comparable=20 +{ + /** + * Returns the name of this JDOMember. + * @return the name + */ + public String getName(); + + /** + * Sets the name of this JDOMember. + * @param name the name + * @exception ModelException if impossible + */ + public void setName(String name) + throws ModelException; + + /**=20 + * Get the declaring class of this JDOMember. + * @return the class that owns this JDOMember, or null + * if the element is not attached to any class + */ + public JDOClass getDeclaringClass(); + + /**=20 + * Set the declaring class of this JDOMember. + * @param declaringClass the declaring class of this member element + * @exception ModelException if impossible + */ + public void setDeclaringClass(JDOClass declaringClass) + throws ModelException; + +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModel.= java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOModel.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModel.jav= a (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModel.jav= a Fri Mar 18 17:02:29 2005 @@ -0,0 +1,162 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +package org.apache.jdo.model.jdo; + +import org.apache.jdo.model.ModelException; +import org.apache.jdo.model.java.JavaModel; +import org.apache.jdo.model.java.JavaType; + + +/** + * A JDOModel instance bundles a number of JDOClass instances used by an=20 + * application. It provides factory methods to create and retrieve JDOClas= s=20 + * instances. A fully qualified class name must be unique within a JDOMode= l=20 + * instance. The model supports multiple classes having the same fully qua= lified=20 + * name by different JDOModel instances. + * + * @author Michael Bouschen + */ +public interface JDOModel + extends JDOElement +{ + /**=20 + * The method returns a JDOClass instance for the specified package na= me. + * If this JDOModel contains the corresponding JDOPackage instance, + * the existing instance is returned. Otherwise, it creates a new JDOP= ackage + * instance and returns the new instance. + * @param packageName the name of the JDOPackage instance=20 + * to be returned + * @return a JDOPackage instance for the specified package name + * @exception ModelException if impossible + */ + public JDOPackage createJDOPackage(String packageName) + throws ModelException; + + /**=20 + * The method returns the JDOPackage instance for the specified packag= e=20 + * name, if present. The method returns null if it cannot=20 + * find a JDOPackage instance for the specified name.=20 + * @param packageName the name of the JDOPackage instance=20 + * to be returned + * @return a JDOPackage instance for the specified package name=20 + * or null if not present + */ + public JDOPackage getJDOPackage(String packageName); + + /** + * Returns the collection of JDOPackage instances declared by this JDO= Model=20 + * in the format of an array. + * @return the packages declared by this JDOModel + */ + public JDOPackage[] getDeclaredPackages(); + + /** + * The method returns a JDOClass instance for the specified fully qual= ified + * class name. If this JDOModel contains the corresponding JDOClass in= stance, + * the existing instance is returned. Otherwise, it creates a new JDOC= lass=20 + * instance, sets its declaringModel and returns the new instance. + *

+ * Invoking this method is method is equivalent to=20 + * createJDOClass(className, true). + * @param className the fully qualified class name of the JDOClass ins= tance=20 + * to be returned + * @return a JDOClass instance for the specified class name + * @exception ModelException if impossible + */ + public JDOClass createJDOClass(String className) + throws ModelException; + + /** + * The method returns a JDOClass instance for the specified fully qual= ified + * class name. If this JDOModel contains the corresponding JDOClass in= stance, + * the existing instance is returned. Otherwise, if the flag loadXMLMe= tadata + * is set to true the method tries to find the JDOClass=20 + * instance by reading the XML metadata. If it could not be found the = method + * creates a new JDOClass instance, sets its declaringModel and return= s the=20 + * instance. + * @param className the fully qualified class name of the JDOClass ins= tance=20 + * to be returned + * @param loadXMLMetadata indicated whether to read XML metatdata or n= ot + * @return a JDOClass instance for the specified class name + * @exception ModelException if impossible + */ + public JDOClass createJDOClass(String className, boolean loadXMLMetada= ta) + throws ModelException; + + /** + * The method returns the JDOClass instance for the specified fully=20 + * qualified class name if present. The method returns null=20 + * if it cannot find a JDOClass instance for the specified name.=20 + *

+ * Invoking this method is equivalent to=20 + * getJDOClass(className, true). + * @param className the fully qualified class name of the JDOClass ins= tance=20 + * to be returned + * @return a JDOClass instance for the specified class name=20 + * or null if not present + */ + public JDOClass getJDOClass(String className); + + /** + * The method returns the JDOClass instance for the specified fully=20 + * qualified class name if present. If the flag loadXMLMetadata is set=20 + * to true the method tries to find the JDOClass instance= by=20 + * reading the XML metadata. The method returns null if it cannot find= a=20 + * JDOClass instance for the specified name. + * @param className the fully qualified class name of the JDOClass ins= tance=20 + * to be returned + * @param loadXMLMetadata indicate whether to read XML metatdata or not + * @return a JDOClass instance for the specified class name + * or null if not present + */ + public JDOClass getJDOClass(String className, boolean loadXMLMetadata); + + /** + * Returns the collection of JDOClass instances declared by this JDOMo= del=20 + * in the format of an array. + * @return the classes declared by this JDOModel + */ + public JDOClass[] getDeclaredClasses(); + + /** + * Returns the JavaModel bound to this JDOModel instance. + * @return the JavaModel + */ + public JavaModel getJavaModel(); + =20 + /** + * Sets the JavaModel for this JDOModel instance. + * @param javaModel the JavaModel + */ + public void setJavaModel(JavaModel javaModel); + + /** + * Returns the parent JDOModel instance of this JDOModel. + * @return the parent JDOModel + */ + public JDOModel getParent(); + + /** + * This method returns the JDOClass instance that defines the specifie= d type + * as its objectId class. In the case of an inheritance hierarchy it r= eturns=20 + * the top most persistence-capable class of the hierarchy (see=20 + * {@link JDOClass#getPersistenceCapableSuperclass}). + * @param objectIdClass the type representation of the ObjectId class + * @return the JDOClass defining the specified class as ObjectId class + */ + public JDOClass getJDOClassForObjectIdClass(JavaType objectIdClass); +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModel.= jpg URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/model/jdo/JDOModel.jpg?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Binary file - no diff available. Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOM= odel.jpg ---------------------------------------------------------------------------= --- svn:executable =3D * Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOM= odel.jpg ---------------------------------------------------------------------------= --- svn:mime-type =3D application/octet-stream