Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends

ACE_Service_Gestalt Class Reference

Supplies common server operations for dynamic and static configuration of services. More...

#include <Service_Gestalt.h>

Collaboration diagram for ACE_Service_Gestalt:
Collaboration graph
[legend]

List of all members.

Classes

struct  Processed_Static_Svc

Public Types

enum  { MAX_SERVICES = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE }
enum  { DEFAULT_SIZE = ACE_DEFAULT_SERVICE_GESTALT_SIZE }

Public Member Functions

 ACE_Service_Gestalt (size_t size=DEFAULT_SIZE, bool svc_repo_is_owned=true, bool no_static_svcs=true)
 ~ACE_Service_Gestalt (void)
void dump (void) const
 Dump the state of an object.
int open (const ACE_TCHAR program_name[], const ACE_TCHAR *logger_key=0, bool ignore_static_svcs=true, bool ignore_default_svc_conf_file=false, bool ignore_debug_flag=false)
int open (int argc, ACE_TCHAR *argv[], const ACE_TCHAR *logger_key=0, bool ignore_static_svcs=true, bool ignore_default_svc_conf_file=false, bool ignore_debug_flag=false)
int is_opened (void)
int process_directive (const ACE_TCHAR directive[])
int process_directive (const ACE_Static_Svc_Descriptor &ssd, bool force_replace=false)
 Process one static service definition.
int process_file (const ACE_TCHAR file[])
int find (const ACE_TCHAR name[], const ACE_Service_Type **srp=0, bool ignore_suspended=true) const
 Searches for a service object declaration in the local repo, only.
int parse_args (int argc, ACE_TCHAR *argv[])
int process_directives (bool defunct_option=false)
int close (void)
int insert (ACE_Static_Svc_Descriptor *stsd)
 Registers a service descriptor for a static service object.
int initialize (const ACE_Service_Type *, const ACE_TCHAR *parameters)
int initialize (const ACE_TCHAR *svc_name, const ACE_TCHAR *parameters)
 Initialize and activate a statically svc_name service.
int resume (const ACE_TCHAR svc_name[])
int suspend (const ACE_TCHAR svc_name[])
int remove (const ACE_TCHAR svc_name[])
int find_static_svc_descriptor (const ACE_TCHAR *name, ACE_Static_Svc_Descriptor **ssd=0) const
 Find a static service descriptor by name.
ACE_Service_Repositorycurrent_service_repository (void)
 Get the current ACE_Service_Repository held by this object.

Static Public Member Functions

static void intrusive_add_ref (ACE_Service_Gestalt *)
static void intrusive_remove_ref (ACE_Service_Gestalt *)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Types

typedef ACE_Unbounded_Queue
< ACE_TString
ACE_SVC_QUEUE
typedef
ACE_Unbounded_Queue_Iterator
< ACE_TString
ACE_SVC_QUEUE_ITERATOR
typedef ACE_Unbounded_Set
< ACE_Static_Svc_Descriptor * > 
ACE_STATIC_SVCS
 Maintain a set of the statically linked service descriptors.
typedef
ACE_Unbounded_Set_Iterator
< ACE_Static_Svc_Descriptor * > 
ACE_STATIC_SVCS_ITERATOR
typedef ACE_Unbounded_Set
< Processed_Static_Svc * > 
ACE_PROCESSED_STATIC_SVCS
typedef
ACE_Unbounded_Set_Iterator
< Processed_Static_Svc * > 
ACE_PROCESSED_STATIC_SVCS_ITERATOR

Protected Member Functions

int parse_args_i (int, ACE_TCHAR *argv[], bool &ignore_default_svc_conf_file)
int open_i (const ACE_TCHAR program_name[], const ACE_TCHAR *logger_key=0, bool ignore_static_svcs=true, bool ignore_default_svc_conf_file=false, bool ignore_debug_flag=false)
int init_svc_conf_file_queue (void)
 Initialize the svc_conf_file_queue_ if necessary.
int load_static_svcs (void)
int process_commandline_directives (void)
int process_directive_i (const ACE_Static_Svc_Descriptor &ssd, bool force_replace=false)
ACE_XML_Svc_Confget_xml_svc_conf (ACE_DLL &d)
int initialize_i (const ACE_Service_Type *sr, const ACE_TCHAR *parameters)
const ACE_Static_Svc_Descriptorfind_processed_static_svc (const ACE_TCHAR *)
void add_processed_static_svc (const ACE_Static_Svc_Descriptor *)
 Captures a list of the direcives processed (explicitely) for this Gestalt so that services can be replicated in other repositories upon their first initialization.
int init_i (void)

Protected Attributes

bool svc_repo_is_owned_
size_t svc_repo_size_
int is_opened_
const ACE_TCHARlogger_key_
bool no_static_svcs_
 Should we avoid loading the static services?
ACE_SVC_QUEUEsvc_queue_
 Queue of services specified on the command-line.
ACE_SVC_QUEUEsvc_conf_file_queue_
ACE_Service_Repositoryrepo_
 The service repository to hold the services.
ACE_STATIC_SVCSstatic_svcs_
 Repository of statically linked services.
ACE_PROCESSED_STATIC_SVCSprocessed_static_svcs_
ACE_Atomic_Op< ACE_SYNCH_MUTEX,
long > 
refcnt_
 Support for intrusive reference counting.

Private Member Functions

 ACE_Service_Gestalt (const ACE_Service_Gestalt &)
ACE_Service_Gestaltoperator= (const ACE_Service_Gestalt &)

Friends

class ACE_Dynamic_Service_Base
class ACE_Service_Object
class ACE_Service_Config
class ACE_Service_Config_Guard

Detailed Description

Supplies common server operations for dynamic and static configuration of services.

The Gestalt embodies the concept of configuration context. On one hand, it is a flat namespace, where names correspond to a Service Object instance. A Gestalt owns the Service Repository instance, which in turn owns the Service Object instances.

Another aspect of a Gestalt is its responsibility for record-keeping and accounting for the meta-data, necessary for locating, removing or instantiating a service.

