summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-09-03 23:28:57 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-09-03 23:28:57 +0000
commitd9d178e5ebdda9f4b01f2846567dbeb19f73d20f (patch)
tree05d80e369d43a865f24d0001bb391fd3c4920144 /TAO
parent4e88a634b9a9b90b74b26e8d53a6980302e57e92 (diff)
downloadATCD-d9d178e5ebdda9f4b01f2846567dbeb19f73d20f.tar.gz
ChangeLogTag: Tue Sep 03 19:26:44 2002 Irfan Pyarali <irfan@oomworks.com>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog32
-rw-r--r--TAO/tao/ORB.cpp18
-rw-r--r--TAO/tao/ORB.h12
-rw-r--r--TAO/tao/PolicyFactory_Registry.cpp23
-rw-r--r--TAO/tao/PolicyFactory_Registry.h7
-rw-r--r--TAO/tao/PortableInterceptorC.cpp10
-rw-r--r--TAO/tao/PortableInterceptorC.h9
-rw-r--r--TAO/tao/Profile.cpp15
-rw-r--r--TAO/tao/RTCORBA/RT_PolicyFactory.cpp55
-rw-r--r--TAO/tao/RTCORBA/RT_PolicyFactory.h10
-rw-r--r--TAO/tao/RTCORBA/RT_Policy_i.cpp8
-rw-r--r--TAO/tests/RTCORBA/Policies/Policies.dsp18
12 files changed, 187 insertions, 30 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 53d177b4f76..4a180f85a3b 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,35 @@
+Tue Sep 03 19:26:44 2002 Irfan Pyarali <irfan@oomworks.com>
+
+ * tao\ORB.cpp (_create_policy): Added proprietary
+ extenstion for the creation of policies to the ORB interface.
+ This function is similar to ORB::create_policy() except that it
+ creates an empty policy, usually to be filled in later by
+ demarshaling.
+
+ Also, corrected the throw spec for ORB::create_policy().
+
+ * tao\PolicyFactory_Registry.cpp (_create_policy): Added new method
+ to TAO_PolicyFactory_Registry as described above.
+
+ * tao\PortableInterceptorC.cpp (_create_policy): Added proprietary
+ extenstion to PortableInterceptor::PolicyFactory as described
+ above. This method is virtual but not pure virtual. Default
+ implementation throws PolicyError exception.
+
+ * tao\Profile.cpp (policies): Changed the call to
+ ORB::create_policy() to ORB::_create_policy(). Passing in
+ "dummy" Anys to create empty RTCORBA policies is no longer
+ valid.
+
+ * tao\RTCORBA\RT_PolicyFactory.cpp (_create_policy): Added code to
+ create empty PRIORITY_MODEL_POLICY_TYPE,
+ PRIORITY_BANDED_CONNECTION_POLICY_TYPE, and
+ CLIENT_PROTOCOL_POLICY_TYPE policies. They will be filled in
+ later by the demarshaling code.
+
+ * tests\RTCORBA\Policies\Policies.dsp: Corrected project name from
+ "POA Policies" to "Policies".
+
Tue Sep 3 18:18:16 2002 Balachandran Natarajan <bala@isis-server.vuse.vanderbilt.edu>
* tao/Messaging/Messaging_No_ImplC.h: Undefined TRANSPARENT, since
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index cf3a0b6177b..5cf23c6fb35 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -1763,6 +1763,8 @@ CORBA::Policy_ptr
CORBA_ORB::create_policy (CORBA::PolicyType type,
const CORBA::Any& val
ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
{
this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Policy::_nil ());
@@ -1775,6 +1777,22 @@ CORBA_ORB::create_policy (CORBA::PolicyType type,
ACE_ENV_ARG_PARAMETER);
}
+CORBA::Policy_ptr
+CORBA_ORB::_create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ // Attempt to obtain the policy from the policy factory registry.
+ return
+ this->orb_core_->policy_factory_registry ()->_create_policy (
+ type
+ ACE_ENV_ARG_PARAMETER);
+}
+
// Destringify OMG-specified "IOR" string.
//
// XXX there should be a simple way to reuse this code in other ORB
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
index effcfbcd8e3..19f5120aeba 100644
--- a/TAO/tao/ORB.h
+++ b/TAO/tao/ORB.h
@@ -451,12 +451,22 @@ public:
CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
const CORBA::Any& val
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+
// ----------------------------------------------------------------
// = TAO-specific extensions to the CORBA specification.
// ----------------------------------------------------------------
+ /// Create an empty policy, usually to be filled in later by
+ /// demarshaling.
+ CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+
/// Resolve the POA.
CORBA_Object_ptr resolve_root_poa (ACE_ENV_SINGLE_ARG_DECL);
diff --git a/TAO/tao/PolicyFactory_Registry.cpp b/TAO/tao/PolicyFactory_Registry.cpp
index d973b66ffaf..bfd42bcca69 100644
--- a/TAO/tao/PolicyFactory_Registry.cpp
+++ b/TAO/tao/PolicyFactory_Registry.cpp
@@ -80,6 +80,29 @@ TAO_PolicyFactory_Registry::create_policy (CORBA::PolicyType type,
ACE_ENV_ARG_PARAMETER);
}
+CORBA::Policy_ptr
+TAO_PolicyFactory_Registry::_create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ PortableInterceptor::PolicyFactory_ptr policy_factory =
+ PortableInterceptor::PolicyFactory::_nil ();
+
+ if (this->factories_.find (type,
+ policy_factory) == -1)
+ {
+ // Policy factory corresponding to given policy type does not
+ // exist in policy factory map.
+ ACE_THROW_RETURN (
+ CORBA::PolicyError (CORBA::BAD_POLICY_TYPE), // @@ Right exception?
+ CORBA::Policy::_nil ());
+ }
+
+ return policy_factory->_create_policy (type
+ ACE_ENV_ARG_PARAMETER);
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
diff --git a/TAO/tao/PolicyFactory_Registry.h b/TAO/tao/PolicyFactory_Registry.h
index af90b54acf7..d97bef0e3ad 100644
--- a/TAO/tao/PolicyFactory_Registry.h
+++ b/TAO/tao/PolicyFactory_Registry.h
@@ -77,6 +77,13 @@ public:
ACE_THROW_SPEC ((CORBA::SystemException,
CORBA::PolicyError));
+ /// Create an empty policy, usually to be filled in later by
+ /// demarshaling.
+ CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
+
private:
/// The table that maps policy type to policy factory.
diff --git a/TAO/tao/PortableInterceptorC.cpp b/TAO/tao/PortableInterceptorC.cpp
index cb7649721d5..4ef49f6f316 100644
--- a/TAO/tao/PortableInterceptorC.cpp
+++ b/TAO/tao/PortableInterceptorC.cpp
@@ -3518,6 +3518,16 @@ PortableInterceptor::PolicyFactory::_duplicate (PolicyFactory_ptr obj)
return obj;
}
+::CORBA::Policy_ptr
+PortableInterceptor::PolicyFactory::_create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
+
void *PortableInterceptor::PolicyFactory::_tao_QueryInterface (ptr_arith_t type)
{
void *retv = 0;
diff --git a/TAO/tao/PortableInterceptorC.h b/TAO/tao/PortableInterceptorC.h
index bf8389ab4ad..8cf394494c0 100644
--- a/TAO/tao/PortableInterceptorC.h
+++ b/TAO/tao/PortableInterceptorC.h
@@ -1955,6 +1955,15 @@ TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr _tc_InvalidSlot;
, CORBA::PolicyError
)) = 0;
+ virtual ::CORBA::Policy_ptr _create_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ , CORBA::PolicyError
+ ));
+
virtual void *_tao_QueryInterface (ptr_arith_t type);
virtual const char* _interface_repository_id (void) const;
diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp
index 96bdb50cd08..a2735761762 100644
--- a/TAO/tao/Profile.cpp
+++ b/TAO/tao/Profile.cpp
@@ -179,20 +179,9 @@ TAO_Profile::policies (ACE_ENV_SINGLE_ARG_DECL)
{
ACE_TRY_NEW_ENV
{
- // @@ Angelo: please check my comments on this stuff
- // in the Policy_Factory.h file.
- // @@ I updated this code to use the standard
- // ORB::create_policy () which now queries the
- // policy factory registry.
- // -Ossama
-
- // We don't need to pass any policy construction
- // value to the RT policies.
- CORBA::Any dummy_any;
policy =
- this->orb_core_->orb ()->create_policy (
- policy_value_seq[i].ptype,
- dummy_any
+ this->orb_core_->orb ()->_create_policy (
+ policy_value_seq[i].ptype
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
diff --git a/TAO/tao/RTCORBA/RT_PolicyFactory.cpp b/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
index 2e70d3f933d..086b162c0b6 100644
--- a/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
+++ b/TAO/tao/RTCORBA/RT_PolicyFactory.cpp
@@ -45,3 +45,58 @@ TAO_RT_PolicyFactory::create_policy (
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
CORBA::Policy::_nil ());
}
+
+CORBA::Policy_ptr
+TAO_RT_PolicyFactory::_create_policy (
+ CORBA::PolicyType type
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError))
+{
+ CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
+
+ if (type == RTCORBA::PRIORITY_MODEL_POLICY_TYPE)
+ {
+ ACE_NEW_THROW_EX (policy,
+ TAO_PriorityModelPolicy,
+ CORBA::NO_MEMORY (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ if (type == RTCORBA::PRIORITY_BANDED_CONNECTION_POLICY_TYPE)
+ {
+ ACE_NEW_THROW_EX (policy,
+ TAO_PriorityBandedConnectionPolicy,
+ CORBA::NO_MEMORY (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ if (type == RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE)
+ {
+ ACE_NEW_THROW_EX (policy,
+ TAO_ClientProtocolPolicy,
+ CORBA::NO_MEMORY (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_DEFAULT_MINOR_CODE,
+ ENOMEM),
+ CORBA::COMPLETED_NO));
+ ACE_CHECK_RETURN (CORBA::Policy::_nil ());
+
+ return policy;
+ }
+
+ ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
+ CORBA::Policy::_nil ());
+}
diff --git a/TAO/tao/RTCORBA/RT_PolicyFactory.h b/TAO/tao/RTCORBA/RT_PolicyFactory.h
index ba25cc18c1e..4116fe4d6c4 100644
--- a/TAO/tao/RTCORBA/RT_PolicyFactory.h
+++ b/TAO/tao/RTCORBA/RT_PolicyFactory.h
@@ -43,12 +43,16 @@ class TAO_RTCORBA_Export TAO_RT_PolicyFactory
{
public:
- virtual CORBA::Policy_ptr create_policy (CORBA::PolicyType type,
- const CORBA::Any &value
- ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ 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));
+ CORBA::Policy_ptr _create_policy (CORBA::PolicyType type
+ ACE_ENV_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ CORBA::PolicyError));
};
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
diff --git a/TAO/tao/RTCORBA/RT_Policy_i.cpp b/TAO/tao/RTCORBA/RT_Policy_i.cpp
index 750690d1540..7252ad27b32 100644
--- a/TAO/tao/RTCORBA/RT_Policy_i.cpp
+++ b/TAO/tao/RTCORBA/RT_Policy_i.cpp
@@ -23,7 +23,7 @@ TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (RTCORBA::PriorityModel priorit
}
TAO_PriorityModelPolicy::TAO_PriorityModelPolicy (const TAO_PriorityModelPolicy &rhs)
- : RTCORBA::PriorityModelPolicy (),
+ : RTCORBA::PriorityModelPolicy (),
TAO_Local_RefCounted_Object (),
priority_model_ (rhs.priority_model_),
server_priority_ (rhs.server_priority_)
@@ -45,9 +45,9 @@ TAO_PriorityModelPolicy::create (const CORBA::Any &
ACE_ENV_ARG_DECL)
{
/*
- * The following code should be changed once the OMG spec has been
- * fixed such that a RTCORBA::PriorityModelPolicy can be created by
- * using the ORB::create_policy interface.
+ * @@ The following code should be changed once the OMG spec has
+ * been fixed such that a RTCORBA::PriorityModelPolicy can be
+ * created by using the ORB::create_policy interface.
*/
ACE_THROW_RETURN (CORBA::PolicyError (CORBA::BAD_POLICY_TYPE),
CORBA::Policy::_nil ());
diff --git a/TAO/tests/RTCORBA/Policies/Policies.dsp b/TAO/tests/RTCORBA/Policies/Policies.dsp
index 7c006940c7b..5ab7cc92327 100644
--- a/TAO/tests/RTCORBA/Policies/Policies.dsp
+++ b/TAO/tests/RTCORBA/Policies/Policies.dsp
@@ -1,10 +1,10 @@
-# Microsoft Developer Studio Project File - Name="POA Policies" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="Policies" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=POA Policies - Win32 Debug
+CFG=Policies - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=POA Policies - Win32 Debug
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "Policies.mak" CFG="POA Policies - Win32 Debug"
+!MESSAGE NMAKE /f "Policies.mak" CFG="Policies - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "POA Policies - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "POA Policies - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Policies - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Policies - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=POA Policies - Win32 Debug
CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "POA Policies - Win32 Release"
+!IF "$(CFG)" == "Policies - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -53,7 +53,7 @@ LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ace.lib TAO.lib TAO_RTCORBA.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace"
-!ELSEIF "$(CFG)" == "POA Policies - Win32 Debug"
+!ELSEIF "$(CFG)" == "Policies - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -82,8 +82,8 @@ LINK32=link.exe
# Begin Target
-# Name "POA Policies - Win32 Release"
-# Name "POA Policies - Win32 Debug"
+# Name "Policies - Win32 Release"
+# Name "Policies - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"