org.openorb.net
Class LocalClientRequest

java.lang.Object
  |
  +--org.omg.CORBA.LocalObject
        |
        +--org.openorb.net.AbstractClientRequest
              |
              +--org.openorb.net.LocalClientRequest
All Implemented Interfaces:
ClientRequest, ClientRequestInfo, ClientRequestInfoOperations, IDLEntity, Object, RequestInfo, RequestInfoOperations, java.io.Serializable

public class LocalClientRequest
extends AbstractClientRequest

This is a very hacked version of the IIOPClientRequest to route calls inside the ORB. This is necessary because of some IDL compilers (as JDK1.4) that leave to the ORB all the local calls instead of handling them inside the stubs

Version:
$Revision: 1.3 $ $Date: 2002/09/26 12:33:47 $
Author:
Erik Putrycz
See Also:
Serialized Form

Fields inherited from interface org.openorb.net.ClientRequest
OBJECT_HERE, STATE_COMPLETE, STATE_CREATED, STATE_MARSHAL, STATE_UNMARSHAL, STATE_WAITING, UNKNOWN_OBJECT
 
Constructor Summary
LocalClientRequest(ORB orb, int request_id, Object target, java.lang.String operation, boolean response_expected, Address[] adresses)
          Creates a new LocalClientRequest
 
Method Summary
 OutputStream begin_marshal()
          Begin marshalling arguments.
 boolean cancel(SystemException ex)
          Cancel the request with the specified system exception reply.
static LocalClientRequest createLocalClientRequest(ORB orb, Object target, java.lang.String operation, boolean response_expected, Address[] adresses)
          This is a factory pattern for creation a new Local Client Request.
 IOR forward_reference_ior()
          Get the ior associated with a forward reference.
 Object forward_reference()
          Return and eventually create a forward reference from a LOCATION_FORWARD reply.
 ServiceContext get_reply_service_context(int id)
          Returns the service context of the request
 boolean is_locate()
          This returns true if this request is a locate request.
 boolean is_poll()
          Request is a poll.
 boolean is_request()
          This returns true if this request is a standard request.
 java.lang.String operation()
          request operation
 boolean poll_response()
          Poll to see if a response is available from the target.
 InputStream receive_response()
          Get the response output stream.
 java.lang.String received_exception_id()
          returns the exception id if an exception has been sent by the server
 Any received_exception()
          returns the forward reference
 SystemException received_system_exception()
          Get the system exception which would be contained in the any returned from receive_exception.
 short reply_status()
          Returns the reply status of the request
 boolean response_expected()
          Read accessor for response_expected attribute
 int send_request()
          When this returns the last fragment of the request has been sent.
 int state()
          Current request state.
 short sync_scope()
          returns the sync scope of the request (depends if it is one way or not)
 int wait_for_response(long timeout)
          Wait for a response from the server.
 
Methods inherited from class org.openorb.net.AbstractClientRequest
add_request_service_context, address, arguments, channel, checkReplyTransportAssoc, contexts, effective_profile, effective_target_ior, effective_target, equals, exceptions, get_effective_component, get_effective_components, get_request_policy, get_request_service_context, get_request_service_contexts, get_slot, get_transport_association, operation_context, orb, request_id, result, state_completion_status, target_ior, target
 
Methods inherited from class org.omg.CORBA.LocalObject
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_interface, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_policy_override, validate_connection
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.omg.CORBA.Object
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_interface, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override
 

Constructor Detail

LocalClientRequest

public LocalClientRequest(ORB orb,
                          int request_id,
                          Object target,
                          java.lang.String operation,
                          boolean response_expected,
                          Address[] adresses)
Creates a new LocalClientRequest
Parameters:
orb - ORB
request_id - the current request id
target - target object for the request
operation - operation
response_expected - oneway call or not
adresses - all the adresses of the target
Method Detail

createLocalClientRequest

public static LocalClientRequest createLocalClientRequest(ORB orb,
                                                          Object target,
                                                          java.lang.String operation,
                                                          boolean response_expected,
                                                          Address[] adresses)
This is a factory pattern for creation a new Local Client Request. This is necessary for having a clean handling of the request_id.
Parameters:
orb - ORB
target - target object for the request
operation - operation
response_expected - oneway call or not
adresses - all the adresses of the target
Returns:
A new instance of this class.

state

public int state()
Current request state.
Returns:
state

is_request

public boolean is_request()
This returns true if this request is a standard request. While in the CREATED state it is valid to call any client request info operations which would be valid in the client side interception points send_request. The send_request interception points are called while in this state.

is_locate