A repository underlies an instance of a gestalt and its lifetime may or may not be bounded by the lifetime of the gestalt, that owns it. This feature is important for the derived classes and the Service Config in particular.

Definition at line 70 of file Service_Gestalt.h.


Member Typedef Documentation

Definition at line 416 of file Service_Gestalt.h.

Definition at line 419 of file Service_Gestalt.h.

Maintain a set of the statically linked service descriptors.

Definition at line 410 of file Service_Gestalt.h.

Definition at line 413 of file Service_Gestalt.h.

Maintain a queue of services to be configured from the command-line.

Definition at line 405 of file Service_Gestalt.h.

Definition at line 406 of file Service_Gestalt.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
MAX_SERVICES 

Definition at line 80 of file Service_Gestalt.h.

anonymous enum
Enumerator:
DEFAULT_SIZE 

Definition at line 85 of file Service_Gestalt.h.


Constructor & Destructor Documentation

ACE_Service_Gestalt::ACE_Service_Gestalt ( const ACE_Service_Gestalt  )  [private]

Not implemented to enforce no copying

ACE_Service_Gestalt::ACE_Service_Gestalt ( size_t  size = DEFAULT_SIZE,
bool  svc_repo_is_owned = true,
bool  no_static_svcs = true 
)

Constructor either associates the instance with the process-wide singleton instance of ACE_Service_Repository, or creates and manages its own instance of the specified size.

Definition at line 210 of file Service_Gestalt.cpp.

  : svc_repo_is_owned_ (svc_repo_is_owned)
  , svc_repo_size_ (size)
  , is_opened_ (0)
  , logger_key_ (ACE_DEFAULT_LOGGER_KEY)
  , no_static_svcs_ (no_static_svcs)
  , svc_queue_ (0)
  , svc_conf_file_queue_ (0)
  , repo_ (0)
  , static_svcs_ (0)
  , processed_static_svcs_ (0)
  , refcnt_ (0)
{
  (void)this->init_i ();

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::ctor - this = %@, pss = %@\n"),
                this, this->processed_static_svcs_));
#endif
}

ACE_Service_Gestalt::~ACE_Service_Gestalt ( void   ) 

Perform user-specified close activities and remove dynamic memory.

Definition at line 172 of file Service_Gestalt.cpp.

{

  if (this->svc_repo_is_owned_)
    delete this->repo_;

  this->repo_ =0;

  delete this->static_svcs_;
  this->static_svcs_ = 0;

  // Delete the dynamically allocated static_svcs instance.
#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::~SG - this=%@, pss = %@\n"),
                this, this->processed_static_svcs_));
#endif

  if (this->processed_static_svcs_ &&
      !this->processed_static_svcs_->is_empty())
    {
      Processed_Static_Svc **pss = 0;
      for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_);
           iter.next (pss) != 0;
           iter.advance ())
        {
          delete *pss;
        }
    }

  delete this->processed_static_svcs_;
  this->processed_static_svcs_ = 0;

  delete this->svc_conf_file_queue_;
  this->svc_conf_file_queue_ = 0;
}


Member Function Documentation

void ACE_Service_Gestalt::add_processed_static_svc ( const ACE_Static_Svc_Descriptor assd  )  [protected]

Captures a list of the direcives processed (explicitely) for this Gestalt so that services can be replicated in other repositories upon their first initialization.

This is part of the mechanism ensuring distinct local instances for static service objects, loaded in another repository.

When process_directive(Static_Svc_Descriptor&) is called, it associates a service object with the Gestalt and makes the resource (a Service Object) local to the repository. This is but the first step in using such SO. The next is the "initialization" step. It is typicaly done through a "static" service configuration directive.

In contrast a "dynamic" directive, when processed through the overloaded process_directives(string) both creates the SO locally and initializes it, where the statics directive must first locate the SO and then calls the init() method. This means that durig the "static" initialization there's no specific information about the hosting repository and the gestalt must employ some lookup strategy to find it elsewhere.

Definition at line 347 of file Service_Gestalt.cpp.

{

  /// When process_directive(Static_Svc_Descriptor&) is called, it
  /// associates a service object with the Gestalt and makes the
  /// resource (a Service Object) local to the repository. This is but
  /// the first step in using such SO. The next is the
  /// "initialization" step. It is typicaly done through a "static"
  /// service configuration directive.
  ///
  /// In contrast a "dynamic" directive, when processed through the
  /// overloaded process_directives(string) both creates the SO
  /// locally and initializes it, where the statics directive must
  /// first locate the SO and then calls the init() method. This means
  /// that durig the "static" initialization there's no specific
  /// information about the hosting repository and the gestalt must
  /// employ some lookup strategy to find it elsewhere.

  if (this->processed_static_svcs_ == 0)
    ACE_NEW (this->processed_static_svcs_,
             ACE_PROCESSED_STATIC_SVCS);

  Processed_Static_Svc **pss = 0;
  for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_);
       iter.next (pss) != 0;
       iter.advance ())
    {
      if (ACE_OS::strcmp ((*pss)->name_, assd->name_) == 0)
        {
          (*pss)->assd_ = assd;
          return;
        }
    }
  Processed_Static_Svc *tmp = 0;
  ACE_NEW (tmp,Processed_Static_Svc(assd));
  this->processed_static_svcs_->insert(tmp);

  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::add_processed_static_svc, ")
                ACE_TEXT ("repo=%@ - %s\n"),
                this->repo_,
                assd->name_));
}

int ACE_Service_Gestalt::close ( void   ) 

Tidy up and perform last rites when ACE_Service_Config is shut down. This method calls close_svcs. Returns 0.

Definition at line 1279 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::close");

  if (!this->is_opened_ || --this->is_opened_ != 0)
    return 0;

  // Delete the list fo svc.conf files
  delete this->svc_conf_file_queue_;
  this->svc_conf_file_queue_ = 0;

  if (this->processed_static_svcs_ &&
      !this->processed_static_svcs_->is_empty())
    {
      Processed_Static_Svc **pss = 0;
      for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_);
           iter.next (pss) != 0;
           iter.advance ())
        {
          delete *pss;
        }
    }
  delete this->processed_static_svcs_;
  this->processed_static_svcs_ = 0;

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::close - complete this=%@, repo=%@, owned=%d\n"),
                this, this->repo_, this->svc_repo_is_owned_));
