1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jdo.impl.model.jdo.caching;
19
20 import org.apache.jdo.model.java.JavaModel;
21 import org.apache.jdo.model.jdo.JDOModel;
22 import org.apache.jdo.model.jdo.JDOModelFactory;
23
24 import org.apache.jdo.impl.model.jdo.JDOModelFactoryImplDynamic;
25
26 /***
27 * Factory for caching JDOModel instances.
28 *
29 * @author Michael Bouschen
30 * @since 1.1
31 * @version 1.1
32 */
33 public class JDOModelFactoryImplCaching extends JDOModelFactoryImplDynamic {
34
35 /*** The singleton JDOModelFactory instance. */
36 private static JDOModelFactory jdoModelFactory =
37 new JDOModelFactoryImplCaching();
38
39 /***
40 * Creates new JDOModelFactoryImplCaching. This constructor
41 * should not be called directly; instead, the singleton access
42 * method {@link #getInstance} should be used.
43 */
44 protected JDOModelFactoryImplCaching() {}
45
46 /***
47 * Get an instance of JDOModelFactoryImpl.
48 * @return an instance of JDOModelFactoryImpl
49 */
50 public static JDOModelFactory getInstance() {
51 return jdoModelFactory;
52 }
53
54 /***
55 * Creates a new empty JDOModel instance.
56 * The returned JDOModel instance uses the specified flag
57 * <code>loadXMLMetadataDefault</code> to set the default behavior
58 * for the creation of new JDOClass instances using methods
59 * {@link JDOModel#createJDOClass(String)} and
60 * {@link JDOModel#getJDOClass(String)} for which the caller doesn't
61 * explicitly specify whether to read XML metatdata or not.
62 * @param loadXMLMetadataDefault the default setting for whether to
63 * read XML metatdata in JDOModel's methods for JDOClass creation.
64 */
65 public JDOModel createJDOModel(JavaModel javaModel,
66 boolean loadXMLMetadataDefault) {
67 return new JDOModelImplCaching(javaModel, loadXMLMetadataDefault);
68 }
69
70 }