diff options
-rw-r--r-- | TAO/tao/PI_Server/PI_Server.cpp | 13 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PI_Server.h | 58 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PI_Server_Loader.cpp | 84 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PI_Server_Loader.h | 47 | ||||
-rw-r--r-- | TAO/tao/PI_Server/POA_Current.cpp | 83 | ||||
-rw-r--r-- | TAO/tao/PI_Server/POA_Current.h | 93 | ||||
-rw-r--r-- | TAO/tao/PI_Server/POA_Current.inl | 16 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PS_Current.pidl | 51 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PS_CurrentA.cpp | 225 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PS_CurrentC.cpp | 287 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PS_CurrentC.h | 313 | ||||
-rw-r--r-- | TAO/tao/PI_Server/Policy_Creator_T.h | 49 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp | 134 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PortableServer_ORBInitializer.h | 65 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp | 113 | ||||
-rw-r--r-- | TAO/tao/PI_Server/PortableServer_PolicyFactory.h | 42 | ||||
-rw-r--r-- | TAO/tao/PI_Server/pi_server_export.h | 40 |
17 files changed, 1713 insertions, 0 deletions
diff --git a/TAO/tao/PI_Server/PI_Server.cpp b/TAO/tao/PI_Server/PI_Server.cpp new file mode 100644 index 00000000000..7c79dbc4acc --- /dev/null +++ b/TAO/tao/PI_Server/PI_Server.cpp @@ -0,0 +1,13 @@ +#include "PI_Server.h" +#include "PI_Server_Loader.h" + +ACE_RCSID (PI_Server, + PI_Server, + "$Id$") + +int +TAO_PI_Server_Init::Initializer (void) +{ + return ACE_Service_Config::process_directive (ace_svc_desc_TAO_PI_Server_Loader); +} + diff --git a/TAO/tao/PI_Server/PI_Server.h b/TAO/tao/PI_Server/PI_Server.h new file mode 100644 index 00000000000..7adefecc73e --- /dev/null +++ b/TAO/tao/PI_Server/PI_Server.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file PI_Server.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_PI_SERVER_H +#define TAO_PI_SERVER_H + +#include /**/ "ace/pre.h" + +#include "pi_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class TAO_PI_Init + * + */ +class TAO_PI_Server_Export TAO_PI_Server_Init +{ +public: + + /// Used to force the initialization of the ORB code. + static int Initializer (void); +}; + +#if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) + +typedef int (*TAO_Module_Initializer) (void); + +static TAO_Module_Initializer +TAO_Requires_PI_Server_Initializer = + &TAO_PI_Server_Init::Initializer; + +#else + +static int +TAO_Requires_PI_Server_Initializer = + TAO_PI_Server_Init::Initializer (); + +#endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */ + +#define TAO_PI_SERVER_SAFE_INCLUDE +#include "PS_CurrentC.h" +#undef TAO_PI_SERVER_SAFE_INCLUDE + +#include /**/ "ace/post.h" + +#endif /* TAO_PI_SERVER_H */ diff --git a/TAO/tao/PI_Server/PI_Server_Loader.cpp b/TAO/tao/PI_Server/PI_Server_Loader.cpp new file mode 100644 index 00000000000..061e91c83d5 --- /dev/null +++ b/TAO/tao/PI_Server/PI_Server_Loader.cpp @@ -0,0 +1,84 @@ + +// $Id$ + +#include "PI_Server_Loader.h" +#include "PortableServer_ORBInitializer.h" + +#include "tao/debug.h" +#include "tao/ORB_Core.h" +#include "tao/ORBInitializer_Registry.h" + +ACE_RCSID (PI_Server, + PI_Server_Loader, + "$Id$") + +TAO_PI_Server_Loader::TAO_PI_Server_Loader (void) +{ +} + +TAO_PI_Server_Loader::~TAO_PI_Server_Loader (void) +{ + +} + +int +TAO_PI_Server_Loader::init (int, + ACE_TCHAR* []) +{ + ACE_TRACE ("TAO_PI_Server_Loader::init"); + + static int initialized = 0; + + // Only allow initialization once. + if (initialized) + return 0; + + initialized = 1; + + // Register the ORB initializer. + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + /// Register the Messaging ORBInitializer. + PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = + PortableInterceptor::ORBInitializer::_nil (); + + ACE_NEW_THROW_EX (temp_orb_initializer, + TAO_PortableServer_ORBInitializer, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_TRY_CHECK; + + PortableInterceptor::ORBInitializer_var orb_initializer = + temp_orb_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "(%P | %t) Caught exception:"); + return -1; + } + ACE_ENDTRY; + + return 0; + + return 0; +} + +///////////////////////////////////////////////////////////////////// + +ACE_FACTORY_DEFINE (TAO_PI_Server, TAO_PI_Server_Loader) +ACE_STATIC_SVC_DEFINE (TAO_PI_Server_Loader, + ACE_TEXT ("PI_Server_Loader"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_PI_Server_Loader), + ACE_Service_Type::DELETE_THIS + | ACE_Service_Type::DELETE_OBJ, + 0) diff --git a/TAO/tao/PI_Server/PI_Server_Loader.h b/TAO/tao/PI_Server/PI_Server_Loader.h new file mode 100644 index 00000000000..02228437152 --- /dev/null +++ b/TAO/tao/PI_Server/PI_Server_Loader.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file PI_Server_Loader.h + * + * $Id$ + * + * Header file for Loading RTScheduler. + * + * + * @author Yamuna Krishnamurthy <yamuna@oomworks.com> + */ +//============================================================================= + +#ifndef TAO_PI_SERVER_LOADER_H +#define TAO_PI_SERVER_LOADER_H +#include /**/ "ace/pre.h" + +#include "pi_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Object.h" +#include "ace/Service_Config.h" + +class TAO_PI_Server_Export TAO_PI_Server_Loader : public ACE_Service_Object +{ +public: + /// Constructor. + TAO_PI_Server_Loader (void); + + /// Destructor. + virtual ~TAO_PI_Server_Loader (void); + + /// Initialize the PI_Server loader hooks. + virtual int init (int argc, + ACE_TCHAR* []); +}; + +ACE_STATIC_SVC_DECLARE_EXPORT (TAO_PI_Server, TAO_PI_Server_Loader) +ACE_FACTORY_DECLARE (TAO_PI_Server, TAO_PI_Server_Loader) + +#include /**/ "ace/post.h" +#endif /* TAO_PI_SERVER_LOADER_H */ diff --git a/TAO/tao/PI_Server/POA_Current.cpp b/TAO/tao/PI_Server/POA_Current.cpp new file mode 100644 index 00000000000..cf696518b9f --- /dev/null +++ b/TAO/tao/PI_Server/POA_Current.cpp @@ -0,0 +1,83 @@ +// $Id$ + +// -- PortableServer Include -- +#include "POA_Current.h" +#include "tao/PortableServer/POA_Current_Impl.h" + +// -- TAO Include -- +#include "tao/TSS_Resources.h" + +#if !defined (__ACE_INLINE__) +# include "POA_Current.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (PI_Server, + POA_Current, + "$Id$") + +namespace TAO +{ + namespace Portable_Server + { + PortableServer::POA_ptr + POA_Current::get_POA (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableServer::Current::NoContext)) + { + POA_Current_Impl *impl = this->implementation (); + + if (impl == 0) + ACE_THROW_RETURN (PortableServer::Current::NoContext (), + 0); + return impl->get_POA (); + } + + PortableServer::ObjectId * + POA_Current::get_object_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableServer::Current::NoContext)) + { + POA_Current_Impl *impl = this->implementation (); + + if (impl == 0) + ACE_THROW_RETURN (PortableServer::Current::NoContext (), + 0); + return impl->get_object_id (); + } + + PortableServer::Servant + POA_Current::get_servant (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableServer::Current::NoContext)) + { + POA_Current_Impl *impl = this->implementation (); + + if (impl == 0) + ACE_THROW_RETURN (PortableServer::Current::NoContext (), + 0); + return impl->get_servant (); + } + + + POA_Current_Impl * + POA_Current::implementation (void) + { + return static_cast <POA_Current_Impl *> + (TAO_TSS_RESOURCES::instance ()->poa_current_impl_); + } + + POA_Current_Impl * + POA_Current::implementation (POA_Current_Impl *new_current) + { + TAO_TSS_Resources *tss = + TAO_TSS_RESOURCES::instance (); + + POA_Current_Impl *old = + static_cast <POA_Current_Impl *> + (tss->poa_current_impl_); + tss->poa_current_impl_ = new_current; + return old; + } + } +} + diff --git a/TAO/tao/PI_Server/POA_Current.h b/TAO/tao/PI_Server/POA_Current.h new file mode 100644 index 00000000000..7cad7c5daae --- /dev/null +++ b/TAO/tao/PI_Server/POA_Current.h @@ -0,0 +1,93 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file POA_Current.h + * + * $Id$ + * + * @author Irfan Pyarali + */ +//============================================================================= + +#ifndef TAO_POA_CURRENT_H +#define TAO_POA_CURRENT_H + +#include /**/ "ace/pre.h" + +#include "pi_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/LocalObject.h" +#include "PI_Server.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +namespace TAO +{ + namespace Portable_Server + { + class POA_Current_Impl; + + class TAO_PI_Server_Export POA_Current + : public PortableServer::Current, + public TAO_Local_RefCounted_Object + { + public: + /// Constructor + POA_Current (void); + + /** + * Returns the POA on which the current request is being invoked. + * Can raise the @c NoContext exception if this function is + * not invoked in the context of an upcall. + */ + PortableServer::POA_ptr get_POA (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableServer::Current::NoContext)); + + /** + * Returns the object id of the current request being invoked. Can + * raise the @c NoContext exception if this function is not + * invoked in the context of an upcall. + */ + PortableServer::ObjectId *get_object_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableServer::Current::NoContext)); + + /** + * Returns a reference to the servant that hosts the object in whose + * context it is called. If called outside the context of the POA + * dispatched operation, a NoContext exception is raised + */ + PortableServer::Servant get_servant (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + PortableServer::Current::NoContext)); + + /// Returns the class that implements this interface. + POA_Current_Impl *implementation (void); + + /// Sets the thread-specific pointer to the new POA Current state, + /// returning a pointer to the existing POA Current state. + POA_Current_Impl *implementation (POA_Current_Impl *new_current); + }; + } +} + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__ACE_INLINE__) +# include "POA_Current.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* TAO_POA_CURRENT_H */ diff --git a/TAO/tao/PI_Server/POA_Current.inl b/TAO/tao/PI_Server/POA_Current.inl new file mode 100644 index 00000000000..4c445f2d29c --- /dev/null +++ b/TAO/tao/PI_Server/POA_Current.inl @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// $Id$ + +#include "tao/SystemException.h" + +namespace TAO +{ + namespace Portable_Server + { + ACE_INLINE + POA_Current::POA_Current (void) + { + } + } +} diff --git a/TAO/tao/PI_Server/PS_Current.pidl b/TAO/tao/PI_Server/PS_Current.pidl new file mode 100644 index 00000000000..ceb6c001366 --- /dev/null +++ b/TAO/tao/PI_Server/PS_Current.pidl @@ -0,0 +1,51 @@ +/** + * @file PS_Current.pidl + * + * $Id$ + * + * @brief Pre-compiled IDL source for the PortableServer module. + * + * This file was used to generate the code in + * PS_CurrentC.{h,inl,cpp}, using the following command: + * + * tao_idl.exe \ + * -o orig -Gp -Gd -Ge 1 -Sci -Sc -GA -I$(TAO_ROOT) + * -Wb,export_macro=TAO_PI_Server_Export \ + * -Wb,export_include="pi_server_export.h" \ + * -Wb,pre_include="ace/pre.h" \ + * -Wb,post_include="ace/post.h" \ + * PS_Current.pidl + */ + +#ifndef _PORTABLESERVER_CURRENT_IDL_ +#define _PORTABLESERVER_CURRENT_IDL_ + +///FUZZ: disable check_for_include/ +#include <tao/PortableServer/PS_Forward.pidl> +#include <Current.pidl> + +#pragma prefix "omg.org" + +module PortableServer +{ +# pragma version PortableServer 2.3 + + // Current interface. + local interface Current : CORBA::Current + { +# pragma version Current 2.3 + + exception NoContext {}; + + POA get_POA () + raises (NoContext); + + ObjectId get_object_id () + raises (NoContext); + + Servant get_servant () + raises (NoContext); + }; +}; + +#endif // _PORTABLESERVER_CURRENT_IDL_ diff --git a/TAO/tao/PI_Server/PS_CurrentA.cpp b/TAO/tao/PI_Server/PS_CurrentA.cpp new file mode 100644 index 00000000000..daf3632957f --- /dev/null +++ b/TAO/tao/PI_Server/PS_CurrentA.cpp @@ -0,0 +1,225 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +#include "PI_Server.h" +#include "tao/Null_RefCount_Policy.h" +#include "tao/TypeCode_Constants.h" +#include "tao/Alias_TypeCode_Static.h" +#include "tao/Objref_TypeCode_Static.h" +#include "tao/Struct_TypeCode_Static.h" +#include "tao/TypeCode_Struct_Field.h" +#include "tao/CDR.h" +#include "tao/Any.h" +#include "tao/Any_Impl_T.h" +#include "tao/Any_Dual_Impl_T.h" + +// TAO_IDL - Generated from +// be/be_visitor_typecode/struct_typecode.cpp:74 + +static TAO::TypeCode::Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const _tao_fields_PortableServer_Current_NoContext = 0; +static TAO::TypeCode::Struct<char const *, + CORBA::TypeCode_ptr const *, + TAO::TypeCode::Struct_Field<char const *, + CORBA::TypeCode_ptr const *> const *, + TAO::Null_RefCount_Policy> + _tao_tc_PortableServer_Current_NoContext ( + CORBA::tk_except, + "IDL:omg.org/PortableServer/Current/NoContext:2.3", + "NoContext", + _tao_fields_PortableServer_Current_NoContext, + 0); + +::CORBA::TypeCode_ptr const PortableServer::Current::_tc_NoContext = + &_tao_tc_PortableServer_Current_NoContext; + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_PortableServer_Current ( + CORBA::tk_local_interface, + "IDL:omg.org/PortableServer/Current:2.3", + "Current"); + +namespace PortableServer +{ + ::CORBA::TypeCode_ptr const _tc_Current = + &_tao_tc_PortableServer_Current; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/any_op_cs.cpp:50 + +namespace TAO +{ + template<> + CORBA::Boolean + Any_Impl_T<PortableServer::Current>::to_object ( + CORBA::Object_ptr &_tao_elem + ) const + { + _tao_elem = CORBA::Object::_duplicate (this->value_); + return true; + } +} + +namespace TAO +{ + template<> + CORBA::Boolean + Any_Impl_T<PortableServer::Current>::marshal_value (TAO_OutputCDR &) + { + return false; + } + + template<> + CORBA::Boolean + Any_Impl_T<PortableServer::Current>::demarshal_value (TAO_InputCDR &) + { + return false; + } +} + +// Copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + PortableServer::Current_ptr _tao_elem + ) +{ + PortableServer::Current_ptr _tao_objptr = + PortableServer::Current::_duplicate (_tao_elem); + _tao_any <<= &_tao_objptr; +} + +// Non-copying insertion. +void +operator<<= ( + CORBA::Any &_tao_any, + PortableServer::Current_ptr *_tao_elem + ) +{ + TAO::Any_Impl_T<PortableServer::Current>::insert ( + _tao_any, + PortableServer::Current::_tao_any_destructor, + PortableServer::_tc_Current, + *_tao_elem + ); +} + +CORBA::Boolean +operator>>= ( + const CORBA::Any &_tao_any, + PortableServer::Current_ptr &_tao_elem + ) +{ + return + TAO::Any_Impl_T<PortableServer::Current>::extract ( + _tao_any, + PortableServer::Current::_tao_any_destructor, + PortableServer::_tc_Current, + _tao_elem + ); +} + +// TAO_IDL - Generated from +// be/be_visitor_exception/any_op_cs.cpp:50 + +namespace TAO +{ + template<> + CORBA::Boolean + Any_Dual_Impl_T<PortableServer::Current::NoContext>::marshal_value (TAO_OutputCDR &) + { + return false; + } + + template<> + CORBA::Boolean + Any_Dual_Impl_T<PortableServer::Current::NoContext>::demarshal_value (TAO_InputCDR &) + { + return false; + } +} + +// Copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + const PortableServer::Current::NoContext &_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<PortableServer::Current::NoContext>::insert_copy ( + _tao_any, + PortableServer::Current::NoContext::_tao_any_destructor, + PortableServer::Current::_tc_NoContext, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + PortableServer::Current::NoContext *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<PortableServer::Current::NoContext>::insert ( + _tao_any, + PortableServer::Current::NoContext::_tao_any_destructor, + PortableServer::Current::_tc_NoContext, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + PortableServer::Current::NoContext *&_tao_elem + ) +{ + return _tao_any >>= const_cast< + const PortableServer::Current::NoContext *&> ( + _tao_elem + ); +} + +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const PortableServer::Current::NoContext *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<PortableServer::Current::NoContext>::extract ( + _tao_any, + PortableServer::Current::NoContext::_tao_any_destructor, + PortableServer::Current::_tc_NoContext, + _tao_elem + ); +} diff --git a/TAO/tao/PI_Server/PS_CurrentC.cpp b/TAO/tao/PI_Server/PS_CurrentC.cpp new file mode 100644 index 00000000000..7ac1e05a182 --- /dev/null +++ b/TAO/tao/PI_Server/PS_CurrentC.cpp @@ -0,0 +1,287 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be\be_codegen.cpp:291 + + +#include "PI_Server.h" +#include "tao/CDR.h" +#include "ace/OS_NS_string.h" + +#if defined (__BORLANDC__) +#pragma option -w-rvl -w-rch -w-ccc -w-aus -w-sig +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be\be_visitor_arg_traits.cpp:69 + +// Arg traits specializations. +namespace TAO +{ +} + + +// TAO_IDL - Generated from +// be\be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for PortableServer::Current. + +PortableServer::Current_ptr +TAO::Objref_Traits<PortableServer::Current>::duplicate ( + PortableServer::Current_ptr p + ) +{ + return PortableServer::Current::_duplicate (p); +} + +void +TAO::Objref_Traits<PortableServer::Current>::release ( + PortableServer::Current_ptr p + ) +{ + CORBA::release (p); +} + +PortableServer::Current_ptr +TAO::Objref_Traits<PortableServer::Current>::nil (void) +{ + return PortableServer::Current::_nil (); +} + +CORBA::Boolean +TAO::Objref_Traits<PortableServer::Current>::marshal ( + PortableServer::Current_ptr p, + TAO_OutputCDR & cdr + ) +{ + return CORBA::Object::marshal (p, cdr); +} + +// TAO_IDL - Generated from +// be\be_visitor_exception/exception_cs.cpp:63 + +PortableServer::Current::NoContext::NoContext (void) + : CORBA::UserException ( + "IDL:omg.org/PortableServer/Current/NoContext:2.3", + "NoContext" + ) +{ +} + +PortableServer::Current::NoContext::~NoContext (void) +{ +} + +PortableServer::Current::NoContext::NoContext (const ::PortableServer::Current::NoContext &_tao_excp) + : CORBA::UserException ( + _tao_excp._rep_id (), + _tao_excp._name () + ) +{ +} + +PortableServer::Current::NoContext& +PortableServer::Current::NoContext::operator= (const ::PortableServer::Current::NoContext &_tao_excp) +{ + this->ACE_NESTED_CLASS (CORBA, UserException)::operator= (_tao_excp); + return *this; +} + +void PortableServer::Current::NoContext::_tao_any_destructor (void *_tao_void_pointer) +{ + NoContext *_tao_tmp_pointer = + static_cast<NoContext *> (_tao_void_pointer); + delete _tao_tmp_pointer; +} + +PortableServer::Current::NoContext * +PortableServer::Current::NoContext::_downcast (CORBA::Exception *_tao_excp) +{ + return dynamic_cast<NoContext *> (_tao_excp); +} + +const PortableServer::Current::NoContext * +PortableServer::Current::NoContext::_downcast (CORBA::Exception const *_tao_excp) +{ + return dynamic_cast<const NoContext *> (_tao_excp); +} + +CORBA::Exception *PortableServer::Current::NoContext::_alloc (void) +{ + CORBA::Exception *retval = 0; + ACE_NEW_RETURN (retval, ::PortableServer::Current::NoContext, 0); + return retval; +} + +CORBA::Exception * +PortableServer::Current::NoContext::_tao_duplicate (void) const +{ + CORBA::Exception *result = 0; + ACE_NEW_RETURN ( + result, + ::PortableServer::Current::NoContext (*this), + 0 + ); + return result; +} + +void PortableServer::Current::NoContext::_raise (void) const +{ + TAO_RAISE (*this); +} + +void PortableServer::Current::NoContext::_tao_encode ( + TAO_OutputCDR & + ACE_ENV_ARG_DECL + ) const +{ + ACE_THROW (CORBA::MARSHAL ()); +} + +void PortableServer::Current::NoContext::_tao_decode ( + TAO_InputCDR & + ACE_ENV_ARG_DECL + ) +{ + ACE_THROW (CORBA::MARSHAL ()); +} + +// TAO extension - the virtual _type method. +CORBA::TypeCode_ptr PortableServer::Current::NoContext::_tao_type (void) const +{ + return ::PortableServer::Current::_tc_NoContext; +} + +PortableServer::Current::Current (void) +{} + +PortableServer::Current::~Current (void) +{} + +void +PortableServer::Current::_tao_any_destructor (void *_tao_void_pointer) +{ + Current *_tao_tmp_pointer = + static_cast<Current *> (_tao_void_pointer); + CORBA::release (_tao_tmp_pointer); +} + +PortableServer::Current_ptr +PortableServer::Current::_narrow ( + CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (_tao_objref)) + { + return Current::_nil (); + } + + Current_ptr proxy = + dynamic_cast<Current_ptr> (_tao_objref); + + return Current::_duplicate (proxy); +} + +PortableServer::Current_ptr +PortableServer::Current::_unchecked_narrow ( + CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if (CORBA::is_nil (_tao_objref)) + { + return Current::_nil (); + } + + Current_ptr proxy = + dynamic_cast<Current_ptr> (_tao_objref); + + return Current::_duplicate (proxy); +} + +PortableServer::Current_ptr +PortableServer::Current::_duplicate (Current_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +PortableServer::Current::_tao_release (Current_ptr obj) +{ + CORBA::release (obj); +} + +CORBA::Boolean +PortableServer::Current::_is_a ( + const char *value + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Current:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/PortableServer/Current:2.3" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/LocalObject:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Object:1.0" + ) + ) + { + return true; // success using local knowledge + } + else + { + return false; + } +} + +const char* PortableServer::Current::_interface_repository_id (void) const +{ + return "IDL:omg.org/PortableServer/Current:2.3"; +} + +CORBA::Boolean +PortableServer::Current::marshal (TAO_OutputCDR &) +{ + return false; +} diff --git a/TAO/tao/PI_Server/PS_CurrentC.h b/TAO/tao/PI_Server/PS_CurrentC.h new file mode 100644 index 00000000000..cb65151114d --- /dev/null +++ b/TAO/tao/PI_Server/PS_CurrentC.h @@ -0,0 +1,313 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be\be_codegen.cpp:153 + +#ifndef _TAO_IDL_ORIG_PS_CURRENTC_H_ +#define _TAO_IDL_ORIG_PS_CURRENTC_H_ + +#include /**/ "ace/pre.h" + + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#ifndef TAO_PI_SERVER_SAFE_INCLUDE +# error "You should not include PS_CurrentC.h directly, use PI_Server.h" +#endif /* !TAO_PI_SAFE_INCLUDE */ + +#include "pi_server_export.h" +#include "tao/ORB.h" +#include "tao/SystemException.h" +#include "tao/Environment.h" +#include "tao/Object.h" +#include "tao/Objref_VarOut_T.h" + +#include "tao/PortableServer/PS_ForwardC.h" +#include "tao/CurrentC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO TAO_PI_Server_Export + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option push -w-rvl -w-rch -w-ccc -w-inl +#endif /* __BORLANDC__ */ + +// TAO_IDL - Generated from +// be\be_visitor_module/module_ch.cpp:48 + +namespace PortableServer +{ + + // TAO_IDL - Generated from + // be\be_interface.cpp:598 + +#if !defined (_PORTABLESERVER_CURRENT__VAR_OUT_CH_) +#define _PORTABLESERVER_CURRENT__VAR_OUT_CH_ + + class Current; + typedef Current *Current_ptr; + + typedef + TAO_Objref_Var_T< + Current + > + Current_var; + + typedef + TAO_Objref_Out_T< + Current + > + Current_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be\be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_PORTABLESERVER_CURRENT_CH_) +#define _PORTABLESERVER_CURRENT_CH_ + + class TAO_PI_Server_Export Current + : public virtual ::CORBA::Current + { + public: + typedef Current_ptr _ptr_type; + typedef Current_var _var_type; + + // The static operations. + static Current_ptr _duplicate (Current_ptr obj); + + static void _tao_release (Current_ptr obj); + + static Current_ptr _narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Current_ptr _unchecked_narrow ( + CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Current_ptr _nil (void) + { + return static_cast<Current_ptr> (0); + } + + static void _tao_any_destructor (void *); + + // TAO_IDL - Generated from + // be\be_visitor_exception/exception_ch.cpp:51 + +#if !defined (_PORTABLESERVER_CURRENT_NOCONTEXT_CH_) +#define _PORTABLESERVER_CURRENT_NOCONTEXT_CH_ + + class TAO_PI_Server_Export NoContext : public CORBA::UserException + { + public: + + NoContext (void); + NoContext (const NoContext &); + ~NoContext (void); + + NoContext &operator= (const NoContext &); + + static void _tao_any_destructor (void *); + + static NoContext *_downcast (CORBA::Exception *); + static const NoContext *_downcast (CORBA::Exception const *); + + static CORBA::Exception *_alloc (void); + + virtual CORBA::Exception *_tao_duplicate (void) const; + + virtual void _raise (void) const; + + virtual void _tao_encode ( + TAO_OutputCDR & + ACE_ENV_ARG_DECL + ) const; + + virtual void _tao_decode ( + TAO_InputCDR & + ACE_ENV_ARG_DECL + ); + + // TAO_IDL - Generated from + // be\be_visitor_exception/exception_ch.cpp:127 + + virtual CORBA::TypeCode_ptr _tao_type (void) const; + }; + + // TAO_IDL - Generated from + // be\be_visitor_typecode/typecode_decl.cpp:44 + + static ::CORBA::TypeCode_ptr const _tc_NoContext; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be\be_visitor_operation/operation_ch.cpp:46 + + virtual ::PortableServer::POA_ptr get_POA ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException, + ::PortableServer::Current::NoContext + )) = 0; + + // TAO_IDL - Generated from + // be\be_visitor_operation/operation_ch.cpp:46 + + virtual ::PortableServer::ObjectId * get_object_id ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException, + ::PortableServer::Current::NoContext + )) = 0; + + // TAO_IDL - Generated from + // be\be_visitor_operation/operation_ch.cpp:46 + + virtual ::PortableServer::Servant get_servant ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException, + ::PortableServer::Current::NoContext + )) = 0; + + // TAO_IDL - Generated from + // be\be_visitor_interface/interface_ch.cpp:210 + + virtual CORBA::Boolean _is_a ( + const char *type_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + virtual const char* _interface_repository_id (void) const; + virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr); + + protected: + // Abstract or local interface only. + Current (void); + + virtual ~Current (void); + + private: + // Private and unimplemented for concrete interfaces. + Current (const Current &); + + void operator= (const Current &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be\be_visitor_typecode/typecode_decl.cpp:44 + + extern TAO_PI_Server_Export ::CORBA::TypeCode_ptr const _tc_Current; + +// TAO_IDL - Generated from +// be\be_visitor_module/module_ch.cpp:66 + +} // module PortableServer + +// TAO_IDL - Generated from +// be\be_visitor_traits.cpp:61 + +// Traits specializations. +namespace TAO +{ + +#if !defined (_PORTABLESERVER_CURRENT__TRAITS_CH_) +#define _PORTABLESERVER_CURRENT__TRAITS_CH_ + + template<> + struct TAO_PI_Server_Export Objref_Traits< ::PortableServer::Current> + { + static ::PortableServer::Current_ptr duplicate ( + ::PortableServer::Current_ptr + ); + static void release ( + ::PortableServer::Current_ptr + ); + static ::PortableServer::Current_ptr nil (void); + static CORBA::Boolean marshal ( + ::PortableServer::Current_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ +} + +// TAO_IDL - Generated from +// be\be_visitor_interface/any_op_ch.cpp:52 + +TAO_PI_Server_Export void operator<<= (CORBA::Any &, PortableServer::Current_ptr); // copying +TAO_PI_Server_Export void operator<<= (CORBA::Any &, PortableServer::Current_ptr *); // non-copying +TAO_PI_Server_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableServer::Current_ptr &); + +// TAO_IDL - Generated from +// be\be_visitor_exception/any_op_ch.cpp:52 + +TAO_PI_Server_Export void operator<<= (CORBA::Any &, const PortableServer::Current::NoContext &); // copying version +TAO_PI_Server_Export void operator<<= (CORBA::Any &, PortableServer::Current::NoContext*); // noncopying version +TAO_PI_Server_Export CORBA::Boolean operator>>= (const CORBA::Any &, PortableServer::Current::NoContext *&); // deprecated +TAO_PI_Server_Export CORBA::Boolean operator>>= (const CORBA::Any &, const PortableServer::Current::NoContext *&); + +// TAO_IDL - Generated from +// be\be_codegen.cpp:955 + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#if defined (__BORLANDC__) +#pragma option pop +#endif /* __BORLANDC__ */ + +#include /**/ "ace/post.h" + +#endif /* ifndef */ + + diff --git a/TAO/tao/PI_Server/Policy_Creator_T.h b/TAO/tao/PI_Server/Policy_Creator_T.h new file mode 100644 index 00000000000..3846ef81c88 --- /dev/null +++ b/TAO/tao/PI_Server/Policy_Creator_T.h @@ -0,0 +1,49 @@ +// This may look like C, but it's really -*- C++ -*- + +//============================================================================= +/** + * @file Policy_Creator_T.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef TAO_PORTABLESERVER_POLICY_CREATOR_T_H +#define TAO_PORTABLESERVER_POLICY_CREATOR_T_H + +#include /**/ "ace/pre.h" + +#include "tao/ORB_Constants.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace TAO +{ + namespace Portable_Server + { + template <class POLICYTYPE, class POLICYVALUE> + void create_policy ( + POLICYTYPE *& policy, + POLICYVALUE &value, + const CORBA::Any& val + ACE_ENV_ARG_DECL) + { + if ((val >>= value) == 0) + ACE_THROW (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE)); + + ACE_NEW_THROW_EX (policy, + POLICYTYPE (value), + CORBA::NO_MEMORY (TAO::VMCID, + CORBA::COMPLETED_NO)); + ACE_CHECK; + } + } +} + +#include /**/ "ace/post.h" + +#endif /* TAO_PORTABLESERVER_POLICY_CREATOR_T_H */ diff --git a/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp b/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp new file mode 100644 index 00000000000..507e39545f2 --- /dev/null +++ b/TAO/tao/PI_Server/PortableServer_ORBInitializer.cpp @@ -0,0 +1,134 @@ +// -*- C++ -*- + +#include "PortableServer_ORBInitializer.h" +#include "PortableServer_PolicyFactory.h" +#include "tao/debug.h" +#include "tao/ORB_Constants.h" +#include "tao/PortableServer/PortableServer.h" +#include "POA_Current.h" +#include "tao/PI/ORBInitInfo.h" +#include "tao/ORB_Core.h" + +ACE_RCSID (PI_Server, + PortableServer_ORBInitializer, + "$Id$") + +void +TAO_PortableServer_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->register_poa_current (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_PortableServer_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->register_policy_factories (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_PortableServer_ORBInitializer::register_poa_current (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) +{ + // Narrow to a TAO_ORBInitInfo object to get access to the + // orb_core() TAO extension. + TAO_ORBInitInfo_var tao_info = + TAO_ORBInitInfo::_narrow (info + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (tao_info.in ())) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + "(%P|%t) PortableServer_ORBInitializer::post_init:\n" + "(%P|%t) Unable to narrow " + "\"PortableInterceptor::ORBInitInfo_ptr\" to\n" + "(%P|%t) \"TAO_ORBInitInfo *.\"\n")); + + ACE_THROW (CORBA::INTERNAL ()); + } + + // Create Current. + CORBA::Object_var current = + new TAO::Portable_Server::POA_Current; + + // Setup the POA_Current object in the ORB Core. + tao_info->orb_core ()->poa_current (current.in ()); +} + +void +TAO_PortableServer_ORBInitializer::register_policy_factories (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) +{ + // Register the PortableServer policy factories. + PortableInterceptor::PolicyFactory_ptr tmp; + ACE_NEW_THROW_EX (tmp, + TAO_PortableServer_PolicyFactory, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + + PortableInterceptor::PolicyFactory_var policy_factory = tmp; + + // Bind the same policy factory to all PortableServer related policy + // types since a single policy factory is used to create each of the + // different types of PortableServer policies. + CORBA::PolicyType type[] = { +#if (TAO_HAS_MINIMUM_POA == 0) + PortableServer::THREAD_POLICY_ID, + PortableServer::IMPLICIT_ACTIVATION_POLICY_ID, + PortableServer::SERVANT_RETENTION_POLICY_ID, + PortableServer::REQUEST_PROCESSING_POLICY_ID, +#endif /* TAO_HAS_MINIMUM_POA == 0 */ + PortableServer::LIFESPAN_POLICY_ID, + PortableServer::ID_UNIQUENESS_POLICY_ID, + PortableServer::ID_ASSIGNMENT_POLICY_ID + }; + + const CORBA::PolicyType *end = + type + sizeof (type) / sizeof (type[0]); + + for (CORBA::PolicyType *i = type; + i != end; + ++i) + { + ACE_TRY + { + info->register_policy_factory (*i, + policy_factory.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (CORBA::BAD_INV_ORDER, ex) + { + if (ex.minor () == (CORBA::OMGVMCID | 16)) + { + // The factory is already there, it happens because the + // magic initializer in PortableServer.cpp registers + // with the ORB multiple times. This is an indication + // that we should do no more work in this + // ORBInitializer. + return; + } + ACE_RE_THROW; + } + ACE_CATCHANY + { + // Rethrow any other exceptions... + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK; + } +} diff --git a/TAO/tao/PI_Server/PortableServer_ORBInitializer.h b/TAO/tao/PI_Server/PortableServer_ORBInitializer.h new file mode 100644 index 00000000000..8ad1025aa5f --- /dev/null +++ b/TAO/tao/PI_Server/PortableServer_ORBInitializer.h @@ -0,0 +1,65 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file PortableServer_ORBInitializer.h + * + * $Id$ + * + * @author Irfan Pyarali <irfan@oomworks.com> + */ +//============================================================================= + +#ifndef TAO_PORTABLESERVER_ORB_INITIALIZER_H +#define TAO_PORTABLESERVER_ORB_INITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "pi_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +/// PortableServer ORB initializer. +class TAO_PI_Server_Export TAO_PortableServer_ORBInitializer + : public virtual PortableInterceptor::ORBInitializer, + public virtual TAO_Local_RefCounted_Object +{ +public: + + /** + * @name PortableInterceptor::ORBInitializer methods + * + * The following methods are required by the + * PortableInterceptor::ORBInitializer interface. + */ + //@{ + + void pre_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void post_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + //@} + +private: + + /// Register PortableServer policy factories. + void register_policy_factories (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL); + + /// Register POA Current. + void register_poa_current (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL); +}; + +#include /**/ "ace/post.h" + +#endif /* TAO_PORTABLESERVER_ORB_INITIALIZER_H */ diff --git a/TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp b/TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp new file mode 100644 index 00000000000..9171b7c7e33 --- /dev/null +++ b/TAO/tao/PI_Server/PortableServer_PolicyFactory.cpp @@ -0,0 +1,113 @@ + +#include "PortableServer_PolicyFactory.h" + +#include "tao/PortableServer/ThreadPolicy.h" +#include "tao/PortableServer/LifespanPolicy.h" +#include "tao/PortableServer/IdAssignmentPolicy.h" +#include "tao/PortableServer/IdUniquenessPolicy.h" +#include "tao/PortableServer/ImplicitActivationPolicy.h" +#include "tao/PortableServer/RequestProcessingPolicy.h" +#include "tao/PortableServer/ServantRetentionPolicy.h" +#include "tao/PortableServer/PortableServer.h" +#include "Policy_Creator_T.h" + +ACE_RCSID (PortableServer, + PortableServer_PolicyFactory, + "$Id$") + +CORBA::Policy_ptr +TAO_PortableServer_PolicyFactory::create_policy ( + CORBA::PolicyType type, + const CORBA::Any &value + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)) +{ +#if (TAO_HAS_MINIMUM_POA == 0) + + + if (type == ::PortableServer::THREAD_POLICY_ID) + { + TAO::Portable_Server::ThreadPolicy *thread_policy = 0; + PortableServer::ThreadPolicyValue thr_value; + + TAO::Portable_Server::create_policy (thread_policy, thr_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return thread_policy; + } + +#endif /* TAO_HAS_MINIMUM_POA == 0 */ + if (type == PortableServer::LIFESPAN_POLICY_ID) + { + TAO::Portable_Server::LifespanPolicy *lifespan_policy = 0; + PortableServer::LifespanPolicyValue lifespan_value; + + TAO::Portable_Server::create_policy (lifespan_policy, lifespan_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return lifespan_policy; + } + + if (type == PortableServer::ID_UNIQUENESS_POLICY_ID) + { + TAO::Portable_Server::IdUniquenessPolicy *id_uniqueness_policy = 0; + PortableServer::IdUniquenessPolicyValue id_uniqueness_value; + + TAO::Portable_Server::create_policy (id_uniqueness_policy, id_uniqueness_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return id_uniqueness_policy; + } + + if (type == PortableServer::ID_ASSIGNMENT_POLICY_ID) + { + TAO::Portable_Server::IdAssignmentPolicy *id_assignment_policy = 0; + PortableServer::IdAssignmentPolicyValue id_assignment_value; + + TAO::Portable_Server::create_policy (id_assignment_policy, id_assignment_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return id_assignment_policy; + } + +#if (TAO_HAS_MINIMUM_POA == 0) + + if (type == PortableServer::IMPLICIT_ACTIVATION_POLICY_ID) + { + TAO::Portable_Server::ImplicitActivationPolicy *implicit_activatation_policy = 0; + PortableServer::ImplicitActivationPolicyValue implicit_activation_value; + + TAO::Portable_Server::create_policy (implicit_activatation_policy, implicit_activation_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return implicit_activatation_policy; + } + + if (type == PortableServer::SERVANT_RETENTION_POLICY_ID) + { + TAO::Portable_Server::ServantRetentionPolicy *servant_retention_policy = 0; + PortableServer::ServantRetentionPolicyValue servant_retention_value; + + TAO::Portable_Server::create_policy (servant_retention_policy, servant_retention_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return servant_retention_policy; + } + + if (type == PortableServer::REQUEST_PROCESSING_POLICY_ID) + { + TAO::Portable_Server::RequestProcessingPolicy *request_processing_policy = 0; + PortableServer::RequestProcessingPolicyValue request_processing_value; + + TAO::Portable_Server::create_policy (request_processing_policy, request_processing_value, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return request_processing_policy; + } + +#endif /* TAO_HAS_MINIMUM_POA == 0 */ + + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), + CORBA::Policy::_nil ()); +} diff --git a/TAO/tao/PI_Server/PortableServer_PolicyFactory.h b/TAO/tao/PI_Server/PortableServer_PolicyFactory.h new file mode 100644 index 00000000000..d24a1e001aa --- /dev/null +++ b/TAO/tao/PI_Server/PortableServer_PolicyFactory.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file PortableServer_PolicyFactory.h + * + * $Id$ + * + * @author Irfan Pyarali <irfan@oomworks.com> + */ +//============================================================================= + +#ifndef TAO_PORTABLESERVER_POLICY_FACTORY_H +#define TAO_PORTABLESERVER_POLICY_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "pi_server_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +/// Policy factory for all PortableServer related policies. +class TAO_PI_Server_Export TAO_PortableServer_PolicyFactory + : public virtual PortableInterceptor::PolicyFactory, + public virtual TAO_Local_RefCounted_Object +{ +public: + CORBA::Policy_ptr create_policy (CORBA::PolicyType type, + const CORBA::Any & value + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)); +}; + +#include /**/ "ace/post.h" + +#endif /* TAO_PORTABLESERVER_POLICY_FACTORY_H */ diff --git a/TAO/tao/PI_Server/pi_server_export.h b/TAO/tao/PI_Server/pi_server_export.h new file mode 100644 index 00000000000..01a9c75af1c --- /dev/null +++ b/TAO/tao/PI_Server/pi_server_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef TAO_PI_SERVER_EXPORT_H +#define TAO_PI_SERVER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (TAO_PI_SERVER_HAS_DLL) +# define TAO_PI_SERVER_HAS_DLL 0 +# endif /* ! TAO_PI_SERVER_HAS_DLL */ +#else +# if !defined (TAO_PI_SERVER_HAS_DLL) +# define TAO_PI_SERVER_HAS_DLL 1 +# endif /* ! TAO_PI_SERVER_HAS_DLL */ +#endif + +#if defined (TAO_PI_SERVER_HAS_DLL) && (TAO_PI_SERVER_HAS_DLL == 1) +# if defined (TAO_PI_SERVER_BUILD_DLL) +# define TAO_PI_Server_Export ACE_Proper_Export_Flag +# define TAO_PI_SERVER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_PI_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_PI_SERVER_BUILD_DLL */ +# define TAO_PI_Server_Export ACE_Proper_Import_Flag +# define TAO_PI_SERVER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_PI_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_PI_SERVER_BUILD_DLL */ +#else /* TAO_PI_SERVER_HAS_DLL == 1 */ +# define TAO_PI_Server_Export +# define TAO_PI_SERVER_SINGLETON_DECLARATION(T) +# define TAO_PI_SERVER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_PI_SERVER_HAS_DLL == 1 */ + +#endif /* TAO_PI_SERVER_EXPORT_H */ + +// End of auto generated file. |