#endif

  if (this->svc_repo_is_owned_)
    delete this->repo_;

  this->repo_ = 0;

  return 0;
} /* close () */

ACE_Service_Repository * ACE_Service_Gestalt::current_service_repository ( void   ) 

Get the current ACE_Service_Repository held by this object.

Definition at line 73 of file Service_Gestalt.inl.

{
  return this->repo_;
}

void ACE_Service_Gestalt::dump ( void   )  const

Dump the state of an object.

Definition at line 414 of file Service_Gestalt.cpp.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Service_Gestalt::dump");
#endif /* ACE_HAS_DUMP */
}

int ACE_Service_Gestalt::find ( const ACE_TCHAR  name[],
const ACE_Service_Type **  srp = 0,
bool  ignore_suspended = true 
) const

Searches for a service object declaration in the local repo, only.

Locate an entry with name in the table. If ignore_suspended is set then only consider services marked as resumed. If the caller wants the located entry, pass back a pointer to the located entry via srp. If name is not found, -1 is returned. If name is found, but it is suspended and the caller wants to ignore suspended services a -2 is returned.

Definition at line 58 of file Service_Gestalt.inl.

{
  // Closing the gestalt will have disassociated it from the
  // repository. If the repository used to be owned by the gestalt, it
  // will also have been destroyed - so just check for repo_ before
  // doing anything with it.
  if (this->repo_ != 0)
    return this->repo_->find (name, srp, ignore_suspended);

  return 0;
}

const ACE_Static_Svc_Descriptor * ACE_Service_Gestalt::find_processed_static_svc ( const ACE_TCHAR name  )  [protected]

Definition at line 321 of file Service_Gestalt.cpp.

{
  if (this->processed_static_svcs_ == 0 || name == 0)
    return 0;

  Processed_Static_Svc **pss = 0;
  for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_);
       iter.next (pss) != 0;
       iter.advance ())
    {
      if (ACE_OS::strcmp ((*pss)->name_, name) == 0)
        return (*pss)->assd_;
    }
  return 0;
}

int ACE_Service_Gestalt::find_static_svc_descriptor ( const ACE_TCHAR name,
ACE_Static_Svc_Descriptor **  ssd = 0 
) const

Find a static service descriptor by name.

Using the supplied name, finds and (if needed) returns a pointer to a static service descriptor. Returns 0 for success and -1 for failure

Definition at line 294 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::find_static_svc_descriptor");

  if (this->static_svcs_ == 0)
    return -1;

  ACE_Static_Svc_Descriptor **ssdp = 0;
  for (ACE_STATIC_SVCS_ITERATOR iter ( *this->static_svcs_);
       iter.next (ssdp) != 0;
       iter.advance ())
    {
      if (ACE_OS::strcmp ((*ssdp)->name_, name) == 0)
        {
          if (ssd != 0)
            *ssd = *ssdp;

          return 0;
        }
    }

  return -1;
}

ACE_XML_Svc_Conf * ACE_Service_Gestalt::get_xml_svc_conf ( ACE_DLL d  )  [protected]

Helper function to dynamically link in the XML Service Configurator parser.

Definition at line 819 of file Service_Gestalt.cpp.

{
  if (xmldll.open (ACE_TEXT ("ACEXML_XML_Svc_Conf_Parser")) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("ACE (%P|%t) Failure to open ACEXML_XML_Svc_Conf_Parser: %p\n"),
                       ACE_TEXT("ACE_Service_Config::get_xml_svc_conf")),
                      0);

  void * foo =
    xmldll.symbol (ACE_TEXT ("_ACEXML_create_XML_Svc_Conf_Object"));

#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64))
  int const temp_p = reinterpret_cast<int> (foo);
#else
  intptr_t const temp_p = reinterpret_cast<intptr_t> (foo);
#endif

  ACE_XML_Svc_Conf::Factory factory = reinterpret_cast<ACE_XML_Svc_Conf::Factory> (temp_p);

  if (factory == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("ACE (%P|%t) Unable to resolve factory: %p\n"),
                       xmldll.error ()),
                      0);

  return factory ();
}

int ACE_Service_Gestalt::init_i ( void   )  [protected]

Performs the common initialization tasks for a new or previously closed instance. Must not be virtual, as it is called from the constructor.

Performs the common initialization tasks for a new or previously closed instance. Must not be virtual, as it is also called from the constructor.

Definition at line 239 of file Service_Gestalt.cpp.

{
  // Only initialize the repo_ if (a) we are being constructed, or;
  // (b) we're being open()-ed, perhaps after previously having been
  // close()-ed. In both cases: repo_ == 0 and we need a repository.
  if (this->repo_ == 0)
    {
      if (this->svc_repo_is_owned_)
        {
          ACE_NEW_RETURN (this->repo_,
                          ACE_Service_Repository (this->svc_repo_size_),
                          -1);
        }
      else
        {
          this->repo_ =
            ACE_Service_Repository::instance (this->svc_repo_size_);
        }
    }

  if (init_svc_conf_file_queue () == -1)
    return -1;

  return 0;
}

int ACE_Service_Gestalt::init_svc_conf_file_queue ( void   )  [protected]

Initialize the svc_conf_file_queue_ if necessary.

Definition at line 966 of file Service_Gestalt.cpp.

{
  if (this->svc_conf_file_queue_ == 0)
    {
      ACE_SVC_QUEUE *tmp = 0;
      ACE_NEW_RETURN (tmp,
          ACE_SVC_QUEUE,
          -1);
      this->svc_conf_file_queue_ = tmp;
    }

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::init_svc_conf_file_queue ")
                ACE_TEXT ("- this=%@, repo=%@\n"),
                this, this->repo_));
#endif

  return 0;

} /* init_svc_conf_file_queue () */

int ACE_Service_Gestalt::initialize ( const ACE_Service_Type sr,
const ACE_TCHAR parameters 
)

Dynamically link the shared object file and retrieve a pointer to the designated shared object in this file.

