diff options
Diffstat (limited to 'TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp')
-rw-r--r-- | TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp | 157 |
1 files changed, 82 insertions, 75 deletions
diff --git a/TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp b/TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp index e9200cb0a49..dcea23fc96c 100644 --- a/TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp +++ b/TAO/CIAO/tools/Config_Handlers/MDD_Handler.cpp @@ -12,12 +12,14 @@ namespace CIAO namespace Config_Handlers { IDREF_Base<CORBA::ULong> MDD_Handler::IDREF; - + void MDD_Handler::mono_deployment_descriptions ( - const DeploymentPlan& src, - Deployment::MonolithicDeploymentDescriptions& dest) + const DeploymentPlan& src, + Deployment::MonolithicDeploymentDescriptions& dest) { + CIAO_TRACE("MDD_Handler::mono_deployment_descriptions"); + DeploymentPlan::implementation_const_iterator imp_e = src.end_implementation (); CORBA::ULong pos = 0; @@ -30,22 +32,22 @@ namespace CIAO MDD_Handler::mono_deployment_description (*imp_b, dest[pos], pos); - pos++; + pos++; } - } - + } + void MDD_Handler::mono_deployment_description ( - const MonolithicDeploymentDescription& desc, - Deployment::MonolithicDeploymentDescription& toconfig, - CORBA::ULong pos) + const MonolithicDeploymentDescription& desc, + Deployment::MonolithicDeploymentDescription& toconfig, + CORBA::ULong pos) { toconfig.name = CORBA::string_dup (desc.name ().c_str ()); MonolithicDeploymentDescription::source_const_iterator me = desc.end_source (); - + CORBA::ULong len = 0; toconfig.source.length (desc.count_source ()); for (MonolithicDeploymentDescription::source_const_iterator se = @@ -68,8 +70,8 @@ namespace CIAO { CORBA::ULong tmp = 0; - ADD_Handler::IDREF.find_ref (ACE_CString (ab->id ().c_str ()), - tmp); + ADD_Handler::IDREF.find_ref (ACE_CString (ab->id ().c_str ()), + tmp); toconfig.artifactRef[len++] = tmp; } @@ -87,24 +89,16 @@ namespace CIAO toconfig.execParameter[len++]); } -#if 0 - // @@ MAJO: Don't know how to handle this - if (desc.deployRequirement_p ()) - { - Req_Handler handler; - toconfig.deployRequirement.length ( - toconfig.deployRequirement.length () + 1); - handler.get_Requirement ( - toconfig.deployRequirement[toconfig.deployRequirement.length () - 1], - desc.deployRequirement ()); - } -#endif /*if 0*/ + toconfig.deployRequirement.length (desc.count_deployRequirement ()); + std::for_each (desc.begin_deployRequirement (), + desc.end_deployRequirement (), + Requirement_Functor (toconfig.deployRequirement)); // Handle the idref if (desc.id_p ()) { ACE_CString cstr (desc.id ().c_str ()); - + MDD_Handler::IDREF.bind_ref (cstr, pos); } else @@ -113,57 +107,70 @@ namespace CIAO "(%P|%t) Warning: MDD %s has no idref \n", desc.name ().c_str ())); } - } - - - MonolithicDeploymentDescription - MDD_Handler::mono_deployment_description( - const Deployment::MonolithicDeploymentDescription &src) - { - //Get the name and instantiate the mdd - XMLSchema::string < char > name ((src.name)); - MonolithicDeploymentDescription mdd (name); - - //Get the source(s) from the IDL and store them - size_t total = src.source.length(); - for(size_t i = 0; i < total; i++) - { - XMLSchema::string< char > curr ((src.source[i])); - mdd.add_source(curr); - } - - //Get the artifactRef(s) from the IDL and store them - total = src.artifactRef.length(); - for(size_t j = 0; j < total; j++) - { - ACE_CString tmp; - ADD_Handler::IDREF.find_ref(src.artifactRef[j], tmp); - XMLSchema::IDREF< ACE_TCHAR > curr(tmp.c_str()); - mdd.add_artifact (curr); - } - - //Get the execParameter(s) from the IDL and store them - total = src.execParameter.length(); - for(size_t k = 0; k < total; k++) - { - mdd.add_execParameter ( - Property_Handler::get_property ( - src.execParameter[k])); - } - - //Get the deployRequirement(s) from the IDL and store them - total = src.deployRequirement.length(); - for(size_t l = 0; l < total; l++) - { - mdd.add_deployRequirement( - Req_Handler::get_requirement ( - src.deployRequirement[l])); - } - - return mdd; - } + } + + + MonolithicDeploymentDescription + MDD_Handler::mono_deployment_description( + const Deployment::MonolithicDeploymentDescription &src) + { + CIAO_TRACE("mono_deployment_description - reverse"); + + //Get the name and instantiate the mdd + XMLSchema::string < char > name ((src.name)); + MonolithicDeploymentDescription mdd (name); + + //Get the source(s) from the IDL and store them + size_t total = src.source.length(); + for(size_t i = 0; i < total; i++) + { + XMLSchema::string< char > curr ((src.source[i])); + mdd.add_source(curr); + } + + //Get the artifactRef(s) from the IDL and store them + total = src.artifactRef.length(); + for(size_t j = 0; j < total; j++) + { + ACE_CString tmp; + ADD_Handler::IDREF.find_ref(src.artifactRef[j], tmp); + XMLSchema::IDREF< ACE_TCHAR > curr(tmp.c_str()); + mdd.add_artifact (curr); + } + + //Get the execParameter(s) from the IDL and store them + total = src.execParameter.length(); + for(size_t k = 0; k < total; k++) + { + mdd.add_execParameter ( + Property_Handler::get_property (src.execParameter[k])); + } + + //Get the deployRequirement(s) from the IDL and store them + total = src.deployRequirement.length(); + for(size_t l = 0; l < total; l++) + { + mdd.add_deployRequirement( + Req_Handler::get_requirement (src.deployRequirement[l])); + } + + // Generate a UUID to use for the IDREF. + ACE_Utils::UUID uuid; + ACE_Utils::UUID_GENERATOR::instance ()->generateUUID (uuid); + ACE_CString mdd_id ("_"); + mdd_id += *uuid.to_string (); + + XMLSchema::ID< ACE_TCHAR > xml_id (mdd_id.c_str ()); + + // Bind the ref and set it in the IDD + MDD_Handler::IDREF.bind_next_available (mdd_id); + + mdd.id (xml_id); + + return mdd; + } } } - + |