00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file LifespanStrategy.h 00006 * 00007 * $Id: LifespanStrategy.h 76551 2007-01-24 13:42:44Z johnnyw $ 00008 * 00009 * @author Johnny Willemsen <jwillemsen@remedy.nl> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_PORTABLESERVER_LIFESPANPOLICY_H 00014 #define TAO_PORTABLESERVER_LIFESPANPOLICY_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "tao/PortableServer/Policy_Strategy.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #include "tao/PortableServer/LifespanPolicyC.h" 00024 #include "tao/Object_KeyC.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 namespace TAO 00029 { 00030 namespace Portable_Server 00031 { 00032 class Temporary_Creation_Time; 00033 00034 class LifespanStrategy 00035 : public Policy_Strategy 00036 { 00037 public: 00038 LifespanStrategy (void); 00039 00040 virtual void strategy_init(TAO_Root_POA *poa); 00041 00042 virtual void strategy_cleanup(void); 00043 00044 void create (const char *name, const TAO::ObjectKey &key); 00045 00046 virtual void notify_startup (void) = 0; 00047 00048 virtual void notify_shutdown (void) = 0; 00049 00050 /** 00051 * Validate the passed object key if it belongs to this POA. 00052 */ 00053 bool validate (TAO::ObjectKey_var& key); 00054 00055 /** 00056 * Returns the length of the key type 00057 */ 00058 virtual CORBA::ULong key_length (void) const = 0; 00059 00060 CORBA::ULong key_type_length (void) const; 00061 00062 /// Do we have set persistent or not, 00063 virtual CORBA::Boolean is_persistent (void) const = 0; 00064 00065 virtual void create_key (CORBA::Octet *buffer, CORBA::ULong& starting_at) = 0; 00066 00067 /// Validate whether this matches the set lifespan strategy 00068 virtual bool validate ( 00069 CORBA::Boolean is_persistent, 00070 const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const = 0; 00071 00072 /// Check the state of the POA. 00073 virtual void check_state (void) = 0; 00074 00075 virtual ::PortableServer::LifespanPolicyValue type() const = 0; 00076 00077 virtual bool use_imr () const = 0; 00078 00079 protected: 00080 TAO_Root_POA *poa_; 00081 }; 00082 00083 } /* namespace Portable_Server */ 00084 } /* namespace TAO */ 00085 00086 TAO_END_VERSIONED_NAMESPACE_DECL 00087 00088 #include /**/ "ace/post.h" 00089 #endif /* TAO_PORTABLESERVER_LIFESPANPOLICY_H */