Deprecated:
Note:
This is error-prone in the presense of dynamic services, which in turn initialize their own static services. This method will allow those static services to register *before* the dynamic service that owns them. Upon finalization of the static services the process will typically crash, because the dynamic service's DLL may have been already released, together with the memory in which the static services reside. It may not crash, for instance, when the first static service to register is the same as the dynamic service being loaded. You should be so lucky!

Dynamically link the shared object file and retrieve a pointer to the designated shared object in this file.

Note:
This is obsolete (and error-prone) in the presense of dynamic services with their own static services. This method will allow those static services to register *before* the dynamic service that owns them. Upon finalization of the static services the process may crash, because the dynamic service's DLL may have been already released, together with the memory in which the static services reside. It may not crash, for instance, when the first static service to register is the same as the dynamic service being loaded. You should be so lucky! ..

Definition at line 581 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::initialize");

  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@, name=%s")
                ACE_TEXT (" - looking up in the repo\n"),
                this->repo_,
                sr->name ()));

  ACE_Service_Type *srp = 0;
  if (this->repo_->find (sr->name (),
                         (const ACE_Service_Type **) &srp) >= 0)
    {
#ifndef ACE_NLOGGING
      ACE_DEBUG ((LM_WARNING,
                  ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@, name=%s")
                  ACE_TEXT (" - removing a pre-existing namesake.\n"),
                  this->repo_,
                  sr->name ()));
#endif
      this->repo_->remove (sr->name ());
    }

  return this->initialize_i (sr, parameters);

}

int ACE_Service_Gestalt::initialize ( const ACE_TCHAR svc_name,
const ACE_TCHAR parameters 
)

Initialize and activate a statically svc_name service.

If initialization fails ...

Definition at line 422 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt_Base::initialize (repo)");
  ACE_ARGV args (parameters);

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("ACE (%P|%t) SG::initialize - () repo=%@, ")
                  ACE_TEXT ("looking up static ")
                  ACE_TEXT ("service \'%s\' to initialize\n"),
                  this->repo_,
                  svc_name));
    }
#endif

  const ACE_Service_Type *srp = 0;
  for (int i = 0; this->find (svc_name, &srp) == -1 && i < 2; i++)
    //  if (this->repo_->find (svc_name, &srp) == -1)
    {
      const ACE_Static_Svc_Descriptor *assd =
        ACE_Service_Config::global()->find_processed_static_svc(svc_name);
      if (assd != 0)
        {
          this->process_directive_i(*assd, 0);
        }
      else
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("ACE (%P|%t) ERROR: SG::initialize - service \'%s\'")
                             ACE_TEXT (" was not located.\n"),
                             svc_name),
                            -1);
        }
    }
  if (srp == 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("ACE (%P|%t) ERROR: SG::initialize - service \'%s\'")
                       ACE_TEXT (" was not located.\n"),
                       svc_name),
                      -1);

  /// If initialization fails ...
  if (srp->type ()->init (args.argc (),
                          args.argv ()) == -1)
    {
      // ... report and remove this entry.
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT ("ACE (%P|%t) ERROR: SG::initialize - static init of \'%s\'")
                  ACE_TEXT (" failed (%p)\n"),
                  svc_name, ACE_TEXT ("error")));
      this->repo_->remove (svc_name);
      return -1;
    }

  // If everything is ok, activate it
  const_cast<ACE_Service_Type *>(srp)->active (1);
  return 0;
}

int ACE_Service_Gestalt::initialize_i ( const ACE_Service_Type sr,
const ACE_TCHAR parameters 
) [protected]

Dynamically link the shared object file and retrieve a pointer to the designated shared object in this file.

Definition at line 614 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::initialize_i");
  ACE_ARGV args (parameters);
  if (sr->type ()->init (args.argc (),
                         args.argv ()) == -1)
    {
      // We just get ps to avoid having remove() delete it.
      ACE_Service_Type *ps = 0;
      this->repo_->remove (sr->name (), &ps);

#ifndef ACE_NLOGGING
      // Not using LM_ERROR here to avoid confusing the test harness
      if (ACE::debug ())
        ACE_ERROR_RETURN ((LM_WARNING,
                           ACE_TEXT ("ACE (%P|%t) SG::initialize_i -")
                           ACE_TEXT (" repo=%@, name=%s - remove failed: %m\n"),
                           this->repo_,
                           sr->name ()),
                          -1);
#endif
      return -1;
    }

  if (this->repo_->insert (sr) == -1)
    {
#ifndef ACE_NLOGGING
      // Not using LM_ERROR here to avoid confusing the test harness
      if (ACE::debug ())
        ACE_ERROR_RETURN ((LM_WARNING,
                           ACE_TEXT ("ACE (%P|%t) SG::initialize_i -")
                           ACE_TEXT (" repo=%@, name=%s - insert failed: %m\n"),
                           this->repo_,
                           sr->name ()),
                          -1);
#endif
        return -1;
    }

  return 0;
}

int ACE_Service_Gestalt::insert ( ACE_Static_Svc_Descriptor stsd  ) 

Registers a service descriptor for a static service object.

Queues a static service object descriptor which, during open() will be given to process_directive() to create the Service Object. Normally, only called from static initializers, prior to calling open() but loading a service from a DLL can cause it too.

Definition at line 399 of file Service_Gestalt.cpp.

{
  if (this->static_svcs_ == 0)
    ACE_NEW_RETURN (this->static_svcs_,
                    ACE_STATIC_SVCS,
                    -1);

  return this->static_svcs_->insert (stsd);
}

void ACE_Service_Gestalt::intrusive_add_ref ( ACE_Service_Gestalt g  )  [static]

Definition at line 151 of file Service_Gestalt.cpp.

{
  if (g != 0)
    {
      ++g->refcnt_;
      ACE_ASSERT (g->refcnt_ > 0);
    }
}

void ACE_Service_Gestalt::intrusive_remove_ref ( ACE_Service_Gestalt g  )  [static]

Definition at line 161 of file Service_Gestalt.cpp.

