# OpenORB 1.3.1: Class Delegate

## org.openorb.CORBA
Class Delegate

    java.lang.Object
      |
      +--org.omg.CORBA.portable.Delegate
            |
            +--org.omg.CORBA_2_3.portable.Delegate
                  |
                  +--org.openorb.CORBA.Delegate

public class Delegate
extends 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
`Delegate(ORB orb, IOR ior)` Construct new delegate from orb and IOR.

Method Summary
`IOR` `_getIOR()`
`ORB` `_getORB()`
`PolicyManagerOperations` `_getPolicyManagerOperations()`
`Request` `create_request(Object self, Context ctx, java.lang.String operation, NVList arg_list, NamedValue result)` Create a dynamic request
`Request` `create_request(Object self, Context ctx, java.lang.String operation, NVList arg_list, NamedValue result, ExceptionList excepts, ContextList contexts)` Create a dynamic request
`Object` `duplicate(Object self)` Dulicate a reference.
`boolean` `equals(Object self, java.lang.Object obj)` Use is_equivalent definition of equals so objects can be stored in hash tables.
`Policy` `get_client_policy(Object self, int policy_type)` Return the effective client side policy.
`java.lang.String` `get_codebase(Object self)` Return codebase for stub class.
`Object` `get_component(Object self)` Return the object's component.
`DomainManager[]` `get_domain_managers(Object self)` Find the domain manager list associated to this object.
`Object` `get_interface_def(Object self)` Return the object interface definition.
`InterfaceDef` `get_interface(Object self)` Deprecated. Deprecated by CORBA 2.3
`Policy[]` `get_policy_overrides(int[] ts)` Returns the list of Policy overrides (of the specified policy types) set at the Object scope.
`Policy` `get_policy(Object self, int policy_type)` Return the policy associated to the policy type passed as parameter.
`Address[]` `getAddresses(Object self)` Get a snapshot list of the target addresses.
`int` `hash(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(Object self)` Use the IOR hash code so that objects can be used in hash tables.
`void` `invoke_deferred(Object self, OutputStream os)` Invoke the request as a deferred request.
`InputStream` `invoke(Object self, OutputStream os)` Invoke a remote operation for stream based stub
`IOR` `ior()` Get the ior of the object as it should be serialized / marshalled.
`boolean` `is_a(Object self, java.lang.String id)` This operation is used to test if an object implements an interface.
`boolean` `is_equivalent(Object obj1, Object obj2)` Check if two object refereces are equivalent.
`boolean` `is_local(Object self)` Return true if this object is local.
`boolean` `non_existent(Object self)` Check if an object exists
`ORB` `orb(Object self)` Return a reference to the ORB
`boolean` `poll_response(Object self, OutputStream os)` Poll for a response for a defered request.
`void` `release(Object self)` Remove a reference.
`void` `releaseReply(Object self, InputStream is)` This function is always called at the end of an invocation sequence regardless of the outcome.
`Request` `request(Object self, java.lang.String operation)` Create a dynamic request
`OutputStream` `request(Object self, java.lang.String operation, boolean responseExpected)` Create a request based on stream stub
`void` `servant_postinvoke(Object self, ServantObject servant)` This function is used after a local invocation
`ServantObject` `servant_preinvoke(Object self, java.lang.String operation, java.lang.Class expectedType)` This function is used for local invocation
`Object` `set_policy_override(Object self, Policy[] policies, SetOverrideType set_add)` Return a copy of this object with the specified policies overriden.
`Object` `set_policy_overrides(Object self, Policy[] policies, SetOverrideType set_add)` Return a copy of this object with the specified policies overriden.
`java.lang.String` `toString(Object self)` Pass to string this object
`boolean` `validate_connection(Object self, PolicyListHolder inconsistent_policies)` Validate the connection to the client.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Delegate

    public Delegate(ORB orb,
                    IOR ior)

  Construct new delegate from orb and IOR.
  Parameters:
    `orb` - the client orb.
    `ior` - the target IOR.

Method Detail

### _getORB

    public final ORB _getORB()

### _getIOR

    public final IOR _getIOR()

### _getPolicyManagerOperations

    public final PolicyManagerOperations _getPolicyManagerOperations()

### get_interface

    public InterfaceDef get_interface(Object self)

  Deprecated. Deprecated by CORBA 2.3

  Return the object interface definition.
  Overrides:
    `get_interface` in class `Delegate`

### get_interface_def

    public Object get_interface_def(Object self)

  Return the object interface definition.
  Overrides:
    `get_interface_def` in class `Delegate`

### get_component

    public Object get_component(Object self)

  Return the object's component. This is currently unused.

