summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp')
-rw-r--r--TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp194
1 files changed, 52 insertions, 142 deletions
diff --git a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp
index 3c2858f541e..30db3d0ba3a 100644
--- a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp
+++ b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp
@@ -47,7 +47,7 @@ CIAO::Container_Impl::init (const CORBA::PolicyList *policies
else
{
ACE_NEW_THROW_EX (this->container_,
- CIAO::Session_Container (this->orb_.in (), this, 1,
+ CIAO::Session_Container (this->orb_.in (), this, 1,
this->static_entrypts_maps_),
CORBA::INTERNAL ());
ACE_CHECK_RETURN (-1);
@@ -78,7 +78,7 @@ CIAO::Container_Impl::install (
CORBA::NO_MEMORY ());
ACE_TRY_CHECK;
- // Get the ComponentImplementationInfos from the
+ // Get the ComponentImplementationInfos from the
// ContainerImplementationInfo
// to avoid too long syntax representation
const ::Deployment::ComponentImplementationInfos impl_infos =
@@ -111,7 +111,7 @@ CIAO::Container_Impl::install (
if (CORBA::is_nil (comp.in ()))
ACE_TRY_THROW (Deployment::InstallationFailure ());
- if (this->component_map_.bind
+ if (this->component_map_.bind
(impl_infos[i].component_instance_name.in (),
Components::CCMObject::_duplicate (comp.in ())))
{
@@ -128,7 +128,7 @@ CIAO::Container_Impl::install (
(*retv)[i].component_instance_name
= impl_infos[i].component_instance_name.in ();
- (*retv)[i].component_ref =
+ (*retv)[i].component_ref =
Components::CCMObject::_duplicate (comp.in ());
// Deal with Component instance related Properties.
@@ -143,7 +143,7 @@ CIAO::Container_Impl::install (
for (CORBA::ULong prop_len = 0; prop_len < clen; ++prop_len)
{
// Set up the ComponentIOR attribute
- if (ACE_OS::strcmp
+ if (ACE_OS::strcmp
(impl_infos[i].component_config[prop_len].name.in (),
"ComponentIOR") == 0)
{
@@ -165,7 +165,7 @@ CIAO::Container_Impl::install (
}
// Set up the naming service attribute
- if (ACE_OS::strcmp
+ if (ACE_OS::strcmp
(impl_infos[i].component_config[prop_len].name.in (),
"RegisterNaming") == 0)
{
@@ -174,45 +174,26 @@ CIAO::Container_Impl::install (
component_config[prop_len].value >>= naming_context;
// Register the component with the naming service
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"Register component with naming service.\n"));
- bool result =
- register_with_ns (
- naming_context,
- this->orb_.in (),
- Components::CCMObject::_duplicate (comp.in ())
- ACE_ENV_ARG_PARAMETER
- );
+ bool result = register_with_ns (naming_context,
+ this->orb_.in (),
+ comp.in ()
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
if (!result)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"Failed to register with naming service.\n"));
}
- else
- {
- if (this->naming_map_.bind
- (impl_infos[i].component_instance_name.in (),
- ACE_CString (naming_context)))
- {
- ACE_DEBUG ((LM_DEBUG,
- "CIAO (%P|%t) Container_Impl.cpp -"
- "CIAO::Container_Impl::install -"
- "error in binding component "
- "instance name [%s] into the naming map \n",
- impl_infos[i].component_instance_name.in ()));
- ACE_TRY_THROW (Deployment::InstallationFailure ());
- }
- }
-
}
// Initialize attributes through StandardConfigurator interface
- // @@Todo: Currently I have to manually map
- // the Deployment::Properties to
- // Components::ConfigValues, we should use a
+ // @@Todo: Currently I have to manually map
+ // the Deployment::Properties to
+ // Components::ConfigValues, we should use a
// common data structure in
// the future. - Gan
CORBA::ULong cur_len = comp_attributes.length ();
@@ -225,11 +206,11 @@ CIAO::Container_Impl::install (
comp_attributes[cur_len] = item;
}
-
+
if (comp_attributes.length () != 0)
{
//std_configurator.set_configuration
- ::Components::StandardConfigurator_var std_configurator =
+ ::Components::StandardConfigurator_var std_configurator =
comp->get_standard_configurator ();
std_configurator->set_configuration (comp_attributes);
@@ -414,7 +395,7 @@ CIAO::Container_Impl::remove (ACE_ENV_SINGLE_ARG_DECL)
//if (CIAO::debug_level () > 1)
if (true)
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"Removed all homes and components from this container!\n"));
}
@@ -464,8 +445,6 @@ CIAO::Container_Impl::remove_component (const char * comp_ins_name
Components::CCMObject_var comp;
Components::CCMHome_ptr home;
- ACE_CString naming_context;
-
ACE_CString str (comp_ins_name);
/* Before we do remove component we have to inform the homeservant so
@@ -490,97 +469,47 @@ CIAO::Container_Impl::remove_component (const char * comp_ins_name
// @@ Still need to remove the home if the previous operation fails?
if (this->component_map_.unbind (str) == -1)
ACE_THROW (::Components::RemoveFailure ());
-
- if (this->naming_map_.find (str, naming_context) == 0)
- {
-
- bool result =
- unregister_with_ns (
- naming_context.c_str (),
- this->orb_.in ()
- ACE_ENV_ARG_PARAMETER
- );
- ACE_TRY_CHECK;
-
- if (!result)
- {
- ACE_DEBUG ((LM_DEBUG,
- "Failed to unregister with naming service.\n"));
- }
- else
- {
- if (this->naming_map_.unbind (str) == -1)
- ACE_THROW (::Components::RemoveFailure ());
- }
- }
}
bool
-CIAO::Container_Impl::register_with_ns (const char * s,
+CIAO::Container_Impl::register_with_ns (const char * obj_name,
CORBA::ORB_ptr orb,
Components::CCMObject_ptr obj
ACE_ENV_ARG_DECL)
{
ACE_TRY
{
- // Obtain the naming service
+ // Obtain the naming service
CORBA::Object_var naming_obj =
- orb->resolve_initial_references ("NameService"
+ orb->resolve_initial_references ("NameService"
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
if (CORBA::is_nil (naming_obj.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
- "DAnCE: (%P|%t) Unable to get the Naming Service.\n"),
- false);
+ " (%P|%t) Unable to get the Naming Service.\n"),
+ false);
- CosNaming::NamingContextExt_var root =
- CosNaming::NamingContextExt::_narrow (naming_obj.in ()
- ACE_ENV_ARG_PARAMETER);
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (naming_obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Create a Naming Sequence
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup (obj_name);
+ name[0].kind = CORBA::string_dup ("");
+
+ // Register with the Name Server
+ naming_context->bind (name, obj ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
- CosNaming::Name name (0);
- name.length (0);
-
- // Get the multicomponent naming context from the <naming_context>.
- // The convention of this <naming_context> input string is that
- // different naming context is separated by character '/', such as
- // "create a naming context A/B/C/D".
- ACE_CString tmp (s);
- char * naming_string = tmp.rep ();
- char seps[] = "/:";
-
- char *token, *lastToken = 0;
- token = ACE_OS::strtok (naming_string, seps);
-
- for (CORBA::ULong i = 0; token != 0; ++i)
- {
- // While there still are tokens in the "naming_string"
- name.length (name.length () + 1);
- name[i].id = CORBA::string_dup (token);
-
- // Get next naming context
- lastToken = token;
- token = ACE_OS::strtok ( 0, seps );
- }
-
- if (name.length() > 1)
- {
- // Let's create the context path first
- name.length(name.length()-1);
- Utility::NameUtility::CreateContextPath (root.in (), name);
- name.length(name.length()+1);
- name[name.length()-1].id = CORBA::string_dup(lastToken);
- }
-
- // Bind the actual object
- Utility::NameUtility::BindObjectPath (root.in (), name, obj);
return true;
}
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"CIAO (%P|%t) Container_Impl.cpp -"
"CIAO::Container_Impl::register_with_ns -"
"NodeApplication: failed to register "
@@ -598,9 +527,9 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name,
{
ACE_TRY
{
- // Obtain the naming service
+ // Obtain the naming service
CORBA::Object_var naming_obj =
- orb->resolve_initial_references ("NameService"
+ orb->resolve_initial_references ("NameService"
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -610,39 +539,19 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name,
false);
CosNaming::NamingContext_var naming_context =
- CosNaming::NamingContext::_narrow (naming_obj.in ()
+ CosNaming::NamingContext::_narrow (naming_obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
-
- CosNaming::Name name (0);
- name.length (0);
-
- // Get the multicomponent naming context from the <naming_context>.
- // The convention of this <naming_context> input string is that
- // different naming context is separated by character '/', such as
- // "create a naming context A/B/C/D".
- ACE_CString tmp (obj_name);
- char * naming_string = tmp.rep ();
- char seps[] = "/:";
-
- char *token, *lastToken = 0;
- token = ACE_OS::strtok (naming_string, seps);
-
- for (CORBA::ULong i = 0; token != 0; ++i)
- {
- // While there still are tokens in the "naming_string"
- name.length (name.length () + 1);
- name[i].id = CORBA::string_dup (token);
-
- // Get next naming context
- lastToken = token;
- token = ACE_OS::strtok ( 0, seps );
- }
-
- // Unregister with the Name Server
- ACE_DEBUG ((LM_DEBUG,
- "Unregister component with the name server : %s!\n",
+
+ // Create a Naming Sequence
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup (obj_name);
+ name[0].kind = CORBA::string_dup ("");
+
+ // Register with the Name Server
+ ACE_DEBUG ((LM_DEBUG,
+ "Unregister component with the name server : %s!\n",
obj_name));
naming_context->unbind (name ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -651,7 +560,7 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name,
}
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"CIAO (%P|%t) Container_Impl.cpp -"
"CIAO::Container_Impl::unregister_with_ns -"
"NodeApplication: failed to unregister "
@@ -661,3 +570,4 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name,
ACE_ENDTRY;
return true;
}
+