00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Adapter.h 00006 * 00007 * $Id: Adapter.h 76995 2007-02-11 12:51:42Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan (coryan@uci.edu) 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_ADAPTER_H 00014 #define TAO_ADAPTER_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CORBA_methods.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Pseudo_VarOut_T.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 namespace CORBA 00029 { 00030 typedef TAO_Pseudo_Var_T<Object> Object_var; 00031 typedef TAO_Pseudo_Out_T<Object> Object_out; 00032 } 00033 00034 namespace TAO 00035 { 00036 class ObjectKey; 00037 } 00038 00039 class TAO_ORB_Core; 00040 class TAO_Stub; 00041 class TAO_MProfile; 00042 class TAO_ServerRequest; 00043 00044 class TAO_Export TAO_Adapter 00045 { 00046 public: 00047 virtual ~TAO_Adapter (void); 00048 00049 /// Initialize the Adapter 00050 virtual void open (void) = 0; 00051 00052 /// The ORB is shutting down, destroy any resources attached to this 00053 /// adapter. 00054 virtual void close (int wait_for_completion 00055 ) = 0; 00056 00057 /// Check if the adapter can be closed in the current context, raise 00058 /// an exception if not. 00059 virtual void check_close (int wait_for_completion 00060 ) = 0; 00061 00062 /** 00063 * Return the priority assigned to this adapter. 00064 * Adapters at higher priority are used first, the first adapter 00065 * that matches a key is used to dispatch a request. 00066 */ 00067 virtual int priority (void) const = 0; 00068 00069 /// Return the status.... 00070 virtual int dispatch (TAO::ObjectKey &key, 00071 TAO_ServerRequest &request, 00072 CORBA::Object_out forward_to 00073 ) = 0; 00074 00075 enum { 00076 /// The operation was successfully dispatched, an exception may 00077 /// have been raised, but that is a correct execution too. 00078 DS_OK, 00079 00080 /// There was a problem in dispatching the operation. 00081 DS_FAILED, 00082 00083 /// The key is not in the right format for this Adapter, try the 00084 /// next one. 00085 DS_MISMATCHED_KEY, 00086 00087 /// Forward the request to another object reference, this decouples 00088 /// the ORB from the PortableServer::ForwardRequest exception 00089 DS_FORWARD 00090 }; 00091 00092 /// Return the name, i.e. the object id used to resolve it in the 00093 /// ORB. 00094 virtual const char *name (void) const = 0; 00095 00096 /** 00097 * Return the root of the Object Adapter. 00098 * Each adapter defines its own IDL interface accessed through the 00099 * method above. 00100 */ 00101 virtual CORBA::Object_ptr root (void) = 0; 00102 00103 /// Create a collocated object using the given profile and stub. 00104 virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *, 00105 const TAO_MProfile &) = 0; 00106 /// Initialize a collocated object using the given stub 00107 /// pointer for lazily evaluated object references. 00108 virtual CORBA::Long initialize_collocated_object (TAO_Stub *) = 0; 00109 }; 00110 00111 TAO_END_VERSIONED_NAMESPACE_DECL 00112 00113 #include /**/ "ace/post.h" 00114 00115 #endif /* TAO_ADAPTER_H */