org.openorb.adapter.boa
Class BOA

java.lang.Object
  |
  +--org.omg.CORBA.BOA
        |
        +--org.openorb.adapter.boa.BOA
All Implemented Interfaces:
ObjectAdapter

public class BOA
extends BOA
implements ObjectAdapter

This class provides the implementation of the Basic Object Adapter (BOA). The BOA has been deprected as of CORBA 2.2, when the Portable Object Adapter (POA) was introduced.

Version:
$Revision: 1.12 $ $Date: 2002/07/14 18:55:10 $
Author:
Chris Wood

Constructor Summary
BOA(ServerManager server_manager)
          Constructor.
 
Method Summary
 byte[] adapter_id(byte[] object_key)
          Return the adapter id.
 int cache_priority()
          Expected lifetime of the adapter.
 void cancel_dispatch(ServerRequest req, TargetInfo target)
          Cancel a dispatch.
 void connect(ObjectImpl obj)
          Connect an object to the BOA but don't activate it.
 void connect(ObjectImpl obj, boolean activate)
          Connect an object to the BOA and optionaly activate it.
 void connect(ObjectImpl obj, java.lang.String name)
          Connect and object and provide its key.
 void deactivate_impl()
          Stop the BOA.
 void deactivate_obj(ObjectImpl obj)
          Deactivate an object.
 void disconnect(ObjectImpl obj)
          Disconnect an object.
 void dispatch(ServerRequest req, TargetInfo target)
          Dispatch a request from a client.
 void etherealize(boolean cleanup_in_progress)
          Etherealize the adapter.
 ObjectAdapter find_adapter(byte[] object_key)
          If this adapter serves this object directly it should return itself, otherwise it should return an adapter that does.
 boolean forced_marshal(byte[] object_key)
          If this returns true then requests for the specified object id must be sent through the network.
 void forward(ObjectImpl objOld, ObjectImpl objNew)
          This operation is used to forward an object.
 Object get_component(byte[] object_key)
          get_componenent operation.
 DomainManager[] get_domain_managers(byte[] object_key)
          get_domain_manager operation.
 Object get_interface_def(byte[] object_key)
          get_interface_def operation.
 Policy[] get_server_policies(int[] ts)
          Returns a PolicyList containing the Polices set for the requested PolicyTypes.
 ServerManager.AdapterManager getAdapterManager()
          Queue manager for the adapter.
 void impl_is_ready()
          Run the BOA.
 boolean is_a(byte[] object_key, java.lang.String repository_id)
          is_a operation.
 boolean locate(byte[] object_key)
          Respond to a local locate request.
 void obj_is_ready(ObjectImpl obj)
          Activate an object.
 byte[] object_id(byte[] object_key)
          Return the object id.
 TargetInfo predispatch(ServerRequest req)
          Locate the servant object for a request.
 void servant_postinvoke(byte[] object_key, ServantObject srvObject)
          Close off a local operation.
 ServantObject servant_preinvoke(byte[] object_key, java.lang.String operation, java.lang.Class expectedType)
          Preinvoke a local operation.
 boolean single_threaded()
          Adapter is single threaded.
 
Methods inherited from class org.omg.CORBA.BOA
init
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BOA

public BOA(ServerManager server_manager)
Constructor. Creates new BOA.
Parameters:
server_manager - The server manager the BOA will be connected to.
Method Detail

connect

public void connect(ObjectImpl obj)
Connect an object to the BOA but don't activate it.
Overrides:
connect in class BOA
Parameters:
obj - The object to connect.

connect

public void connect(ObjectImpl obj,
                    boolean activate)
Connect an object to the BOA and optionaly activate it.
Parameters:
obj - The object to connect to this BOA instance.
activate - Whether the object should be activated or not.

connect

public void connect(ObjectImpl obj,
                    java.lang.String name)
Connect and object and provide its key.
Overrides:
connect in class BOA
Parameters:
obj - The object to connect to this BOA instance.
name - The name to register the object at the corbaloc service.