{
  if (g != 0)
    {
      long tmp = --g->refcnt_;
      if (tmp <= 0)  delete g;
      ACE_ASSERT (tmp >= 0);
    }
}

int ACE_Service_Gestalt::is_opened ( void   ) 

Has it been opened? Returns the difference between the times open and close have been called on this instance

Definition at line 1137 of file Service_Gestalt.cpp.

{
  return this->is_opened_;
}

int ACE_Service_Gestalt::load_static_svcs ( void   )  [protected]

Add the default statically-linked services to the ACE_Service_Repository.

Add the default statically-linked services to the Service Repository.

Definition at line 269 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::load_static_svcs");

  if (this->static_svcs_ == 0)
    return 0; // Nothing to do

  ACE_Static_Svc_Descriptor **ssdp = 0;
  for (ACE_STATIC_SVCS_ITERATOR iter (*this->static_svcs_);
       iter.next (ssdp) != 0;
       iter.advance ())
    {
      ACE_Static_Svc_Descriptor *ssd = *ssdp;

      if (this->process_directive (*ssd, 1) == -1)
        return -1;
    }
  return 0;

} /* load_static_svcs () */

int ACE_Service_Gestalt::open ( int  argc,
ACE_TCHAR argv[],
const ACE_TCHAR logger_key = 0,
bool  ignore_static_svcs = true,
bool  ignore_default_svc_conf_file = false,
bool  ignore_debug_flag = false 
)

This is the primary entry point into the ACE_Service_Config (the constructor just handles simple initializations). It parses arguments passed in from argc and argv parameters. The arguments that are valid in a call to this method include:

  • '-b' Option to indicate that we should be a daemon. Note that when this option is used, the process will be daemonized before the service configuration file(s) are read. During daemonization, (on POSIX systems) the current directory will be changed to "/" so the caller should either fully specify the file names, or execute a chroot() to the appropriate directory.
    See also:
    ACE::daemonize().
  • '-d' Turn on debugging mode
  • '-f' Specifies a configuration file name other than the default svc.conf. Can be specified multiple times to use multiple files. If any configuration file is provided with this option then the default svc.conf will be ignored.
  • '-k' Specifies the rendezvous point to use for the ACE distributed logger.
  • '-y' Explicitly enables the use of static services. This flag overrides the ignore_static_svcs parameter value.
  • '-n' Explicitly disables the use of static services. This flag overrides the ignore_static_svcs parameter value.
  • '-p' Specifies a pathname which is used to store the process id.
  • '-s' Specifies a signal number other than SIGHUP to trigger reprocessing of the configuration file(s). Ignored for platforms that do not have POSIX signals, such as Windows.
  • '-S' Specifies a service directive string. Enclose the string in quotes and escape any embedded quotes with a backslash. This option specifies service directives without the need for a configuration file. Can be specified multiple times.

Note: Options '-f' and '-S' complement each other. Directives from files and from '-S' option are processed together in the following order. First, the default file "./svc.conf" is evaluated if not ignored, then all files are processed in the order they are specified in '-f' argv parameter. Finally, all '-S' directive strings are executed in the order the directives appear in argv parameter.

If no files or directives are added via the '-f' and '-S' arguments, and the default file is not ignored, it will be evaluated whether it exists or not, possibly causing a failure return. If any other directives are added then the default file will be evaluated only if it exists.

Parameters:
argc The number of commandline arguments.
argv The array with commandline arguments
logger_key Indicates where to write the logging output, which is typically either a STREAM pipe or a socket address.
ignore_static_svcs If true then static services are not loaded, otherwise, they are loaded.
ignore_default_svc_conf_file If false then the ./svc.conf configuration file will be ignored.
ignore_debug_flag If false then the application is responsible for setting the ACE_Log_Msg::priority_mask appropriately.
Return values:
-1 A configuration file is not found or cannot be opened (errno is set accordingly).
0 Success.
>0 The number of directive errors encountered while processing the service configuration file(s).

Definition at line 30 of file Service_Gestalt.inl.

{
  ACE_TRACE ("ACE_Service_Gestalt::open");

  // Parsing argv may change no_static_svcs_ so set the default here, then
  // parse, then pass the final value to open_i().
  this->no_static_svcs_ = ignore_static_svcs;

  if (this->parse_args_i (argc,
                          argv,
                          ignore_default_svc_conf) == -1)
    return -1;

  return this->open_i (argv == 0 ? 0 : argv[0],
                       logger_key,
                       this->no_static_svcs_,
                       ignore_default_svc_conf,
                       ignore_debug_flag);
}

int ACE_Service_Gestalt::open ( const ACE_TCHAR  program_name[],
const ACE_TCHAR logger_key = 0,
bool  ignore_static_svcs = true,
bool  ignore_default_svc_conf_file = false,
bool  ignore_debug_flag = false 
)

Performs an open without parsing command-line arguments. The logger_key indicates where to write the logging output, which is typically either a STREAM pipe or a socket address. If ignore_static_svcs is true then static services are not loaded, otherwise, they are loaded. If ignore_default_svc_conf_file is true then the svc.conf configuration file will be ignored. Returns zero upon success, -1 if the file is not found or cannot be opened (errno is set accordingly), otherwise returns the number of errors encountered loading the services in the specified svc.conf configuration file. If ignore_debug_flag is true then the application is responsible for setting the ACE_Log_Msg::priority_mask appropriately.

Definition at line 13 of file Service_Gestalt.inl.

{
  ACE_TRACE ("ACE_Service_Gestalt::open");
  this->no_static_svcs_ = ignore_static_svcs;

  return this->open_i (program_name,
                       logger_key,
                       ignore_static_svcs,
                       ignore_default_svc_conf,
                       ignore_debug_flag);
}

int ACE_Service_Gestalt::open_i ( const ACE_TCHAR  program_name[],
const ACE_TCHAR logger_key = 0,
bool  ignore_static_svcs = true,
bool  ignore_default_svc_conf_file = false,
bool  ignore_debug_flag = false 
) [protected]

