diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2006-04-26 14:18:54 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2006-04-26 14:18:54 +0000 |
commit | b0c6f2976a551d7a0d4d8a0b62934a07a309193e (patch) | |
tree | 2d1d5b0ab5e71b1b25d66f8ca3fa74885b4e82bf /TAO/tao | |
parent | 03b1776d1c526d007e2187e6721e801109617b23 (diff) | |
download | ATCD-b0c6f2976a551d7a0d4d8a0b62934a07a309193e.tar.gz |
ChangeLog tag: Wed Apr 26 13:47:28 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'TAO/tao')
40 files changed, 3377 insertions, 1 deletions
diff --git a/TAO/tao/EndpointPolicy.mpc b/TAO/tao/EndpointPolicy.mpc new file mode 100644 index 00000000000..db77b97aecb --- /dev/null +++ b/TAO/tao/EndpointPolicy.mpc @@ -0,0 +1,32 @@ +//$Id$ +project : taolib, core, portableserver, pi { + sharedname = TAO_EndpointPolicy + dynamicflags = TAO_ENDPOINTPOLICY_BUILD_DLL + + Source_Files { + EndpointPolicy + } + + Header_Files { + EndpointPolicy + } + + Inline_Files { + EndpointPolicy + } + + Template_Files { + EndpointPolicy + } + + Resource_Files { + EndpointPolicy + } + + PIDL_Files { + } + + IDL_Files { + } + +} diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy.cpp new file mode 100644 index 00000000000..534ac8fbd77 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy.cpp @@ -0,0 +1,61 @@ +// @(#) $Id$ + +#include "tao/EndpointPolicy/EndpointPolicy.h" +#include "tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h" +#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h" + +#include "tao/ORB_Core.h" +#include "tao/ORBInitializer_Registry.h" + + +ACE_RCSID (EndpointPolicy, EndpointPolicy, "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +int +TAO_EndpointPolicy_Initializer::init (void) +{ + ACE_Service_Config::process_directive (ace_svc_desc_TAO_Endpoint_Acceptor_Filter_Factory); + + PortableInterceptor::ORBInitializer_ptr temp_orb_initializer = + PortableInterceptor::ORBInitializer::_nil (); + PortableInterceptor::ORBInitializer_var orb_initializer; + + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + /// Register the EndpointPolicy ORBInitializer. + ACE_NEW_THROW_EX (temp_orb_initializer, + TAO_EndpointPolicy_ORBInitializer, + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_TRY_CHECK; + + orb_initializer = temp_orb_initializer; + + PortableInterceptor::register_orb_initializer (orb_initializer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + if (TAO_debug_level > 0) + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught exception:"); + } + return -1; + } + ACE_ENDTRY; + + ACE_Service_Config::process_directive + (ace_svc_desc_TAO_Endpoint_Acceptor_Filter_Factory,1); // force replacement + + + return 0; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy.h b/TAO/tao/EndpointPolicy/EndpointPolicy.h new file mode 100644 index 00000000000..14c9bd7f1a0 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy.h @@ -0,0 +1,50 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file EndpointPolicy.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_ENDPOINTPOLICY_H +#define TAO_ENDPOINTPOLICY_H + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Versioned_Namespace.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_EndpointPolicy_Export TAO_EndpointPolicy_Initializer +{ +public: + /// Used to force the initialization of the ORB code. + static int init (void); +}; + +static int +TAO_Requires_EndpointPolicy_Initializer = TAO_EndpointPolicy_Initializer::init (); + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#define TAO_ENDPOINTPOLICY_SAFE_INCLUDE +#include "tao/EndpointPolicy/EndpointPolicyC.h" +#include "tao/EndpointPolicy/EndpointPolicyA.h" +#include "tao/IOP_IORC.h" +#include "tao/AnyTypeCode/Any.h" +#undef TAO_ENDPOINTPOLICY_SAFE_INCLUDE + +#endif /* TAO_ENDPOINTPOLICY_H */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy.pidl b/TAO/tao/EndpointPolicy/EndpointPolicy.pidl new file mode 100644 index 00000000000..4b0fcede25f --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy.pidl @@ -0,0 +1,55 @@ +// +// $Id$ +// +// ================================================================ +// +// = LIBRARY +// EndpointPolicy +// +// = FILENAME +// EndpointPolicy.pidl +// +// = DESCRIPTION +// This file contains idl definition for Endpoint policy interface and +// the policy value. This TAO-specific policy is used to filter endpoints +// in the profiles for use in Object References. +// +// +// This file was used to generate the code in +// EndpointPolicyC.* The command used to generate code +// is: +/* + $ACE_ROOT/bin/tao_idl \ + -Ge 1 -Sc \ + -Wb,export_macro=TAO_EndpointPolicy_Export \ + -Wb,export_include="tao/EndpointPolicy/EndpointPolicy_Export.h" \ + -Wb,pre_include="ace/pre.h" \ + -Wb,post_include="ace/post.h" \ + EndpointPolicy.pidl +*/ +// ================================================================ + +#ifndef _TAO_ENDPOINT_POLICY_IDL_ +#define _TAO_ENDPOINT_POLICY_IDL_ + +///FUZZ: disable check_for_include/ +#include "tao/Policy.pidl" +#include "tao/EndpointPolicy/EndpointPolicyType.pidl" + +module EndpointPolicy +{ + local interface EndpointValueBase + { + readonly attribute unsigned long protocol_tag; + }; + + typedef sequence<EndpointValueBase> EndpointList; + + local interface Policy : CORBA::Policy + { + readonly attribute EndpointList value; + }; +}; + + +#endif /* _TAO_ENDPOINT_POLICY_IDL_ */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyA.cpp b/TAO/tao/EndpointPolicy/EndpointPolicyA.cpp new file mode 100644 index 00000000000..94a683d6b1f --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyA.cpp @@ -0,0 +1,212 @@ +// -*- 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 "EndpointPolicyA.h" +#include "tao/AnyTypeCode/Null_RefCount_Policy.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" +#include "tao/AnyTypeCode/Objref_TypeCode_Static.h" +#include "tao/AnyTypeCode/Sequence_TypeCode_Static.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/CDR.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/AnyTypeCode/Any_Impl_T.h" +#include "tao/AnyTypeCode/Any_Dual_Impl_T.h" + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_EndpointPolicy_EndpointValueBase ( + ::CORBA::tk_local_interface, + "IDL:EndpointPolicy/EndpointValueBase:1.0", + "EndpointValueBase"); + +namespace EndpointPolicy +{ + ::CORBA::TypeCode_ptr const _tc_EndpointValueBase = + &_tao_tc_EndpointPolicy_EndpointValueBase; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_typecode/alias_typecode.cpp:50 + + + +// TAO_IDL - Generated from +// be/be_visitor_typecode/typecode_defn.cpp:942 + + +#ifndef _TAO_TYPECODE_EndpointPolicy_EndpointList_GUARD +#define _TAO_TYPECODE_EndpointPolicy_EndpointList_GUARD + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + namespace TypeCode + { + TAO::TypeCode::Sequence< ::CORBA::TypeCode_ptr const *, + TAO::Null_RefCount_Policy> + EndpointPolicy_EndpointList_0 ( + ::CORBA::tk_sequence, + &EndpointPolicy::_tc_EndpointValueBase, + 0U); + + ::CORBA::TypeCode_ptr const tc_EndpointPolicy_EndpointList_0 = + &EndpointPolicy_EndpointList_0; + + } +} + + +TAO_END_VERSIONED_NAMESPACE_DECL + + +#endif /* _TAO_TYPECODE_EndpointPolicy_EndpointList_GUARD */ + +static TAO::TypeCode::Alias<char const *, + ::CORBA::TypeCode_ptr const *, + TAO::Null_RefCount_Policy> + _tao_tc_EndpointPolicy_EndpointList ( + ::CORBA::tk_alias, + "IDL:EndpointPolicy/EndpointList:1.0", + "EndpointList", + &TAO::TypeCode::tc_EndpointPolicy_EndpointList_0); + +namespace EndpointPolicy +{ + ::CORBA::TypeCode_ptr const _tc_EndpointList = + &_tao_tc_EndpointPolicy_EndpointList; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_EndpointPolicy_Policy ( + ::CORBA::tk_local_interface, + "IDL:EndpointPolicy/Policy:1.0", + "Policy"); + +namespace EndpointPolicy +{ + ::CORBA::TypeCode_ptr const _tc_Policy = + &_tao_tc_EndpointPolicy_Policy; +} + + + +// TAO_IDL - Generated from +// be/be_visitor_sequence/any_op_cs.cpp:54 + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + template<> + ::CORBA::Boolean + Any_Dual_Impl_T<EndpointPolicy::EndpointList>::marshal_value (TAO_OutputCDR &) + { + return false; + } + + template<> + ::CORBA::Boolean + Any_Dual_Impl_T<EndpointPolicy::EndpointList>::demarshal_value (TAO_InputCDR &) + { + return false; + } +} + +// Copying insertion. +void operator<<= ( + ::CORBA::Any &_tao_any, + const EndpointPolicy::EndpointList &_tao_elem + ) +{ + if (0 == &_tao_elem) // Trying to de-reference NULL object + _tao_any <<= static_cast<EndpointPolicy::EndpointList *>( 0 ); // Use non-copying insertion of a NULL + else + TAO::Any_Dual_Impl_T<EndpointPolicy::EndpointList>::insert_copy ( + _tao_any, + EndpointPolicy::EndpointList::_tao_any_destructor, + TAO::TypeCode::tc_EndpointPolicy_EndpointList_0, + _tao_elem + ); +} + +// Non-copying insertion. +void operator<<= ( + ::CORBA::Any &_tao_any, + EndpointPolicy::EndpointList *_tao_elem + ) +{ + TAO::Any_Dual_Impl_T<EndpointPolicy::EndpointList>::insert ( + _tao_any, + EndpointPolicy::EndpointList::_tao_any_destructor, + TAO::TypeCode::tc_EndpointPolicy_EndpointList_0, + _tao_elem + ); +} + +// Extraction to non-const pointer (deprecated). +::CORBA::Boolean operator>>= ( + const ::CORBA::Any &_tao_any, + EndpointPolicy::EndpointList *&_tao_elem + ) +{ + return _tao_any >>= const_cast< + const EndpointPolicy::EndpointList *&> ( + _tao_elem + ); +} + +// Extraction to const pointer. +::CORBA::Boolean operator>>= ( + const ::CORBA::Any &_tao_any, + const EndpointPolicy::EndpointList *&_tao_elem + ) +{ + return + TAO::Any_Dual_Impl_T<EndpointPolicy::EndpointList>::extract ( + _tao_any, + EndpointPolicy::EndpointList::_tao_any_destructor, + TAO::TypeCode::tc_EndpointPolicy_EndpointList_0, + _tao_elem + ); +} +TAO_END_VERSIONED_NAMESPACE_DECL + + diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyA.h b/TAO/tao/EndpointPolicy/EndpointPolicyA.h new file mode 100644 index 00000000000..f8e99832e13 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyA.h @@ -0,0 +1,84 @@ +// -*- 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:796 + +#ifndef _TAO_IDL_ENDPOINTPOLICYA_H_ +#define _TAO_IDL_ENDPOINTPOLICYA_H_ + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" +#include "tao/EndpointPolicy/EndpointPolicyC.h" +#include "tao/AnyTypeCode/PolicyA.h" +#include "tao/EndpointPolicy/EndpointPolicyTypeA.h" + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:59 + +namespace EndpointPolicy +{ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern TAO_EndpointPolicy_Export ::CORBA::TypeCode_ptr const _tc_EndpointValueBase; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern TAO_EndpointPolicy_Export ::CORBA::TypeCode_ptr const _tc_EndpointList; + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern TAO_EndpointPolicy_Export ::CORBA::TypeCode_ptr const _tc_Policy; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:86 + +} // module EndpointPolicy + +// TAO_IDL - Generated from +// be/be_visitor_sequence/any_op_ch.cpp:53 + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_EndpointPolicy_Export void operator<<= ( ::CORBA::Any &, const EndpointPolicy::EndpointList &); // copying version +TAO_EndpointPolicy_Export void operator<<= ( ::CORBA::Any &, EndpointPolicy::EndpointList*); // noncopying version +TAO_EndpointPolicy_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, EndpointPolicy::EndpointList *&); // deprecated +TAO_EndpointPolicy_Export ::CORBA::Boolean operator>>= (const ::CORBA::Any &, const EndpointPolicy::EndpointList *&); +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyC.cpp b/TAO/tao/EndpointPolicy/EndpointPolicyC.cpp new file mode 100644 index 00000000000..de557e569ac --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyC.cpp @@ -0,0 +1,356 @@ +// -*- 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:282 + + +#include "EndpointPolicyC.h" +#include "tao/CDR.h" +#include "ace/OS_NS_string.h" + +#if !defined (__ACE_INLINE__) +#include "EndpointPolicyC.inl" +#endif /* !defined INLINE */ + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:71 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for EndpointPolicy::EndpointValueBase. + +EndpointPolicy::EndpointValueBase_ptr +TAO::Objref_Traits<EndpointPolicy::EndpointValueBase>::duplicate ( + EndpointPolicy::EndpointValueBase_ptr p + ) +{ + return EndpointPolicy::EndpointValueBase::_duplicate (p); +} + +void +TAO::Objref_Traits<EndpointPolicy::EndpointValueBase>::release ( + EndpointPolicy::EndpointValueBase_ptr p + ) +{ + ::CORBA::release (p); +} + +EndpointPolicy::EndpointValueBase_ptr +TAO::Objref_Traits<EndpointPolicy::EndpointValueBase>::nil (void) +{ + return EndpointPolicy::EndpointValueBase::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<EndpointPolicy::EndpointValueBase>::marshal ( + const EndpointPolicy::EndpointValueBase_ptr p, + TAO_OutputCDR & cdr + ) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +EndpointPolicy::EndpointValueBase::EndpointValueBase (void) +{} + +EndpointPolicy::EndpointValueBase::~EndpointValueBase (void) +{} + +EndpointPolicy::EndpointValueBase_ptr +EndpointPolicy::EndpointValueBase::_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return EndpointValueBase::_duplicate ( + dynamic_cast<EndpointValueBase_ptr> (_tao_objref) + ); +} + +EndpointPolicy::EndpointValueBase_ptr +EndpointPolicy::EndpointValueBase::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return EndpointValueBase::_duplicate ( + dynamic_cast<EndpointValueBase_ptr> (_tao_objref) + ); +} + +EndpointPolicy::EndpointValueBase_ptr +EndpointPolicy::EndpointValueBase::_duplicate (EndpointValueBase_ptr obj) +{ + if (! ::CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +EndpointPolicy::EndpointValueBase::_tao_release (EndpointValueBase_ptr obj) +{ + ::CORBA::release (obj); +} + +::CORBA::Boolean +EndpointPolicy::EndpointValueBase::_is_a ( + const char *value + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:EndpointPolicy/EndpointValueBase:1.0" + ) || + !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* EndpointPolicy::EndpointValueBase::_interface_repository_id (void) const +{ + return "IDL:EndpointPolicy/EndpointValueBase:1.0"; +} + +::CORBA::Boolean +EndpointPolicy::EndpointValueBase::marshal (TAO_OutputCDR &) +{ + return false; +} + +// TAO_IDL - Generated from +// be/be_visitor_sequence/sequence_cs.cpp:65 + +#if !defined (_ENDPOINTPOLICY_ENDPOINTLIST_CS_) +#define _ENDPOINTPOLICY_ENDPOINTLIST_CS_ + +EndpointPolicy::EndpointList::EndpointList (void) +{} + +EndpointPolicy::EndpointList::EndpointList ( + ::CORBA::ULong max + ) + : TAO::unbounded_object_reference_sequence< + EndpointValueBase, + EndpointValueBase_var + > + (max) +{} + +EndpointPolicy::EndpointList::EndpointList ( + ::CORBA::ULong max, + ::CORBA::ULong length, + EndpointPolicy::EndpointValueBase_ptr * buffer, + ::CORBA::Boolean release + ) + : TAO::unbounded_object_reference_sequence< + EndpointValueBase, + EndpointValueBase_var + > + (max, length, buffer, release) +{} + +EndpointPolicy::EndpointList::EndpointList ( + const EndpointList &seq + ) + : TAO::unbounded_object_reference_sequence< + EndpointValueBase, + EndpointValueBase_var + > + (seq) +{} + +EndpointPolicy::EndpointList::~EndpointList (void) +{} + +void EndpointPolicy::EndpointList::_tao_any_destructor ( + void * _tao_void_pointer + ) +{ + EndpointList * _tao_tmp_pointer = + static_cast<EndpointList *> (_tao_void_pointer); + delete _tao_tmp_pointer; +} + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for EndpointPolicy::Policy. + +EndpointPolicy::Policy_ptr +TAO::Objref_Traits<EndpointPolicy::Policy>::duplicate ( + EndpointPolicy::Policy_ptr p + ) +{ + return EndpointPolicy::Policy::_duplicate (p); +} + +void +TAO::Objref_Traits<EndpointPolicy::Policy>::release ( + EndpointPolicy::Policy_ptr p + ) +{ + ::CORBA::release (p); +} + +EndpointPolicy::Policy_ptr +TAO::Objref_Traits<EndpointPolicy::Policy>::nil (void) +{ + return EndpointPolicy::Policy::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<EndpointPolicy::Policy>::marshal ( + const EndpointPolicy::Policy_ptr p, + TAO_OutputCDR & cdr + ) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +EndpointPolicy::Policy::Policy (void) +{} + +EndpointPolicy::Policy::~Policy (void) +{} + +EndpointPolicy::Policy_ptr +EndpointPolicy::Policy::_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return Policy::_duplicate ( + dynamic_cast<Policy_ptr> (_tao_objref) + ); +} + +EndpointPolicy::Policy_ptr +EndpointPolicy::Policy::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return Policy::_duplicate ( + dynamic_cast<Policy_ptr> (_tao_objref) + ); +} + +EndpointPolicy::Policy_ptr +EndpointPolicy::Policy::_duplicate (Policy_ptr obj) +{ + if (! ::CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +EndpointPolicy::Policy::_tao_release (Policy_ptr obj) +{ + ::CORBA::release (obj); +} + +::CORBA::Boolean +EndpointPolicy::Policy::_is_a ( + const char *value + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:omg.org/CORBA/Policy:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:EndpointPolicy/Policy:1.0" + ) || + !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* EndpointPolicy::Policy::_interface_repository_id (void) const +{ + return "IDL:EndpointPolicy/Policy:1.0"; +} + +::CORBA::Boolean +EndpointPolicy::Policy::marshal (TAO_OutputCDR &) +{ + return false; +} + diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyC.h b/TAO/tao/EndpointPolicy/EndpointPolicyC.h new file mode 100644 index 00000000000..12a7836e99f --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyC.h @@ -0,0 +1,393 @@ +// -*- 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:154 + +#ifndef _TAO_IDL_ENDPOINTPOLICYC_H_ +#define _TAO_IDL_ENDPOINTPOLICYC_H_ + +#include /**/ "ace/pre.h" + + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" +#include "tao/ORB.h" +#include "tao/SystemException.h" +#include "tao/Environment.h" +#include "tao/Object.h" +#include "tao/Sequence_T.h" +#include "tao/Objref_VarOut_T.h" +#include "tao/Seq_Var_T.h" +#include "tao/Seq_Out_T.h" +#include "tao/Versioned_Namespace.h" + +#include "tao/PolicyC.h" +#include "tao/EndpointPolicy/EndpointPolicyTypeC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO TAO_EndpointPolicy_Export + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:49 + +namespace EndpointPolicy +{ + + // TAO_IDL - Generated from + // be/be_interface.cpp:640 + +#if !defined (_ENDPOINTPOLICY_ENDPOINTVALUEBASE__VAR_OUT_CH_) +#define _ENDPOINTPOLICY_ENDPOINTVALUEBASE__VAR_OUT_CH_ + + class EndpointValueBase; + typedef EndpointValueBase *EndpointValueBase_ptr; + + typedef + TAO_Objref_Var_T< + EndpointValueBase + > + EndpointValueBase_var; + + typedef + TAO_Objref_Out_T< + EndpointValueBase + > + EndpointValueBase_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_ENDPOINTPOLICY_ENDPOINTVALUEBASE_CH_) +#define _ENDPOINTPOLICY_ENDPOINTVALUEBASE_CH_ + + class TAO_EndpointPolicy_Export EndpointValueBase + : public virtual ::CORBA::Object + { + public: + typedef EndpointValueBase_ptr _ptr_type; + typedef EndpointValueBase_var _var_type; + + // The static operations. + static EndpointValueBase_ptr _duplicate (EndpointValueBase_ptr obj); + + static void _tao_release (EndpointValueBase_ptr obj); + + static EndpointValueBase_ptr _narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static EndpointValueBase_ptr _unchecked_narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static EndpointValueBase_ptr _nil (void) + { + return static_cast<EndpointValueBase_ptr> (0); + } + + + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::CORBA::ULong protocol_tag ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 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. + EndpointValueBase (void); + + virtual ~EndpointValueBase (void); + + private: + // Private and unimplemented for concrete interfaces. + EndpointValueBase (const EndpointValueBase &); + + void operator= (const EndpointValueBase &); + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_sequence/sequence_ch.cpp:101 + +#if !defined (_ENDPOINTPOLICY_ENDPOINTLIST_CH_) +#define _ENDPOINTPOLICY_ENDPOINTLIST_CH_ + + class EndpointList; + + typedef + TAO_VarSeq_Var_T< + EndpointList + > + EndpointList_var; + + typedef + TAO_Seq_Out_T< + EndpointList + > + EndpointList_out; + + class TAO_EndpointPolicy_Export EndpointList + : public + TAO::unbounded_object_reference_sequence< + EndpointValueBase, + EndpointValueBase_var + > + { + public: + EndpointList (void); + EndpointList ( ::CORBA::ULong max); + EndpointList ( + ::CORBA::ULong max, + ::CORBA::ULong length, + EndpointValueBase_ptr* buffer, + ::CORBA::Boolean release = false + ); + EndpointList (const EndpointList &); + ~EndpointList (void); + + static void _tao_any_destructor (void *); + + typedef EndpointList_var _var_type; + }; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_interface.cpp:640 + +#if !defined (_ENDPOINTPOLICY_POLICY__VAR_OUT_CH_) +#define _ENDPOINTPOLICY_POLICY__VAR_OUT_CH_ + + class Policy; + typedef Policy *Policy_ptr; + + typedef + TAO_Objref_Var_T< + Policy + > + Policy_var; + + typedef + TAO_Objref_Out_T< + Policy + > + Policy_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_ENDPOINTPOLICY_POLICY_CH_) +#define _ENDPOINTPOLICY_POLICY_CH_ + + class TAO_EndpointPolicy_Export Policy + : public virtual ::CORBA::Policy + { + public: + typedef Policy_ptr _ptr_type; + typedef Policy_var _var_type; + + // The static operations. + static Policy_ptr _duplicate (Policy_ptr obj); + + static void _tao_release (Policy_ptr obj); + + static Policy_ptr _narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Policy_ptr _unchecked_narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static Policy_ptr _nil (void) + { + return static_cast<Policy_ptr> (0); + } + + + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::EndpointPolicy::EndpointList * value ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::CORBA::Policy_ptr copy ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void destroy ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 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. + Policy (void); + + virtual ~Policy (void); + + private: + // Private and unimplemented for concrete interfaces. + Policy (const Policy &); + + void operator= (const Policy &); + }; + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:78 + +} // module EndpointPolicy + +// TAO_IDL - Generated from +// be/be_visitor_traits.cpp:63 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Traits specializations. +namespace TAO +{ + +#if !defined (_ENDPOINTPOLICY_ENDPOINTVALUEBASE__TRAITS_) +#define _ENDPOINTPOLICY_ENDPOINTVALUEBASE__TRAITS_ + + template<> + struct TAO_EndpointPolicy_Export Objref_Traits< ::EndpointPolicy::EndpointValueBase> + { + static ::EndpointPolicy::EndpointValueBase_ptr duplicate ( + ::EndpointPolicy::EndpointValueBase_ptr + ); + static void release ( + ::EndpointPolicy::EndpointValueBase_ptr + ); + static ::EndpointPolicy::EndpointValueBase_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::EndpointPolicy::EndpointValueBase_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ + +#if !defined (_ENDPOINTPOLICY_POLICY__TRAITS_) +#define _ENDPOINTPOLICY_POLICY__TRAITS_ + + template<> + struct TAO_EndpointPolicy_Export Objref_Traits< ::EndpointPolicy::Policy> + { + static ::EndpointPolicy::Policy_ptr duplicate ( + ::EndpointPolicy::Policy_ptr + ); + static void release ( + ::EndpointPolicy::Policy_ptr + ); + static ::EndpointPolicy::Policy_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::EndpointPolicy::Policy_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1092 +#if defined (__ACE_INLINE__) +#include "EndpointPolicyC.inl" +#endif /* defined INLINE */ + +#include /**/ "ace/post.h" + +#endif /* ifndef */ + + diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyC.inl b/TAO/tao/EndpointPolicy/EndpointPolicyC.inl new file mode 100644 index 00000000000..38aa32569ba --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyC.inl @@ -0,0 +1,28 @@ +// -*- 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 + + diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyType.pidl b/TAO/tao/EndpointPolicy/EndpointPolicyType.pidl new file mode 100644 index 00000000000..2a07f2c886a --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyType.pidl @@ -0,0 +1,41 @@ +// +// $Id$ +// +// ================================================================ +// +// = LIBRARY +// EndpointPolicy +// +// = FILENAME +// EndpointPolicyType.pidl +// +// = DESCRIPTION +// This file contains idl definition for EndpointPolicy type. +// +// +// This file was used to generate the code in +// EndpointPolicyTypeC.* The command used to generate code +// is: +// +// tao_idl +// -o orig -Ge 1 -GA -Sc \ +// -Wb,export_macro=TAO_EndpointPolicy_Export \ +// -Wb,export_include="tao/EndpointPolicy/TAO_EndpointPolicy_Export.h" \ +// -Wb,pre_include="ace/pre.h" \ +// -Wb,post_include="ace/post.h" \ +// EndpointPolicyType.pidl +// +// ================================================================ + +#ifndef _TAO_ENDPOINT_POLICY_TYPE_IDL_ +#define _TAO_ENDPOINT_POLICY_TYPE_IDL_ + +#include "tao/Policy.pidl" + +module EndpointPolicy +{ + const CORBA::PolicyType ENDPOINT_POLICY_TYPE = 0x4f43000c; +}; + + +#endif /* _TAO_ENDPOINT_POLICY_TYPE_IDL_ */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp new file mode 100644 index 00000000000..c4c90d969c0 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.cpp @@ -0,0 +1,33 @@ +// -*- 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 "tao/EndpointPolicy/EndpointPolicyTypeA.h" +#include "tao/AnyTypeCode/Null_RefCount_Policy.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/CDR.h" diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h new file mode 100644 index 00000000000..a7953240ff9 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeA.h @@ -0,0 +1,54 @@ +// -*- 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:797 + +#ifndef _TAO_IDL_ENDPOINTPOLICYTYPEA_H_ +#define _TAO_IDL_ENDPOINTPOLICYTYPEA_H_ + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" +#include "tao/EndpointPolicy/EndpointPolicyTypeC.h" +#include "tao/AnyTypeCode/PolicyA.h" + + +// TAO_IDL - Generated from +// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:59 + +namespace EndpointPolicy +{ + +// TAO_IDL - Generated from +// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:86 + +} // module EndpointPolicy + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp new file mode 100644 index 00000000000..a3f9a0e196d --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.cpp @@ -0,0 +1,49 @@ +// -*- 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:283 + + +#include "tao/EndpointPolicy/EndpointPolicyTypeC.h" +#include "tao/CDR.h" + +// TAO_IDL - Generated from +// .\be\be_visitor_arg_traits.cpp:70 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + diff --git a/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h new file mode 100644 index 00000000000..59b8f094a5b --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicyTypeC.h @@ -0,0 +1,90 @@ +// -*- 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:155 + +#ifndef _TAO_IDL_ENDPOINTPOLICYTYPEC_H_ +#define _TAO_IDL_ENDPOINTPOLICYTYPEC_H_ + +#include /**/ "ace/pre.h" + + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" +#include "tao/ORB.h" +#include "tao/SystemException.h" +#include "tao/Environment.h" +#include "tao/Versioned_Namespace.h" + +#include "tao/PolicyC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO TAO_EndpointPolicy_Export + +// TAO_IDL - Generated from +// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:49 + +namespace EndpointPolicy +{ + + // TAO_IDL - Generated from + // c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_constant/constant_ch.cpp:52 + + const CORBA::PolicyType ENDPOINT_POLICY_TYPE = 1329790988U; + +// TAO_IDL - Generated from +// c:\ticket\tao-1_4_8_merge\ace_wrappers\tao\tao_idl\be\be_visitor_module/module_ch.cpp:78 + +} // module EndpointPolicy + +// TAO_IDL - Generated from +// .\be\be_visitor_traits.cpp:62 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Traits specializations. +namespace TAO +{ +} +TAO_END_VERSIONED_NAMESPACE_DECL + + + +#include /**/ "ace/post.h" + +#endif /* ifndef */ + + diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Export.h b/TAO/tao/EndpointPolicy/EndpointPolicy_Export.h new file mode 100644 index 00000000000..d9940484cfe --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s TAO_EndpointPolicy +// ------------------------------ +#ifndef TAO_ENDPOINTPOLICY_EXPORT_H +#define TAO_ENDPOINTPOLICY_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_ENDPOINTPOLICY_HAS_DLL) +# define TAO_ENDPOINTPOLICY_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && TAO_ENDPOINTPOLICY_HAS_DLL */ + +#if !defined (TAO_ENDPOINTPOLICY_HAS_DLL) +# define TAO_ENDPOINTPOLICY_HAS_DLL 1 +#endif /* ! TAO_ENDPOINTPOLICY_HAS_DLL */ + +#if defined (TAO_ENDPOINTPOLICY_HAS_DLL) && (TAO_ENDPOINTPOLICY_HAS_DLL == 1) +# if defined (TAO_ENDPOINTPOLICY_BUILD_DLL) +# define TAO_EndpointPolicy_Export ACE_Proper_Export_Flag +# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_ENDPOINTPOLICY_BUILD_DLL */ +# define TAO_EndpointPolicy_Export ACE_Proper_Import_Flag +# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_ENDPOINTPOLICY_BUILD_DLL */ +#else /* TAO_ENDPOINTPOLICY_HAS_DLL == 1 */ +# define TAO_EndpointPolicy_Export +# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARATION(T) +# define TAO_ENDPOINTPOLICY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_ENDPOINTPOLICY_HAS_DLL == 1 */ + +// Set TAO_ENDPOINTPOLICY_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TAO_ENDPOINTPOLICY_NTRACE) +# if (ACE_NTRACE == 1) +# define TAO_ENDPOINTPOLICY_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TAO_ENDPOINTPOLICY_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TAO_ENDPOINTPOLICY_NTRACE */ + +#if (TAO_ENDPOINTPOLICY_NTRACE == 1) +# define TAO_ENDPOINTPOLICY_TRACE(X) +#else /* (TAO_ENDPOINTPOLICY_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define TAO_ENDPOINTPOLICY_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (TAO_ENDPOINTPOLICY_NTRACE == 1) */ + +#endif /* TAO_ENDPOINTPOLICY_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp new file mode 100644 index 00000000000..11c4a887519 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.cpp @@ -0,0 +1,94 @@ +// @(#) $Id$ +#include "tao/EndpointPolicy/EndpointPolicy_Factory.h" + +ACE_RCSID (EndpointPolicy, + EndpointPolicy_Factory, + "$Id$") + +#include "tao/EndpointPolicy/EndpointPolicy_i.h" +#include "tao/EndpointPolicy/EndpointPolicyA.h" +#include "tao/EndpointPolicy/Endpoint_Value_Impl.h" + +#include "tao/PolicyC.h" +#include "tao/ORB_Constants.h" +#include "tao/ORB_Core.h" +#include "tao/Acceptor_Registry.h" +#include "tao/AnyTypeCode/TAOA.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/Thread_Lane_Resources.h" +#include "tao/Transport_Acceptor.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +TAO_EndpointPolicy_Factory::TAO_EndpointPolicy_Factory (TAO_ORB_Core * orb_core) +: orb_core_ (orb_core) +{ +} + + +CORBA::Policy_ptr +TAO_EndpointPolicy_Factory::create_policy ( + CORBA::PolicyType type, + const CORBA::Any &value + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException, + CORBA::PolicyError)) +{ + if (type == EndpointPolicy::ENDPOINT_POLICY_TYPE) + { + const EndpointPolicy::EndpointList* endpoint_list; + if ((value >>= endpoint_list) == 0) + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE), + CORBA::Policy::_nil ()); + + TAO_Acceptor_Registry & registry + = this->orb_core_->lane_resources ().acceptor_registry (); + + TAO_Acceptor ** acceptors_begin = registry.begin (); + TAO_Acceptor ** acceptors_end = registry.end (); + CORBA::ULong num_eps = endpoint_list->length (); + + // The endpoint list in the value is validated to ensure that + // at least one endpoint in the list matches an endpoint the + // ORB is listening on. + + bool found_one = true; + for (CORBA::ULong idx = 0; !found_one && idx < num_eps; ++idx) + { + CORBA::ULong prot_tag = (*endpoint_list)[idx]->protocol_tag(); + + const TAO_Endpoint_Value_Impl *evi = + dynamic_cast <const TAO_Endpoint_Value_Impl*> ((*endpoint_list)[idx]); + + for (TAO_Acceptor** acceptor = acceptors_begin; + !found_one && acceptor != acceptors_end; + ++acceptor) + { + if ((*acceptor)->tag() == prot_tag) + found_one = evi->validate_acceptor(*acceptor); + } + } + // There is no endpoint policy value matches an endpoint the ORB + // is listening on. A CORBA::PolicyError exception with a + // PolicyErrorCode of UNSUPPORTED_POLICY_VALUE is raised. + if (!found_one) + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::UNSUPPORTED_POLICY_VALUE), + CORBA::Policy::_nil ()); + + TAO_EndpointPolicy_i *tmp; + ACE_NEW_THROW_EX (tmp, + TAO_EndpointPolicy_i (*endpoint_list), + CORBA::NO_MEMORY (TAO::VMCID, + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return tmp; + } + else + ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), + CORBA::Policy::_nil ()); +} + + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h new file mode 100644 index 00000000000..667c7f2aa9a --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_Factory.h @@ -0,0 +1,67 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file EndpointPolicy_Factory.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_ENDPOINTPOLICY_FACTORY_H +#define TAO_ENDPOINTPOLICY_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations. +class TAO_ORB_Core; + +/// Policy factory for the endpoint policies. +class TAO_EndpointPolicy_Export TAO_EndpointPolicy_Factory + : public virtual PortableInterceptor::PolicyFactory, + public virtual TAO_Local_RefCounted_Object +{ +public: + + TAO_EndpointPolicy_Factory (TAO_ORB_Core * orb_core); + + virtual 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)); +private: + + TAO_ORB_Core * orb_core_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" + +#endif /* TAO_ENDPOINTPOLICY_FACTORY_H */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp new file mode 100644 index 00000000000..d457e78d389 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.cpp @@ -0,0 +1,86 @@ +// $Id$ + +#include "tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h" + +#include "tao/EndpointPolicy/EndpointPolicyC.h" +#include "tao/EndpointPolicy/EndpointPolicy_Factory.h" +#include "tao/ORB_Core.h" +#include "tao/PI/ORBInitInfo.h" + +ACE_RCSID (EndpointPolicy, + EndpointPolicy_ORBInitializer, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +void +TAO_EndpointPolicy_ORBInitializer::pre_init ( + PortableInterceptor::ORBInitInfo_ptr + ACE_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +void +TAO_EndpointPolicy_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_EndpointPolicy_ORBInitializer::register_policy_factories ( + PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL) +{ + TAO_ORBInitInfo * local_info = dynamic_cast <TAO_ORBInitInfo *> (info); + TAO_ORB_Core * the_orb_core = local_info->orb_core (); + + // Register the EndpointPolicy policy factories. + PortableInterceptor::PolicyFactory_ptr policy_factory_ptr; + ACE_NEW_THROW_EX (policy_factory_ptr, + TAO_EndpointPolicy_Factory(the_orb_core), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO::VMCID, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + + + PortableInterceptor::PolicyFactory_var policy_factory = + policy_factory_ptr; + + ACE_TRY + { + info->register_policy_factory (EndpointPolicy::ENDPOINT_POLICY_TYPE, + 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 Messaging.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; +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h new file mode 100644 index 00000000000..daeeff7f2c0 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_ORBInitializer.h @@ -0,0 +1,79 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file EndpointPolicy_ORBInitializer.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_ENDPOINTPOLICY_ORB_INITIALIZER_H +#define TAO_ENDPOINTPOLICY_ORB_INITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PI/PI.h" +#include "tao/LocalObject.h" + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/// EndpointPolicy ORB initializer. +class TAO_EndpointPolicy_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. + */ + //@{ + + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + //@} + +private: + + /// Register Endpoint policy factories. + void register_policy_factories ( + PortableInterceptor::ORBInitInfo_ptr info + ACE_ENV_ARG_DECL); + +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" + +#endif /* TAO_ENDPOINTPOLICY_ORB_INITIALIZER_H */ diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp b/TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp new file mode 100644 index 00000000000..41df9fe5175 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp @@ -0,0 +1,84 @@ +// $Id$ + +#include "tao/EndpointPolicy/EndpointPolicy_i.h" + +#include "tao/SystemException.h" + +ACE_RCSID (EndpointPolicy, + EndpointPolicy_i, + "$Id$") + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_EndpointPolicy_i::TAO_EndpointPolicy_i (const EndpointPolicy::EndpointList &value) +: value_ (value) +{ +} + +TAO_EndpointPolicy_i::TAO_EndpointPolicy_i (const TAO_EndpointPolicy_i &rhs) + : ACE_NESTED_CLASS (CORBA, Object) () + , ACE_NESTED_CLASS (CORBA, Policy) () + , ACE_NESTED_CLASS (EndpointPolicy, Policy) () + , ACE_NESTED_CLASS (CORBA, LocalObject) () + , TAO_Local_RefCounted_Object () + , value_ (rhs.value_) +{ +} + +CORBA::PolicyType +TAO_EndpointPolicy_i::policy_type (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return EndpointPolicy::ENDPOINT_POLICY_TYPE; +} + +TAO_EndpointPolicy_i * +TAO_EndpointPolicy_i::clone (void) const +{ + TAO_EndpointPolicy_i *copy = 0; + ACE_NEW_RETURN (copy, + TAO_EndpointPolicy_i (*this), + 0); + return copy; +} + +EndpointPolicy::EndpointList * +TAO_EndpointPolicy_i::value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + EndpointPolicy::EndpointList* list = 0; + ACE_NEW_RETURN (list, + EndpointPolicy::EndpointList (this->value_), + 0); + + return list; +} + +CORBA::Policy_ptr +TAO_EndpointPolicy_i::copy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + TAO_EndpointPolicy_i* servant = 0; + ACE_NEW_THROW_EX (servant, + TAO_EndpointPolicy_i (*this), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CORBA::Policy::_nil ()); + + return servant; +} + +void +TAO_EndpointPolicy_i::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ +} + +TAO_Cached_Policy_Type +TAO_EndpointPolicy_i::_tao_cached_type (void) const +{ + return TAO_CACHED_POLICY_ENDPOINT; +} + + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/EndpointPolicy/EndpointPolicy_i.h b/TAO/tao/EndpointPolicy/EndpointPolicy_i.h new file mode 100644 index 00000000000..c41626ba4d8 --- /dev/null +++ b/TAO/tao/EndpointPolicy/EndpointPolicy_i.h @@ -0,0 +1,93 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file EndpointPolicy_i.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_ENDPOINTPOLICY_I_H +#define TAO_ENDPOINTPOLICY_I_H + +#include /**/ "ace/pre.h" + +#include "tao/TAOC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/EndpointPolicy/EndpointPolicyC.h" +#include "tao/LocalObject.h" + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +/** + * @class TAO_EndpointPolicy_i + * + * @brief Implementation class for TAO-specific Endpoint Policy. + * + * This policy is used to filter the endpoints in profiles during + * the creation of object references. + */ +class TAO_EndpointPolicy_Export TAO_EndpointPolicy_i + : public virtual EndpointPolicy::Policy, + public virtual TAO_Local_RefCounted_Object +{ +public: + /// Constructor. + TAO_EndpointPolicy_i (const EndpointPolicy::EndpointList &value); + + /// Copy constructor. + TAO_EndpointPolicy_i (const TAO_EndpointPolicy_i &rhs); + + /// Returns a copy of <this>. + virtual TAO_EndpointPolicy_i *clone (void) const; + + // = The EndpointPolicy::Policy methods + + virtual CORBA::PolicyType policy_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Policy_ptr copy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Return the cached policy type for this policy. + virtual TAO_Cached_Policy_Type _tao_cached_type (void) const; + + virtual EndpointPolicy::EndpointList * value ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )); + +private: + /// The attribute + EndpointPolicy::EndpointList value_; +}; + + + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /* TAO_ENDPOINTPOLICY_I_H */ diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp new file mode 100644 index 00000000000..dfa5686f7fe --- /dev/null +++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.cpp @@ -0,0 +1,132 @@ +// @(#) $Id$ + +#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter.h" +#include "tao/EndpointPolicy/EndpointPolicyC.h" +#include "tao/EndpointPolicy/Endpoint_Value_Impl.h" + +#include "tao/Transport_Acceptor.h" +#include "tao/MProfile.h" +#include "tao/IIOP_Profile.h" + +ACE_RCSID(EndpointPolicy, + Endpoint_Acceptor_Filter, + "$Id$") + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +TAO_Endpoint_Acceptor_Filter::TAO_Endpoint_Acceptor_Filter (EndpointPolicy::Policy_ptr p) +: endpoints_(p->value()) +{ +} + +int +TAO_Endpoint_Acceptor_Filter::fill_profile (const TAO::ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority) +{ + CORBA::ULong num_endpoints = endpoints_->length (); + + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) EndpointPolicy filtering acceptors") + ACE_TEXT(" - mprofile has %d profiles,") + ACE_TEXT(" endpoint list has %d entries\n"), + mprofile.profile_count(), num_endpoints)); + + for (TAO_Acceptor** acceptor = acceptors_begin; + acceptor != acceptors_end; + ++acceptor) + { + bool tagfound = false; + for (CORBA::ULong epx = 0; !tagfound && epx < num_endpoints; epx++) + { + tagfound = (*acceptor)->tag () == endpoints_[epx]->protocol_tag(); + } + if (!tagfound) + continue; + + if ((*acceptor)->create_profile (object_key, + mprofile, + priority) == -1) + return -1; + } + + for (TAO_PHandle i = 0; i < mprofile.profile_count (); ++i) + { + TAO_Profile *pfile =mprofile.get_profile (i); + + TAO_Endpoint *ep_in_pfile = pfile->endpoint (); + + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) Testing profile %d - ") + ACE_TEXT("it contains %d endpoints\n"), + i, pfile->endpoint_count())); + + bool first_endpoint = true; + // Iterate the endpoints in the profile. + while (ep_in_pfile != 0 && pfile->endpoint_count() > 0) + { + // Iterate the endpoints in the endpoint policy to see if the endpoint + // in the profile matches. + CORBA::ULong j = 0; + bool epmatch = false; + for (j = 0; !epmatch && j < num_endpoints; ++j) + { + if (endpoints_[j]->protocol_tag() != pfile->tag()) + continue; + + const EndpointPolicy::EndpointValueBase *evb = endpoints_[i]; + + const TAO_Endpoint_Value_Impl *evi = + dynamic_cast <const TAO_Endpoint_Value_Impl*>(evb); + + epmatch = evi->is_equivalent(ep_in_pfile); + } + + // The endpoint in profile does not match the endpoint specified in + // Endpoint policy, now remove the endpoint from the profile. + if (!epmatch) + { + //Get next endpoint before removing current one. + TAO_Endpoint * next = ep_in_pfile->next (); + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) EndpointPolicy filter ") + ACE_TEXT ("removing endpoint\n"))); + pfile->remove_generic_endpoint (ep_in_pfile); + ep_in_pfile = first_endpoint ? pfile->endpoint() : next; + } + else + { + ep_in_pfile = ep_in_pfile->next(); + first_endpoint = false; + } + } + // Remove the profiles that have no endpoints match the endpoints in + // endpoint policy. + if (pfile->endpoint_count () == 0) + { + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) EndpointPolicy filter removing profile\n"))); + mprofile.remove_profile (pfile); + --i; // step back one, since we've just shifted the profile list. + } + } + + if (mprofile.profile_count () == 0) { + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("(%P|%t) EndpointPolicy filter eliminated all profiles\n"))); + + return -1; + } + return 0; +} + + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h new file mode 100644 index 00000000000..818c3847455 --- /dev/null +++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Endpoint_Acceptor_Filter.h + * + * $Id$ + * + * Subclass of TAO_Default_Acceptor_Filter that populates mprofile and filters + * mprofile with the endpoint policy in TAO_POA_Manager. + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_ENDPOINT_ACCEPTOR_FILTER_H +#define TAO_ENDPOINT_ACCEPTOR_FILTER_H + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Default_Acceptor_Filter.h" +#include "tao/EndpointPolicy/EndpointPolicyC.h" + +class TAO_POA_Manager; + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +//============================================================================= +/** + * @class TAO_Endpoint_Acceptor_Filter + * + * @brief Subclass of default Acceptor_Filter. + * + * Endpoint strategy for populating mprofile: only the endpoints match + * the POAManager endpoint policy are included. + */ +//============================================================================= +class TAO_EndpointPolicy_Export TAO_Endpoint_Acceptor_Filter + : public TAO_Default_Acceptor_Filter +{ +public: + TAO_Endpoint_Acceptor_Filter (EndpointPolicy::Policy_ptr p); + + /// Populate @a mprofile with endpoints match the POAManager endpoint + /// policy. + int fill_profile (const TAO::ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority = TAO_INVALID_PRIORITY); + +private: + // this is the list of endpoints as obtained from the policy value supplied + // to the constructor. + EndpointPolicy::EndpointList_var endpoints_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_ENDPOINT_ACCEPTOR_FILTER_H */ diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp new file mode 100644 index 00000000000..13aeb5d62da --- /dev/null +++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp @@ -0,0 +1,56 @@ +// @(#) $Id$ + +#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h" +#include "tao/EndpointPolicy/Endpoint_Acceptor_Filter.h" +#include "tao/PortableServer/Default_Acceptor_Filter.h" +#include "tao/PortableServer/POAManager.h" +#include "tao/EndpointPolicy/EndpointPolicyC.h" + +ACE_RCSID(EndpointPolicy, + Endpoint_Acceptor_Filter_Factory, + "$Id$") + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +TAO_Endpoint_Acceptor_Filter_Factory::~TAO_Endpoint_Acceptor_Filter_Factory(void) +{ +} + + TAO_Acceptor_Filter* + TAO_Endpoint_Acceptor_Filter_Factory::create_object (TAO_POA_Manager& poamanager) +{ + CORBA::PolicyList& policies = poamanager.get_policies (); + EndpointPolicy::Policy_var policy; + TAO_Acceptor_Filter* filter = 0; + for (CORBA::ULong i = 0; i < policies.length(); i++) + { + if (policies[i]->policy_type() == EndpointPolicy::ENDPOINT_POLICY_TYPE) + { + policy = EndpointPolicy::Policy::_narrow (policies[0]); + ACE_NEW_RETURN (filter, + TAO_Endpoint_Acceptor_Filter (policy.in()), + 0); + return filter; + } + } + // no policy was in force, just return a default filter + ACE_NEW_RETURN (filter, + TAO_Default_Acceptor_Filter (), + 0); + + return filter; +} + + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_FACTORY_DEFINE (TAO_EndpointPolicy, TAO_Endpoint_Acceptor_Filter_Factory) +ACE_STATIC_SVC_DEFINE (TAO_Endpoint_Acceptor_Filter_Factory, + ACE_TEXT ("TAO_Acceptor_Filter_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_Endpoint_Acceptor_Filter_Factory), + ACE_Service_Type::DELETE_THIS + | ACE_Service_Type::DELETE_OBJ, + 0) diff --git a/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h new file mode 100644 index 00000000000..54a61c45c93 --- /dev/null +++ b/TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h @@ -0,0 +1,56 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Endpoint_Acceptor_Filter_Factory.h + * + * $Id$ + * + * The factory of the TAO_Endpoint_Acceptor_Filter objects. + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + +#ifndef TAO_ENDPOINT_ACCEPTOR_FILTER_FACTORY_H +#define TAO_ENDPOINT_ACCEPTOR_FILTER_FACTORY_H + +#include /**/ "ace/pre.h" +#include "ace/Service_Config.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/Acceptor_Filter_Factory.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class TAO_Endpoint_Acceptor_Filter_Factory + * + * @brief The factory of the TAO_Endpoint_Acceptor_Filter objects. + * + * Factory service object that creates the TAO_Endpoint_Acceptor_Filter objects. + */ +class TAO_EndpointPolicy_Export TAO_Endpoint_Acceptor_Filter_Factory + : public TAO_Acceptor_Filter_Factory +{ +public: + virtual ~TAO_Endpoint_Acceptor_Filter_Factory(void); + + /// Create a new TAO_Endpoint_Acceptor_Filter object. + TAO_Acceptor_Filter* create_object (TAO_POA_Manager& poamanager); +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE_EXPORT (TAO_EndpointPolicy, TAO_Endpoint_Acceptor_Filter_Factory) +ACE_FACTORY_DECLARE (TAO_EndpointPolicy, TAO_Endpoint_Acceptor_Filter_Factory) + + +#include /**/ "ace/post.h" + +#endif /* TAO_ENDPOINT_ACCEPTOR_FILTER_FACTORY_H */ diff --git a/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h b/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h new file mode 100644 index 00000000000..14cc43b7382 --- /dev/null +++ b/TAO/tao/EndpointPolicy/Endpoint_Value_Impl.h @@ -0,0 +1,59 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Endpoint_Value_Impl.h + * + * $Id$ + * + * Implementation of the IIOP-Specific endpoint policy value + * + * @author Phil Mesnier <mesnier_p@ociweb.com> + */ +//============================================================================= + +#ifndef _TAO_ENDPOINT_VALUE_IMPL_H_ +#define _TAO_ENDPOINT_VALUE_IMPL_H_ + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class TAO_Endpoint; +class TAO_Acceptor; + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class Endpoint_Value_Impl + * + * @brief Abstract base class to be mixed in to servants of protocol + * specific EndpointValues. + * + * This inteface defines the methods necessary for the + * protocol-specific endpoint value to be used with the endpoint + * policy + */ + +class TAO_EndpointPolicy_Export TAO_Endpoint_Value_Impl +{ +public: + + /// This method is used to compare a candidate IOR endpoint with the + /// endpoint defined by this policy value. + virtual CORBA::Boolean is_equivalent (const TAO_Endpoint * ) const = 0; + + /// This method is used by the framework to validate that an + /// acceptor is available to produce an endpoint required by at + /// least one of the endpoint policies values. + virtual CORBA::Boolean validate_acceptor (TAO_Acceptor *) const = 0; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* _TAO_Endpoint_Value_Impl_H_ */ diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl b/TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl new file mode 100644 index 00000000000..a1b97a957ad --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValue.pidl @@ -0,0 +1,49 @@ +// +// $Id$ +// +// ================================================================ +// +// = LIBRARY +// EndpointPolicy +// +// = FILENAME +// EndpointPolicy.pidl +// +// = DESCRIPTION +// This file contains idl definition for Endpoint policy interface and +// the policy value. This TAO-specific policy is used to filter endpoints +// in the profiles for use in Object References. +// +// +// This file was used to generate the code in +// EndpointPolicyC.* The command used to generate code +// is: +// +// tao_idl +// -o orig -Ge 1 -GA -Sc \ +// -Wb,export_macro=TAO_EndpointPolicy_Export \ +// -Wb,export_include="tao/EndpointPolicy/EndpointPolicy_Export.h" \ +// -Wb,pre_include="ace/pre.h" \ +// -Wb,post_include="ace/post.h" \ +// IIOPEndpointValue.pidl +// +// ================================================================ + +#ifndef _TAO_IIOPENDPOINT_VALUE_IDL_ +#define _TAO_IIOPENDPOINT_VALUE_IDL_ + +///FUZZ: disable check_for_include/ +#include "tao/EndpointPolicy/EndpointPolicy.pidl" + +module EndpointPolicy +{ + local interface IIOPEndpointValue : EndpointValueBase + { + // protocol_tag set to TAG_Internet_IOP; + + attribute string host; + attribute unsigned short port; + }; +}; + +#endif /* _TAO_IIOPENDPOINT_VALUE_IDL_ */ diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValueA.cpp b/TAO/tao/EndpointPolicy/IIOPEndpointValueA.cpp new file mode 100644 index 00000000000..0c27c6a5ce5 --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValueA.cpp @@ -0,0 +1,53 @@ +// -*- 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 "tao/EndpointPolicy/IIOPEndpointValueA.h" +#include "tao/AnyTypeCode/Null_RefCount_Policy.h" +#include "tao/AnyTypeCode/TypeCode_Constants.h" +#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" +#include "tao/AnyTypeCode/Objref_TypeCode_Static.h" +#include "tao/AnyTypeCode/String_TypeCode_Static.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/CDR.h" +#include "tao/AnyTypeCode/Any.h" +#include "tao/AnyTypeCode/Any_Impl_T.h" + +// TAO_IDL - Generated from +// be/be_visitor_typecode/objref_typecode.cpp:76 + +static TAO::TypeCode::Objref<char const *, + TAO::Null_RefCount_Policy> + _tao_tc_EndpointPolicy_IIOPEndpointValue ( + ::CORBA::tk_local_interface, + "IDL:EndpointPolicy/IIOPEndpointValue:1.0", + "IIOPEndpointValue"); + +namespace EndpointPolicy +{ + ::CORBA::TypeCode_ptr const _tc_IIOPEndpointValue = + &_tao_tc_EndpointPolicy_IIOPEndpointValue; +} diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValueA.h b/TAO/tao/EndpointPolicy/IIOPEndpointValueA.h new file mode 100644 index 00000000000..e0113397f95 --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValueA.h @@ -0,0 +1,59 @@ +// -*- 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:797 + +#ifndef _TAO_IDL_IIOPENDPOINTVALUEA_H_ +#define _TAO_IDL_IIOPENDPOINTVALUEA_H_ + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" +#include "tao/EndpointPolicy/IIOPEndpointValueC.h" +#include "tao/EndpointPolicy/EndpointPolicyA.h" + + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:59 + +namespace EndpointPolicy +{ + + // TAO_IDL - Generated from + // be/be_visitor_typecode/typecode_decl.cpp:49 + + extern TAO_EndpointPolicy_Export ::CORBA::TypeCode_ptr const _tc_IIOPEndpointValue; + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:86 + +} // module EndpointPolicy + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValueC.cpp b/TAO/tao/EndpointPolicy/IIOPEndpointValueC.cpp new file mode 100644 index 00000000000..9ebff2c4571 --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValueC.cpp @@ -0,0 +1,176 @@ +// -*- 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:283 + + +#include "tao/EndpointPolicy/IIOPEndpointValueC.h" +#include "tao/CDR.h" +#include "tao/Basic_Arguments.h" +#include "tao/UB_String_Arguments.h" +#include "ace/OS_NS_string.h" + +// TAO_IDL - Generated from +// be/be_visitor_arg_traits.cpp:70 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Arg traits specializations. +namespace TAO +{ +} + +TAO_END_VERSIONED_NAMESPACE_DECL + + + +// TAO_IDL - Generated from +// be/be_visitor_interface/interface_cs.cpp:60 + +// Traits specializations for EndpointPolicy::IIOPEndpointValue. + +EndpointPolicy::IIOPEndpointValue_ptr +TAO::Objref_Traits<EndpointPolicy::IIOPEndpointValue>::duplicate ( + EndpointPolicy::IIOPEndpointValue_ptr p + ) +{ + return EndpointPolicy::IIOPEndpointValue::_duplicate (p); +} + +void +TAO::Objref_Traits<EndpointPolicy::IIOPEndpointValue>::release ( + EndpointPolicy::IIOPEndpointValue_ptr p + ) +{ + CORBA::release (p); +} + +EndpointPolicy::IIOPEndpointValue_ptr +TAO::Objref_Traits<EndpointPolicy::IIOPEndpointValue>::nil (void) +{ + return EndpointPolicy::IIOPEndpointValue::_nil (); +} + +::CORBA::Boolean +TAO::Objref_Traits<EndpointPolicy::IIOPEndpointValue>::marshal ( + const EndpointPolicy::IIOPEndpointValue_ptr p, + TAO_OutputCDR & cdr + ) +{ + return ::CORBA::Object::marshal (p, cdr); +} + +EndpointPolicy::IIOPEndpointValue::IIOPEndpointValue (void) +{} + +EndpointPolicy::IIOPEndpointValue::~IIOPEndpointValue (void) +{} + +EndpointPolicy::IIOPEndpointValue_ptr +EndpointPolicy::IIOPEndpointValue::_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return IIOPEndpointValue::_duplicate ( + dynamic_cast<IIOPEndpointValue_ptr> (_tao_objref) + ); +} + +EndpointPolicy::IIOPEndpointValue_ptr +EndpointPolicy::IIOPEndpointValue::_unchecked_narrow ( + ::CORBA::Object_ptr _tao_objref + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + return IIOPEndpointValue::_duplicate ( + dynamic_cast<IIOPEndpointValue_ptr> (_tao_objref) + ); +} + +EndpointPolicy::IIOPEndpointValue_ptr +EndpointPolicy::IIOPEndpointValue::_duplicate (IIOPEndpointValue_ptr obj) +{ + if (! CORBA::is_nil (obj)) + { + obj->_add_ref (); + } + + return obj; +} + +void +EndpointPolicy::IIOPEndpointValue::_tao_release (IIOPEndpointValue_ptr obj) +{ + CORBA::release (obj); +} + +::CORBA::Boolean +EndpointPolicy::IIOPEndpointValue::_is_a ( + const char *value + ACE_ENV_ARG_DECL_NOT_USED + ) +{ + if ( + !ACE_OS::strcmp ( + value, + "IDL:EndpointPolicy/EndpointValueBase:1.0" + ) || + !ACE_OS::strcmp ( + value, + "IDL:EndpointPolicy/IIOPEndpointValue:1.0" + ) || + !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* EndpointPolicy::IIOPEndpointValue::_interface_repository_id (void) const +{ + return "IDL:EndpointPolicy/IIOPEndpointValue:1.0"; +} + +::CORBA::Boolean +EndpointPolicy::IIOPEndpointValue::marshal (TAO_OutputCDR &) +{ + return false; +} diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValueC.h b/TAO/tao/EndpointPolicy/IIOPEndpointValueC.h new file mode 100644 index 00000000000..2ccc247bd8e --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValueC.h @@ -0,0 +1,230 @@ +// -*- 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:155 + +#ifndef _TAO_IDL_IIOPENDPOINTVALUEC_H_ +#define _TAO_IDL_IIOPENDPOINTVALUEC_H_ + +#include /**/ "ace/pre.h" + + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/EndpointPolicy/EndpointPolicy_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/Versioned_Namespace.h" + +#include "tao/EndpointPolicy/EndpointPolicyC.h" + +#if defined (TAO_EXPORT_MACRO) +#undef TAO_EXPORT_MACRO +#endif +#define TAO_EXPORT_MACRO TAO_EndpointPolicy_Export + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:49 + +namespace EndpointPolicy +{ + + // TAO_IDL - Generated from + // be/be_interface.cpp:646 + +#if !defined (_ENDPOINTPOLICY_IIOPENDPOINTVALUE__VAR_OUT_CH_) +#define _ENDPOINTPOLICY_IIOPENDPOINTVALUE__VAR_OUT_CH_ + + class IIOPEndpointValue; + typedef IIOPEndpointValue *IIOPEndpointValue_ptr; + + typedef + TAO_Objref_Var_T< + IIOPEndpointValue + > + IIOPEndpointValue_var; + + typedef + TAO_Objref_Out_T< + IIOPEndpointValue + > + IIOPEndpointValue_out; + +#endif /* end #if !defined */ + + // TAO_IDL - Generated from + // be/be_visitor_interface/interface_ch.cpp:54 + +#if !defined (_ENDPOINTPOLICY_IIOPENDPOINTVALUE_CH_) +#define _ENDPOINTPOLICY_IIOPENDPOINTVALUE_CH_ + + class TAO_EndpointPolicy_Export IIOPEndpointValue + : public virtual ::EndpointPolicy::EndpointValueBase + { + public: + typedef IIOPEndpointValue_ptr _ptr_type; + typedef IIOPEndpointValue_var _var_type; + + // The static operations. + static IIOPEndpointValue_ptr _duplicate (IIOPEndpointValue_ptr obj); + + static void _tao_release (IIOPEndpointValue_ptr obj); + + static IIOPEndpointValue_ptr _narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static IIOPEndpointValue_ptr _unchecked_narrow ( + ::CORBA::Object_ptr obj + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ); + + static IIOPEndpointValue_ptr _nil (void) + { + return static_cast<IIOPEndpointValue_ptr> (0); + } + + + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual char * host ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void host ( + const char * host + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual ::CORBA::UShort port ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from + // be/be_visitor_operation/operation_ch.cpp:46 + + virtual void port ( + ::CORBA::UShort port + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) = 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. + IIOPEndpointValue (void); + + virtual ~IIOPEndpointValue (void); + + private: + // Private and unimplemented for concrete interfaces. + IIOPEndpointValue (const IIOPEndpointValue &); + + void operator= (const IIOPEndpointValue &); + }; + +#endif /* end #if !defined */ + +// TAO_IDL - Generated from +// be/be_visitor_module/module_ch.cpp:78 + +} // module EndpointPolicy + +// TAO_IDL - Generated from +// be/be_visitor_traits.cpp:62 +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + + +// Traits specializations. +namespace TAO +{ + +#if !defined (_ENDPOINTPOLICY_IIOPENDPOINTVALUE__TRAITS_) +#define _ENDPOINTPOLICY_IIOPENDPOINTVALUE__TRAITS_ + + template<> + struct TAO_EndpointPolicy_Export Objref_Traits< ::EndpointPolicy::IIOPEndpointValue> + { + static ::EndpointPolicy::IIOPEndpointValue_ptr duplicate ( + ::EndpointPolicy::IIOPEndpointValue_ptr + ); + static void release ( + ::EndpointPolicy::IIOPEndpointValue_ptr + ); + static ::EndpointPolicy::IIOPEndpointValue_ptr nil (void); + static ::CORBA::Boolean marshal ( + const ::EndpointPolicy::IIOPEndpointValue_ptr p, + TAO_OutputCDR & cdr + ); + }; + +#endif /* end #if !defined */ +} +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ifndef */ diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp new file mode 100644 index 00000000000..299f53bcb28 --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp @@ -0,0 +1,119 @@ +// -*- C++ -*- + +#include "tao/EndpointPolicy/IIOPEndpointValue_i.h" +#include "tao/IIOP_Endpoint.h" +#include "tao/IIOP_Acceptor.h" +#include "ace/OS_NS_strings.h" + +ACE_RCSID (IIOPEndpointValue, + IIOPEndpointValue_i, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +IIOPEndpointValue_i::IIOPEndpointValue_i () + :host_(CORBA::string_dup("")), + port_(0) +{ +} + +IIOPEndpointValue_i::IIOPEndpointValue_i (const char *host, + CORBA::UShort port) + :host_(host), + port_(port) +{ +} + +IIOPEndpointValue_i::~IIOPEndpointValue_i (void) +{ +} + +CORBA::Boolean +IIOPEndpointValue_i::is_equivalent (const TAO_Endpoint * endpoint) const +{ + const TAO_IIOP_Endpoint *iep = + dynamic_cast<const TAO_IIOP_Endpoint *>(endpoint); + if (iep == 0) + return 0; + return this->is_equivalent_i(iep->port(), iep->host()); +} + +CORBA::Boolean +IIOPEndpointValue_i::is_equivalent_i (CORBA::UShort port, + const char *host) const +{ + return + this->port_ == port && ACE_OS::strcasecmp(host, this->host_.in()) == 0; +} + +CORBA::Boolean +IIOPEndpointValue_i::validate_acceptor(TAO_Acceptor * acceptor) const +{ + TAO_IIOP_Acceptor *iacc = dynamic_cast<TAO_IIOP_Acceptor *>(acceptor); + if (iacc == 0) + return 0; + +#if 0 + // @@@ mesnier_p@ociweb.com @@@ + // This test was originally intended to validate that there is an + // acceptor available which supports the target endpoint. However, + // variablility in the definition of a "hostname" makes this hard + // to determine, without adding more overhead, probably to the + // IIOP_Acceptor class. + // I'm not sure this level of validation is really required, so + // for now I'm just leaving it out. + + const ACE_INET_Addr * eps = iacc->endpoints (); + CORBA::ULong eps_count = iacc->endpoint_count (); + for (CORBA::ULong eps_idx = 0; eps_idx < eps_count; ++ eps_idx) + { + char hostname[513]; + eps[eps_idx].get_host_name(hostname,512); + if (this->is_equivalent_i(eps[eps_idx].get_port_number(),hostname)) + return 1; + } + return 0; +#else + return 1; +#endif /* 0 */ +} + +char * +IIOPEndpointValue_i::host ( void ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::string_dup (this->host_.in()); +} + +void +IIOPEndpointValue_i::host (const char *h) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->host_ = h; +} + +CORBA::UShort +IIOPEndpointValue_i::port (void) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->port_; +} + +void +IIOPEndpointValue_i::port (CORBA::UShort p ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->port_ = p; +} + + +CORBA::ULong +IIOPEndpointValue_i::protocol_tag (void) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return IOP::TAG_INTERNET_IOP; +} + + + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h new file mode 100644 index 00000000000..254841b7954 --- /dev/null +++ b/TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h @@ -0,0 +1,115 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file IIOPEndpointValue_i.h + * + * $Id$ + * + * Implementation of the IIOP-Specific endpoint policy value + * + * @author Phil Mesnier <mesnier_p@ociweb.com> + */ +//============================================================================= + +#ifndef _TAO_IIOP_ENDPOINT_VALUE_I_H_ +#define _TAO_IIOP_ENDPOINT_VALUE_I_H_ + +#include /**/ "ace/pre.h" + +#include "tao/EndpointPolicy/EndpointPolicy_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/EndpointPolicy/IIOPEndpointValueC.h" +#include "tao/EndpointPolicy/Endpoint_Value_Impl.h" +#include "tao/LocalObject.h" + + +// This is to remove "inherits via dominance" warnings from MSVC. +// MSVC is being a little too paranoid. +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class IIOPEndpointValue_i + * + * @brief Implementation of the IIOP-Specific endpoint policy value + * + * This class is used by applications to create an instance of an + * endpoint value for constructing an EndpointPolicy. While the + * endpoint policy argument is of type + * EndpointPolicy::EndpointValueBase, always use instances of this + * type so that the endpoint policy framework is able to call the + * equivalency test method. + */ + +class TAO_EndpointPolicy_Export IIOPEndpointValue_i : + public virtual EndpointPolicy::IIOPEndpointValue, + public virtual TAO_Endpoint_Value_Impl, + public virtual CORBA::LocalObject +{ +public: + + /// Default Constructor. It is acceptable to create an empty value + /// and modify the state via the attributes. + IIOPEndpointValue_i (); + + /// Value initializing constructor, this is typically for creation + /// of one-off values. + IIOPEndpointValue_i (const char *host, + CORBA::UShort port); + + virtual ~IIOPEndpointValue_i (void); + + /// The is_equivalent test is used by the endpoint policy framework + /// for testing if a target endpoint is the same as the endpoint + /// defined by this value. + CORBA::Boolean is_equivalent (const TAO_Endpoint * endpoint) const; + + /// The validate_acceptor method is used during EndpointPolicy + /// creation to ensure there is an acceptor which provides this + /// endpoint. Currently the test is limited to only validating that + /// the acceptor's tag is consistent, as the interfaces do not yet + /// exist for examining the eventual TAO_Endpoint values the + /// acceptor would produce. + CORBA::Boolean validate_acceptor (TAO_Acceptor *) const; + + /// Host attribute get/set operators. + char * host ( void ) + ACE_THROW_SPEC ((CORBA::SystemException)); + void host (const char *) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Port attribute get/set operators. + CORBA::UShort port (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + void port (CORBA::UShort ) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // Protocol tag get operator, inherited from EndpointValueBase + CORBA::ULong protocol_tag (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + +private: + CORBA::Boolean is_equivalent_i (CORBA::UShort port, const char *host) const; + + CORBA::String_var host_; + CORBA::UShort port_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" + +#endif /* _TAO_IIOP_ENDPOINT_VALUE_I_H_ */ diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp index 2ca751b4ba2..a595be39d13 100644 --- a/TAO/tao/IIOP_Endpoint.cpp +++ b/TAO/tao/IIOP_Endpoint.cpp @@ -109,6 +109,22 @@ TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host, //@@ TAO_ENDPOINT_SPL_COPY_HOOK_END +TAO_IIOP_Endpoint & +TAO_IIOP_Endpoint::operator= (const TAO_IIOP_Endpoint &other) +{ + this->host_ = other.host_; + this->port_ = other.port_; +#if defined (ACE_HAS_IPV6) + this->is_ipv6_decimal_ = other.is_ipv6_decimal_; +#endif /* ACE_HAS_IPV6 */ + this->is_encodable_ = other.is_encodable_; + this->object_addr_set_ = other.object_addr_set_; + this->object_addr_ = other.object_addr_; + this->preferred_path_ = other.preferred_path_; + this->next_ = 0; // do not copy list membership, since we are only cloning the values + return *this; +} + TAO_IIOP_Endpoint::~TAO_IIOP_Endpoint (void) { } diff --git a/TAO/tao/IIOP_Endpoint.h b/TAO/tao/IIOP_Endpoint.h index 73fda040cd1..197c4f03a0e 100644 --- a/TAO/tao/IIOP_Endpoint.h +++ b/TAO/tao/IIOP_Endpoint.h @@ -135,6 +135,11 @@ public: //@@ TAO_ENDPOINT_SPL_PUBLIC_METHODS_COPY_HOOK_END + + /// Need to have an assignment operator since the IIOP_Profile class may + /// have to reorder its list of endpoints based on filtering by the EndpointPolicy. + TAO_IIOP_Endpoint & operator= (const TAO_IIOP_Endpoint& other); + private: //@@ TAO_ENDPOINT_SPL_PRIVATE_DATA_COPY_HOOK_START diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index 93bc39cbd7d..a9b421046b4 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -299,6 +299,9 @@ TAO_IIOP_Profile::parse_string_i (const char *ior CORBA::Boolean TAO_IIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) { + if (other_profile == this) + return 1; + const TAO_IIOP_Profile *op = dynamic_cast<const TAO_IIOP_Profile *> (other_profile); @@ -306,6 +309,10 @@ TAO_IIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) if (op == 0) return 0; + if (this->count_ == 0 && op->count_ == 0) + return 1; + if (this->count_ != op->count_) + return 0; // Check endpoints equivalence. const TAO_IIOP_Endpoint *other_endp = &op->endpoint_; for (TAO_IIOP_Endpoint *endp = &this->endpoint_; @@ -372,6 +379,53 @@ TAO_IIOP_Profile::add_endpoint (TAO_IIOP_Endpoint *endp) ++this->count_; } +void +TAO_IIOP_Profile::remove_endpoint (TAO_IIOP_Endpoint *endp) +{ + if (endp == 0) + return; + + // special handling for the target matching the base endpoint + if (endp == &this->endpoint_) + { + if (--this->count_ > 0) + { + TAO_IIOP_Endpoint* n = this->endpoint_.next_; + this->endpoint_ = *n; + // since the assignment operator does not copy the next_ + // pointer, we must do it by hand + this->endpoint_.next_ = n->next_; + delete n; + } + return; + } + + TAO_IIOP_Endpoint* last = &this->endpoint_; + TAO_IIOP_Endpoint* cur = this->endpoint_.next_; + + while (cur != 0) + { + if (cur == endp) + break; + last = cur; + cur = cur->next_; + } + + if (cur != 0) + { + last->next_ = cur->next_; + cur->next_ = 0; + --this->count_; + delete cur; + } +} + +void +TAO_IIOP_Profile::remove_generic_endpoint (TAO_Endpoint *ep) +{ + this->remove_endpoint(dynamic_cast<TAO_IIOP_Endpoint *>(ep)); +} + char * TAO_IIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h index 4c338cbc664..3ca09cb2dd7 100644 --- a/TAO/tao/IIOP_Profile.h +++ b/TAO/tao/IIOP_Profile.h @@ -77,6 +77,15 @@ public: */ void add_endpoint (TAO_IIOP_Endpoint *endp); + /** + * Remove @a endp from this profile's list of endpoints and free the + * @a endp memory. + * This method assumes @a endp is in this profile's endpoint list. + */ + void remove_endpoint (TAO_IIOP_Endpoint *endp); + + void remove_generic_endpoint (TAO_Endpoint *ep); + //@@ TAO_PROFILE_SPL_PUBLIC_METHODS_COPY_HOOK_END /// The object key delimiter that IIOP uses or expects. diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp index 9879ff26ef4..1c4d2976c69 100644 --- a/TAO/tao/Profile.cpp +++ b/TAO/tao/Profile.cpp @@ -760,6 +760,12 @@ TAO_Profile::encode_alternate_endpoints(void) return 0; } +void +TAO_Profile::remove_generic_endpoint (TAO_Endpoint *) +{ + // default for virtual methods, thus a no-op +} + //@@ TAO_PROFILE_SPL_COMMENT_HOOK_END //@@ TAO_PROFILE_SPL_METHODS_ADD_HOOK diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h index d31e55b6257..6382de6b44e 100644 --- a/TAO/tao/Profile.h +++ b/TAO/tao/Profile.h @@ -215,6 +215,17 @@ public: /// Return how many endpoints this profile contains. virtual CORBA::ULong endpoint_count (void) const = 0; + /** + * Remove the provided endpoint from the profile. Some + * subclasses of TAO_Profile already have a protocol-specific + * version of remove_endpoint, but this generic interface is + * required. The default implementation is a no-op. Protocol + * maintainers wishing to add support for the EndpointPolicy must + * implement remove_generic_endpoint to call their protocol-specific + * version of remove_endpoint + */ + virtual void remove_generic_endpoint (TAO_Endpoint *ep); + /// Verify profile equivalance. /** * Two profiles are equivalent if their tag, object_key, version diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index 61cf7bfb65b..b6e8ed7613b 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -735,7 +735,9 @@ enum TAO_Cached_Policy_Type TAO_CACHED_POLICY_BIDIRECTIONAL_GIOP, - TAO_CACHED_POLICY_MAX_CACHED + TAO_CACHED_POLICY_MAX_CACHED, + + TAO_CACHED_POLICY_ENDPOINT }; // This enum provides a mask that represent the scope at which a given |