gnu.CORBA

Class gnuRequest

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
LocalRequest

public class gnuRequest
extends Request
implements Cloneable

The implementation of the CORBA request.

Field Summary

static Version
MAX_SUPPORTED
The maximal supported GIOP version.
static int
PAUSE_INITIAL
The initial pause that the Request makes when the required port is not available.
static int
PAUSE_MAX
The maximal pausing interval between two repetetive attempts.
static int
PAUSE_STEPS
The number of repretetive attempts to get a required port, if it is not immediately available.
protected boolean
complete
The flag, indicating that the request has been sent and the result is already received.
protected gnuNVList
m_args
The request arguments.
protected Context
m_context
The context holder for methods ctx(Context) and ctx().
protected ContextList
m_context_list
The context list for method contexts().
protected Environment
m_environment
The request environment for holding the exception the has possibly been thrown by the method being invoked.
protected String
m_exception_id
The exception id, received from the server, null if none.
protected ExceptionList
m_exceptions
The list of all exceptions that can be thrown by the method being invoked.
IOR
m_forward_ior
This field temporary remembers the value of the forwarded ior reference.
Object
m_forwarding_target
Is set when object, and not IOR is directly available.
protected String
m_operation
The name of the method being invoked.
protected StreamBasedRequest
m_parameter_buffer
The request arguments in the case when they are directly written into the parameter buffer.
protected NamedValue
m_result
The result, returned by the invoked method (function).
protected ReplyHeader
m_rph
The reply header currently in use.
protected RequestHeader
m_rqh
The request header currently in use.
protected Any[]
m_slots
The array of slots.
protected SystemException
m_sys_ex
The thrown system exception.
protected Object
m_target
The invocation target.
protected boolean
oneWay
The flag, indicating that the response to this request must be ignored (used with send_oneway()).
protected boolean
running
The flag, indicating that the request has been sent and no result is yet received.

Method Summary

gnuRequest
Clone()
Creates a shallow copy of this request.
Any
add_in_arg()
Any
add_inout_arg()
Any
add_named_in_arg(String name)
Any
add_named_inout_arg(String name)
Any
add_named_out_arg(String name)
Any
add_out_arg()
void
add_request_service_context(ServiceContext service_context, boolean replace)
Add context to request.
NVList
arguments()
void
checkDii()
Check if the call is done via DII.
ContextList
contexts()
Context
ctx()
void
ctx(Context a_context)
TaggedProfile
effective_profile()
Get the Internet profile as an effective profile.
Object
effective_target()
Return either target or forwarded targed.
Environment
env()
ExceptionList
exceptions()
Object
forward_reference()
Return the forwarded reference, null if none.
IOR
getIor()
Get the IOR data, sufficient to find the invocation target.
StreamBasedRequest
getParameterStream()
Get the parameter stream, where the invocation arguments should be written if they are written into the stream directly.
TaggedComponent
get_effective_component(int id)
Get effective component with the give id from the Internet profile.
TaggedComponent[]
get_effective_components(int id)
Get all components with the given id from the internet profile.
ServiceContext
get_reply_service_context(int ctx_name)
Policy
get_request_policy(int type)
This should be not implemented up till jdk 1.5 inclusive.
ServiceContext
get_request_service_context(int ctx_name)
void
get_response()
Any
get_slot(int id)
Get the slot from the slot array inside this request.
String[]
ice_contexts()
Get contexts as required by interceptor.
void
invoke()
Submit the request, suspending the current thread until the answer is received.
String
operation()
String[]
operation_context()
ORB
orb()
Get the orb, related to the invocation target.
boolean
poll_response()
Any
received_exception()
String
received_exception_id()
short
reply_status()
Get the reply status.
int
request_id()
Get the request id.
boolean
response_expected()
Return true if the response is expected.
NamedValue
result()
Any
return_value()
void
send_deferred()
void
send_oneway()
Send a request and forget about it, not waiting for a response.
void
setBigEndian(boolean use_big_endian)
Set the encoding that will be used to send the message.
void
setIor(IOR an_ior)
Set the IOR data, sufficient to find the invocation target.
void
setORB(ORB an_orb)
Set the ORB, related to the invocation target.
void
setOperation(String operation)
The the method name to invoke.
void
set_args(NVList a_args)
Set the argument list.
void
set_context_list(ContextList a_context_list)
Set the context list that is later returned by the method contexts().
void
set_environment(Environment a_environment)
Set the exception container.
void
set_exceptions(ExceptionList a_exceptions)
Set the list of exceptions.
void
set_operation(String a_operation)
Set the operation name.
void
set_result(NamedValue a_result)
Set the named value, returned as result.
void
set_return_type(TypeCode returns)
Set the type of the named value, returned as a result.
void
set_target(Object a_target)
Set the invocation target.
gnu.CORBA.RawReply
submit()
Do the actual invocation.
short
sync_scope()
Determines how far the request shall progress before control is returned to the client.
Object
target()
Version
useVersion(Version desired)
Get the used version.
void
waitWhileBusy()
Wait while the response to request, submitted using send_deferred() or invoke() (from other thread) is returned.
protected void
write_parameter_buffer(MessageHeader header, BufferedCdrOutput request_part)
Write the operation parameters.
protected void
write_parameters(MessageHeader header, BufferedCdrOutput request_part)
Write the operation parameters.