Performs an open without parsing command-line arguments. The logger_key indicates where to write the logging output, which is typically either a STREAM pipe or a socket address. If ignore_default_svc_conf_file is non-0 then the "svc.conf" file will not be added by default. If ignore_debug_flag is non-0 then the application is responsible for setting the ACE_Log_Msg::priority_mask() appropriately. Returns number of errors that occurred on failure and 0 otherwise.

Definition at line 991 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::open_i");
  int result = 0;
  ACE_Log_Msg *log_msg = ACE_LOG_MSG;

  this->no_static_svcs_ = ignore_static_svcs;

  // Record the current log setting upon entering this thread.
  u_long old_process_mask = log_msg->priority_mask
    (ACE_Log_Msg::PROCESS);

  u_long old_thread_mask = log_msg->priority_mask
    (ACE_Log_Msg::THREAD);

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::open_i - this=%@, ")
                ACE_TEXT ("opened=%d, loadstatics=%d\n"),
                this, this->is_opened_, this->no_static_svcs_));
#endif

  // Guard against reentrant processing. For example,
  // if the singleton gestalt (ubergestalt) was already open,
  // do not open it again...
  if (this->is_opened_++ != 0)
    return 0;

  if (this->init_i () != 0)
    return -1;

  u_long flags = log_msg->flags ();

  // Only use STDERR if the caller hasn't already set the flags.
  if (flags == 0)
    flags = (u_long) ACE_Log_Msg::STDERR;

  const ACE_TCHAR *key = logger_key;

  if (key == 0 || ACE_OS::strcmp (key, ACE_DEFAULT_LOGGER_KEY) == 0)
    {
      // Only use the static <logger_key_> if the caller doesn't
      // override it in the parameter list or if the key supplied is
      // equal to the default static logger key.
      key = this->logger_key_;
    }
  else
    {
      ACE_SET_BITS (flags, ACE_Log_Msg::LOGGER);
    }

  if (log_msg->open (program_name,
                     flags,
                     key) == -1)
    return -1;

  if (!ignore_debug_flag)
    {
      // If -d was included as a startup parameter, the user wants debug
      // information printed during service initialization.
      if (ACE::debug ())
        ACE_Log_Msg::enable_debug_messages ();
      else
        // The user has requested no debugging info.
        ACE_Log_Msg::disable_debug_messages ();
    }

  if (!ignore_default_svc_conf_file)
    {
      bool add_default = true;
      bool has_files = this->svc_conf_file_queue_ && 
        !this->svc_conf_file_queue_->is_empty ();
      bool has_cmdline = this->svc_queue_ && !this->svc_queue_->is_empty ();
      if (has_files || has_cmdline)
        {
          // check if default file is already listed
          ACE_TString *sptr = 0;
          ACE_TString default_svc_conf (ACE_DEFAULT_SVC_CONF);

          for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_);
               iter.next (sptr) != 0 && add_default;
               iter.advance ())
            {
              add_default = (*sptr != default_svc_conf);
            }

          if (add_default)
            {
              FILE *fp = ACE_OS::fopen (ACE_DEFAULT_SVC_CONF, ACE_TEXT ("r"));
              if (fp != 0)
                ACE_OS::fclose(fp);
              else
                add_default = false;

            }
        }

      // Load the default "svc.conf" entry. here if there weren't
      // overriding -f arguments in <parse_args>.
      if (add_default && svc_conf_file_queue_->enqueue_head
          (ACE_TString (ACE_DEFAULT_SVC_CONF)) == -1)
        {
          errno = ENOENT;
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("%p\n"),
                             ACE_TEXT ("enqueuing ")
                             ACE_DEFAULT_SVC_CONF
                             ACE_TEXT(" file")),
                            -1);
        }
    }

  // See if we need to load the static services.
  if (this->no_static_svcs_ == 0
      && this->load_static_svcs () == -1)
    result = -1;
  else
    {
      result = this->process_directives ();
      if (result != -1 || errno == ENOENT)
        result = this->process_commandline_directives ();
    }

  // Reset debugging back to the way it was when we came into
  // into <open_i>.
  {
    // Make sure to save/restore errno properly.
    ACE_Errno_Guard error (errno);

    if (!ignore_debug_flag)
      {
        log_msg->priority_mask (old_process_mask, ACE_Log_Msg::PROCESS);
        log_msg->priority_mask (old_thread_mask, ACE_Log_Msg::THREAD);
      }
  }

  return result;
} /* open_i () */

ACE_Service_Gestalt& ACE_Service_Gestalt::operator= ( const ACE_Service_Gestalt  )  [private]
int ACE_Service_Gestalt::parse_args ( int  argc,
ACE_TCHAR argv[] 
)

Handle the command-line options intended for the ACE_Service_Gestalt. Note that argv[0] is assumed to be the program name.

The arguments that are valid in a call to this method are

  • '-d' Turn on debugging mode
  • '-f' Option to read in the list of svc.conf file names
  • '-k' Option to read a wide string where in the logger output can be written
  • '-y' Turn on the flag for a repository of statically linked services
  • '-n' Need not have a repository of statically linked services
  • '-S' Option to read in the list of services on the command-line Please observe the difference between options '-f' that looks for a list of files and here a list of services.

Definition at line 1173 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::parse_args");
  bool unused_ignore_default_svc_conf = true;
  return parse_args_i (argc, argv, unused_ignore_default_svc_conf);
}

int ACE_Service_Gestalt::parse_args_i ( int  argc,
ACE_TCHAR argv[],
bool &  ignore_default_svc_conf_file 
) [protected]