public boolean is_locate()
This returns true if this request is a locate request. Client side interceptors are not called for locate requests. ClientRequestInfo operations: arguments, exceptions, contexts, operation_context, result, get_request_service_context, get_reply_service_context, add_request_service_context are not valid. operation returns the empty string "", response_expected returns true. Note the extra value for reply_status, UNKNOWN_OBJECT.

is_poll

public boolean is_poll()
Request is a poll. While in the CREATED state it is valid to call any client request info operations which would be valid in the client side interception points send_poll. The send_poll interception points are called while in this state.
Returns:
true if is a poll

sync_scope

public short sync_scope()
returns the sync scope of the request (depends if it is one way or not)
Returns:
sync_scope

response_expected

public boolean response_expected()
Description copied from interface: RequestInfoOperations
Read accessor for response_expected attribute
Following copied from interface: org.omg.PortableInterceptor.RequestInfoOperations
Returns:
the attribute value

operation

public java.lang.String operation()
request operation
Following copied from interface: org.omg.PortableInterceptor.RequestInfoOperations
Returns:
the attribute value

cancel

public boolean cancel(SystemException ex)
Cancel the request with the specified system exception reply. This is valid in any state apart from COMPLETE. This may result in cancel messages being sent to the server. If this is successful state changes to COMPLETED/SYSTEM_EXCEPTION. If the provided exception's status is set to null the exception thown will set the exception status according to the request's state.
Returns:
true if the request is succesfully canceled.

begin_marshal

public OutputStream begin_marshal()
Begin marshalling arguments. Valid in CREATED state. State changes to MARSHAL. If no arguments are required for marshalling this can enter the MARSHAL state and return null, this occours for locate requests and polls only. This may also return null if entering COMPLETE/SYSTEM_EXCEPTION/COMPLETED_NO, COMPLETE/LOCATION_FORWARD or COMPLETE/LOCATION_FORWARD_PERMINENT due to communication problems or client side interceptors.

send_request

public int send_request()
When this returns the last fragment of the request has been sent. In MARSHAL state changes to WAITING or COMPLETE. This may result in entering COMPLETE/SYSTEM_EXCEPTION/COMPLETED_NO, COMPLETE/LOCATION_FORWARD or COMPLETE/LOCATION_FORWARD_PERMINENT due to communication problems.
Returns:
new state. May be WAITING or COMPLETE.

poll_response

public boolean poll_response()
Poll to see if a response is available from the target. If in the WAITING state this will return true if wait_for_response would not have to wait for a response. In the UNMARSHAL and COMPLETE states this returns true, It is illegal to call this function in all other states.

receive_response

public InputStream receive_response()
Get the response output stream. This function is valid in the UNMARSHAL state when reply_status is SUCESSFUL or USER_EXCEPTION. The returned input stream may throw a system exception with status COMPLETED_YES at any time. With the local server request no error can happen at this stage

wait_for_response

public int wait_for_response(long timeout)
Wait for a response from the server. When this returns either the given wait_time has expired (WAITING), a response has arrived from the server (UNMARSHAL or COMPLETE), a transport error has occoured (COMPLETE), or for requests where no response is expected the sync scope is satisfied (COMPLETE). The request state will not exit the WAITING state unless this function is called.
Parameters:
timeout - Maximum amount of time to wait for response. <=0 to wait forever, > 0 for some timeout (in ms)
Returns:
new state. May be WAITING, UNMARSHAL or COMPLETE.

reply_status

public short reply_status()
Returns the reply status of the request
Returns:
reply

get_reply_service_context

public ServiceContext get_reply_service_context(int id)
Returns the service context of the request
Parameters:
id -  
Returns:
The service context of the request.

forward_reference

public Object forward_reference()
Return and eventually create a forward reference from a LOCATION_FORWARD reply.
Returns:
The forward reference in case one exists.

forward_reference_ior

public IOR forward_reference_ior()
Get the ior associated with a forward reference. Calling this function instead of forward_reference avoids creating an enclosing delegate/object. This function is valid in the COMPLETE/LOCATION_FORWARD state.

received_system_exception

public SystemException received_system_exception()
Get the system exception which would be contained in the any returned from receive_exception. This function is valid in the COMPLETE/SYSTEM_EXCEPTION state.

received_exception

public Any received_exception()
returns the forward reference
Following copied from interface: org.omg.PortableInterceptor.ClientRequestInfoOperations
Returns:
the attribute value

received_exception_id

public java.lang.String received_exception_id()
returns the exception id if an exception has been sent by the server
Following copied from interface: org.omg.PortableInterceptor.ClientRequestInfoOperations
Returns:
the attribute value