Methods inherited from class org.omg.CORBA.Request

add_in_arg, add_inout_arg, add_named_in_arg, add_named_inout_arg, add_named_out_arg, add_out_arg, arguments, contexts, ctx, ctx, env, exceptions, get_response, invoke, operation, poll_response, result, return_value, send_deferred, send_oneway, set_return_type, target

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

MAX_SUPPORTED

public static Version MAX_SUPPORTED
The maximal supported GIOP version.

PAUSE_INITIAL

public static int PAUSE_INITIAL
The initial pause that the Request makes when the required port is not available.

PAUSE_MAX

public static int PAUSE_MAX
The maximal pausing interval between two repetetive attempts. The interval doubles after each unsuccessful attempt, but will not exceed this value.

PAUSE_STEPS

public static int PAUSE_STEPS
The number of repretetive attempts to get a required port, if it is not immediately available.

complete

protected boolean complete
The flag, indicating that the request has been sent and the result is already received.

m_args

protected gnuNVList m_args
The request arguments.

m_context

protected Context m_context
The context holder for methods ctx(Context) and ctx().

m_context_list

protected ContextList m_context_list
The context list for method contexts().

m_environment

protected Environment m_environment
The request environment for holding the exception the has possibly been thrown by the method being invoked.

m_exception_id

protected String m_exception_id
The exception id, received from the server, null if none.

m_exceptions

protected ExceptionList m_exceptions
The list of all exceptions that can be thrown by the method being invoked.

m_forward_ior

public IOR m_forward_ior
This field temporary remembers the value of the forwarded ior reference. If it is not null, the request was forwarded and the effective target is not the same as the default target.

m_forwarding_target

public Object m_forwarding_target
Is set when object, and not IOR is directly available.

m_operation

protected String m_operation
The name of the method being invoked.

m_parameter_buffer

protected StreamBasedRequest m_parameter_buffer
The request arguments in the case when they are directly written into the parameter buffer.

m_result

protected NamedValue m_result
The result, returned by the invoked method (function).

m_rph

protected ReplyHeader m_rph
The reply header currently in use.

m_rqh

protected RequestHeader m_rqh
The request header currently in use.

m_slots

protected Any[] m_slots
The array of slots.

m_sys_ex

protected SystemException m_sys_ex
The thrown system exception.

m_target

protected Object m_target
The invocation target.

oneWay

protected boolean oneWay
The flag, indicating that the response to this request must be ignored (used with send_oneway()).

running