Definition at line 1181 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::parse_args_i");
  ACE_Get_Opt get_opt (argc,
                       argv,
                       ACE_TEXT ("df:k:nyS:"),
                       1); // Start at argv[1].

  if (this->init_svc_conf_file_queue () == -1)
    return -1;

  for (int c; (argc != 0) && ((c = get_opt ()) != -1); )
    switch (c)
      {
      case 'd':
        ACE::debug (1);
        break;
      case 'f':
        if (this->svc_conf_file_queue_->enqueue_tail (ACE_TString (get_opt.opt_arg ())) == -1)
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("%p\n"),
                             ACE_TEXT ("enqueue_tail")),
                            -1);
        ignore_default_svc_conf_file = true;
        break;
      case 'k':
        /*
         * @TODO: Is this always a static storage? Shouldn't we copy
         * & gain ownership of the value?
         */
        this->logger_key_ = get_opt.opt_arg ();
        break;
      case 'n':
        this->no_static_svcs_ = 1;
        break;
      case 'y':
        this->no_static_svcs_ = 0;
        break;
      case 'S':
        if (this->svc_queue_ == 0)
          {
            ACE_NEW_RETURN (this->svc_queue_,
                            ACE_SVC_QUEUE,
                            -1);
          }

        if (this->svc_queue_->enqueue_tail (ACE_TString (get_opt.opt_arg ())) == -1)
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("%p\n"),
                             ACE_TEXT ("enqueue_tail")),
                            -1);
        break;
      default:
        if (ACE::debug ())
          ACE_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("ACE (%P|%t) %c is not a ACE_Service_Config option\n"),
                      c));
      }

  return 0;
} /* parse_args_i () */

int ACE_Service_Gestalt::process_commandline_directives ( void   )  [protected]

Process service configuration requests that were provided on the command-line. Returns the number of errors that occurred.

Definition at line 1143 of file Service_Gestalt.cpp.

{
  int result = 0;
  if (this->svc_queue_ != 0)
    {
      ACE_TString *sptr = 0;
      for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_queue_);
           iter.next (sptr) != 0;
           iter.advance ())
        {
          // Process just a single directive.
          if (this->process_directive ((sptr->fast_rep ())) != 0)
            {
              ACE_ERROR ((LM_ERROR,
                          ACE_TEXT ("ACE (%P|%t) %p\n"),
                          ACE_TEXT ("process_directive")));
              result = -1;
            }
        }

      delete this->svc_queue_;
      this->svc_queue_ = 0;
    }

  return result;

} /* process_commandline_directives () */

int ACE_Service_Gestalt::process_directive ( const ACE_Static_Svc_Descriptor ssd,
bool  force_replace = false 
)

Process one static service definition.

Load a new static service.

Parameters:
ssd Service descriptor, see the document of ACE_Static_Svc_Descriptor for more details.
force_replace If set the new service descriptor replaces any previous instance in the repository.
Returns:
Returns -1 if the service cannot be 'loaded'.

Definition at line 700 of file Service_Gestalt.cpp.

{
  int const result = process_directive_i (ssd, force_replace);
  if (result == 0)
    {
      this->add_processed_static_svc(&ssd);
    }
  return result;
}

int ACE_Service_Gestalt::process_directive ( const ACE_TCHAR  directive[]  ) 

Process one service configuration directive, which is passed as a string. Returns the number of errors that occurred.

Definition at line 924 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::process_directive");

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::process_directive, repo=%@ - %s\n"),
                this->repo_,
                directive));
#endif

#if (ACE_USES_CLASSIC_SVC_CONF == 1)
  ACE_UNUSED_ARG (directive);

  ACE_Svc_Conf_Param d (this, directive);

  return this->process_directives_i (&d);
#else
  ACE_DLL dll;

  auto_ptr<ACE_XML_Svc_Conf>
    xml_svc_conf (this->get_xml_svc_conf (dll));

  if (xml_svc_conf.get () == 0)
    return -1;

  // Temporarily (for the duration of this call) make sure that *any* static
  // service registrations will happen with this instance. Such registrations
  // are possible as a side-effect of dynamically loading a DLL, which has
  // other static services registered. Thus this instance will own both the
  // DLL and those static services, which implies that their finalization
  // will be performed in the correct order, i.e. prior to finalizing the DLL
  ACE_Service_Config_Guard guard (this);

  return xml_svc_conf->parse_string (directive);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */

} /* process_directive () */

int ACE_Service_Gestalt::process_directive_i ( const ACE_Static_Svc_Descriptor ssd,
bool  force_replace = false 
) [protected]

Process a static directive without also inserting its descriptor the global table. This avoids multiple additions when processing directives in non-global gestalts.

Definition at line 712 of file Service_Gestalt.cpp.

{
  if (this->repo_ == 0)
    return -1;

  if (!force_replace)
    {
      if (this->repo_->find (ssd.name_, 0, 0) >= 0)
        {
          // The service is already there, just return
          return 0;
        }
    }


  ACE_Service_Object_Exterminator gobbler;
  void *sym = (ssd.alloc_)(&gobbler);

  ACE_Service_Type_Impl *stp =
    ACE_Service_Config::create_service_type_impl (ssd.name_,
                                                  ssd.type_,
                                                  sym,
                                                  ssd.flags_,
                                                  gobbler);
  if (stp == 0)
    return 0;

  ACE_Service_Type *service_type = 0;

  // This is just a temporary to force the compiler to use the right
  // constructor in ACE_Service_Type. Note that, in cases where we are
  // called from a static initializer which is part of a DLL, there is
  // not enough information about the actuall DLL in this context.
  ACE_DLL tmp_dll;

  ACE_NEW_RETURN (service_type,
                  ACE_Service_Type (ssd.name_,
                                    stp,
                                    tmp_dll,
                                    ssd.active_),
                  -1);

#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SG::process_directive_i, ")
                ACE_TEXT ("repo=%@ - %s, dll=%s, force=%d\n"),
                this->repo_,
                ssd.name_,
                (tmp_dll.dll_name_ == 0) ? ACE_TEXT ("<null>") : tmp_dll.dll_name_,
                force_replace));
#endif

  return this->repo_->insert (service_type);
}

int ACE_Service_Gestalt::process_directives ( bool  defunct_option = false  ) 

Process (or re-process) service configuration requests that are provided in the svc.conf file(s). Returns the number of errors that occurred.

Definition at line 1250 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::process_directives");
  if (this->svc_conf_file_queue_ == 0
       || this->svc_conf_file_queue_->is_empty ())
    {
      return 0;
    }

  ACE_TString *sptr = 0;
  int failed = 0;

  // Iterate through all the svc.conf files.
  for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_);
       iter.next (sptr) != 0;
       iter.advance ())
    {
      int result = this->process_file (sptr->fast_rep ());
      if (result < 0)
        return result;
      failed += result;
    }

  return failed;

} /* process_directives () */

