Ejemplo n.º 1
0
void
XML_Backing_Store::persist (FILE* fp,
                            const Activator_Info& info,
                            const char* tag_prepend,
                            const NameValues& name_values)
{
  ACE_OS::fprintf (fp,"%s<%s", tag_prepend,
    Locator_XMLHandler::ACTIVATOR_INFO_TAG);
  ACE_OS::fprintf( fp," name=\"%s\"", info.name.c_str ());
  ACE_OS::fprintf (fp," token=\"%d\"", info.token);
  ACE_OS::fprintf (fp," ior=\"%s\"", info.ior.c_str ());

  NameValues::const_iterator name_value;
  for (name_value = name_values.begin(); name_value != name_values.end(); ++name_value)
    {
      ACE_OS::fprintf (fp," %s=\"%s\"",
                       name_value->first.c_str(), name_value->second.c_str());
    }

  ACE_OS::fprintf (fp,"/>\n");
}
Ejemplo n.º 2
0
void
XML_Backing_Store::persist (FILE* fp,
                            const Server_Info& info,
                            const char* tag_prepend,
                            const NameValues& name_values)
{
  ACE_CString server_id = ACEXML_escape_string (info.server_id);
  ACE_CString pname = ACEXML_escape_string (info.poa_name);
  ACE_CString keyname = ACEXML_escape_string (info.key_name_);
  ACE_CString altkey = "";
  if (!info.alt_info_.null())
    {
      altkey = ACEXML_escape_string (info.alt_info_->key_name_);
    }

  ACE_CString activator = ACEXML_escape_string (info.activator);
  ACE_CString cmdline = ACEXML_escape_string (info.cmdline);
  ACE_CString wdir = ACEXML_escape_string (info.dir);
  ACE_CString partial_ior = ACEXML_escape_string (info.partial_ior);
  ACE_CString ior = ACEXML_escape_string (info.ior);
  ACE_CString amodestr =
    ImR_Utils::activationModeToString (info.activation_mode_);

  ACE_OS::fprintf (fp,"%s<%s", tag_prepend,
    Locator_XMLHandler::SERVER_INFO_TAG);
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::SERVER_TAG, server_id.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::POANAME_TAG, pname.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::ACTNAME_TAG, activator.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::CMDLINE_TAG, cmdline.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::DIR_TAG, wdir.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::MODE_TAG, amodestr.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%d\"", Locator_XMLHandler::LIMIT_TAG, info.start_limit_);
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::PARTIOR_TAG, partial_ior.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%s\"", Locator_XMLHandler::IOR_TAG, ior.c_str ());
  ACE_OS::fprintf (fp, " %s=\"%d\"", Locator_XMLHandler::STARTED_TAG, !CORBA::is_nil(info.server.in()));
  ACE_OS::fprintf (fp, " %s=\"%d\"", Locator_XMLHandler::JACORB_TAG, info.is_jacorb);
  ACE_OS::fprintf (fp, " %s=\"%d\"", Locator_XMLHandler::PID_TAG, info.pid);
  ACE_OS::fprintf (fp, " %s= \"%s\"", Locator_XMLHandler::KEYNAME_TAG, keyname.c_str ());
  ACE_OS::fprintf (fp, " %s= \"%s\"", Locator_XMLHandler::ALTKEY_TAG, altkey.c_str ());

  NameValues::const_iterator name_value;
  for (name_value = name_values.begin(); name_value != name_values.end(); ++name_value)
    {
      ACE_OS::fprintf (fp," %s=\"%s\"",
                       name_value->first.c_str(), name_value->second.c_str());
    }

  CORBA::ULong elen = info.env_vars.length ();
  CORBA::ULong plen = info.peers.length ();

  if (elen + plen > 0)
    {
      ACE_OS::fprintf (fp,">\n");
      for (CORBA::ULong i = 0; i < elen; ++i)
        {
          ACE_OS::fprintf (fp,"%s\t<%s", tag_prepend,
            Locator_XMLHandler::ENVIRONMENT_TAG);
          ACE_OS::fprintf (fp," name=\"%s\"", info.env_vars[i].name.in ());
          ACE_CString val = ACEXML_escape_string(info.env_vars[i].value.in());
          ACE_OS::fprintf (fp," value=\"%s\"", val.c_str());
          ACE_OS::fprintf (fp,"/>\n");
        }
      for (CORBA::ULong i = 0; i < plen; ++i)
        {
          ACE_OS::fprintf (fp,"%s\t<%s", tag_prepend,
            Locator_XMLHandler::PEER_TAG);
          ACE_CString name = ACEXML_escape_string(info.peers[i].in());
          ACE_OS::fprintf (fp," name=\"%s\"", name.c_str());
          ACE_OS::fprintf (fp,"/>\n");
        }

      ACE_OS::fprintf (fp,"%s</%s>\n", tag_prepend, Locator_XMLHandler::SERVER_INFO_TAG);
    }
  else
    {
      ACE_OS::fprintf (fp,"/>\n");
    }
}