summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/ImplRepo_Service/Server_Info.cpp
blob: 70ed15854f97e52af82a07d8de693dccf232f055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// $Id$
#include "Server_Info.h"

Server_Info::Server_Info
(
 const ACE_CString& server_name,
 const ACE_CString& aname,
 const ACE_CString& cmdline,
 const ImplementationRepository::EnvironmentList& env,
 const ACE_CString& working_dir,
 ImplementationRepository::ActivationMode amode,
 int limit,
 const ACE_CString& partial_ior,
 const ACE_CString& server_ior,
 ImplementationRepository::ServerObject_ptr svrobj
 )
 : name(server_name)
 , activator(aname)
 , cmdline(cmdline)
 , env_vars(env)
 , dir(working_dir)
 , activation_mode(amode)
 , start_limit (limit)
 , partial_ior(partial_ior)
 , ior(server_ior)
 , server(ImplementationRepository::ServerObject::_duplicate(svrobj))
 , start_count(0)
 , waiting_clients(0)
 , starting(false)
{
}

ImplementationRepository::ServerInformation*
Server_Info::createImRServerInfo(ACE_ENV_SINGLE_ARG_DECL)
{
  ImplementationRepository::ServerInformation* info;
  ACE_NEW_THROW_EX (info, ImplementationRepository::ServerInformation, CORBA::NO_MEMORY());

  info->server = name.c_str();
  info->startup.command_line = cmdline.c_str();
  info->startup.environment = env_vars;
  info->startup.working_directory = dir.c_str();
  info->startup.activation = activation_mode;
  info->startup.activator = activator.c_str();
  if (start_count >= start_limit) {
    info->startup.start_limit = -start_limit;
  }
  else
  {
    info->startup.start_limit = start_limit;
  }
  info->partial_ior = partial_ior.c_str();

  return info;
}

void
Server_Info::reset(void)
{
  ior = "";
  partial_ior = "";
  last_ping = ACE_Time_Value::zero;
  server = ImplementationRepository::ServerObject::_nil();
  // start_count = 0; Note : We can't do this, because it would be reset during startup.
}