forward

public void forward(ObjectImpl objOld,
                    ObjectImpl objNew)
This operation is used to forward an object.
Overrides:
forward in class BOA
Parameters:
objOld - The old object.
objNew - The new object requests should be forwarded to.

disconnect

public void disconnect(ObjectImpl obj)
Disconnect an object.
Overrides:
disconnect in class BOA
Parameters:
obj - The object to disconnect from this BOA.

obj_is_ready

public void obj_is_ready(ObjectImpl obj)
Activate an object.
Overrides:
obj_is_ready in class BOA
Parameters:
obj - The object to activate.

deactivate_obj

public void deactivate_obj(ObjectImpl obj)
Deactivate an object.
Overrides:
deactivate_obj in class BOA
Parameters:
obj - The object to deactivate.

impl_is_ready

public void impl_is_ready()
Run the BOA. This operation will not return.
Overrides:
impl_is_ready in class BOA

deactivate_impl

public void deactivate_impl()
Stop the BOA.
Overrides:
deactivate_impl in class BOA

cache_priority

public int cache_priority()
Expected lifetime of the adapter. Higher numbers are more likley to be dropped from the lookup cache. If this returns 0 then the adapter should never be dropped. This value should be stable throughout the lifetime of the adapter. The highest byte will be used for determining the binding priority. Suggested values: = 0 Root adapters. Always keep. < 0x1000000 Adpaters created directly. < 0x2000000 Adapters created dynamicaly. < 0x3000000 Objects created directly. < 0x4000000 Objects created dynamicaly. < 0 Never cache adapter, single invocation only. These should not be returned from find_adapter.
Specified by:
cache_priority in interface ObjectAdapter
Returns:
Always returns 0 (???).

single_threaded

public boolean single_threaded()
Adapter is single threaded. Calls to all single threaded Adapters are serialized.
Specified by:
single_threaded in interface ObjectAdapter
Returns:
Always returns false (???).

etherealize

public void etherealize(boolean cleanup_in_progress)
Etherealize the adapter. When this function returns the adapter's memory resident state should have been minimized. This function will always be called before purging the adapter from the cache. If cleanup_in_progress is true the adapter is being perminently deactivated and will no longer have to dispatch operations.
Specified by:
etherealize in interface ObjectAdapter
Parameters:
cleanup_in_progress - ???

getAdapterManager

public ServerManager.AdapterManager getAdapterManager()
Queue manager for the adapter. This may return null for an adapter which is always active. To create an adapter manager for an adapter use the create_manager operation on the ServerManager.
Specified by:
getAdapterManager in interface ObjectAdapter

find_adapter

public ObjectAdapter find_adapter(byte[] object_key)
                           throws AdapterDestroyedException
If this adapter serves this object directly it should return itself, otherwise it should return an adapter that does. If an adapter for an object with the given object id cannot be found this returns null. The returned adapter may be cached for future use.
Specified by:
find_adapter in interface ObjectAdapter

adapter_id

public byte[] adapter_id(byte[] object_key)
Return the adapter id. This should be a prefix of the object_key, should be stable and will be treated as read-only. If an object with the given object_key is not served by this adapter this returns null.
Specified by:
adapter_id in interface ObjectAdapter

object_id

public byte[] object_id(byte[] object_key)
Return the object id. This should should be a suffix of the object_key if the object id is cacheable, it should be stable with respect to a given object_key and will be treated as read-only. If an object with the given object_key is not served by this adapter this returns null.
Specified by:
object_id in interface ObjectAdapter

get_server_policies

public Policy[] get_server_policies(int[] ts)
Returns a PolicyList containing the Polices set for the requested PolicyTypes. If the specified sequence is empty, all Policy overrides will be returned. If none of the requested PolicyTypes are overridden an empty sequence is returned.
Specified by:
get_server_policies in interface ObjectAdapter

forced_marshal

public boolean forced_marshal(byte[] object_key)
                       throws AdapterDestroyedException
