org.openorb.orb.core
Class Delegate

java.lang.Object
  extended by org.omg.CORBA.portable.Delegate
      extended by org.omg.CORBA_2_3.portable.Delegate
          extended by org.openorb.orb.core.Delegate

public class Delegate
extends org.omg.CORBA_2_3.portable.Delegate

This class constitutes the top layer in the object request sequence. It manages selecting between alternative paths for invoking requests and manages the invocation sequence, in concert with the server stubs.

Author:
Chris Wood, Richard G Clark

Constructor Summary
protected Delegate(org.omg.CORBA.ORB orb)
          This constructor can be used from a derived class if it is clear in the local optimized case that the object will not be exported.
  Delegate(org.omg.CORBA.ORB orb, org.omg.IOP.IOR ior)
          Construct new delegate from orb and IOR.
protected Delegate(org.omg.CORBA.ORB orb, org.omg.IOP.IOR ior, org.omg.CORBA.PolicyManagerOperations policyOverides)
          Construct new delegate from orb and IOR.
 
Method Summary
protected  org.omg.IOP.IOR _getIOR()
          Return the IOR of the object.
protected  org.omg.CORBA.ORB _getORB()
          Return the ORB with which this object is associated.
protected  org.omg.CORBA.PolicyManagerOperations _getPolicyManagerOperations()
          Return the interface for the PolicyManager object.
 org.omg.CORBA.Request create_request(org.omg.CORBA.Object self, org.omg.CORBA.Context ctx, java.lang.String operation, org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result)
          Create a dynamic request
 org.omg.CORBA.Request create_request(org.omg.CORBA.Object self, org.omg.CORBA.Context ctx, java.lang.String operation, org.omg.CORBA.NVList arg_list, org.omg.CORBA.NamedValue result, org.omg.CORBA.ExceptionList excepts, org.omg.CORBA.ContextList contexts)
          Create a dynamic request
 org.omg.CORBA.Object duplicate(org.omg.CORBA.Object self)
          Dulicate a reference.
 boolean equals(org.omg.CORBA.Object self, java.lang.Object obj)
          Use is_equivalent definition of equals so objects can be stored in hash tables.
 org.omg.CORBA.Policy get_client_policy(org.omg.CORBA.Object self, int policy_type)
          Return the effective client side policy.
 java.lang.String get_codebase(org.omg.CORBA.Object self)
          Return codebase for stub class.
 org.omg.CORBA.Object get_component(org.omg.CORBA.Object self)
          Return the object's component.
 org.omg.CORBA.DomainManager[] get_domain_managers(org.omg.CORBA.Object self)
          Find the domain manager list associated to this object.
 org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object self)
          Return the object interface definition.
 org.omg.CORBA.InterfaceDef get_interface(org.omg.CORBA.Object self)
          Deprecated. Deprecated by CORBA 2.3
 org.omg.CORBA.Policy[] get_policy_overrides(int[] ts)
          Returns the list of Policy overrides (of the specified policy types) set at the Object scope.
 org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self, int policy_type)
          Return the policy associated to the policy type passed as parameter.
 Address[] getAddresses(org.omg.CORBA.Object self)
          Get a snapshot list of the target addresses.
 boolean getPolicyCacheEnabled()
          Return the value for the flag whether the policy cache is enabled or not.
 int hash(org.omg.CORBA.Object self, int max)
          Return an hashcode for an object (with a max value) Note that this hash code will not change even if the object is redirected.
 int hashCode(org.omg.CORBA.Object self)
          Use the IOR hash code so that objects can be used in hash tables.
 void invoke_deferred(org.omg.CORBA.Object self, org.omg.CORBA.portable.OutputStream os)
          Invoke the request as a deferred request.
 org.omg.CORBA.portable.InputStream invoke(org.omg.CORBA.Object self, org.omg.CORBA.portable.OutputStream os)
          Invoke a remote operation for stream based stub
 org.omg.IOP.IOR ior()
          Get the ior of the object as it should be serialized / marshalled.
 boolean is_a(org.omg.CORBA.Object self, java.lang.String id)
          This operation is used to test if an object implements an interface.
 boolean is_equivalent(org.omg.CORBA.Object obj1, org.omg.CORBA.Object obj2)
          Check if two object refereces are equivalent.
 boolean is_local(org.omg.CORBA.Object self)
          Return true if this object is local.
 boolean non_existent(org.omg.CORBA.Object self)
          Check if an object exists
 org.omg.CORBA.ORB orb(org.omg.CORBA.Object self)
          Return a reference to the ORB
 boolean poll_response(org.omg.CORBA.Object self, org.omg.CORBA.portable.OutputStream os)
          Poll for a response for a defered request.
 void release(org.omg.CORBA.Object self)
          Remove a reference.
 void releaseReply(org.omg.CORBA.Object self, org.omg.CORBA.portable.InputStream is)
          This function is always called at the end of an invocation sequence regardless of the outcome.
 org.omg.CORBA.Request request(org.omg.CORBA.Object self, java.lang.String operation)
          Create a dynamic request
 org.omg.CORBA.portable.OutputStream request(org.omg.CORBA.Object self, java.lang.String operation, boolean responseExpected)
          Create a request based on stream stub
 void servant_postinvoke(org.omg.CORBA.Object self, org.omg.CORBA.portable.ServantObject servant)
          This function is used after a local invocation
 org.omg.CORBA.portable.ServantObject servant_preinvoke(org.omg.CORBA.Object self, java.lang.String operation, java.lang.Class expectedType)
          This function is used for local invocation
 org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self, org.omg.CORBA.Policy[] policies, org.omg.CORBA.SetOverrideType set_add)
          Return a copy of this object with the specified policies overriden.
 org.omg.CORBA.Object set_policy_overrides(org.omg.CORBA.Object self, org.omg.CORBA.Policy[] policies, org.omg.CORBA.SetOverrideType set_add)
          Return a copy of this object with the specified policies overriden.
 void setPolicyCacheEnabled(boolean policy_cache_enabled)
          Set the value for the flag whether the policy cache is enabled or not.
 java.lang.String toString(org.omg.CORBA.Object self)
          Pass to string this object
 boolean validate_connection(org.omg.CORBA.Object self, org.omg.CORBA.PolicyListHolder inconsistent_policies)
          Validate the connection to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Delegate

