KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > mapper > api > JormFactory


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.mapper.api;
19
20 import org.objectweb.jorm.api.PClassMapping;
21 import org.objectweb.jorm.api.PException;
22 import org.objectweb.jorm.naming.api.PNamingContext;
23 import org.objectweb.jorm.naming.api.PBinder;
24
25 /**
26  * It defines a Jorm configurator which manages the PClassMapping, the PBinder
27  * and the PNamingContext for persistent classes.
28  *
29  * @author S.Chassande-Barrioz
30  */

31 public interface JormFactory {
32
33     /**
34      * Retrieve the Binder managing the persistent class (Not a Generic class).
35      * This method is a shortcut to this call:
36      * getPClassMapping(clazz).getPBinder()
37      *
38      * @param clazz the Jorm class name managed which the PBinder is asked
39      * @return the PBinder instance to use for the given jorm class name
40      */

41     PBinder getPBinder(Class JavaDoc clazz) throws PException;
42
43     /**
44      * Retrieve the Binder managing the persistent class (Not a Generic class).
45      * This method is a shortcut to this call:
46      * getPClassMapping(Class.forName(classname, cl, true)).getPBinder()
47      *
48      * @param classname is the class name of the jorm class which the
49      * PBinder is required
50      * @param cl is the classloader where to find/load the class
51      * @return the PBinder instance to use for the given jorm class name
52      */

53     PBinder getPBinder(String JavaDoc classname, ClassLoader JavaDoc cl) throws PException;
54
55     /**
56      * Is a shortcut to the call
57      * getPClassMapping(Class.forName(classname, cl, true))
58      *
59      * @param classname is the class name of the jorm class which the
60      * PClassMapping is required
61      * @param cl is the classloader where to find/load the class
62      * @return the PClassMapping which manages a SpeedoProxy
63      */

64     PClassMapping getPClassMapping(String JavaDoc classname, ClassLoader JavaDoc cl) throws PException;
65
66     /**
67      * Retrieves a PClassMapping instance managing a jorm class. If the
68      * PClassMapping does not already exist then it is created, configured and
69      * mapped in the PMapper. The PClassMapping configuration contains the
70      * PBinder assignement, the PNamingContext assignement for each reference,
71      * and the GenClassMapping assignement. The assigned GenClassMapping must
72      * also be configured. In other hand the PClassMapping of referenced class
73      * is not configured now. Only the PNamingContext is needed.
74      * @param clazz is the class of the jorm class which the
75      * PClassMapping is required
76      * @return the PClassMapping which manages the persistent class
77      */

78     PClassMapping getPClassMapping(Class JavaDoc clazz) throws PException;
79
80     /**
81      * Retrieve the PClassMapping of a gen class since its path
82      * @param path is the path representing the way to access the
83      * GenClassMapping
84      */

85     PClassMapping getGenClassMapping(String JavaDoc path);
86
87     /**
88      * Is a shortcut to the call
89      * getPNamingContext(Class.forName(classname, cl, true))
90      *
91      * @see #getPNamingContext(Class)
92      * @param classname the Jorm class name managed by the wanted PNamingContext
93      * @return the PNamingContext instance to use for the given jorm class name
94      */

95     PNamingContext getPNamingContext(String JavaDoc classname, ClassLoader JavaDoc cl) throws PException;
96
97     /**
98      * Retrieve the PNamingcontext managing the persistent class (Not a
99      * Generic class) and its sub classes.
100      *
101      * @param clazz the Jorm class name managed which the PNamingContext is asked
102      * @return the PBinder instance to use for the given jorm class name
103      */

104     PNamingContext getPNamingContext(Class JavaDoc clazz) throws PException;
105
106     /**
107      * Retrieves the classloader of a class if the class has been already mapped.
108      * Otherwise a null value is returned
109      */

110     ClassLoader JavaDoc getClassLoader(String JavaDoc className);
111
112     /**
113      * @see org.objectweb.speedo.mapper.api.JormFactoryAttributes
114      */

115     byte getMappingStructureRule();
116
117 }
118
Popular Tags