KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > presentation > rmi > PresentationManager


1 /*
2  * @(#)PresentationManager.java 1.9 04/06/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.spi.presentation.rmi ;
9
10 import java.util.Map JavaDoc ;
11
12 import java.lang.reflect.Method JavaDoc ;
13 import java.lang.reflect.InvocationHandler JavaDoc ;
14
15 import javax.rmi.CORBA.Tie JavaDoc ;
16
17 import com.sun.corba.se.spi.orb.ORB ;
18 import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
19
20
21 /** Provides access to RMI-IIOP stubs and ties.
22  * Any style of stub and tie generation may be used.
23  * This includes compiler generated stubs and runtime generated stubs
24  * as well as compiled and reflective ties. There is normally
25  * only one instance of this interface per VM. The instance
26  * is obtained from the static method
27  * com.sun.corba.se.spi.orb.ORB.getPresentationManager.
28  * <p>
29  * Note that
30  * the getClassData and getDynamicMethodMarshaller methods
31  * maintain caches to avoid redundant computation.
32  */

33 public interface PresentationManager
34 {
35     /** Creates StubFactory and Tie instances.
36      */

37     public interface StubFactoryFactory
38     {
39     /** Return the standard name of a stub (according to the RMI-IIOP specification
40      * and rmic). This is needed so that the name of a stub is known for
41      * standalone clients of the app server.
42      */

43     String JavaDoc getStubName( String JavaDoc className ) ;
44
45     /** Create a stub factory for stubs for the interface whose type is given by
46      * className. className may identify either an IDL interface or an RMI-IIOP
47      * interface.
48      * @param className The name of the remote interface as a Java class name.
49      * @param isIDLStub True if className identifies an IDL stub, else false.
50      * @param remoteCodeBase The CodeBase to use for loading Stub classes, if
51      * necessary (may be null or unused).
52      * @param expectedClass The expected stub type (may be null or unused).
53      * @param classLoader The classLoader to use (may be null).
54      */

55     PresentationManager.StubFactory createStubFactory( String JavaDoc className,
56         boolean isIDLStub, String JavaDoc remoteCodeBase, Class JavaDoc expectedClass,
57         ClassLoader JavaDoc classLoader);
58
59     /** Return a Tie for the given class.
60      */

61     Tie JavaDoc getTie( Class JavaDoc cls ) ;
62
63     /** Return whether or not this StubFactoryFactory creates StubFactory
64      * instances that create dynamic stubs and ties. At the top level,
65      * true indicates that rmic -iiop is not needed for generating stubs
66      * or ties.
67      */

68     boolean createsDynamicStubs() ;
69     }
70
71     /** Creates the actual stub needed for RMI-IIOP remote
72      * references.
73      */

74     public interface StubFactory
75     {
76     /** Create a new dynamic stub. It has the type that was
77      * used to create this factory.
78      */

79     org.omg.CORBA.Object JavaDoc makeStub() ;
80
81     /** Return the repository ID information for all Stubs
82      * created by this stub factory.
83      */

84     String JavaDoc[] getTypeIds() ;
85     }
86
87     public interface ClassData
88     {
89     /** Get the class used to create this ClassData instance
90      */

91     Class JavaDoc getMyClass() ;
92
93     /** Get the IDLNameTranslator for the class used to create
94      * this ClassData instance.
95      */

96     IDLNameTranslator getIDLNameTranslator() ;
97
98     /** Return the array of repository IDs for all of the remote
99      * interfaces implemented by this class.
100      */

101     String JavaDoc[] getTypeIds() ;
102
103     /** Get the InvocationHandlerFactory that is used to create
104      * an InvocationHandler for dynamic stubs of the type of the
105      * ClassData.
106      */

107     InvocationHandlerFactory getInvocationHandlerFactory() ;
108
109     /** Get the dictionary for this ClassData instance.
110      * This is used to hold class-specific information for a Class
111      * in the class data. This avoids the need to create other
112      * caches for accessing the information.
113      */

114     Map JavaDoc getDictionary() ;
115     }
116
117     /** Get the ClassData for a particular class.
118      * This class may be an implementation class, in which
119      * case the IDLNameTranslator handles all Remote interfaces implemented by
120      * the class. If the class implements more than one remote interface, and not
121      * all of the remote interfaces are related by inheritance, then the type
122      * IDs have the implementation class as element 0.
123      */

124     ClassData getClassData( Class JavaDoc cls ) ;
125
126     /** Given a particular method, return a DynamicMethodMarshaller
127      * for that method. This is used for dynamic stubs and ties.
128      */

129     DynamicMethodMarshaller getDynamicMethodMarshaller( Method JavaDoc method ) ;
130
131     /** Return the registered StubFactoryFactory.
132      */

133     StubFactoryFactory getStubFactoryFactory( boolean isDynamic ) ;
134
135     /** Register the StubFactoryFactory. Note that
136      * a static StubFactoryFactory is always required for IDL. The
137      * dynamic stubFactoryFactory is optional.
138      */

139     void setStubFactoryFactory( boolean isDynamic, StubFactoryFactory sff ) ;
140
141     /** Equivalent to getStubFactoryFactory( true ).getTie( null ).
142      * Provided for compatibility with earlier versions of PresentationManager
143      * as used in the app server. The class argument is ignored in
144      * the dynamic case, so this is safe.
145      */

146     Tie JavaDoc getTie() ;
147
148     /** Returns the value of the com.sun.CORBA.ORBUseDynamicStub
149      * property.
150      */

151     boolean useDynamicStubs() ;
152 }
153
Popular Tags