public Delegate(org.omg.CORBA.ORB orb,
                org.omg.IOP.IOR ior)
Construct new delegate from orb and IOR.

Parameters:
orb - the client orb.
ior - the target IOR.

Delegate

protected Delegate(org.omg.CORBA.ORB orb)
This constructor can be used from a derived class if it is clear in the local optimized case that the object will not be exported. In this particular case most of the initialization can be avoided.


Delegate

protected Delegate(org.omg.CORBA.ORB orb,
                   org.omg.IOP.IOR ior,
                   org.omg.CORBA.PolicyManagerOperations policyOverides)
Construct new delegate from orb and IOR.

Parameters:
orb - the client orb.
ior - the target IOR.
policyOverides - the policy overides for this delegate
Method Detail

_getORB

protected org.omg.CORBA.ORB _getORB()
Return the ORB with which this object is associated.

Returns:
The ORB of the object.

_getIOR

protected org.omg.IOP.IOR _getIOR()
Return the IOR of the object.

Returns:
The IOR of the object.

getPolicyCacheEnabled

public boolean getPolicyCacheEnabled()
Return the value for the flag whether the policy cache is enabled or not.

Returns:
The value of the flag.

_getPolicyManagerOperations

protected org.omg.CORBA.PolicyManagerOperations _getPolicyManagerOperations()
Return the interface for the PolicyManager object.

Returns:
The PolicyManager interface.

setPolicyCacheEnabled

public void setPolicyCacheEnabled(boolean policy_cache_enabled)
Set the value for the flag whether the policy cache is enabled or not.

Parameters:
policy_cache_enabled - The new value for the flag.

get_interface

public org.omg.CORBA.InterfaceDef get_interface(org.omg.CORBA.Object self)
Deprecated. Deprecated by CORBA 2.3

Return the object interface definition.

Specified by:
get_interface in class org.omg.CORBA.portable.Delegate

get_interface_def

public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object self)
Return the object interface definition.

Overrides:
get_interface_def in class org.omg.CORBA.portable.Delegate

get_component

public org.omg.CORBA.Object get_component(org.omg.CORBA.Object self)
Return the object's component. This is currently unused.


is_a

public boolean is_a(org.omg.CORBA.Object self,
                    java.lang.String id)
