void CUTS_BE_Component_Impl_Begin_T <CUTS_BE_Xml>:: generate (const PICML::MonolithicImplementation & mono, const PICML::Component & component) { this->ctx_.outfile_ << "<cuts:behavior type=\"" << component.name () << "\">" << std::endl; }
void MPCStream::create_cidl_defn (PICML::ImplementationArtifact_in artifact) { // Step 1: From the implementation artifact get all the references // Obtain the reference that is contained in the Implementations // foler auto impl_refs = artifact->referenced_by (); bool entered_loop = 0; for (auto artifact_ref : impl_refs) { try { PICML::ComponentImplementationContainer parent = artifact_ref->parent (); // @@ There should only be one Container that should hold // a reference to this entered_loop = 1; // Step 2: Obtain the Component name that is present within this // Implements folder auto children = parent->get_MonolithprimaryArtifacts (); if (children.count ()) { PICML::ComponentImplementation ci = *children.begin (); std::vector <PICML::Implements> impls; ci->src_of_Implements (impls); PICML::ComponentRef type = impls[0]->dst_ComponentRef (); // Get the name of the ComponentType PICML::Component comp = type->refers_to (); // Step 3: The name of the cidl will be based on the component idl // file name std::string name = comp->name (); std::string message = "Cidl_file_name" + name; this->cidl_file_.push_back (name); } } catch (GAME::Mga::Exception & ) { } } // Step 4: Write out the cidl_files this->nl (); this->indent (); this->strm_ << "CIDL_Files {"; this->nl (); this->incr_indent (); for (std::string & cidl_entry : this->cidl_file_) { this->indent (); this->strm_ << (cidl_entry); //@@ Need to check for command line arguments to the cidl file // if any this->strm_ << ".cidl"; this->nl (); } // Close the Cidl file this->decr_indent (); this->indent (); this->strm_<< "}"; this->nl (); }
// // Visit_Component // void QED_Deployment_Visitor:: Visit_Component (const PICML::Component & component) { // Create the XML document. if (this->doc_ != 0) this->doc_->release(); this->doc_ = this->impl_->createDocument ( Utils::XStr ("http://www.springframework.org/schema/beans"), Utils::XStr ("beans"), 0); this->doc_->setXmlVersion (Utils::XStr("1.0")); xercesc::DOMElement * root = this->doc_->getDocumentElement (); root->setAttributeNS ( Utils::XStr ("http://www.w3.org/2000/xmlns/"), Utils::XStr ("xmlns:xsi"), Utils::XStr ("http://www.w3.org/2001/XMLSchema-instance")); root->setAttribute ( Utils::XStr ("xsi:schemaLocation"), Utils::XStr ("http://www.springframework.org/schema/beans " "http://www.springframework.org/schema/beans/spring-beans-2.5.xsd")); // Create the filename for the configuration. std::string name = component.name (); // Define the instance information. std::ostringstream unique_id; unique_id << this->scope_.top () << "." << name; xercesc::DOMElement * element = this->doc_->createElementNS (Utils::XStr ("http://www.springframework.org/schema/beans"), Utils::XStr ("bean")); element->setAttribute (Utils::XStr ("id"), Utils::XStr (unique_id.str ().c_str ())); // Save the unique id for later usage. this->instance_names_[component] = unique_id.str (); // Find the implementation for this component. QED_Implementation_Finder finder; PICML::Component (component).Accept (finder); // Remove all the default properties. if (!this->default_props_.empty ()) this->default_props_.empty (); if (finder.is_found ()) { PICML::MonolithicImplementation impl = finder.implementation (); std::string type = impl.name (); element->setAttribute (Utils::XStr ("class"), Utils::XStr (type)); impl.Accept (*this); } // Overwrite the default properties, if there are any. typedef std::set <PICML::AssemblyConfigProperty> ConfigProperty_Set; ConfigProperty_Set configs = component.dstAssemblyConfigProperty (); std::for_each (configs.begin (), configs.end (), boost::bind (&ConfigProperty_Set::value_type::Accept, _1, boost::ref (*this))); root->appendChild (element); this->root_.push (element); // Write the default properties to the XML document. std::for_each (this->default_props_.begin (), this->default_props_.end (), boost::bind (&QED_Deployment_Visitor::write_property, this, _1)); // Get all the attributes for the component. We need to visit them // and add them to the XML document. typedef std::vector <PICML::Attribute> Attribute_Set; Attribute_Set attributes = component.Attribute_kind_children (); std::for_each (attributes.begin (), attributes.end (), boost::bind (&Attribute_Set::value_type::Accept, _1, boost::ref (*this))); this->root_.pop (); // Construct the filename for the XML document. std::ostringstream filename; filename << this->path_.top () << "/" << name << ".qic"; // Serialize the XML to file. this->serialize_xml_to_file (filename.str ()); }