diff options
author | lseibert <lseibert@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-08-10 14:45:20 +0000 |
---|---|---|
committer | lseibert <lseibert@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-08-10 14:45:20 +0000 |
commit | da3cfefb87a804afd5a184a81679a281f1db3918 (patch) | |
tree | 0e70470f178e82ec0d5c5660981976f950df963a | |
parent | 8b90c54cc42b85e382e667ed0d4cd6ff2ffd5d1c (diff) | |
download | ATCD-xsc_reverse_handlers.tar.gz |
*** empty log message ***xsc_reverse_handlers
26 files changed, 650 insertions, 330 deletions
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.cpp index ab7e104b823..acbc733a1b2 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.cpp @@ -154,38 +154,42 @@ namespace CIAO return true; } - ArtifactDeploymentDescription - ADD_Handler::artifact_deployment_descr ( - const Deployment::ArtifactDeploymentDescription &src) - { - XMLSchema::string< char > name ((src.name)); - XMLSchema::string< char > node ((src.node)); - - ArtifactDeploymentDescription add (name,node); - - size_t total = src.location.length (); - for (size_t i = 0; i < total; ++i) - { - XMLSchema::string< char > curr ((src.location[i])); - add.add_location (curr); - } - - total = src.source.length (); - for (size_t j = 0; j < total; ++j) - { - XMLSchema::string< char > curr ((src.source[j])); - add.add_source (curr); - } - - total = src.execParameter.length (); - for (size_t k = 0; k < total; ++k) - { - add.add_execParameter ( - Property_Handler::get_property (src.execParameter[k]) - ); - } + ArtifactDeploymentDescription + ADD_Handler::artifact_deployment_descr ( + const Deployment::ArtifactDeploymentDescription &src) + { + //Get the name and node and store them in the add + XMLSchema::string< char > name ((src.name)); + XMLSchema::string< char > node ((src.node)); + + ArtifactDeploymentDescription add (name,node); + + //Get the location(s) and store it/them in the add + size_t total = src.location.length (); + for (size_t i = 0; i < total; ++i) + { + XMLSchema::string< char > curr ((src.location[i])); + add.add_location (curr); + } + + //As above, for the source(s) + total = src.source.length (); + for (size_t j = 0; j < total; ++j) + { + XMLSchema::string< char > curr ((src.source[j])); + add.add_source (curr); + } + + //As above for the execParameter(s) + total = src.execParameter.length (); + for (size_t k = 0; k < total; ++k) + { + add.add_execParameter ( + Property_Handler::get_property ( + src.execParameter[k])); + } - return add; + return add; } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.h index a56d0143be8..69bb27cab22 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/ADD_Handler.h @@ -54,8 +54,8 @@ namespace CIAO ::Deployment::ArtifactDeploymentDescriptions &dest); static ArtifactDeploymentDescription - artifact_deployment_descr ( - const Deployment::ArtifactDeploymentDescription &src); + artifact_deployment_descr ( + const Deployment::ArtifactDeploymentDescription &src); /// The IDREF Table associated with this class static IDREF_Base IDREF; diff --git a/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.cpp index d1cb5f8566c..eea88416d1a 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.cpp @@ -16,184 +16,195 @@ namespace CIAO const ComponentInterfaceDescription &desc, Deployment::ComponentInterfaceDescription& toconfig) { - if (desc.UUID_p ()) - toconfig.UUID = - CORBA::string_dup (desc.UUID ().c_str ()); + if (desc.UUID_p ()) + toconfig.UUID = + CORBA::string_dup (desc.UUID ().c_str ()); - if (desc.label_p ()) + if (desc.label_p ()) { - toconfig.label = - CORBA::string_dup (desc.label ().c_str ()); + toconfig.label = + CORBA::string_dup (desc.label ().c_str ()); } - - if (desc.specificType_p ()) + + if (desc.specificType_p ()) { - toconfig.specificType = - CORBA::string_dup (desc.specificType ().c_str ()); + toconfig.specificType = + CORBA::string_dup (desc.specificType ().c_str ()); } - ComponentInterfaceDescription::supportedType_const_iterator - end = desc.end_supportedType (); - - for (ComponentInterfaceDescription::supportedType_const_iterator s = - desc.begin_supportedType (); - s != end; - ++s) + ComponentInterfaceDescription::supportedType_const_iterator + end = desc.end_supportedType (); + + for (ComponentInterfaceDescription::supportedType_const_iterator s = + desc.begin_supportedType (); + s != end; + ++s) { - // This loop is going to be very slow! :(! - CORBA::ULong len = - toconfig.supportedType.length (); - - toconfig.supportedType.length (len + 1); - toconfig.supportedType[len] = - CORBA::string_dup ((*s).c_str ()); + // This loop is going to be very slow! :(! + CORBA::ULong len = + toconfig.supportedType.length (); + + toconfig.supportedType.length (len + 1); + toconfig.supportedType[len] = + CORBA::string_dup ((*s).c_str ()); } - - ComponentInterfaceDescription::idlFile_const_iterator - eidl = desc.end_idlFile (); - - for (ComponentInterfaceDescription::idlFile_const_iterator sidl= - desc.begin_idlFile (); - sidl != eidl; - ++sidl) + + ComponentInterfaceDescription::idlFile_const_iterator + eidl = desc.end_idlFile (); + + for (ComponentInterfaceDescription::idlFile_const_iterator sidl= + desc.begin_idlFile (); + sidl != eidl; + ++sidl) { - // @@ Another n^2 algorithm - CORBA::ULong len = - toconfig.idlFile.length (); - - toconfig.idlFile.length (len + 1); - - toconfig.idlFile [len] = - (*sidl).c_str (); + // @@ Another n^2 algorithm + CORBA::ULong len = + toconfig.idlFile.length (); + + toconfig.idlFile.length (len + 1); + + toconfig.idlFile [len] = + (*sidl).c_str (); } + + ComponentInterfaceDescription::configProperty_const_iterator pend = + desc.end_configProperty (); + + for (ComponentInterfaceDescription::configProperty_const_iterator pstart = + desc.begin_configProperty (); + pstart != pend; + ++pstart) + { + // Need to improve this. This is clearly O(n^2). + CORBA::ULong len = + toconfig.configProperty.length (); + + toconfig.configProperty.length (len + 1); + + Property_Handler::get_property (*pstart, + toconfig.configProperty [len]); + } + + for (ComponentInterfaceDescription::port_const_iterator + port (desc.begin_port ()); + port != desc.end_port (); + ++port) + { + CORBA::ULong len = + toconfig.port.length (); + + toconfig.port.length (len + 1); + + CPD_Handler::component_port_description ( + *port, + toconfig.port[len]); + } + + for(ComponentInterfaceDescription::property_const_iterator + prop (desc.begin_property()); + prop != desc.end_property(); + prop++) + { + CORBA::ULong len = + toconfig.property.length(); + + toconfig.property.length (len + 1); + + ComponentPropertyDescription_Handler::component_property_description ( + *prop, + toconfig.property[len]); + } + + for ( ComponentInterfaceDescription::infoProperty_const_iterator + infoProp (desc.begin_infoProperty()); + infoProp != desc.end_infoProperty(); + infoProp++) + { + CORBA::ULong len = toconfig.infoProperty.length(); + + toconfig.infoProperty.length( len + 1 ); + + Property_Handler::get_property ( + *infoProp, + toconfig.infoProperty[len]); + } + + return 1; + } - ComponentInterfaceDescription::configProperty_const_iterator pend = - desc.end_configProperty (); - - for (ComponentInterfaceDescription::configProperty_const_iterator pstart = - desc.begin_configProperty (); - pstart != pend; - ++pstart) - { - // Need to improve this. This is clearly O(n^2). - CORBA::ULong len = - toconfig.configProperty.length (); - - toconfig.configProperty.length (len + 1); - - Property_Handler::get_property (*pstart, - toconfig.configProperty [len]); - } - - for (ComponentInterfaceDescription::port_const_iterator - port (desc.begin_port ()); - port != desc.end_port (); - ++port) + ComponentInterfaceDescription + CCD_Handler::component_interface_descr ( + const ::Deployment::ComponentInterfaceDescription& src) { - CORBA::ULong len = - toconfig.port.length (); - - toconfig.port.length (len + 1); - - CPD_Handler::component_port_description ( - *port, - toconfig.port[len]); + ComponentInterfaceDescription cid; + + //Load up the basic string members + XMLSchema::string< char > uuid ((src.UUID)); + XMLSchema::string< char > label ((src.label)); + XMLSchema::string< char > specifict ((src.specificType)); + + //Then put them in the CID + cid.UUID (uuid); + cid.label (label); + cid.specificType (specifict); + + //Get the supported type(s) and load them into cid + ::CORBA::ULong total = src.supportedType.length (); + for (size_t i = 0; i < total; ++i) + { + XMLSchema::string< char > curr ((src.supportedType[i])); + cid.add_supportedType (curr); + } + + //Get the idlFile(s) and store them into the cid + total = src.idlFile.length (); + for (size_t j = 0; j < total; ++j) + { + XMLSchema::string< char > curr ((src.idlFile[j])); + cid.add_idlFile (curr); + } + + //Get the configProperty(ies) and store them into the cid + total = src.configProperty.length (); + for (size_t k = 0; k < total; ++k) + { + cid.add_configProperty ( + Property_Handler::get_property ( + src.configProperty[k])); + } + + //Same drill for the component port description(s) + total = src.port.length (); + for (size_t l = 0; l < total; ++l) + { + cid.add_port ( + CPD_Handler::component_port_description ( + src.port[l])); + } + + //Load up the property field + total = src.property.length(); + for(size_t m = 0; + m < total; + m++) + { + cid.add_property( + ComponentPropertyDescription_Handler::component_property_description ( + src.property[m])); + } + + //Load up the infoProperty(s) + total = src.infoProperty.length(); + for(size_t n = 0; + n < total; + n++) + { + cid.add_infoProperty( + Property_Handler::get_property ( + src.infoProperty[n])); + } + + return cid; } - -#if 0 - // @@ MAJO: I don't think we need to handle this now, since they - // are not needed for this round. IOW, we don't really understand - // how to use this stuff ;) - if (desc.property_p ()) - { - //Create the ComponentPropertyDescription handler. - ComponentPropertyDescription_Handler cprop_handler; - - //Increase the size of the property sequence. - toconfig.property.length ( - toconfig.property.length () + 1); - //Now delegate the propogation to the - //<ComponentPropertyDescription_Handler>. - cprop_handler.get_ComponentPropertyDescription ( - toconfig.property [toconfig.property.length () -1], - desc.property ()); - } - - - - //The IDL for the <infoProperty> specifies - //a sequence of <Property> structs but the schema - //specifies <infoProperty> as a single - //<Property>. We construct that single property - //element and assign it to the first position in the - //<infoProperty> sequence. We only do this if it - //is present. - if (desc.infoProperty_p () ) - { - //First construct the <Deployment::Property> - //to configure. - Deployment::Property prop; - - //Now, propogate the values from the <desc> into <prop>. - Property_Handler::get_property (desc.infoProperty (), - prop); - - //Finally, add it to the sequence. - toconfig.infoProperty.length ( - toconfig.infoProperty.length () + 1); - toconfig.infoProperty [toconfig.infoProperty.length () - 1] = prop; - } -#endif /*if 0*/ - - return 1; - } - - ComponentInterfaceDescription - CCD_Handler::component_interface_descr ( - const ::Deployment::ComponentInterfaceDescription& src) - { - ComponentInterfaceDescription cid; - - XMLSchema::string< char > uuid ((src.UUID)); - XMLSchema::string< char > label ((src.label)); - XMLSchema::string< char > specifict ((src.specificType)); - - cid.UUID (uuid); - cid.label (label); - cid.specificType (specifict); - - ::CORBA::ULong total = src.supportedType.length (); - for (size_t i = 0; i < total; ++i) - { - XMLSchema::string< char > curr ((src.supportedType[i])); - cid.add_supportedType (curr); - } - - total = src.idlFile.length (); - for (size_t j = 0; j < total; ++j) - { - XMLSchema::string< char > curr ((src.idlFile[j])); - cid.add_idlFile (curr); - } - - total = src.configProperty.length (); - for (size_t k = 0; k < total; ++k) - { - cid.add_configProperty ( - Property_Handler::get_property ( - src.configProperty[k])); - } - - total = src.port.length (); - for (size_t l = 0; l < total; ++l) - { - cid.add_port ( - CPD_Handler::component_port_description ( - src.port[l])); - } - - - return cid; - } } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.h index bb960c37f2b..376b9cb0eba 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/CCD_Handler.h @@ -48,8 +48,8 @@ namespace CIAO const ComponentInterfaceDescription &src, ::Deployment::ComponentInterfaceDescription& dest); static ComponentInterfaceDescription - component_interface_descr ( - const ::Deployment::ComponentInterfaceDescription& src); + component_interface_descr ( + const ::Deployment::ComponentInterfaceDescription& src); }; } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/CRDD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/CRDD_Handler.h index c4b38e1479a..3196b4bb1f4 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/CRDD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/CRDD_Handler.h @@ -56,7 +56,7 @@ namespace CIAO Deployment::ConnectionResourceDeploymentDescription& toconfig, ConnectionResourceDeploymentDescription& desc); - ConnectionResourceDeploymentDescription + static ConnectionResourceDeploymentDescription connection_resource_depl_desc ( const ::Deployment::ConnectionResourceDeploymentDescription& src); diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc b/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc index 735be77ed79..ad0da169eb6 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc +++ b/TAO/CIAO/DAnCE/Config_Handlers/Config_Handlers.mpc @@ -29,6 +29,7 @@ project (XSC_Config_Handlers) : acelib, ciao_deployment_stub,xerces { Req_Handler.cpp CPD_Handler.cpp Any_Handler.cpp + XercesString.cpp ComponentPropertyDescription_Handler.cpp DataType_Handler.cpp MDD_Handler.cpp @@ -37,6 +38,8 @@ project (XSC_Config_Handlers) : acelib, ciao_deployment_stub,xerces { PSPE_Handler.cpp ERE_Handler.cpp CRDD_Handler.cpp + PCD_Handler.cpp + IRDD_Handler.cpp IDD_Handler.cpp ADD_Handler.cpp ComponentPropertyDescription_Handler.cpp @@ -57,14 +60,13 @@ project (XSC_Config_Handlers) : acelib, ciao_deployment_stub,xerces { project (XSC_Config_Handlers_Tests) : ciao_deployment_stub,xerces { - requires += dummy_label exename = test after += XSC_Config_Handlers dynamicflags = CONFIG_HANDLERS_BUILD_DLL macros += XML_USE_PTHREADS requires += exceptions libs += CIAO_DnC_Server TAO_IFR_Client XSC_Config_Handlers - + includes += $(CIAO_ROOT)/DAnCE/Config_Handlers Source_Files { test.cpp } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp index 2eaffd21af0..e22db151485 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_Handler.cpp @@ -6,6 +6,7 @@ #include "MDD_Handler.h" #include "IDD_Handler.h" #include "ID_Handler.h" +#include "Property_Handler.h" #include "cdp.hpp" #include "DP_PCD_Handler.h" @@ -28,7 +29,7 @@ namespace CIAO } DP_Handler::DP_Handler (const ::Deployment::DeploymentPlan &plan) - : xsc_dp_ (0), + : xsc_dp_ (new DeploymentPlan), idl_dp_ (0), retval_ (0) { @@ -47,7 +48,7 @@ namespace CIAO { if (this->retval_ && this->xsc_dp_.get () != 0) return this->xsc_dp_.get (); - + throw NoPlan (); } @@ -106,19 +107,16 @@ namespace CIAO // Similar thing for dependsOn for (DeploymentPlan::dependsOn_const_iterator dstart = xsc_dp.begin_dependsOn (); - dstart != xsc_dp.end_dependsOn (); - ++dstart) - { - CORBA::ULong len = - this->idl_dp_->dependsOn.length (); - - this->idl_dp_->dependsOn.length (len + 1); - - ID_Handler::get_ImplementationDependency ( - this->idl_dp_->dependsOn [len], + dstart != xsc_dp.end_dependsOn (); + ++dstart) + { + CORBA::ULong len = this->idl_dp_->dependsOn.length (); + this->idl_dp_->dependsOn.length (len + 1); + ID_Handler::get_ImplementationDependency ( + this->idl_dp_->dependsOn [len], *dstart); - } + } /* @@ Not needed at this time... @@ -196,16 +194,111 @@ namespace CIAO } DP_PCD_Handler::plan_connection_descrs (xsc_dp, this->idl_dp_->connection); - return this->retval_; } bool DP_Handler::build_xsc (const ::Deployment::DeploymentPlan &plan) { - // @@Lucas: Fill in the implementation here. - } + size_t len; //Used for checking the length of struct data members + + // Read in the label, if present, since minoccurs = 0 + if (plan.label != 0) + { + XMLSchema::string< char > i((plan.label)); + this->xsc_dp_->label(i); + } + + // Read in the UUID, if present + if (plan.UUID != 0) + { + XMLSchema::string< char > j((plan.UUID)); + this->xsc_dp_->UUID(j); + } + + // Similar thing for dependsOn + len = plan.dependsOn.length(); + for (size_t j = 0; + j < len; + ++j) + { + this->xsc_dp_->add_dependsOn( + ID_Handler::impl_dependency( + plan.dependsOn[j])); + } + + + /* @@ Not needed at this time for the forward handler, so I assume not for the reverse handlers either... + // This should be functional if we want to activate it at a later point + // ... And the property stuff + len = plan.infoProperty.length(); + for (size_t q = 0; + q < len; + q++) + { + this->xsc_dp_->add_infoProperty ( + Property_Handler::get_property ( + plan.infoProperty[q])); + } + */ + + // We are assuming there is a realizes for the moment + // @@ We may want to change this at a later date by creating a sequence of + // @@ ComponentInterfaceDescriptions in the DeploymentPlan in ../ciao/Deployment_Data.idl + // @@ so we can check for length + this->xsc_dp_->realizes(CCD_Handler::component_interface_descr(plan.realizes)); + if (!this->xsc_dp_->realizes_p()) + { + ACE_DEBUG ((LM_ERROR, + "(%P|%t) DP_Handler: " + "Error parsing Component Interface Descriptor.")); + return false; + } + + //Take care of the artifact(s) if they exist + len = plan.artifact.length(); + for(size_t k = 0; + k < len; + k++) + { + this->xsc_dp_->add_artifact ( + ADD_Handler::artifact_deployment_descr ( + plan.artifact[k])); + } + + //Take care of the implementation(s) if they exist + len = plan.implementation.length(); + for(size_t l = 0; + l < len; + l++) + { + this->xsc_dp_->add_implementation ( + MDD_Handler::mono_deployment_description ( + plan.implementation[l])); + } + //Ditto for the instance(s) + len = plan.instance.length(); + for(size_t m = 0; + m < len; + m++) + { + this->xsc_dp_->add_instance ( + IDD_Handler::instance_deployment_descr ( + plan.instance[m])); + } + //Finally, take care of the Connection Planning + len = plan.connection.length(); + for(size_t n = 0; n < len; n++) + { + this->xsc_dp_->add_connection ( + DP_PCD_Handler::plan_connection_descr ( + plan.connection[n])); + } + + retval_ = true; + return true; + } } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp index 61cc196778d..30f07cf291b 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.cpp @@ -5,6 +5,7 @@ #include "PSPE_Handler.h" #include "ERE_Handler.h" #include "CRDD_Handler.h" +#include "PCD_Handler.h" #include "Basic_Deployment_Data.hpp" #include "cdp.hpp" #include "ciao/Deployment_DataC.h" @@ -42,6 +43,14 @@ namespace CIAO return true; } + + PlanConnectionDescription + DP_PCD_Handler::plan_connection_descr ( + const Deployment::PlanConnectionDescription &src) + { + PlanConnectionDescription pcd = PCD_Handler::get_PlanConnectionDescription(src); + return pcd; + } bool DP_PCD_Handler::plan_connection_descr ( diff --git a/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h index 16439cd0014..e0c2c7caa8e 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/DP_PCD_Handler.h @@ -52,6 +52,9 @@ namespace CIAO const DeploymentPlan &src, Deployment::PlanConnectionDescriptions& toconfig); + static PlanConnectionDescription plan_connection_descr( + const Deployment::PlanConnectionDescription &src); + private: static bool plan_connection_descr ( const PlanConnectionDescription& desc, diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Deployment.cpp b/TAO/CIAO/DAnCE/Config_Handlers/Deployment.cpp index 4f65a9fe6f5..f377aae8d58 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/Deployment.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/Deployment.cpp @@ -10,6 +10,7 @@ */ #include "Deployment.hpp" +#include "ace/Log_Msg.h" namespace CIAO { @@ -246,7 +247,6 @@ namespace CIAO { throw 1; } - struct W : virtual ::CIAO::Config_Handlers::Writer::DeploymentPlan, virtual ::XMLSchema::Writer::FundamentalType< ::XMLSchema::string< ACE_TCHAR >, ACE_TCHAR >, virtual ::CIAO::Config_Handlers::Writer::ComponentInterfaceDescription, @@ -290,7 +290,6 @@ namespace CIAO { } }; - W w (e); w.dispatch (s); } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp index e73d77e44e2..cf94d631bcb 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.cpp @@ -1,6 +1,7 @@ // $Id$ #include "IDD_Handler.h" +#include "IRDD_Handler.h" #include "MDD_Handler.h" #include "Property_Handler.h" #include "Any_Handler.h" @@ -183,5 +184,49 @@ namespace CIAO } + InstanceDeploymentDescription + IDD_Handler::instance_deployment_descr ( + const Deployment::InstanceDeploymentDescription& src) + { + + //Get all the string/IDREFs + XMLSchema::string < char > name ((src.name)); + XMLSchema::string < char > node ((src.node)); + XMLSchema::string < char > source ((src.source[0])); + ACE_CString temp; + MDD_Handler::IDREF.find_ref(src.implementationRef, temp); + XMLSchema::IDREF< ACE_TCHAR > implementation ((temp.c_str())); + + //Instantiate the IDD + InstanceDeploymentDescription idd (name, node, source, implementation); + + //Get and store the configProperty(s) + size_t total = src.configProperty.length(); + for(size_t j = 0; j < total; j++) + { + idd.add_configProperty( + Property_Handler::get_property ( + src.configProperty[j])); + } + + //Check if there is a deployedResource, if so store + if(src.deployedResource.length() != 0) + idd.deployedResource( + IRDD_Handler::instance_resource_deployment_descr( + src.deployedResource[0])); + + //Check if there is a deployedSharedResource, if so store it + if(src.deployedSharedResource.length() != 0) + idd. deployedSharedResource( + IRDD_Handler::instance_resource_deployment_descr( + src.deployedSharedResource[0])); + + // @@ LDS: There is no variable id in src, is this correct, does it need to be added? + // XMLSchema::ID < char > id ((src.id)); + // idd.id(id); + + return idd; + } + } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h index 5e2dff69dd8..be58f567aea 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/IDD_Handler.h @@ -53,6 +53,9 @@ namespace CIAO const DeploymentPlan &src, ::Deployment::InstanceDeploymentDescriptions& dest); + static InstanceDeploymentDescription instance_deployment_descr ( + const Deployment::InstanceDeploymentDescription &src); + static IDREF_Base IDREF; private: diff --git a/TAO/CIAO/DAnCE/Config_Handlers/ID_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/ID_Handler.h index 84923db4418..c800b31e0b3 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/ID_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/ID_Handler.h @@ -58,7 +58,7 @@ namespace CIAO Deployment::ImplementationDependency& toconfig, const ImplementationDependency& desc); - ImplementationDependency impl_dependency ( + static ImplementationDependency impl_dependency ( const ::Deployment::ImplementationDependency& src); }; } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/IRDD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/IRDD_Handler.cpp index 503f4ae7598..57e876b81b0 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/IRDD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/IRDD_Handler.cpp @@ -45,7 +45,7 @@ namespace CIAO toconfig.resourceUsage = Deployment::PortUsesResource; if (desc.resourceUsage () == ResourceUsageKind::ResourceUsesPort) - toconfig.resourceUsage asdfasdf = Deployment::ResourceUsesPosdfrt; + toconfig.resourceUsage = Deployment::ResourceUsesPort; toconfig.requirementName= CORBA::string_dup (desc.requirementName ().c_str ()); @@ -68,24 +68,25 @@ namespace CIAO Any resval (Any_Handler::get_any (src.resourceValue)); InstanceResourceDeploymentDescription irdd ( - reqname, - resname, - ResourceUsageKind::None); + ResourceUsageKind::None, + reqname, + resname, + resval); if (src.resourceUsage == Deployment::None) irdd.resourceUsage (ResourceUsageKind::None); - if (desc.resourceUsage == + if (src.resourceUsage == Deployment::InstanceUsesResource) - toconfig.resourceUsage = (ResourceUsageKind::InstanceUsesResource); - if (desc.resourceUsage == + irdd.resourceUsage (ResourceUsageKind::InstanceUsesResource); + if (src.resourceUsage == Deployment::ResourceUsesInstance) - toconfig.resourceUsage = (ResourceUsageKind::ResourceUsesInstance); - if (desc.resourceUsage == + irdd.resourceUsage (ResourceUsageKind::ResourceUsesInstance); + if (src.resourceUsage == Deployment::PortUsesResource) - toconfig.resourceUsage = (ResourceUsageKind::PortUsesResource); - if (desc.resourceUsage == + irdd.resourceUsage (ResourceUsageKind::PortUsesResource); + if (src.resourceUsage == Deployment::ResourceUsesPort) - toconfig.resourceUsage (ResourceUsageKind::ResourceUsesPort); + irdd.resourceUsage (ResourceUsageKind::ResourceUsesPort); return irdd; } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.cpp index 2728135b8b0..3972a1ba616 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.cpp @@ -48,8 +48,8 @@ namespace CIAO } return true; - } - + } + bool MDD_Handler::mono_deployment_description ( const MonolithicDeploymentDescription& desc, @@ -152,8 +152,57 @@ namespace CIAO } return true; - } + } + + + 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; + } } } + diff --git a/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.h index 7ad554ac859..8ea99c9cfc0 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/MDD_Handler.h @@ -52,6 +52,9 @@ namespace CIAO static bool mono_deployment_descriptions ( const DeploymentPlan &src, Deployment::MonolithicDeploymentDescriptions &dest); + + static MonolithicDeploymentDescription mono_deployment_description( + const Deployment::MonolithicDeploymentDescription &src); static IDREF_Base IDREF; diff --git a/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.cpp index ed43410e824..f8b11fdc6a4 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.cpp @@ -43,8 +43,10 @@ namespace CIAO CORBA::string_dup (desc.source ().c_str ()); } - - if (desc.deployRequirement_p ()) + for(PlanConnectionDescription::deployRequirement_iterator + req (desc.begin_deployRequirement()); + req != desc.end_deployRequirement(); + req++) { #if 0 // @@ MAJO: @@ -62,69 +64,100 @@ namespace CIAO } //Create the ComponentExternalPortEndpoint handler. - CEPE_Handler cepehandler; - - //Iterate through and configure each port in the - //externalEndpoint sequence. - for (PlanConnectionDescription::externalEndpoint_iterator - port (desc.begin_externalEndpoint ()); - port != desc.end_externalEndpoint (); - ++port) - { - toconfig.externalEndpoint.length ( - toconfig.externalEndpoint.length () + 1); - - cepehandler.get_ComponentExternalPortEndpoint ( - toconfig.externalEndpoint [toconfig.externalEndpoint.length () - 1], - *port); - } - + CEPE_Handler::external_port_endpoints ( + desc, + toconfig.externalEndpoint); + //Configure the PlanSubcomponentPortEndpoint's. - PSPE_Handler pspehandler; - - for (PlanConnectionDescription::internalEndpoint_iterator - ipoint (desc.begin_internalEndpoint ()); - ipoint != desc.end_internalEndpoint (); - ++ipoint) - { - toconfig.internalEndpoint.length ( - toconfig.internalEndpoint.length () + 1); - pspehandler.get_PlanSubcomponentPortEndpoint ( - toconfig.internalEndpoint [toconfig.internalEndpoint.length () - 1], - *ipoint); - } + PSPE_Handler::sub_component_port_endpoints ( + desc, + toconfig.internalEndpoint); //Configure the ExternalReferenceEndpoint's. - ERE_Handler erehandler; - - for (PlanConnectionDescription::externalReference_iterator - ipoint (desc.begin_externalReference ()); - ipoint != desc.end_externalReference (); - ++ipoint) - { - toconfig.externalReference.length ( - toconfig.externalReference.length () + 1); - - erehandler.get_ExternalReferenceEndpoint ( - toconfig.externalReference [toconfig.externalReference.length () - 1], - *ipoint); - } + ERE_Handler::external_ref_endpoints ( + desc, + toconfig.externalReference); + //Configure the resource value. - if (desc.deployedResource_p ()) - { - CRDD_Handler crddhandler; - - toconfig.deployedResource.length ( + CRDD_Handler crddhandler; + for(PlanConnectionDescription::deployedResource_iterator res = + desc.begin_deployedResource(); + res != desc.end_deployedResource(); + res++) + { + + toconfig.deployedResource.length ( toconfig.deployedResource.length () + 1); crddhandler.get_ConnectionResourceDeploymentDescription ( toconfig.deployedResource[toconfig.deployedResource.length () - 1], - desc.deployedResource ()); - } + *res); + } } - + + PlanConnectionDescription PCD_Handler::get_PlanConnectionDescription ( + const Deployment::PlanConnectionDescription &src) + { + XMLSchema::string< char > name ((src.name)); + + PlanConnectionDescription pcd(name); + + //Get the source if it exists + if(src.source.length() != 0) + { + XMLSchema::string< char > source((src.source[0])); + pcd.source(source); + } + + //Get any externalEndpoint(s) and store them + size_t total = src.externalEndpoint.length(); + for(size_t i = 0; i < total; i++) + { + pcd.add_externalEndpoint( + CEPE_Handler::external_port_endpoint( + src.externalEndpoint[i])); + } + + //Get any externalReference(s) and store them + total = src.externalReference.length(); + for(size_t j = 0; j < total; j++) + { + pcd.add_externalReference( + ERE_Handler::external_ref_endpoint( + src.externalReference[j])); + } + + //Get any internalEndpoint(s) and store them + total = src.internalEndpoint.length(); + for(size_t k = 0; k < total; k++) + { + pcd.add_internalEndpoint( + PSPE_Handler::sub_component_port_endpoint( + src.internalEndpoint[k])); + } + + //Get any deployedResource(s) and store them + total = src.deployedResource.length(); + for(size_t l = 0; l < total; l++) + { + pcd.add_deployedResource( + CRDD_Handler::connection_resource_depl_desc( + src.deployedResource[l])); + } + + //Get any deployRequirement(s) and store them + total = src.deployRequirement.length(); + for(size_t m = 0; m < total; m++) + { + pcd.add_deployRequirement( + Req_Handler::get_requirement( + src.deployRequirement[m])); + } + + return pcd; + } } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.h b/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.h index be3b2c93402..bdbb9d77d28 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/PCD_Handler.h @@ -56,6 +56,11 @@ namespace CIAO Deployment::PlanConnectionDescription& toconfig, PlanConnectionDescription& desc); + //This method takes a <Deployment::PlanConnectionDescription> + //converts it into a <Config_Handler::PlanConnectionDescription> + //and returns the value + static PlanConnectionDescription get_PlanConnectionDescription ( + const Deployment::PlanConnectionDescription &src); }; } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/PSPE_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/PSPE_Handler.cpp index d84ba36aac7..2a1b33f8e99 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/PSPE_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/PSPE_Handler.cpp @@ -71,7 +71,7 @@ namespace CIAO if (src.kind () == CCMComponentPortKind::EventConsumer) dest.kind = Deployment::EventConsumer; } -/* + PlanSubcomponentPortEndpoint PSPE_Handler::sub_component_port_endpoint ( const Deployment::PlanSubcomponentPortEndpoint &src) @@ -79,11 +79,16 @@ namespace CIAO XMLSchema::string< char > pname ((src.portName)); XMLSchema::string< char > tval ("true"); XMLSchema::string< char > prov (""); - + ACE_CString id; + IDD_Handler::IDREF.find_ref(src.instanceRef, id); + XMLSchema::IDREF < ACE_TCHAR > idref(id.c_str()); + if (src.provider) prov = tval; - PlanSubcomponentPortEndpoint pspe (pname,CCMComponentPortKind::Facet); + PlanSubcomponentPortEndpoint pspe (pname, + CCMComponentPortKind::Facet, + idref); pspe.provider (prov); if (src.kind == ::Deployment::Facet) @@ -91,7 +96,7 @@ namespace CIAO if (src.kind == ::Deployment::SimplexReceptacle) pspe.kind (CCMComponentPortKind::SimplexReceptacle); if (src.kind == ::Deployment::MultiplexReceptacle) - cpd.kind (CCMComponentPortKind::MultiplexReceptacle); + pspe.kind (CCMComponentPortKind::MultiplexReceptacle); if (src.kind == ::Deployment::EventEmitter) pspe.kind (CCMComponentPortKind::EventEmitter); if (src.kind == ::Deployment::EventPublisher) @@ -100,6 +105,6 @@ namespace CIAO pspe.kind (CCMComponentPortKind::EventConsumer); return pspe; - } */ + } } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/Req_Handler.cpp b/TAO/CIAO/DAnCE/Config_Handlers/Req_Handler.cpp index 6fa0928b637..4a52efb9967 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/Req_Handler.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/Req_Handler.cpp @@ -38,17 +38,23 @@ namespace CIAO toconfig.property[toconfig.property.length () - 1]); } - Requirement - Req_Handler::get_requirement ( - const Deployment::Requirement& src) - { - XMLSchema::string< char > name ((src.name)); - XMLSchema::string< char > res ((src.resourceType)); - Property prop ( - Property_Handler::get_property (src.property[0])); - Requirement req (name,res,prop); + Requirement + Req_Handler::get_requirement ( + const Deployment::Requirement& src) + { + //Get the values for name and res + XMLSchema::string< char > name ((src.name)); + XMLSchema::string< char > res ((src.resourceType)); - return req; - } + //Get the Property + Property prop ( + Property_Handler::get_property ( + src.property[0])); + + //Instantiate the Requirement + Requirement req (name,res,prop); + + return req; + } } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp index a95df7e7301..1ace3cd114f 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.cpp @@ -5,7 +5,8 @@ #include "xercesc/util/XMLUniDefs.hpp" #include "xercesc/dom/DOM.hpp" #include "XML_Error_Handler.h" - +#include "xercesc/framework/LocalFileFormatTarget.hpp" +#include "XercesString.h" namespace CIAO { @@ -68,6 +69,16 @@ namespace CIAO return; } + // Instantiate the DOM parser. + static const XMLCh gLS[] = { xercesc::chLatin_L, + xercesc::chLatin_S, + xercesc::chNull }; + + // Get an implementation of the Load-Store (LS) interface + // and cache it for later use + impl_ = + DOMImplementationRegistry::getDOMImplementation(gLS); + this->initialized_ = true; return; } @@ -77,22 +88,17 @@ namespace CIAO { if (url == 0) - throw; + return impl_->createDocument( + XStr ("http://www.omg.org/DeploymentPlan"), + XStr ("deploymentPlan"), + 0); try { - // Instantiate the DOM parser. - static const XMLCh gLS[] = { xercesc::chLatin_L, - xercesc::chLatin_S, - xercesc::chNull }; - - // Get an implementation of the Load-Store (LS) interface - DOMImplementation* impl = - DOMImplementationRegistry::getDOMImplementation(gLS); // Create a DOMBuilder DOMBuilder* parser = - impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, + impl_->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0); // Discard comment nodes in the document @@ -190,5 +196,18 @@ namespace CIAO this->initialized_ = false; return; } + + bool XML_Helper::write_DOM (XERCES_CPP_NAMESPACE::DOMDocument *doc, + ACE_TCHAR *file) + { + bool retn; + XERCES_CPP_NAMESPACE::DOMWriter *writer = impl_->createDOMWriter(); + xercesc::XMLFormatTarget* ft (new xercesc::LocalFileFormatTarget(file)); + retn = writer->writeNode(ft, *doc); + delete writer; + delete ft; + return retn; + } + } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h index 9920ece69fd..1acf3ce0e82 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/XML_Helper.h @@ -23,6 +23,8 @@ namespace XERCES_CPP_NAMESPACE { class DOMDocument; + class DOMWriter; + class DOMImplementation; } @@ -46,6 +48,10 @@ namespace CIAO XERCES_CPP_NAMESPACE::DOMDocument * create_dom (const ACE_TCHAR *uri); + //Writes out a DOMDocument to an XML file + bool write_DOM (XERCES_CPP_NAMESPACE::DOMDocument *doc, + ACE_TCHAR *file); + bool is_initialized (void) const; protected: @@ -57,6 +63,7 @@ namespace CIAO private: bool initialized_; + XERCES_CPP_NAMESPACE::DOMImplementation *impl_; }; } } diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp index 877f9639d51..1d4d5a74a0e 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp @@ -5,7 +5,9 @@ #include "XercesString.h" using xercesc::XMLString; -namespace Config_Handler +namespace CIAO +{ +namespace Config_Handlers { XStr::XStr (const char* str) @@ -138,3 +140,4 @@ namespace Config_Handler } } +} diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h index 7ac692d34de..9e8f963f8d1 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h +++ b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h @@ -18,7 +18,9 @@ // Utility class that provides a std::string like facade to XMLString. // Doesn't implement all of the methods of std::string. -namespace Config_Handler +namespace CIAO +{ +namespace Config_Handlers { class XStr @@ -67,7 +69,7 @@ namespace Config_Handler operator<< (std::ostream& o, XStr const& str); } - +} #include /**/ "ace/post.h" #endif /* _XERCESSTRING_H */ diff --git a/TAO/CIAO/DAnCE/Config_Handlers/cdp.cpp b/TAO/CIAO/DAnCE/Config_Handlers/cdp.cpp index aa3366da732..d69c3923753 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/cdp.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/cdp.cpp @@ -10,6 +10,7 @@ */ #include "cdp.hpp" +#include "ace/Log_Msg.h" namespace CIAO { diff --git a/TAO/CIAO/DAnCE/Config_Handlers/test.cpp b/TAO/CIAO/DAnCE/Config_Handlers/test.cpp index f0b192b9374..43a15b3abda 100644 --- a/TAO/CIAO/DAnCE/Config_Handlers/test.cpp +++ b/TAO/CIAO/DAnCE/Config_Handlers/test.cpp @@ -48,20 +48,37 @@ int main (int argc, char *argv[]) // Initialize an ORB so Any will work CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv, ""); - + + //Create an XML_Helper for all the file work XML_Helper the_helper; if (xercesc::DOMDocument *doc = the_helper.create_dom (input_file)) - { + { + //Read in the XSC type structure from the DOMDocument DeploymentPlan dp = deploymentPlan (doc); - - + + //Convert the XSC to an IDL datatype DP_Handler dp_handler (dp); - std::cout << "Instance document import succeeded. Dumping contents....\n"; - - Deployment::DnC_Dump::dump (*dp_handler.plan ()); - + std::cout << "Instance document import succeeded. Dumping contents to file\n"; + + //Retrieve the newly created IDL structure + Deployment::DeploymentPlan *idl = dp_handler.plan(); + + //Convert it back to an XSC structure with a new DP_Handler + DP_Handler reverse_handler(*idl); + + //Create a new DOMDocument for writing the XSC into XML + xercesc::DOMDocument* the_xsc (the_helper.create_dom(0)); + + //Serialize the XSC into a DOMDocument + deploymentPlan(*reverse_handler.xsc(), the_xsc); + + //Write it to test.xml + the_helper.write_DOM(doc, "test.xml"); + + //Cleanliness is next to Godliness + delete doc; } std::cout << "Test completed!\n"; |