summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-09 21:34:27 +0000
committermk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-09 21:34:27 +0000
commit31f75d6d87d22db66ef3c72a8473f08df5f31395 (patch)
tree7967a548963426093247b85faf9904f0087f29a2
parentdc89f39d579dd3a9dd62a482ffcd885dd6a9f18a (diff)
downloadATCD-31f75d6d87d22db66ef3c72a8473f08df5f31395.tar.gz
Corrected some naming mismatches. Now it is fine.
-rw-r--r--TAO/tests/Quoter/Generic_Factory_Impl.cpp10
-rw-r--r--TAO/tests/Quoter/Quoter_Impl.cpp58
-rw-r--r--TAO/tests/Quoter/client.cpp39
3 files changed, 31 insertions, 76 deletions
diff --git a/TAO/tests/Quoter/Generic_Factory_Impl.cpp b/TAO/tests/Quoter/Generic_Factory_Impl.cpp
index f312fb9849c..f498a560d08 100644
--- a/TAO/tests/Quoter/Generic_Factory_Impl.cpp
+++ b/TAO/tests/Quoter/Generic_Factory_Impl.cpp
@@ -104,11 +104,11 @@ Quoter_Generic_Factory_Impl::create_object (const CosLifeCycle::Key &factory_key
// ** now a proper reference to the quoter naming context is available
// Fill in the name of the Quoter Factory.
- CosNaming::Name factory_Name (1); // max = 1
- factory_Name.length (1);
- factory_Name[0].id = CORBA::string_dup ("Quoter_Factory");
- // or Take the key supplied to search for a Quoter Factory
- //CosNaming::Name factoryName = (CosNaming::Name) factory_key;
+ //CosNaming::Name factory_Name (1); // max = 1
+ //factory_Name.length (1);
+ //factory_Name[0].id = CORBA::string_dup ("Quoter_Factory");
+ // Take the key supplied to search for a Quoter Factory
+ CosNaming::Name factory_Name = (CosNaming::Name) factory_key;
// Try to get a reference to a Quoter Factory
CORBA::Object_var quoterFactoryObject_var =
diff --git a/TAO/tests/Quoter/Quoter_Impl.cpp b/TAO/tests/Quoter/Quoter_Impl.cpp
index f5d129fde3e..2e41c44de18 100644
--- a/TAO/tests/Quoter/Quoter_Impl.cpp
+++ b/TAO/tests/Quoter/Quoter_Impl.cpp
@@ -138,7 +138,7 @@ Quoter_Impl::copy (CosLifeCycle::FactoryFinder_ptr there,
for (u_int i = 0; i < factories_ptr->length (); i++)
{
// Get the first object reference to a factory.
- CORBA::Object_ptr generic_Obj_ptr = (*factories_ptr)[i];
+ CORBA::Object_ptr generic_FactoryObj_ptr = (*factories_ptr)[i];
// Narrow it to a Quoter Factory.
CosLifeCycle::GenericFactory_var generic_Factory_var =
@@ -153,40 +153,23 @@ Quoter_Impl::copy (CosLifeCycle::FactoryFinder_ptr there,
return CosLifeCycle::LifeCycleObject::_nil();
}
- CosLifeCycle::Key genericFactoryName (1); // max = 1
- genericFactoryName.length(1);
- genericFactoryName[0].id = CORBA::string_dup ("Generic_Quoter_Factory");
-
- CosLifeCycle::Criteria criteria(1);
- criteria.length (1);
- criteria[0].name = CORBA::string_dup ("filter");
- criteria[0].value <<= CORBA::string_dup ("name=='Quoter_Generic_Factory'");
-
- CORBA::Object_var quoterObject_var =
- this->generic_Factory_var_->create_object (genericFactoryName,
- criteria,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- this->quoter_var_ = Stock::Quoter::_narrow (quoterObject_var.in(), TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG, "Quoter Created\n"));
-
- if (CORBA::is_nil (this->quoter_var_.in()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "null quoter objref returned by factory\n"),
- -1);
- }
-
- // Try to get a Quoter created by this factory.
- // and duplicate the pointer to it
- quoter_var = Stock::Quoter::_duplicate ();
+ CosLifeCycle::Key genericFactoryName (1); // max = 1
+ genericFactoryName.length(1);
+ genericFactoryName[0].id = CORBA::string_dup ("Quoter_Factory");
- // @@ mk1: The create_quoter should return an exception
- TAO_CHECK_ENV;
+ CosLifeCycle::Criteria criteria(1);
+ criteria.length (1);
+ criteria[0].name = CORBA::string_dup ("filter");
+ criteria[0].value <<= CORBA::string_dup ("name=='Quoter_Generic_Factory'");
+
+ CORBA::Object_var quoterObject_var =
+ generic_Factory_var->create_object (genericFactoryName,
+ criteria,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ Stock::Quoter_var quoter_var = Stock::Quoter::_narrow (quoterObject_var.in(), TAO_TRY_ENV);
+ TAO_CHECK_ENV;
if (CORBA::is_nil (quoter_var.in ()))
{
@@ -211,8 +194,11 @@ Quoter_Impl::copy (CosLifeCycle::FactoryFinder_ptr there,
break;
}
- // Return an object reference to the newly created Quoter.
- return (CosLifeCycle::LifeCycleObject_ptr) quoter_var.ptr();
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "Quoter copied\n"));
+
+ // Duplicate and eturn an object reference to the newly created Quoter.
+ return CosLifeCycle::LifeCycleObject::_duplicate ((CosLifeCycle::LifeCycleObject_ptr) quoter_var.ptr());
}
TAO_CATCHANY
{
diff --git a/TAO/tests/Quoter/client.cpp b/TAO/tests/Quoter/client.cpp
index c91aa4ac2c1..8f059bbaf96 100644
--- a/TAO/tests/Quoter/client.cpp
+++ b/TAO/tests/Quoter/client.cpp
@@ -258,10 +258,7 @@ Quoter_Client::init_naming_service (void)
-1);
}
- // Narrow it
- // to a direct Quoter Factory
- // factory_var_ = Stock::Quoter_Factory::_narrow (quoter_FactoryObj_var.in (), TAO_TRY_ENV);
- // to a Quoter Generic Factory
+ // Narrow it to a Quoter Generic Factory
generic_Factory_var_ = CosLifeCycle::GenericFactory::_narrow (quoter_FactoryObj_var.in (), TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -319,49 +316,21 @@ Quoter_Client::init (int argc, char **argv)
int naming_result = this->init_naming_service ();
if (naming_result == -1)
return naming_result;
- /*}
- else
- {
- if (this->quoter_factory_key_ == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%s: no quoter factory key specified\n",
- this->argv_[0]),
- -1);
-
- CORBA::Object_var factory_object =
- this->orb_->string_to_object (this->quoter_factory_key_,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- this->factory_var_ = Stock::Quoter_Factory::_narrow (factory_object.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- if (CORBA::is_nil (this->factory_var_.in ()))
- {
- ACE_ERROR_RETURN ((LM_ERROR,"invalid factory key <%s>\n",
- this->quoter_factory_key_),
- -1);
- }
- }*/
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG, "Factory received OK\n"));
- // Now retrieve the Quoter obj ref corresponding to the key.
- // direct Quoter Factory
-
- // this->quoter_ = this->factory_var_->create_quoter (this->quoter_key_, TAO_TRY_ENV);
-
// using the Quoter Generic Factory
CosLifeCycle::Key genericFactoryName (1); // max = 1
genericFactoryName.length(1);
- genericFactoryName[0].id = CORBA::string_dup ("Generic_Quoter_Factory");
+ genericFactoryName[0].id = CORBA::string_dup ("Quoter_Factory");
+ // The final factory
CosLifeCycle::Criteria criteria(1);
criteria.length (1);
criteria[0].name = CORBA::string_dup ("filter");
criteria[0].value <<= CORBA::string_dup ("name=='Quoter_Generic_Factory'");
+ // used to find the last generic factory in the chain
CORBA::Object_var quoterObject_var =
this->generic_Factory_var_->create_object (genericFactoryName,