This operation is used to test if an object implements an interface. This may result in invoking a remote operation.

Specified by:
is_a in class org.omg.CORBA.portable.Delegate

get_domain_managers

public org.omg.CORBA.DomainManager[] get_domain_managers(org.omg.CORBA.Object self)
Find the domain manager list associated to this object.

Overrides:
get_domain_managers in class org.omg.CORBA.portable.Delegate
Returns:
the list of domain managers.

non_existent

public boolean non_existent(org.omg.CORBA.Object self)
Check if an object exists

Specified by:
non_existent in class org.omg.CORBA.portable.Delegate

duplicate

public org.omg.CORBA.Object duplicate(org.omg.CORBA.Object self)
Dulicate a reference. This simply returns the same delegate.

Specified by:
duplicate in class org.omg.CORBA.portable.Delegate

release

public void release(org.omg.CORBA.Object self)
Remove a reference. This is an empty operation.

Specified by:
release in class org.omg.CORBA.portable.Delegate

is_equivalent

public boolean is_equivalent(org.omg.CORBA.Object obj1,
                             org.omg.CORBA.Object obj2)
Check if two object refereces are equivalent. Two references are considered equivalent if their IORs are identical.

Specified by:
is_equivalent in class org.omg.CORBA.portable.Delegate

equals

public boolean equals(org.omg.CORBA.Object self,
                      java.lang.Object obj)
Use is_equivalent definition of equals so objects can be stored in hash tables.

Overrides:
equals in class org.omg.CORBA.portable.Delegate

hash

public int hash(org.omg.CORBA.Object self,
                int max)
Return an hashcode for an object (with a max value) Note that this hash code will not change even if the object is redirected.

Specified by:
hash in class org.omg.CORBA.portable.Delegate

hashCode

public int hashCode(org.omg.CORBA.Object self)
Use the IOR hash code so that objects can be used in hash tables.

Overrides:
hashCode in class org.omg.CORBA.portable.Delegate

create_request

public org.omg.CORBA.Request create_request(org.omg.CORBA.Object self,
                                            org.omg.CORBA.Context ctx,
                                            java.lang.String operation,
                                            org.omg.CORBA.NVList arg_list,
                                            org.omg.CORBA.NamedValue result)
Create a dynamic request

Specified by:
create_request in class org.omg.CORBA.portable.Delegate

create_request

public org.omg.CORBA.Request create_request(org.omg.CORBA.Object self,
                                            org.omg.CORBA.Context ctx,
                                            java.lang.String operation,
                                            org.omg.CORBA.NVList arg_list,
                                            org.omg.CORBA.NamedValue result,
                                            org.omg.CORBA.ExceptionList excepts,
                                            org.omg.CORBA.ContextList contexts)
Create a dynamic request

Specified by:
create_request in class org.omg.CORBA.portable.Delegate

request

public org.omg.CORBA.Request request(org.omg.CORBA.Object self,
                                     java.lang.String operation)
Create a dynamic request

Specified by:
request in class org.omg.CORBA.portable.Delegate

is_local

public boolean is_local(org.omg.CORBA.Object self)
Return true if this object is local. This fuction also sets up a request sequence.

Overrides:
is_local in class org.omg.CORBA.portable.Delegate

request

public org.omg.CORBA.portable.OutputStream request(org.omg.CORBA.Object self,
                                                   java.lang.String operation,
                                                   boolean responseExpected)
Create a request based on stream stub

Overrides:
request in class org.omg.CORBA.portable.Delegate
Parameters:
self - the object to apply this operation
operation - the operation name
responseExpected - True if a response is expected
Returns:
an Outputstream to marshal data

invoke_deferred

public void invoke_deferred(org.omg.CORBA.Object self,
                            org.omg.CORBA.portable.OutputStream os)
Invoke the request as a deferred request.

Parameters:
self - the object to apply this operation
os - the output stream returned from the request operation.

poll_response

public boolean poll_response(org.omg.CORBA.Object self,
                             org.omg.CORBA.portable.OutputStream os)
Poll for a response for a defered request. Note that this operation can be called from a different thread to the original request, providing that the invocation state is migrated.

Parameters:
self - the object to apply this operation
os - the output stream returned from the request operation.
Returns:
true if the invoke operation would return immediatly without waiting.

invoke

