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