protected boolean running
The flag, indicating that the request has been sent and no result is yet received.

Method Details

Clone

public gnuRequest Clone()
Creates a shallow copy of this request.

add_in_arg

public Any add_in_arg()
Overrides:
add_in_arg in interface Request

add_inout_arg

public Any add_inout_arg()
Overrides:
add_inout_arg in interface Request

add_named_in_arg

public Any add_named_in_arg(String name)
Overrides:
add_named_in_arg in interface Request

add_named_inout_arg

public Any add_named_inout_arg(String name)
Overrides:
add_named_inout_arg in interface Request

add_named_out_arg

public Any add_named_out_arg(String name)
Overrides:
add_named_out_arg in interface Request

add_out_arg

public Any add_out_arg()
Overrides:
add_out_arg in interface Request

add_request_service_context

public void add_request_service_context(ServiceContext service_context,
                                        boolean replace)
Add context to request.

arguments

public NVList arguments()
Overrides:
arguments in interface Request

checkDii

public void checkDii()
Check if the call is done via DII.

contexts

public ContextList contexts()
Overrides:
contexts in interface Request

ctx

public Context ctx()
Overrides:
ctx in interface Request

ctx

public void ctx(Context a_context)
Overrides:
ctx in interface Request

effective_profile

public TaggedProfile effective_profile()
Get the Internet profile as an effective profile.

effective_target

public Object effective_target()
Return either target or forwarded targed.

env

public Environment env()
Overrides:
env in interface Request

exceptions

public ExceptionList exceptions()
Overrides:
exceptions in interface Request

forward_reference

public Object forward_reference()
Return the forwarded reference, null if none.

getIor

public IOR getIor()
Get the IOR data, sufficient to find the invocation target.
Returns:
the IOR data.

getParameterStream

public StreamBasedRequest getParameterStream()
Get the parameter stream, where the invocation arguments should be written if they are written into the stream directly.

get_effective_component

public TaggedComponent get_effective_component(int id)
            throws BAD_PARAM
Get effective component with the give id from the Internet profile.

get_effective_components

public TaggedComponent[] get_effective_components(int id)
            throws BAD_PARAM
Get all components with the given id from the internet profile.

get_reply_service_context

public ServiceContext get_reply_service_context(int ctx_name)
            throws BAD_PARAM

get_request_policy

public Policy get_request_policy(int type)
            throws INV_POLICY
This should be not implemented up till jdk 1.5 inclusive.

get_request_service_context

public ServiceContext get_request_service_context(int ctx_name)
            throws BAD_PARAM

get_response

public void get_response()
            throws WrongTransaction
Overrides:
get_response in interface Request

get_slot

public Any get_slot(int id)
            throws InvalidSlot
Get the slot from the slot array inside this request.

ice_contexts

public String[] ice_contexts()
Get contexts as required by interceptor.

invoke

public void invoke()
            throws BAD_INV_ORDER
