44 import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
45 import com.sun.corba.se.spi.orb.ORB ;
46 import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
47 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
48 import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
49 import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
50
51 import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
52 import com.sun.corba.se.impl.oa.NullServantImpl;
53 import com.sun.corba.se.impl.oa.poa.Policies;
54 import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
55 import com.sun.corba.se.impl.orbutil.ORBConstants ;
56 import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ;
57
58 /** The Transient Object Adapter (TOA) represents the OA for purely transient
59 * objects. It is used for standard RMI-IIOP as well as backwards compatible
60 * server support (i.e. the ORB.connect() method)
61 * Its characteristics include:
62 * <UL>
63 * <LI>There is only one OA instance of the TOA. Its OAId is { "TOA" }</LI>
64 * <LI>There is not adapter manager. The TOA manager ID is fixed.<LI>
65 * <LI>State is the same as ORB state (TBD)</LI>
66 * </UL>
67 * Other requirements:
68 * <UL>
69 * <LI>All object adapters must invoke ORB.adapterCreated when they are created.
70 * </LI>
71 * <LI>All adapter managers must invoke ORB.adapterManagerStateChanged when
72 * their state changes, mapping the internal state to an ORT state.</LI>
73 * <LI>AdapterStateChanged must be invoked (from somewhere) whenever
74 * an adapter state changes that is not due to an adapter manager state change.</LI>
75 * </UL>
76 */
77 public class TOAImpl extends ObjectAdapterBase implements TOA
78 {
79 private TransientObjectManager servants ;
80
81 public TOAImpl( ORB orb, TransientObjectManager tom, String codebase )
82 {
83 super( orb ) ;
84 servants = tom ;
101 ) ;
102 }
103
104 // Methods required for dispatching requests
105
106 public ObjectCopierFactory getObjectCopierFactory()
107 {
108 CopierManager cm = getORB().getCopierManager() ;
109 return cm.getDefaultObjectCopierFactory() ;
110 }
111
112 public org.omg.CORBA.Object getLocalServant( byte[] objectId )
113 {
114 return (org.omg.CORBA.Object)(servants.lookupServant( objectId ) ) ;
115 }
116
117 /** Get the servant for the request given by the parameters.
118 * This will update thread Current, so that subsequent calls to
119 * returnServant and removeCurrent from the same thread are for the
120 * same request.
121 * @param request is the request containing the rest of the request
122 */
123 public void getInvocationServant( OAInvocationInfo info )
124 {
125 java.lang.Object servant = servants.lookupServant( info.id() ) ;
126 if (servant == null)
127 // This is expected to result in an RMI-IIOP NoSuchObjectException.
128 // See bug 4973160.
129 servant = new NullServantImpl( lifecycleWrapper().nullServant() ) ;
130 info.setServant( servant ) ;
131 }
132
133 public void returnServant()
134 {
135 // NO-OP
136 }
137
138 /** Return the most derived interface for the given servant and objectId.
139 */
140 public String[] getInterfaces( Object servant, byte[] objectId )
141 {
|
44 import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
45 import com.sun.corba.se.spi.orb.ORB ;
46 import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
47 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
48 import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
49 import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
50
51 import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
52 import com.sun.corba.se.impl.oa.NullServantImpl;
53 import com.sun.corba.se.impl.oa.poa.Policies;
54 import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
55 import com.sun.corba.se.impl.orbutil.ORBConstants ;
56 import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ;
57
58 /** The Transient Object Adapter (TOA) represents the OA for purely transient
59 * objects. It is used for standard RMI-IIOP as well as backwards compatible
60 * server support (i.e. the ORB.connect() method)
61 * Its characteristics include:
62 * <UL>
63 * <LI>There is only one OA instance of the TOA. Its OAId is { "TOA" }</LI>
64 * <LI>There is not adapter manager. The TOA manager ID is fixed.</LI>
65 * <LI>State is the same as ORB state (TBD)</LI>
66 * </UL>
67 * Other requirements:
68 * <UL>
69 * <LI>All object adapters must invoke ORB.adapterCreated when they are created.
70 * </LI>
71 * <LI>All adapter managers must invoke ORB.adapterManagerStateChanged when
72 * their state changes, mapping the internal state to an ORT state.</LI>
73 * <LI>AdapterStateChanged must be invoked (from somewhere) whenever
74 * an adapter state changes that is not due to an adapter manager state change.</LI>
75 * </UL>
76 */
77 public class TOAImpl extends ObjectAdapterBase implements TOA
78 {
79 private TransientObjectManager servants ;
80
81 public TOAImpl( ORB orb, TransientObjectManager tom, String codebase )
82 {
83 super( orb ) ;
84 servants = tom ;
101 ) ;
102 }
103
104 // Methods required for dispatching requests
105
106 public ObjectCopierFactory getObjectCopierFactory()
107 {
108 CopierManager cm = getORB().getCopierManager() ;
109 return cm.getDefaultObjectCopierFactory() ;
110 }
111
112 public org.omg.CORBA.Object getLocalServant( byte[] objectId )
113 {
114 return (org.omg.CORBA.Object)(servants.lookupServant( objectId ) ) ;
115 }
116
117 /** Get the servant for the request given by the parameters.
118 * This will update thread Current, so that subsequent calls to
119 * returnServant and removeCurrent from the same thread are for the
120 * same request.
121 * @param info is the request containing the rest of the request
122 */
123 public void getInvocationServant( OAInvocationInfo info )
124 {
125 java.lang.Object servant = servants.lookupServant( info.id() ) ;
126 if (servant == null)
127 // This is expected to result in an RMI-IIOP NoSuchObjectException.
128 // See bug 4973160.
129 servant = new NullServantImpl( lifecycleWrapper().nullServant() ) ;
130 info.setServant( servant ) ;
131 }
132
133 public void returnServant()
134 {
135 // NO-OP
136 }
137
138 /** Return the most derived interface for the given servant and objectId.
139 */
140 public String[] getInterfaces( Object servant, byte[] objectId )
141 {
|