If this returns true then requests for the specified object id must be sent through the network. This will be true for example when using the DSI. This should return true if the object_key is unknown to the adapter. The result should be stable with respect to a given object ID.
Specified by:
forced_marshal in interface ObjectAdapter

servant_preinvoke

public ServantObject servant_preinvoke(byte[] object_key,
                                       java.lang.String operation,
                                       java.lang.Class expectedType)
                                throws ForwardRequest,
                                       AdapterDestroyedException
Preinvoke a local operation. Always paired with a call to servant_postinvoke. If the given object_key was not created by this adapter an OBJ_ADAPTER exception is thrown, if the object does not exist this returns null.
Specified by:
servant_preinvoke in interface ObjectAdapter

servant_postinvoke

public void servant_postinvoke(byte[] object_key,
                               ServantObject srvObject)
Close off a local operation. Always paired with a call to servant_preinvoke
Specified by:
servant_postinvoke in interface ObjectAdapter

locate

public boolean locate(byte[] object_key)
               throws ForwardRequest,
                      AdapterDestroyedException
Respond to a local locate request. This returns true if the object is located locally, false if the object is unknown and throws a forward request for a location forward. This should not throw a system exception.
Specified by:
locate in interface ObjectAdapter

is_a

public boolean is_a(byte[] object_key,
                    java.lang.String repository_id)
             throws ForwardRequest,
                    AdapterDestroyedException
is_a operation. If the given object_key was not created by this adapter an OBJ_ADAPTER exception is thrown, if the object does not exist OBJECT_NOT_EXIST is thrown.
Specified by:
is_a in interface ObjectAdapter

get_interface_def

public Object get_interface_def(byte[] object_key)
                         throws ForwardRequest,
                                AdapterDestroyedException
get_interface_def operation. If the given object_key was not created by this adapter an OBJ_ADAPTER exception is thrown, if the object does not exist OBJECT_NOT_EXIST is thrown.
Specified by:
get_interface_def in interface ObjectAdapter

get_domain_managers

public DomainManager[] get_domain_managers(byte[] object_key)
                                    throws ForwardRequest,
                                           AdapterDestroyedException
get_domain_manager operation. If the given object_key was not created by this adapter an OBJ_ADAPTER exception is thrown, if the object does not exist OBJECT_NOT_EXIST is thrown.
Specified by:
get_domain_managers in interface ObjectAdapter

get_component

public Object get_component(byte[] object_key)
                     throws ForwardRequest,
                            AdapterDestroyedException
get_componenent operation. If the given object_key was not created by this adapter an OBJ_ADAPTER exception is thrown, if the object does not exist OBJECT_NOT_EXIST is thrown.
Specified by:
get_component in interface ObjectAdapter

predispatch

public TargetInfo predispatch(ServerRequest req)
                       throws ForwardRequest,
                              AdapterDestroyedException
Locate the servant object for a request. The returned object is handed to the dispatch operation. This may throw a system exception or respond with a forward request if one is indicated, in which case the dispatch operation will not be called.
Specified by:
predispatch in interface ObjectAdapter
Parameters:
ids - out parameter holding repository ids of all available interfaces with the most derived interface appearing first.
Returns:
the 'target' of the operation. This is simply passed to the dispatch operation and is not interpreted in any way.

dispatch

public void dispatch(ServerRequest req,
                     TargetInfo target)
Dispatch a request from a client. This may throw a system exception at any time or call the ResponseHandler interface on the request to create a standard reply. If this returns without calling a response handler an empty reply is constructed, this is the usual situation for a locate request.
Specified by:
dispatch in interface ObjectAdapter

cancel_dispatch

public void cancel_dispatch(ServerRequest req,
                            TargetInfo target)
Cancel a dispatch. This may follow a predispatch or dispatch call to indicate that the client no longer expects any reply from the request and the server can stop expending effort towards completing it.
Specified by:
cancel_dispatch in interface ObjectAdapter