Submit the request, suspending the current thread until the answer is received. This implementation requires to set the IOR property (setIOR(IOR) before calling this method.
Overrides:
invoke in interface Request
Throws:
SystemException - if this exception has been thrown on remote side. The exact exception type and the minor code are the same as they have been for the exception, thrown on remoted side.

operation

public String operation()
Overrides:
operation in interface Request

operation_context

public String[] operation_context()

orb

public ORB orb()
Get the orb, related to the invocation target.

poll_response

public boolean poll_response()
Overrides:
poll_response in interface Request

received_exception

public Any received_exception()

received_exception_id

public String received_exception_id()

reply_status

public short reply_status()
Get the reply status.

request_id

public int request_id()
Get the request id.

response_expected

public boolean response_expected()
Return true if the response is expected.

result

public NamedValue result()
Overrides:
result in interface Request

return_value

public Any return_value()
Overrides:
return_value in interface Request

send_deferred

public void send_deferred()
Overrides:
send_deferred in interface Request

send_oneway

public void send_oneway()
Send a request and forget about it, not waiting for a response. This can be done also for methods that normally are expected to return some values. TODO It is generally recommended to reuse the threads. Reuse?
Overrides:
send_oneway in interface Request

setBigEndian

public void setBigEndian(boolean use_big_endian)
Set the encoding that will be used to send the message. The default encoding is inherited from the set IOR (that string reference can be encoded in either Big or Little endian). If the IOR encoding is not known (for example, by obtaining the reference from the naming service), the Big Endian is used.
Parameters:
use_big_endian - true to use the Big Endian, false to use the Little Endian encoding.

setIor

public void setIor(IOR an_ior)
Set the IOR data, sufficient to find the invocation target. This also sets default endian encoding for invocations.
See Also:
IOR.parse(String)

setORB

public void setORB(ORB an_orb)
Set the ORB, related to the invocation target.

setOperation

public void setOperation(String operation)
The the method name to invoke.
Parameters:
operation - the method name.

set_args

public void set_args(NVList a_args)
Set the argument list. This field is initialised as empty non null instance by default, so the method is only used in cases when the direct replacement is desired.
Parameters:
a_args - the argument list.

set_context_list

public void set_context_list(ContextList a_context_list)
Set the context list that is later returned by the method contexts().
Parameters:
a_context_list - a new context list.

set_environment

public void set_environment(Environment a_environment)
Set the exception container. This field is initialised as empty non null instance by default, so the method is only used in cases when the direct replacement is desired.
Parameters:
a_environment - the new exception container.

set_exceptions

public void set_exceptions(ExceptionList a_exceptions)
Set the list of exceptions. This field is initialised as empty non null instance by default, so the method is only used in cases when the direct replacement is desired.
Parameters:
a_exceptions - a list of exceptions.

set_operation

public void set_operation(String a_operation)
Set the operation name.
Parameters:
a_operation - the operation name.

set_result

public void set_result(NamedValue a_result)
Set the named value, returned as result. This field is initialised as empty non null instance by default, so the method is only used in cases when the direct replacement is desired.
Parameters:
a_result - the result keeper.

set_return_type

public void set_return_type(TypeCode returns)
Set the type of the named value, returned as a result. Instantiates a new instance of the result value.
Overrides:
set_return_type in interface Request

set_target

public void set_target(Object a_target)
Set the invocation target.
Parameters:
a_target - the CORBA object for that the method will be invoked.

submit

public gnu.CORBA.RawReply submit()
            throws ForwardRequest
Do the actual invocation. This implementation requires to set the IOR property (setIOR(IOR) before calling this method.
Returns:
the server response in binary form.

sync_scope

public short sync_scope()
Determines how far the request shall progress before control is returned to the client. However up till JDK 1.5 inclusive this method always returns SYNC_WITH_TRANSPORT.
Returns:
(1), always.

target

public Object target()
Overrides:
target in interface Request

useVersion

public Version useVersion(Version desired)
Get the used version. Normally, it is better to respond using the same version as it is specified in IOR, but not above the maximal supported version.

waitWhileBusy

public void waitWhileBusy()
Wait while the response to request, submitted using send_deferred() or invoke() (from other thread) is returned. FIXME It is possible to rewrite this using Object.wait() and Object.notify(), but be sure to prepare the test as well.

write_parameter_buffer

protected void write_parameter_buffer(MessageHeader header,
                                      BufferedCdrOutput request_part)
            throws MARSHAL
Write the operation parameters.
Parameters:
header - the message header
request_part - the stream to write parameters into
Throws:
MARSHAL - if the attempt to write the parameters has failde.

write_parameters

protected void write_parameters(MessageHeader header,
                                BufferedCdrOutput request_part)
            throws MARSHAL
Write the operation parameters.
Parameters:
header - the message header
request_part - the stream to write parameters into
Throws:
MARSHAL - if the attempt to write the parameters has failde.

gnuRequest.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.