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