summaryrefslogtreecommitdiff
path: root/TAO/tests/Quoter/Quoter_Impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/Quoter/Quoter_Impl.cpp')
-rw-r--r--TAO/tests/Quoter/Quoter_Impl.cpp135
1 files changed, 72 insertions, 63 deletions
diff --git a/TAO/tests/Quoter/Quoter_Impl.cpp b/TAO/tests/Quoter/Quoter_Impl.cpp
index 0591d9bda26..9cf81cbd529 100644
--- a/TAO/tests/Quoter/Quoter_Impl.cpp
+++ b/TAO/tests/Quoter/Quoter_Impl.cpp
@@ -34,12 +34,12 @@ Stock::Quoter_ptr
Quoter_Factory_Impl::create_quoter (const char *name,
CORBA::Environment &env)
{
- ACE_DEBUG ((LM_DEBUG, "Quoter Created\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "Quoter Created\n"));
ACE_UNUSED_ARG (name);
return my_quoter_._this (env);
}
-
// Constructor
Quoter_Impl::Quoter_Impl (const char *)
@@ -52,7 +52,8 @@ Quoter_Impl::~Quoter_Impl (void)
{
}
-Quoter_Impl::get_quote (char const *stock_name, class CORBA_Environment &env)
+Quoter_Impl::get_quote (char const *stock_name,
+ class CORBA_Environment &env)
{
ACE_UNUSED_ARG (stock_name);
ACE_UNUSED_ARG (env);
@@ -73,69 +74,75 @@ void Quoter_Impl::destroy (CORBA::Environment &env)
TAO_ORB_Core_instance ()->orb ()->shutdown ();
}
-
-
CosLifeCycle::LifeCycleObject_ptr
Quoter_Impl::copy (CosLifeCycle::FactoryFinder_ptr there,
- const CosLifeCycle::Criteria & the_criteria,
- CORBA::Environment &_env_there) {
-
- TAO_TRY {
- // The name of the Quoter Factory
- CosLifeCycle::Key factoryKey (1); // max = 1
- factoryKey.length(1);
- factoryKey[0].id = CORBA::string_dup ("quoter_factory");
+ const CosLifeCycle::Criteria &the_criteria,
+ CORBA::Environment &_env_there)
+{
+ TAO_TRY
+ {
+ // The name of the Quoter Factory
+ CosLifeCycle::Key factoryKey (1); // max = 1
+ factoryKey.length(1);
+ factoryKey[0].id =
+ CORBA::string_dup ("quoter_factory");
- // Find an appropriate factory over there
- CosLifeCycle::Factories_ptr factories_ptr =
- there->find_factories (factoryKey,_env_there);
-
- // Only a NoFactory exception might have occured, so if it occured,
- // then go immediately back.
- if (_env_there.exception() != 0) {
- // _env_there contains already the exception
- return CosLifeCycle::LifeCycleObject::_nil();
- }
-
- // now it is known that there is at least one factory
- Stock::Quoter_var quoter_var;
- for (unsigned int i = 0; i < factories_ptr->length (); i++) {
-
- // get the first object reference to a factory
- CORBA::Object_var quoter_FactoryObj_var = (*factories_ptr)[i];
-
- // narrow it to a Quoter Factory
- Stock::Quoter_Factory_var quoter_Factory_var =
- Stock::Quoter_Factory::_narrow (quoter_FactoryObj_var.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // try to get a Quoter created by this factory
- quoter_var = quoter_Factory_var->create_quoter ("quoter_copied", TAO_TRY_ENV);
- // @@ mk1: The create_quoter should return an exception
- TAO_CHECK_ENV;
-
- if (CORBA::is_nil (quoter_var.in ())) {
-
- // if we had already our last chance, then give up
- if (i == factories_ptr->length ()) {
- _env_there.exception (new CosLifeCycle::NoFactory (factoryKey));
+ // Find an appropriate factory over there.
+ CosLifeCycle::Factories_ptr factories_ptr =
+ there->find_factories (factoryKey, _env_there);
+
+ // Only a NoFactory exception might have occured, so if it
+ // occured, then go immediately back.
+ if (_env_there.exception() != 0)
+ {
+ // _env_there contains already the exception.
return CosLifeCycle::LifeCycleObject::_nil();
}
- else {
- ACE_ERROR((LM_ERROR,"Quoter::copy: Factory did not create the Quoter properly.\n"));
- // else tell what's wrong and try the next factory
+
+ // Now it is known that there is at least one factory.
+ Stock::Quoter_var quoter_var;
+
+ for (u_int i = 0; i < factories_ptr->length (); i++)
+ {
+ // Get the first object reference to a factory.
+ CORBA::Object_var quoter_FactoryObj_var = (*factories_ptr)[i];
+
+ // Narrow it to a Quoter Factory.
+ Stock::Quoter_Factory_var quoter_Factory_var =
+ Stock::Quoter_Factory::_narrow (quoter_FactoryObj_var.in (),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ // Try to get a Quoter created by this factory.
+ quoter_var =
+ quoter_Factory_var->create_quoter ("quoter_copied", TAO_TRY_ENV);
+
+ // @@ mk1: The create_quoter should return an exception
+ TAO_CHECK_ENV;
+
+ if (CORBA::is_nil (quoter_var.in ()))
+ {
+ // If we had already our last chance, then give up.
+ if (i == factories_ptr->length ())
+ {
+ _env_there.exception (new CosLifeCycle::NoFactory (factoryKey));
+ return CosLifeCycle::LifeCycleObject::_nil();
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Quoter::copy: Factory did not create the Quoter properly.\n"));
+ // Else tell what's wrong and try the next factory.
+ }
+ }
+ else
+ break;
+ // if succeeded in creating a new Quoter over there, then stop trying
}
- }
- else {
- break;
- // if succeeded in creating a new Quoter over there, then stop trying
- }
- }
- // return an object reference to the newly created Quoter
- return (CosLifeCycle::LifeCycleObject_ptr) quoter_var;
- }
+ // Return an object reference to the newly created Quoter.
+ return (CosLifeCycle::LifeCycleObject_ptr) quoter_var;
+ }
TAO_CATCHANY
{
TAO_TRY_ENV.print_exception ("SYS_EX");
@@ -147,8 +154,9 @@ Quoter_Impl::copy (CosLifeCycle::FactoryFinder_ptr there,
void
Quoter_Impl::move (CosLifeCycle::FactoryFinder_ptr there,
- const CosLifeCycle::Criteria & the_criteria,
- CORBA::Environment &_env_there) {
+ const CosLifeCycle::Criteria &the_criteria,
+ CORBA::Environment &_env_there)
+{
// for later
// this->copy (there, the_criteria, _env_there);
@@ -156,10 +164,11 @@ Quoter_Impl::move (CosLifeCycle::FactoryFinder_ptr there,
// that the object reference has to stay the same. But if it has
// to stay the same this object. the old object, has to forward
// further calls.
+
_env_there.exception (new CosLifeCycle::NotMovable());
}
void
-Quoter_Impl::remove (CORBA::Environment &_tao_environment) {
-
+Quoter_Impl::remove (CORBA::Environment &_tao_environment)
+{
}