00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Adapter.h 00006 * 00007 * $Id: Adapter.h 84215 2009-01-22 18:31:17Z 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) = 0; 00055 00056 /// Check if the adapter can be closed in the current context, raise 00057 /// an exception if not. 00058 virtual void check_close (int wait_for_completion) = 0; 00059 00060 /** 00061 * Return the priority assigned to this adapter. 00062 * Adapters at higher priority are used first, the first adapter 00063 * that matches a key is used to dispatch a request. 00064 */ 00065 virtual int priority (void) const = 0; 00066 00067 /// Return the status.... 00068 virtual int dispatch (TAO::ObjectKey &key, 00069 TAO_ServerRequest &request, 00070 CORBA::Object_out forward_to) = 0; 00071 00072 enum { 00073 /// The operation was successfully dispatched, an exception may 00074 /// have been raised, but that is a correct execution too. 00075 DS_OK, 00076 00077 /// There was a problem in dispatching the operation. 00078 DS_FAILED, 00079 00080 /// The key is not in the right format for this Adapter, try the 00081 /// next one. 00082 DS_MISMATCHED_KEY, 00083 00084 /// Forward the request to another object reference, this decouples 00085 /// the ORB from the PortableServer::ForwardRequest exception 00086 DS_FORWARD 00087 }; 00088 00089 /// Return the name, i.e. the object id used to resolve it in the 00090 /// ORB. 00091 virtual const char *name (void) const = 0; 00092 00093 /** 00094 * Return the root of the Object Adapter. 00095 * Each adapter defines its own IDL interface accessed through the 00096 * method above. 00097 */ 00098 virtual CORBA::Object_ptr root (void) = 0; 00099 00100 /// Create a collocated object using the given profile and stub. 00101 virtual CORBA::Object_ptr create_collocated_object (TAO_Stub *, 00102 const TAO_MProfile &) = 0; 00103 00104 /// Initialize a collocated object using the given stub 00105 /// pointer for lazily evaluated object references. 00106 virtual CORBA::Long initialize_collocated_object (TAO_Stub *) = 0; 00107 }; 00108 00109 TAO_END_VERSIONED_NAMESPACE_DECL 00110 00111 #include /**/ "ace/post.h" 00112 00113 #endif /* TAO_ADAPTER_H */