コード例 #1
0
ファイル: Generator_Base.cpp プロジェクト: SEDS/CUTS
//
// write_impl_begin
//
void CUTS_EISA_Generator_Base::
write_impl_begin (const PICML::MonolithicImplementation & monoimpl,
                  const PICML::Component & type)
{
  this->out_
    << std::endl
    << "namespace CIDL_" << monoimpl.name () << "{";
}
コード例 #2
0
//
// Visit_MonolithicImplementation
//
void Set_Classpath_Script_Generator::
Visit_MonolithicImplementation (const PICML::MonolithicImplementation & mono)
{
  this->impls_.insert (mono.name ());
}
コード例 #3
0
//
// 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 ());
}