int ACE_Service_Gestalt::process_file ( const ACE_TCHAR  file[]  ) 

Process a file containing a list of service configuration directives.

Definition at line 849 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::process_file");

  // To avoid recursive processing of the same file and the same repository
  // we maintain an implicit stack of dummy "services" named after the file
  // being processed. Anytime we have to open a new file, we then can check
  // to see if it is not already being processed by searching for a dummy
  // service with a matching name.
  if (this->repo_->find (file, 0, 0) >=0)
    {
      ACE_DEBUG ((LM_WARNING,
                  ACE_TEXT ("ACE (%P|%t) Configuration file %s is currently")
                  ACE_TEXT (" being processed. Ignoring recursive process_file().\n"),
                  file));
      return 0;
    }

  // Register a dummy service as a forward decl, using the file name as name.
  // The entry will be automaticaly removed once the thread exits this block.
  ACE_Service_Type_Dynamic_Guard recursion_guard (*this->repo_,
                                                  file);

  /*
   * @TODO: Test with ACE_USES_CLASSIC_SVC_CONF turned off!
   */
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
  int result = 0;

  FILE *fp = ACE_OS::fopen (file,
                            ACE_TEXT ("r"));

  if (fp == 0)
    {
      // Invalid svc.conf file.  We'll report it here and break out of
      // the method.
      if (ACE::debug ())
        ACE_DEBUG ((LM_ERROR,
                    ACE_TEXT ("ACE (%P|%t): %p\n"),
                    file));

      // Use stat to find out if the file exists.  I didn't use access()
      // because stat is better supported on most non-unix platforms.
      ACE_stat exists;
      if (ACE_OS::stat (file, &exists) == 0)
        // If it exists, but we couldn't open it for reading then we
        // must not have permission to read it.
        errno = EPERM;
      else
        errno = ENOENT;
      result = -1;
    }
  else
    {
      ACE_Svc_Conf_Param f (this, fp);

      // Keep track of the number of errors.
      result = this->process_directives_i (&f);

      (void) ACE_OS::fclose (fp);
    }
  return result;
#else
  ACE_DLL dll;

  auto_ptr<ACE_XML_Svc_Conf> xml_svc_conf (this->get_xml_svc_conf (dll));

  if (xml_svc_conf.get () == 0)
    return -1;

  return xml_svc_conf->parse_file (file);
#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */
}

int ACE_Service_Gestalt::remove ( const ACE_TCHAR  svc_name[]  ) 

Totally remove svc_name from the daemon by removing it from the ACE_Reactor, and unlinking it if necessary.

Definition at line 661 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::remove");
  if (this->repo_ == 0)
    return -1;

  return this->repo_->remove (svc_name);
}

int ACE_Service_Gestalt::resume ( const ACE_TCHAR  svc_name[]  ) 

Resume a svc_name that was previously suspended or has not yet been resumed (e.g., a static service).

Definition at line 689 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::resume");
  if (this->repo_ == 0)
    return -1;

  return this->repo_->resume (svc_name);
}

int ACE_Service_Gestalt::suspend ( const ACE_TCHAR  svc_name[]  ) 

Suspend svc_name. Note that this will not unlink the service from the daemon if it was dynamically linked, it will mark it as being suspended in the Service Repository and call the suspend() member function on the appropriate ACE_Service_Object. A service can be resumed later on by calling the resume() member function...

Suspend svc_name. Note that this will not unlink the service from the daemon if it was dynamically linked, it will mark it as being suspended in the Service Repository and call the <suspend> member function on the appropriate <ACE_Service_Object>. A service can be resumed later on by calling the <resume> method...

Definition at line 676 of file Service_Gestalt.cpp.

{
  ACE_TRACE ("ACE_Service_Gestalt::suspend");
  if (this->repo_ == 0)
    return -1;

  return this->repo_->suspend (svc_name);
}


Friends And Related Function Documentation

friend class ACE_Dynamic_Service_Base [friend]

Definition at line 421 of file Service_Gestalt.h.

friend class ACE_Service_Config [friend]

Definition at line 423 of file Service_Gestalt.h.

friend class ACE_Service_Config_Guard [friend]

Definition at line 424 of file Service_Gestalt.h.

friend class ACE_Service_Object [friend]

Definition at line 422 of file Service_Gestalt.h.


Member Data Documentation

Declare the dynamic allocation hooks.

Definition at line 202 of file Service_Gestalt.h.

Keep track of the number of times the instance has been initialized (opened). "If so, we can't allow <yyparse> to be called since it's not reentrant" is the original motivation, but that does not seem to be the case anymore. This variable is incremented by the <ACE_Service_Gestalt::open> method and decremented by the <ACE_Service_Gestalt::close> method.

Definition at line 442 of file Service_Gestalt.h.

Indicates where to write the logging output. This is typically either a STREAM pipe or a socket

Definition at line 446 of file Service_Gestalt.h.

Should we avoid loading the static services?

Definition at line 449 of file Service_Gestalt.h.

Repository of statically linked services for which process directive was called, but the service is not already a member of the static_svcs_ list.

Definition at line 469 of file Service_Gestalt.h.

ACE_Atomic_Op<ACE_SYNCH_MUTEX, long> ACE_Service_Gestalt::refcnt_ [protected]

Support for intrusive reference counting.

Definition at line 472 of file Service_Gestalt.h.

The service repository to hold the services.

Definition at line 461 of file Service_Gestalt.h.

Repository of statically linked services.

Definition at line 464 of file Service_Gestalt.h.

Queue of svc.conf files specified on the command-line. @ This should probably be made to handle unicode filenames...

Definition at line 458 of file Service_Gestalt.h.

Queue of services specified on the command-line.

Definition at line 452 of file Service_Gestalt.h.

Do we own the service repository instance, or have only been given a ptr to the singleton?

Definition at line 430 of file Service_Gestalt.h.

Repository size is necessary, so that we can close (which may destroy the repository instance), and then re-open again.

Definition at line 434 of file Service_Gestalt.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines