1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jdo.model.jdo;
18
19 import org.apache.jdo.model.ModelException;
20 import org.apache.jdo.model.java.JavaModel;
21
22
23 /***
24 * Factory for JDOModel instances. The factory provides a mechanism to cache
25 * JDOModel instances per user defined keys.
26 *
27 * @author Michael Bouschen
28 * @version 2.0
29 */
30 public interface JDOModelFactory
31 {
32 /***
33 * Creates a new empty JDOModel instance.
34 * The returned JDOModel instance uses the specified flag
35 * <code>loadXMLMetadataDefault</code> to set the default behavior
36 * for the creation of new JDOClass instances using methods
37 * {@link JDOModel#createJDOClass(String)} and
38 * {@link JDOModel#getJDOClass(String)} for which the caller doesn't
39 * explicitly specify whether to read XML metatdata or not.
40 * @param loadXMLMetadataDefault the default setting for whether to
41 * read XML metatdata in JDOModel's methods for JDOClass creation.
42 * @exception ModelException if impossible
43 */
44 public JDOModel createJDOModel(JavaModel javaModel,
45 boolean loadXMLMetadataDefault)
46 throws ModelException;
47
48 /***
49 * Returns the JDOModel instance for the specified javaModel.
50 * @param javaModel the javaModel used to cache the returned JDOModel
51 * instance.
52 */
53 public JDOModel getJDOModel(JavaModel javaModel);
54
55 /***
56 * Returns the JDOModel instance for the specified javaModel.
57 * The returned JDOModel instance uses the specified flag
58 * <code>loadXMLMetadataDefault</code> to set the default behavior
59 * for the creation of new JDOClass instances using methods
60 * {@link JDOModel#createJDOClass(String)} and
61 * {@link JDOModel#getJDOClass(String)} for which the caller doesn't
62 * explicitly specify whether to read XML metatdata or not.
63 * @param loadXMLMetadataDefault the default setting for whether to
64 * read XML metatdata in JDOModel's methods for JDOClass creation.
65 */
66 public JDOModel getJDOModel(JavaModel javaModel,
67 boolean loadXMLMetadataDefault);
68
69 /***
70 * Removes the specified jdoModel from the JDOModel cache. Note, if
71 * there are multiple entries in the cache with the specified jdoModel
72 * as value, then all of them get removed. The method does not have an
73 * effect, if this factory does not have the specified jdoModel.
74 * @param jdoModel the JDOModel to be removed.
75 * @since 2.0
76 */
77 public void removeJDOModel(JDOModel jdoModel)
78 throws ModelException;
79
80 /***
81 * Removes the JDOModel for the specified javaModel from the JDOModel
82 * cache. The method does not have an effect, if this factory does not
83 * have a JDOModel for the the specified javaModel.
84 * @param javaModel the javaModel used to find the JDOModel instance to be
85 * removed.
86 * @since 2.0
87 */
88 public void removeJDOModel(JavaModel javaModel)
89 throws ModelException;
90
91 }