01: /**
02: * Copyright (C) 2001-2006 France Telecom R&D
03: */package org.objectweb.speedo.naming.api;
04:
05: import org.objectweb.jorm.api.PException;
06: import org.objectweb.jorm.naming.api.PName;
07: import org.objectweb.jorm.naming.api.PNameCoder;
08: import org.objectweb.speedo.api.SpeedoException;
09: import org.objectweb.speedo.mapper.api.JormFactory;
10: import org.objectweb.speedo.metadata.SpeedoClass;
11:
12: /**
13: * A NamingManagerFactory manages a set of NamingManager instance. It permits
14: * - To bind or unbind a NamingManager,
15: * - To find the right NamingManager managing the identifier/naming of a
16: * persistent class,
17: * - To encode or decode persistent identifier.
18: *
19: * @see NamingManager
20: * @author S.Chassande-Barrioz
21: */
22: public interface NamingManagerFactoryItf {
23:
24: /**
25: * Binds a new NamaingManager in this factory
26: * @param nm is the new NamingManager instance
27: */
28: void bindNamingManager(NamingManager nm);
29:
30: /**
31: * Unbinds an existing NamaingManager in this factory
32: * @param nm is the NamingManager instance to forget
33: * @return true is the NamingManager has been really found and therefore
34: * forgoten.
35: */
36: boolean unbindNamingManager(NamingManager nm);
37:
38: /**
39: * @return the NamingManager instance able to manage the identifier of a
40: * persistent class.
41: * @param sc is the speedo meta object representing the persistent class.
42: * @throws SpeedoException if no NamingManager can manage the persistent
43: * class.
44: */
45: NamingManager getNamingManager(SpeedoClass sc)
46: throws SpeedoException;
47:
48: /**
49: * @return the NamingManager instance able to manage the identifier of a
50: * persistent class.
51: * @param hints is string value containing information permitting to find
52: * the naming manager required.
53: * @param classloader is the class loader of the application.
54: * @throws SpeedoException if no NamingManager can manage the persistent
55: * class.
56: */
57: NamingManager getNamingManager(String hints, ClassLoader classloader)
58: throws PException;
59:
60: /**
61: * Decodes an object identifer into a PName.
62: * @param pnc is the PNamingContext managing the naming of the referenced
63: * persistent class
64: * @param oid is the object identifier
65: * @param clazz is the java class of the referenced class. this paramter
66: * permits of course to access to the class loader of the application.
67: * @param jf is the JormFactory managing the persistent class.
68: * @return a PName (JORM identifier of persistent class)
69: * @throws PException if it is not possible to decode the object identifier
70: * corresponding to the specified class.
71: * @see #encode(PName)
72: */
73: PName decode(PNameCoder pnc, Object oid, java.lang.Class clazz,
74: JormFactory jf) throws PException;
75:
76: /**
77: * Encodes the persistent identifier (PName) into an object identifier
78: * usable, externaly to the Speedo system.
79: * @param pn is the Pname to encode
80: * @see #decode(PNameCoder, Object, java.lang.Class, JormFactory)
81: */
82: Object encode(PName pn) throws PException;
83:
84: /**
85: * clean all naming Manager
86: *
87: */
88: void clean();
89: }
|