### is_a

    public boolean is_a(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.
  Overrides:
    `is_a` in class `Delegate`

### get_domain_managers

    public DomainManager[] get_domain_managers(Object self)

  Find the domain manager list associated to this object.
  Overrides:
    `get_domain_managers` in class `Delegate`
  Returns:
    the list of domain managers.

### non_existent

    public boolean non_existent(Object self)

  Check if an object exists
  Overrides:
    `non_existent` in class `Delegate`

### duplicate

    public Object duplicate(Object self)

  Dulicate a reference. This simply returns the same delegate.
  Overrides:
    `duplicate` in class `Delegate`

### release

    public void release(Object self)

  Remove a reference. This is an empty operation.
  Overrides:
    `release` in class `Delegate`

### is_equivalent

    public boolean is_equivalent(Object obj1,
                                 Object obj2)

  Check if two object refereces are equivalent. Two references are considered equivalent if their IORs are identical.
  Overrides:
    `is_equivalent` in class `Delegate`

### equals

    public boolean equals(Object self,
                          java.lang.Object obj)

  Use is_equivalent definition of equals so objects can be stored in hash tables.
  Overrides:
    `equals` in class `Delegate`

### hash

    public int hash(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.
  Overrides:
    `hash` in class `Delegate`

### hashCode

    public int hashCode(Object self)

  Use the IOR hash code so that objects can be used in hash tables.
  Overrides:
    `hashCode` in class `Delegate`

### create_request

    public Request create_request(Object self,
                                  Context ctx,
                                  java.lang.String operation,
                                  NVList arg_list,
                                  NamedValue result)

  Create a dynamic request
  Overrides:
    `create_request` in class `Delegate`

### create_request

    public Request create_request(Object self,
                                  Context ctx,
                                  java.lang.String operation,
                                  NVList arg_list,
                                  NamedValue result,
                                  ExceptionList excepts,
                                  ContextList contexts)

  Create a dynamic request
  Overrides:
    `create_request` in class `Delegate`

### request

    public Request request(Object self,
                           java.lang.String operation)

  Create a dynamic request
  Overrides:
    `request` in class `Delegate`

### is_local

    public boolean is_local(Object self)

  Return true if this object is local. This fuction also sets up a request sequence.
  Overrides:
    `is_local` in class `Delegate`

### request

    public OutputStream request(Object self,
                                java.lang.String operation,
                                boolean responseExpected)

  Create a request based on stream stub
  Overrides:
    `request` in class `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(Object self,
                                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(Object self,
                                 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 InputStream invoke(Object self,
                              OutputStream os)
                       throws ApplicationException,
                              RemarshalException

  Invoke a remote operation for stream based stub
  Overrides:
    `invoke` in class `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

### releaseReply

    public void releaseReply(Object self,
                             InputStream is)

  This function is always called at the end of an invocation sequence regardless of the outcome.
  Overrides:
    `releaseReply` in class `Delegate`
  Parameters:
    `self` - the object to apply this operation
    `is` - the input stream for marshalled data from remote object

### servant_preinvoke

    public ServantObject servant_preinvoke(Object self,
                                           java.lang.String operation,
                                           java.lang.Class expectedType)

  This function is used for local invocation
  Overrides:
    `servant_preinvoke` in class `Delegate`

### servant_postinvoke

    public void servant_postinvoke(Object self,
                                   ServantObject servant)

  This function is used after a local invocation
  Overrides:
    `servant_postinvoke` in class `Delegate`

### get_policy

    public Policy get_policy(Object self,
                             int policy_type)

  Return the policy associated to the policy type passed as parameter. This will get
  Overrides:
    `get_policy` in class `Delegate`
  Parameters:
    `policy_type` - the policy type to search and to return
  Returns:
    the policy associated to the policy type

### get_client_policy

    public Policy get_client_policy(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 Object set_policy_override(Object self,
                                      Policy[] policies,
                                      SetOverrideType set_add)

  Return a copy of this object with the specified policies overriden.
  Overrides:
    `set_policy_override` in class `Delegate`
  Throws:
    `NO_PERMISSION` - some of the overriden policies are invalid.

### set_policy_overrides

    public Object set_policy_overrides(Object self,
                                       Policy[] policies,
                                       SetOverrideType set_add)
                                throws InvalidPolicies

  Return a copy of this object with the specified policies overriden.
  Throws:
    `InvalidPolicies` - some of the overriden policies are invalid.

### get_policy_overrides

    public 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(Object self,
                                       PolicyListHolder inconsistent_policies)

  Validate the connection to the client. This operation ignores the rebind policy.

### orb

    public ORB orb(Object self)

  Return a reference to the ORB
  Overrides:
    `orb` in class `Delegate`

### get_codebase

    public java.lang.String get_codebase(Object self)

  Return codebase for stub class.
  Overrides:
    `get_codebase` in class `Delegate`

### ior

    public 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(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(Object self)

  Pass to string this object
  Overrides:
    `toString` in class `Delegate`