KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > metainfo > api > Manager


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.metainfo.api;
25
26 import org.objectweb.jorm.type.api.PTypeSpace;
27
28 import java.util.Iterator JavaDoc;
29 import java.util.Collection JavaDoc;
30 import java.util.List JavaDoc;
31
32 /**
33  * The Manager object is the main interface to create the meta information.
34  * This object is able to register mapping factories, and to create schema
35  * objects.
36  * @author X. Spengler
37  */

38 public interface Manager extends MetaObject {
39     /**
40      * Initializes the current Manager.
41      * This method replaces the constructor method, with a single parameter,
42      * which is a class loader.
43      */

44     void init();
45
46     /**
47      * Returns an existing schema.
48      * If no Package corresponds to the given name, null is returned.
49      * @param packageName the name of the package
50      * @return a Package object. If the schema does not exist, null is returned.
51      */

52     Package JavaDoc getPackage(String JavaDoc packageName);
53
54     /**
55      * Returns a new schema.
56      * This method is the factory method to create schema object. If the
57      * schemaName schema already exists, it is returned.
58      * @param packageName the name of the schema
59      * @return a new schema object, or the existing one if already defined
60      */

61     Package JavaDoc createPackage(String JavaDoc packageName);
62
63     /**
64      * Allows to know all the declared schemas into the current metainformation
65      * manager.
66      * This iterator contains Package object.
67      * @return an iterator on registered Package object. If there is no schema,
68      * an empty iterator is returned.
69      */

70     Collection JavaDoc getPackages();
71
72     /**
73      * Adds a mapping factory to the current metainformation manager.
74      * A mapping factory is a factory to map object (class, field, ...).
75      * @param mapperName the name of the mapper (i.e: OR for rdb)
76      * @param mappingFactory the mapping factory to add to the list of
77      * existing mapping factories
78      */

79     void addMappingFactory(String JavaDoc mapperName, MappingFactory mappingFactory);
80
81     /**
82      * Returns a mapping factory corresponding to a mapper name.
83      * If no MappingFactory corresponds to the mapper name, null is returned.
84      * @param mapperName the name of the mapper to obtain
85      * @return a mapping factory. If the mapping factory does not exist for
86      * the mapper, null is returned.
87      */

88     MappingFactory getMappingFactory(String JavaDoc mapperName);
89
90     Collection JavaDoc getMappingFactories();
91
92     /**
93      * Searches a class into all the declared schemas and returns it.
94      * If no class corresponds to this name, null is returned.
95      * @param fqclassName is the fully qualifed name of the expected class
96      * @return the Class object found, null if not found
97      */

98     Class JavaDoc getClass(String JavaDoc fqclassName);
99
100     Class JavaDoc createClass(String JavaDoc fqclassName);
101
102     CompositeName getCompositeName(String JavaDoc fqcompositeNameName);
103
104     CompositeName createCompositeName(String JavaDoc fqcompositeNameName);
105
106     /**
107      * Build an iterator to iterate all classes in the meta information
108      * (composite names are excluded)
109      */

110     Collection JavaDoc getClasses();
111
112     Collection JavaDoc getCompositeNames();
113
114     Collection JavaDoc getJormObjects();
115
116     /**
117      * Returns the PTypeSpace structure.
118      */

119     PTypeSpace getPTypeSpace();
120 }
121
Popular Tags