public org.omg.CORBA.portable.InputStream invoke(org.omg.CORBA.Object self,
                                                 org.omg.CORBA.portable.OutputStream os)
                                          throws org.omg.CORBA.portable.ApplicationException,
                                                 org.omg.CORBA.portable.RemarshalException
Invoke a remote operation for stream based stub

Overrides:
invoke in class org.omg.CORBA.portable.Delegate
Parameters:
self - the object to apply this operation
os - the output stream returned from the request operation.
Returns:
the marshalled data return from remote object
Throws:
org.omg.CORBA.portable.ApplicationException
org.omg.CORBA.portable.RemarshalException

releaseReply

public void releaseReply(org.omg.CORBA.Object self,
                         org.omg.CORBA.portable.InputStream is)
This function is always called at the end of an invocation sequence regardless of the outcome.

Overrides:
releaseReply in class org.omg.CORBA.portable.Delegate
Parameters:
self - the object to apply this operation
is - the input stream for marshalled data from remote object

servant_preinvoke

public org.omg.CORBA.portable.ServantObject servant_preinvoke(org.omg.CORBA.Object self,
                                                              java.lang.String operation,
                                                              java.lang.Class expectedType)
This function is used for local invocation

Overrides:
servant_preinvoke in class org.omg.CORBA.portable.Delegate

servant_postinvoke

public void servant_postinvoke(org.omg.CORBA.Object self,
                               org.omg.CORBA.portable.ServantObject servant)
This function is used after a local invocation

Overrides:
servant_postinvoke in class org.omg.CORBA.portable.Delegate

get_policy

public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self,
                                       int policy_type)
Return the policy associated to the policy type passed as parameter. This will get

Overrides:
get_policy in class org.omg.CORBA.portable.Delegate
Parameters:
policy_type - the policy type to search and to return
Returns:
the policy associated to the policy type

get_client_policy

public org.omg.CORBA.Policy get_client_policy(org.omg.CORBA.Object self,
                                              int policy_type)
Return the effective client side policy.

Parameters:
policy_type - the policy type to search and to return
Returns:
the policy associated to the policy type

set_policy_override

public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
                                                org.omg.CORBA.Policy[] policies,
                                                org.omg.CORBA.SetOverrideType set_add)
Return a copy of this object with the specified policies overriden.

Overrides:
set_policy_override in class org.omg.CORBA.portable.Delegate
Throws:
org.omg.CORBA.NO_PERMISSION - some of the overriden policies are invalid.

set_policy_overrides

public org.omg.CORBA.Object set_policy_overrides(org.omg.CORBA.Object self,
                                                 org.omg.CORBA.Policy[] policies,
                                                 org.omg.CORBA.SetOverrideType set_add)
                                          throws org.omg.CORBA.InvalidPolicies
Return a copy of this object with the specified policies overriden.

Throws:
org.omg.CORBA.InvalidPolicies - some of the overriden policies are invalid.

get_policy_overrides

public org.omg.CORBA.Policy[] get_policy_overrides(int[] ts)
Returns the list of Policy overrides (of the specified policy types) set at the Object scope. If the specified sequence is empty, all Policy overrides at this scope will be returned. If none of the requested PolicyTypes are overridden at the Object scope, an empty sequence is returned.


validate_connection

public boolean validate_connection(org.omg.CORBA.Object self,
                                   org.omg.CORBA.PolicyListHolder inconsistent_policies)
Validate the connection to the client. This operation ignores the rebind policy.


orb

public org.omg.CORBA.ORB orb(org.omg.CORBA.Object self)
Return a reference to the ORB

Overrides:
orb in class org.omg.CORBA.portable.Delegate

get_codebase

public java.lang.String get_codebase(org.omg.CORBA.Object self)
Return codebase for stub class.

Overrides:
get_codebase in class org.omg.CORBA_2_3.portable.Delegate

ior

public org.omg.IOP.IOR ior()
Get the ior of the object as it should be serialized / marshalled. This will change on a permanent redirection.


getAddresses

public Address[] getAddresses(org.omg.CORBA.Object self)
Get a snapshot list of the target addresses. This is subject to grow when an object forward is received.


toString

public java.lang.String toString(org.omg.CORBA.Object self)
Pass to string this object

Overrides:
toString in class org.omg.CORBA.portable.Delegate