📄 requestinfoimpl.java
字号:
return result; } /** * Utility method to look up a service context with the given id and * convert it to an IOP.ServiceContext. Uses the given HashMap as * a cache. If not found in cache, the result is inserted in the cache. */ protected org.omg.IOP.ServiceContext getServiceContext ( HashMap cachedServiceContexts, ServiceContexts serviceContexts, int id ) { org.omg.IOP.ServiceContext result = null; Integer integerId = new Integer( id ); // Search cache first: result = (org.omg.IOP.ServiceContext) cachedServiceContexts.get( integerId ); // null could normally mean that either we cached the value null // or it's not in the cache. However, there is no way for us to // cache the value null in the following code. if( result == null ) { // Not in cache. Find it and put in cache. // Get the desired "core" service context. com.sun.corba.se.spi.servicecontext.ServiceContext context = serviceContexts.get( id ); if (context == null) throw stdWrapper.invalidServiceContextId() ; // Convert the "core" service context to an // "IOP" ServiceContext by writing it to a // CDROutputStream and reading it back. EncapsOutputStream out = new EncapsOutputStream(myORB); context.write( out, GIOPVersion.V1_2 ); InputStream inputStream = out.create_input_stream(); result = ServiceContextHelper.read( inputStream ); cachedServiceContexts.put( integerId, result ); } // Good citizen: For increased efficiency, we assume that interceptors // will not modify the returned ServiceContext. Otherwise, we would // have to make a deep copy. return result; } /** * Utility method to add an IOP.ServiceContext to a core.ServiceContexts * object. If replace is true, any service context with the given id * is replaced. * <p> * Raises BAD_INV_ORDER if replace is false and a service context with * the given id already exists. * <p> * Uses the given HashMap as a cache. If a service context is placed * in the container, it goes in the HashMap as well. */ protected void addServiceContext( HashMap cachedServiceContexts, ServiceContexts serviceContexts, org.omg.IOP.ServiceContext service_context, boolean replace ) { int id = 0 ; // Convert IOP.service_context to core.ServiceContext: EncapsOutputStream outputStream = new EncapsOutputStream( myORB ); InputStream inputStream = null; UnknownServiceContext coreServiceContext = null; ServiceContextHelper.write( outputStream, service_context ); inputStream = outputStream.create_input_stream(); // Constructor expects id to already have been read from stream. coreServiceContext = new UnknownServiceContext( inputStream.read_long(), (org.omg.CORBA_2_3.portable.InputStream)inputStream ); id = coreServiceContext.getId(); if (serviceContexts.get(id) != null) if (replace) serviceContexts.delete( id ); else throw stdWrapper.serviceContextAddFailed( new Integer(id) ) ; serviceContexts.put( coreServiceContext ); // Place IOP.ServiceContext in cache as well: cachedServiceContexts.put( new Integer( id ), service_context ); } /** * Sets the number of interceptors whose starting interception * points were successfully invoked on this client call. As specified * in orbos/99-12-02, section 5.2.1., not all interceptors will * be invoked if a ForwardRequest exception or a system exception * is raised. This keeps track of how many were successfully executed * so we know not to execute the corresponding ending interception * points for the interceptors whose starting interception points * were not completed. This simulates the "Flow Stack Visual Model" * presented in section 5.1.3.*/ protected void setFlowStackIndex(int num ) { this.flowStackIndex = num; } /** * Returns the number of interceptors whose starting interception * points were actually invoked on this client request. See * setFlowStackIndex for more details. */ protected int getFlowStackIndex() { return this.flowStackIndex; } /** * Sets which ending interception point should be called * for each interceptor in the virtual flow stack. */ protected void setEndingPointCall( int call ) { this.endingPointCall = call; } /** * Retrieves the current ending point call type (see * setEndingPointCall for more details). */ protected int getEndingPointCall() { return this.endingPointCall; } /** * Sets which intermediate interception point should be called * for each interceptor in the virtual flow stack. */ protected void setIntermediatePointCall( int call ) { this.intermediatePointCall = call; } /** * Retrieves the current intermediate point call type (see * setEndingPointCall for more details). */ protected int getIntermediatePointCall() { return this.intermediatePointCall; } /** * Sets which starting interception point should be called * for each interceptor in the virtual flow stack. */ protected void setStartingPointCall( int call ) { this.startingPointCall = call; } /** * Retrieves the current starting point call type (see * setStartingPointCall for more details). */ protected int getStartingPointCall() { return this.startingPointCall; } /** * Returns true if all interceptors' starting and ending points * have already executed to completion, or false if not yet. */ protected boolean getAlreadyExecuted() { return this.alreadyExecuted; } /** * Sets whether all interceotrs' starting and ending points * have already been executed to completion. */ protected void setAlreadyExecuted( boolean alreadyExecuted ) { this.alreadyExecuted = alreadyExecuted; } /** * Sets the value to be returned by reply_status */ protected void setReplyStatus( short replyStatus ) { this.replyStatus = replyStatus; } /** * Gets the current reply_status without doing an access check * (available only to package and subclasses) */ protected short getReplyStatus() { return this.replyStatus; } /** * Stores the given ForwardRequest object for later analysis. * This version supplements setForwardRequest( IOR ); */ protected void setForwardRequest( ForwardRequest forwardRequest ) { this.forwardRequest = forwardRequest; this.forwardRequestIOR = null; } /** * Stores the given IOR for later forward request analysis. * This version supplements setForwardRequest( ForwardRequest ); */ protected void setForwardRequest( IOR ior ) { this.forwardRequestIOR = ior; this.forwardRequest = null; } /** * Retrieves the ForwardRequest object as a ForwardRequest exception. */ protected ForwardRequest getForwardRequestException() { if( this.forwardRequest == null ) { if( this.forwardRequestIOR != null ) { // Convert the internal IOR to a forward request exception // by creating an object reference. org.omg.CORBA.Object obj = iorToObject(this.forwardRequestIOR); this.forwardRequest = new ForwardRequest( obj ); } } return this.forwardRequest; } /** * Retrieves the IOR of the ForwardRequest exception. */ protected IOR getForwardRequestIOR() { if( this.forwardRequestIOR == null ) { if( this.forwardRequest != null ) { this.forwardRequestIOR = ORBUtility.getIOR( this.forwardRequest.forward ) ; } } return this.forwardRequestIOR; } /** * Sets the exception to be returned by received_exception and * received_exception_id. */ protected void setException( Exception exception ) { this.exception = exception; } /** * Returns the exception to be returned by received_exception and * received_exception_id. */ Exception getException() { return this.exception; } /** * Sets the execution point that we are currently executing * (starting points, intermediate points, or ending points). * This allows us to enforce the validity table. */ protected void setCurrentExecutionPoint( int executionPoint ) { this.currentExecutionPoint = executionPoint; } /** * Check whether the caller is allowed to access this method at * this particular time. This is overridden in subclasses to implement * the validity table specified in ptc/00-04-05, table 21-1 and 21-2. * The currentExecutionPoint attribute is checked, and if access is * forbidden at this time, BAD_INV_ORDER is raised with a minor code of * TBD_BIO. * * @param methodID The ID of this method, one of the MID_* constants. * This allows us to easily look up the method access in a table. * Note that method ids may overlap between subclasses. */ protected abstract void checkAccess( int methodID ) throws BAD_INV_ORDER; /** * The server side does an explicit set rather than taking the * current PICurrent table as is done in the general RequestInfoImpl * constructor. */ void setSlotTable(SlotTable slotTable) { this.slotTable = slotTable; } protected org.omg.CORBA.Object iorToObject( IOR ior ) { return ORBUtility.makeObjectReference( ior ) ; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -