src/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java

Tue, 28 Dec 2010 15:52:36 -0800

author
ohair
date
Tue, 28 Dec 2010 15:52:36 -0800
changeset 240
f90b3e014e83
parent 215
cff5a173ec1e
child 380
47adb42076f1
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

duke@1 1 /*
ohair@240 2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@158 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@158 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@158 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 * or visit www.oracle.com if you need additional information or have any
ohair@158 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.corba.se.spi.protocol;
duke@1 27
duke@1 28 import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
duke@1 29 import org.omg.PortableInterceptor.Interceptor ;
duke@1 30 import org.omg.PortableInterceptor.Current ;
duke@1 31 import org.omg.PortableInterceptor.PolicyFactory ;
duke@1 32 import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ;
duke@1 33
duke@1 34 import org.omg.CORBA.NVList ;
duke@1 35 import org.omg.CORBA.Any ;
duke@1 36 import org.omg.CORBA.Policy ;
duke@1 37 import org.omg.CORBA.PolicyError ;
duke@1 38
duke@1 39 import org.omg.CORBA.portable.RemarshalException;
duke@1 40
duke@1 41 import com.sun.corba.se.spi.oa.ObjectAdapter ;
duke@1 42
duke@1 43 import com.sun.corba.se.spi.protocol.CorbaMessageMediator ;
duke@1 44
duke@1 45 import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
duke@1 46
duke@1 47 // XXX These need to go away.
duke@1 48 import com.sun.corba.se.impl.corba.RequestImpl ;
duke@1 49 import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage ;
duke@1 50
duke@1 51 /** This interface defines the PI interface that is used to interface the rest of the
duke@1 52 * ORB to the PI implementation.
duke@1 53 */
duke@1 54 public interface PIHandler {
duke@1 55 /** Complete the initialization of the PIHandler. This will execute the methods
duke@1 56 * on the ORBInitializers, if any are defined. This must be done here so that
duke@1 57 * the ORB can obtain the PIHandler BEFORE the ORBInitializers run, since they
duke@1 58 * will need access to the PIHandler through the ORB.
duke@1 59 */
duke@1 60 public void initialize() ;
duke@1 61
duke@1 62 public void destroyInterceptors() ;
duke@1 63
duke@1 64 /*
duke@1 65 ****************************
duke@1 66 * IOR interceptor PI hooks
duke@1 67 ****************************/
duke@1 68
duke@1 69 /**
duke@1 70 * Called when a new object adapter is created.
duke@1 71 *
duke@1 72 * @param oa The adapter associated with the interceptors to be
duke@1 73 * invoked.
duke@1 74 */
duke@1 75 void objectAdapterCreated( ObjectAdapter oa ) ;
duke@1 76
duke@1 77 /**
duke@1 78 * Called whenever a state change occurs in an adapter manager.
duke@1 79 *
duke@1 80 * @param managerId managerId The adapter manager id
duke@1 81 * @param newState newState The new state of the adapter manager,
duke@1 82 * and by implication of all object adapters managed by this manager.
duke@1 83 */
duke@1 84 void adapterManagerStateChanged( int managerId,
duke@1 85 short newState ) ;
duke@1 86
duke@1 87 /** Called whenever a state change occurs in an object adapter that
duke@1 88 * was not caused by an adapter manager state change.
duke@1 89 *
duke@1 90 * @param templates The templates that are changing state.
duke@1 91 * @param newState The new state of the adapters identified by the
duke@1 92 * templates.
duke@1 93 */
duke@1 94 void adapterStateChanged( ObjectReferenceTemplate[] templates,
duke@1 95 short newState ) ;
duke@1 96
duke@1 97 /*
duke@1 98 *****************
duke@1 99 * Client PI hooks
duke@1 100 *****************/
duke@1 101
duke@1 102 /**
duke@1 103 * Called for pseudo-ops to temporarily disable portable interceptor
duke@1 104 * hooks for calls on this thread. Keeps track of the number of
duke@1 105 * times this is called and increments the disabledCount.
duke@1 106 */
duke@1 107 void disableInterceptorsThisThread() ;
duke@1 108
duke@1 109 /**
duke@1 110 * Called for pseudo-ops to re-enable portable interceptor
duke@1 111 * hooks for calls on this thread. Decrements the disabledCount.
duke@1 112 * If disabledCount is 0, interceptors are re-enabled.
duke@1 113 */
duke@1 114 void enableInterceptorsThisThread() ;
duke@1 115
duke@1 116 /**
duke@1 117 * Called when the send_request or send_poll portable interception point
duke@1 118 * is to be invoked for all appropriate client-side request interceptors.
duke@1 119 *
duke@1 120 * @exception RemarhsalException - Thrown when this request needs to
duke@1 121 * be retried.
duke@1 122 */
duke@1 123 void invokeClientPIStartingPoint()
duke@1 124 throws RemarshalException ;
duke@1 125
duke@1 126 /**
duke@1 127 * Called when the appropriate client ending interception point is
duke@1 128 * to be invoked for all apporpriate client-side request interceptors.
duke@1 129 *
duke@1 130 * @param replyStatus One of the constants in iiop.messages.ReplyMessage
duke@1 131 * indicating which reply status to set.
duke@1 132 * @param exception The exception before ending interception points have
duke@1 133 * been invoked, or null if no exception at the moment.
duke@1 134 * @return The exception to be thrown, after having gone through
duke@1 135 * all ending points, or null if there is no exception to be
duke@1 136 * thrown. Note that this exception can be either the same or
duke@1 137 * different from the exception set using setClientPIException.
duke@1 138 * There are four possible return types: null (no exception),
duke@1 139 * SystemException, UserException, or RemarshalException.
duke@1 140 */
duke@1 141 Exception invokeClientPIEndingPoint(
duke@1 142 int replyStatus, Exception exception ) ;
duke@1 143
duke@1 144 /**
robm@215 145 * Called when a retry is needed after initiateClientPIRequest but
robm@215 146 * before invokeClientPIRequest. In this case, we need to properly
robm@215 147 * balance initiateClientPIRequest/cleanupClientPIRequest calls,
robm@215 148 * but WITHOUT extraneous calls to invokeClientPIEndingPoint
robm@215 149 * (see bug 6763340).
robm@215 150 *
robm@215 151 * @param replyStatus One of the constants in iiop.messages.ReplyMessage
robm@215 152 * indicating which reply status to set.
robm@215 153 * @param exception The exception before ending interception points have
robm@215 154 * been invoked, or null if no exception at the moment.
robm@215 155 * @return The exception to be thrown, after having gone through
robm@215 156 * all ending points, or null if there is no exception to be
robm@215 157 * thrown. Note that this exception can be either the same or
robm@215 158 * different from the exception set using setClientPIException.
robm@215 159 * There are four possible return types: null (no exception),
robm@215 160 * SystemException, UserException, or RemarshalException.
robm@215 161 */
robm@215 162 Exception makeCompletedClientRequest(
robm@215 163 int replyStatus, Exception exception ) ;
robm@215 164
robm@215 165 /**
duke@1 166 * Invoked when a request is about to be created. Must be called before
duke@1 167 * any of the setClientPI* methods so that a new info object can be
duke@1 168 * prepared for information collection.
duke@1 169 *
duke@1 170 * @param diiRequest True if this is to be a DII request, or false if it
duke@1 171 * is a "normal" request. In the DII case, initiateClientPIRequest
duke@1 172 * is called twice and we need to ignore the second one.
duke@1 173 */
duke@1 174 void initiateClientPIRequest( boolean diiRequest ) ;
duke@1 175
duke@1 176 /**
duke@1 177 * Invoked when a request is about to be cleaned up. Must be called
duke@1 178 * after ending points are called so that the info object on the stack
duke@1 179 * can be deinitialized and popped from the stack at the appropriate
duke@1 180 * time.
duke@1 181 */
duke@1 182 void cleanupClientPIRequest() ;
duke@1 183
duke@1 184 /**
duke@1 185 * Notifies PI of additional information for client-side interceptors.
duke@1 186 * PI will use this information as a source of information for the
duke@1 187 * ClientRequestInfo object.
duke@1 188 */
duke@1 189 void setClientPIInfo( RequestImpl requestImpl ) ;
duke@1 190
duke@1 191 /**
duke@1 192 * Notify PI of the MessageMediator for the request.
duke@1 193 */
duke@1 194 void setClientPIInfo(CorbaMessageMediator messageMediator) ;
duke@1 195
duke@1 196 /*
duke@1 197 *****************
duke@1 198 * Server PI hooks
duke@1 199 *****************/
duke@1 200
duke@1 201 /**
duke@1 202 * Called when the appropriate server starting interception point is
duke@1 203 * to be invoked for all appropriate server-side request interceptors.
duke@1 204 *
duke@1 205 * @throws ForwardException Thrown if an interceptor raises
duke@1 206 * ForwardRequest. This is an unchecked exception so that we need
duke@1 207 * not modify the entire execution path to declare throwing
duke@1 208 * ForwardException.
duke@1 209 */
duke@1 210 void invokeServerPIStartingPoint() ;
duke@1 211
duke@1 212 /**
duke@1 213 * Called when the appropriate server intermediate interception point is
duke@1 214 * to be invoked for all appropriate server-side request interceptors.
duke@1 215 *
duke@1 216 * @throws ForwardException Thrown if an interceptor raises
duke@1 217 * ForwardRequest. This is an unchecked exception so that we need
duke@1 218 * not modify the entire execution path to declare throwing
duke@1 219 * ForwardException.
duke@1 220 */
duke@1 221 void invokeServerPIIntermediatePoint() ;
duke@1 222
duke@1 223 /**
duke@1 224 * Called when the appropriate server ending interception point is
duke@1 225 * to be invoked for all appropriate server-side request interceptors.
duke@1 226 *
duke@1 227 * @param replyMessage The iiop.messages.ReplyMessage containing the
duke@1 228 * reply status.
duke@1 229 * @throws ForwardException Thrown if an interceptor raises
duke@1 230 * ForwardRequest. This is an unchecked exception so that we need
duke@1 231 * not modify the entire execution path to declare throwing
duke@1 232 * ForwardException.
duke@1 233 */
duke@1 234 void invokeServerPIEndingPoint( ReplyMessage replyMessage ) ;
duke@1 235
duke@1 236 /**
duke@1 237 * Notifies PI to start a new server request and set initial
duke@1 238 * information for server-side interceptors.
duke@1 239 * PI will use this information as a source of information for the
duke@1 240 * ServerRequestInfo object. poaimpl is declared as an Object so that
duke@1 241 * we need not introduce a dependency on the POA package.
duke@1 242 */
duke@1 243 void initializeServerPIInfo( CorbaMessageMediator request,
duke@1 244 ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) ;
duke@1 245
duke@1 246 /**
duke@1 247 * Notifies PI of additional information reqired for ServerRequestInfo.
duke@1 248 *
duke@1 249 * @param servant The servant. This is java.lang.Object because in the
duke@1 250 * POA case, this will be a org.omg.PortableServer.Servant whereas
duke@1 251 * in the ServerRequestDispatcher case this will be an ObjectImpl.
duke@1 252 * @param targetMostDerivedInterface. The most derived interface. This
duke@1 253 * is passed in instead of calculated when needed because it requires
duke@1 254 * extra information in the POA case that we didn't want to bother
duke@1 255 * creating extra methods for to pass in.
duke@1 256 */
duke@1 257 void setServerPIInfo( java.lang.Object servant,
duke@1 258 String targetMostDerivedInterface ) ;
duke@1 259
duke@1 260 /**
duke@1 261 * Notifies PI of additional information required for ServerRequestInfo.
duke@1 262 */
duke@1 263 void setServerPIInfo( Exception exception ) ;
duke@1 264
duke@1 265 /**
duke@1 266 * Notifies PI of additional information for server-side interceptors.
duke@1 267 * PI will use this information as a source of information for the
duke@1 268 * ServerRequestInfo object. These are the arguments for a DSI request.
duke@1 269 */
duke@1 270 void setServerPIInfo( NVList arguments ) ;
duke@1 271
duke@1 272 /**
duke@1 273 * Notifies PI of additional information for server-side interceptors.
duke@1 274 * PI will use this information as a source of information for the
duke@1 275 * ServerRequestInfo object. This is the exception of a DSI request.
duke@1 276 */
duke@1 277 void setServerPIExceptionInfo( Any exception ) ;
duke@1 278
duke@1 279 /**
duke@1 280 * Notifies PI of additional information for server-side interceptors.
duke@1 281 * PI will use this information as a source of information for the
duke@1 282 * ServerRequestInfo object. This is the result of a DSI request.
duke@1 283 */
duke@1 284 void setServerPIInfo( Any result ) ;
duke@1 285
duke@1 286 /**
duke@1 287 * Invoked when a request is about to be cleaned up. Must be called
duke@1 288 * after ending points are called so that the info object on the stack
duke@1 289 * can be deinitialized and popped from the stack at the appropriate
duke@1 290 * time.
duke@1 291 */
duke@1 292 void cleanupServerPIRequest() ;
duke@1 293
duke@1 294 Policy create_policy( int type, Any val ) throws PolicyError ;
duke@1 295
duke@1 296 void register_interceptor( Interceptor interceptor, int type )
duke@1 297 throws DuplicateName ;
duke@1 298
duke@1 299 Current getPICurrent() ;
duke@1 300
duke@1 301 void registerPolicyFactory( int type, PolicyFactory factory ) ;
duke@1 302
duke@1 303 int allocateServerRequestId() ;
duke@1 304 }

mercurial