summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-02-05 16:07:08 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-02-05 16:07:08 +0000
commit9fd21dd2328245f12c23a607194e839e2318fb24 (patch)
tree99643bfbff34fe7b13a1c9592239e481f266fc26
parented4d5e98e34dd6117542430242e098f7c7dbfadb (diff)
downloadATCD-9fd21dd2328245f12c23a607194e839e2318fb24.tar.gz
ChangeLogTag: Thu Feb 5 16:03:59 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
-rw-r--r--flat/CIAO/ChangeLog13
-rw-r--r--flat/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp123
-rw-r--r--flat/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp113
-rw-r--r--flat/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp138
4 files changed, 355 insertions, 32 deletions
diff --git a/flat/CIAO/ChangeLog b/flat/CIAO/ChangeLog
index 79e4710ea0a..2b3ec7d99d6 100644
--- a/flat/CIAO/ChangeLog
+++ b/flat/CIAO/ChangeLog
@@ -1,3 +1,10 @@
+Thu Feb 5 16:03:59 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
+
+ * DAnCE/NodeApplication/NodeApplication_Impl.cpp:
+ * ciao/ComponentServer/CIAO_Container_Impl.cpp:
+
+ First cut implementation of unhomed component deployment. Untested as yet.
+
Thu Feb 5 14:40:18 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
* DAnCE/NodeApplication/NodeApplication_Impl.cpp:
@@ -7,9 +14,9 @@ Thu Feb 5 14:40:18 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
* DAnCE/tests/CIAO/ExecutionManager-Deployments/SimplexConnectionExplicitHome_NS.cdp:
* DAnCE/tests/CIAO/ExecutionManager-Deployments/run_test.pl:
* tools/Config_Handlers/ERE_Handler.cpp:
-
- Fixes to enable external reference connections for non-provider connections.
-
+
+ Fixes to enable external reference connections for non-provider connections.
+
Thu Feb 5 00:39:48 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
* DAnCE/tests/CIAO/Components/SimpleConsumer_exec.cpp:
diff --git a/flat/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/flat/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp
index e1f9c715a50..a14171dbbf6 100644
--- a/flat/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp
+++ b/flat/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp
@@ -668,10 +668,127 @@ NodeApplication_Impl::install_home (Container &cont, Instance &inst)
}
void
-NodeApplication_Impl::install_component (Container &/*cont*/, Instance &/*inst*/)
+NodeApplication_Impl::install_component (Container &cont, Instance &inst)
{
- DANCE_TRACE( "NodeApplication_Impl::install_component (unsigned int index)");
- throw CORBA::NO_IMPLEMENT ();
+ DANCE_TRACE( "NodeApplication_Impl::install_component");
+
+ const ::Deployment::MonolithicDeploymentDescription &mdd = this->plan_.implementation[inst.mdd_idx];
+ const ::Deployment::InstanceDeploymentDescription &idd = this->plan_.instance[inst.idd_idx];
+
+ DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_home - "
+ "Starting installation of home %C on node %C\n",
+ idd.name.in (), idd.node.in ()));
+
+ this->instances_[inst.idd_idx] = &inst;
+
+ const char *entrypt = 0;
+ get_property_value (DAnCE::COMPONENT_FACTORY, mdd.execParameter, entrypt);
+
+ if (entrypt == 0)
+ {
+ DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - "
+ "Unable to find component factory property on component %C\n",
+ idd.name.in ()));
+ throw ::Deployment::InvalidComponentExecParameter (mdd.name.in (),
+ "No 'component factory' property present on MDD\n");
+ }
+
+ // @@TODO: Perhaps need better way to do this.
+ Components::ConfigValues config;
+ config.length (mdd.execParameter.length () + idd.configProperty.length ());
+ CORBA::ULong pos (0);
+
+ for (CORBA::ULong i = 0; i < mdd.execParameter.length (); ++i)
+ {
+ DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_component - "
+ "Inserting value for execParameter %C\n", mdd.execParameter[i].name.in ()));
+ config[pos++] = new CIAO::ConfigValue_impl (mdd.execParameter[i].name.in (),
+ mdd.execParameter[i].value);
+ }
+
+ for (CORBA::ULong i = 0; i < idd.configProperty.length (); ++i)
+ {
+ DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_component - "
+ "Inserting value for configProperty %C\n", idd.configProperty[i].name.in ()));
+ config[pos++] = new CIAO::ConfigValue_impl (idd.configProperty[i].name.in (),
+ idd.configProperty[i].value);
+ }
+
+ ::CIAO::Deployment::Container_var ciao_cont = ::CIAO::Deployment::Container::_narrow (cont.ref.in ());
+
+ if (CORBA::is_nil (ciao_cont.in ()))
+ {
+ DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - "
+ "Unable to narrow container assigned for component instance %C to one that supports "
+ "un-homed components.\n"));
+ throw ::Deployment::PlanError (idd.name.in (),
+ "Hosting container does not support unhomed components.\n");
+ }
+
+ try
+ {
+ DANCE_DEBUG ((LM_DEBUG, DLINFO "NodeApplication_Impl::install_component - "
+ "Calling install_component on container. Component id '%C', entrypt '%C', "
+ "length of config values is %u\n",
+ idd.name.in (), entrypt, config.length ()));
+
+ ::Components::CCMObject_var comp = ciao_cont->install_component (idd.name.in (),
+ entrypt,
+ config);
+
+ if (CORBA::is_nil (comp))
+ {
+ DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - "
+ "Got nil object reference from container while installing component %C on node %C,"
+ "throwing PlanError\n",
+ idd.name.in (), idd.node.in ()));
+ throw ::Deployment::PlanError (idd.name.in (),
+ "Nil object reference returned from install_component on conainer");
+ }
+
+ DANCE_DEBUG ((LM_INFO, DLINFO "NodeApplication_Impl::install_component - "
+ "Component '%C' on node '%C' successfully installed\n",
+ idd.name.in (), idd.node.in ()));
+
+ inst.ref = CORBA::Object::_narrow (comp);
+
+ DANCE_DEBUG ((LM_TRACE, DLINFO "NodeApplication_Impl::install_component - "
+ "Populating attributes for home %C\n",
+ idd.name.in ()));
+
+
+ ComponentAttributesSetter::SetComponentAttributes (idd.name.in (),
+ inst.ref.in (),
+ idd.configProperty,
+ this->orb_.in ());
+
+ inst.state = eInstalled;
+ }
+ catch (const Components::InvalidConfiguration &)
+ {
+ DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - "
+ "Error creating component %C on node %C, caught InvalidConfiguration. Throwing exception\n",
+ idd.name.in (), idd.node.in ()));
+ throw ::Deployment::InvalidProperty (idd.name.in (),
+ "Invalid configuration exception from container");
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - "
+ "Caught CORBA exception while installing component %C: %C\n",
+ idd.name.in (),
+ ex._info ().c_str ()));
+ throw ::Deployment::StartError (idd.name.in (),
+ ex._info ().c_str ());
+ }
+ catch (...)
+ {
+ DANCE_ERROR ((LM_ERROR, DLINFO "NodeApplication_Impl::install_component - "
+ "Caught unknown C++ exception while installing component %C\n",
+ idd.name.in ()));
+ throw ::Deployment::StartError (idd.name.in (),
+ "Unknown C++ exception");
+ }
}
void
diff --git a/flat/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp b/flat/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp
new file mode 100644
index 00000000000..5632d219c48
--- /dev/null
+++ b/flat/CIAO/DAnCE/tests/CIAO/NodeManager-Deployments/SimpleComponentUnhomed.cdp
@@ -0,0 +1,113 @@
+<Deployment:DeploymentPlan
+ xmlns:Deployment="http://www.omg.org/Deployment"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.omg.org/Deployment Deployment.xsd">
+ <label>SimpleComponent_Home</label>
+ <UUID>SimpleComponent_Home</UUID>
+
+ <!-- Implementations declarations -->
+
+ <!-- Server Dance implementation-->
+ <!-- Home implementation -->
+ <implementation xmi:id="SimpleNullHomeImplementation">
+ <name>SimpleNullHomeImplementation</name>
+ <source/>
+ <artifact xmi:idref="SimpleNull_ExecArtifact" />
+ <artifact xmi:idref="SimpleNull_SvntArtifact" />
+ <execParameter>
+ <!-- entrypoint as exec parameter (see ยง10.6.1) -->
+ <name>home factory</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Simple_SimpleNullHome_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantEntrypoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_Simple_SimpleNullHome_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ServantArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>SimpleNull_svnt</string>
+ </value>
+ </value>
+ </execParameter>
+ <execParameter>
+ <name>edu.vanderbilt.dre.CIAO.ExecutorArtifact</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>SimpleNull_exec</string>
+ </value>
+ </value>
+ </execParameter>
+ </implementation>
+
+ <implementation xmi:id="SimpleNullComponentImplementation">
+ <name>SimpleNullComponentImplementation</name>
+ <source/>
+ <artifact xmi:idref="SimpleNull_ExecArtifact" />
+ <artifact xmi:idref="SimpleNull_SvntArtifact" />
+ </implementation>
+
+ <instance xmi:id="SimpleNullHomeInstance">
+ <name>SimpleNullHome</name>
+ <node>Node</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="SimpleNullHomeImplementation" />
+ </instance>
+
+ <instance xmi:id="SimpleNullComponentInstance">
+ <name>SimpleNullComponent</name>
+ <node>Node</node>
+ <!-- hostname -->
+ <source/>
+ <implementation xmi:idref="SimpleNullComponentImplementation" />
+ <configProperty>
+ <name>edu.vanderbilt.dre.DAnCE.ExplicitHome</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>SimpleNullHome</string>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <!-- Artifacts declarations -->
+ <artifact xmi:id="SimpleNull_ExecArtifact">
+ <name>SimpleNull_exec</name>
+ <source/>
+ <node/>
+ <location>SimpleNull_exec</location>
+ </artifact>
+ <artifact xmi:id="SimpleNull_SvntArtifact">
+ <name>SimpleNull_svnt</name>
+ <source/>
+ <node/>
+ <location>SimpleNull_svnt</location>
+ </artifact>
+
+ </Deployment:DeploymentPlan>
diff --git a/flat/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp b/flat/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp
index 6ba1a6b5cda..43aee0428de 100644
--- a/flat/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp
+++ b/flat/CIAO/ciao/ComponentServer/CIAO_Container_Impl.cpp
@@ -62,13 +62,120 @@ namespace CIAO
}
::Components::CCMObject_ptr
- CIAO_Container_i::install_component (const char * /*id*/,
- const char * /*entrypt*/,
- const ::Components::ConfigValues & /*config*/)
+ CIAO_Container_i::install_component (const char * id,
+ const char * entrypt,
+ const ::Components::ConfigValues & config)
{
CIAO_TRACE("CIAO_Container_i::install_component");
- throw CORBA::NO_IMPLEMENT ();
- return 0;
+
+ if (id == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_component - "
+ "No home ID provided\n"));
+ throw ::Components::Deployment::InvalidConfiguration ();
+ }
+
+ Components::CCMObject_var comp;
+
+ if (this->component_map_.find (id, comp) == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_component - "
+ "Component with id %C already installed, aborting\n",
+ id));
+ throw Components::CreateFailure ();
+ }
+
+ if (entrypt == 0)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO "CIAO_Container_i::install_component - "
+ "No executor entrypoint found.\n"));
+ throw ::Components::Deployment::InvalidConfiguration ();
+ }
+
+ CIAO_DEBUG ((LM_INFO, CLINFO "CIAO_Container_i::install_component - "
+ "Attempting to install home with id [%C]\n",
+ id));
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Extracting ConfigValues from sequence of length [%u]\n",
+ config.length ()));
+
+ CIAO::Utility::CONFIGVALUE_MAP cm;
+ CIAO::Utility::build_config_values_map (cm, config);
+ CORBA::Any val;
+
+ const char *tmp;
+ CORBA::String_var exec_art, svnt_art, svnt_entry;
+
+ if (cm.find (SVNT_ENTRYPT, val) == 0)
+ {
+ val >>= tmp;
+ svnt_entry = tmp;
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Found Servant entrypoint %C\n", svnt_entry.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Error: No Servant entrypoint porovided, aborting installation\n"));
+ throw Components::InvalidConfiguration ();
+ }
+
+ if (cm.find (SVNT_ARTIFACT, val) == 0)
+ {
+ val >>= tmp;
+ svnt_art = tmp;
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Found Servant artifact %C\n", svnt_art.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Error: No Servant artifact porovided, aborting installation\n"));
+ throw Components::InvalidConfiguration ();
+ }
+
+
+ if (cm.find (EXEC_ARTIFACT, val) == 0)
+ {
+ val >>= tmp;
+ exec_art = tmp;
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Found executor artifact: %C\n", exec_art.in ()));
+ }
+ else
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Error: No Executor artifact porovided, aborting installation\n"));
+ }
+
+ CIAO_DEBUG ((LM_TRACE, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Extraction resulted in map of [%u] values", cm.current_size ()));
+
+ comp = this->container_->install_component (exec_art,
+ entrypt,
+ svnt_art,
+ svnt_entry,
+ id);
+
+ if (this->component_map_.bind (id,
+ Components::CCMObject::_duplicate (comp.in ())) == -1)
+ {
+ CIAO_ERROR ((LM_ERROR, CLINFO
+ "CIAO_Container_i::install_component - "
+ "Unable to bind componnet into component map\n"));
+ }
+
+
+ return comp._retn ();
}
void
@@ -221,27 +328,6 @@ namespace CIAO
"Unable to bind home into home map\n"));
}
- if (cm.find (REGISTER_NAMING, val) == 0)
- {
- const char *str_val;
-
- if (val >>= str_val)
- {
- CIAO_ERROR ((LM_WARNING, CLINFO
- "CIAO_Container_i::install_home - "
- "Naming service registration not yet supported\n"));
-
- //CIAO_DEBUG ((LM_NOTICE, CLINFO
- // "CIAO_Container_i::install_home - "
- // "Home with ID [%C] registered in naming service with name [%C]\n",
- // id, str_val));
- }
- else
- CIAO_ERROR ((LM_WARNING, CLINFO
- "CIAO_Container_i::install_home - "
- "Warning: Extraction of Naming Service value failed!\n"));
- }
-
return home._retn ();
}