summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/ImplRepo_Service/Locator_XMLHandler.h
blob: e8745f48799e835b0b53933e381b425fd3689ec7 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// -*- C++ -*-
//=============================================================================
/**
 *  @file   Locator_XMLHandler.h
 *
 *  $Id$
 *
 *  @author Justin Michel <michel_j@ociweb.com>
 */
//=============================================================================

#ifndef Locator_XMLHandler_H
#define Locator_XMLHandler_H

#include "ACEXML/common/DefaultHandler.h"

#include "ace/Vector_T.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

/**
 * Callback SAX XML Handler for parsing XML.
 */
class Locator_XMLHandler : public ACEXML_DefaultHandler
{
public:

  // XML ELEMENT names
  static const char* ROOT_TAG;
  static const char* SERVER_INFO_TAG;
  static const char* ENVIRONMENT_TAG;
  static const char* ACTIVATOR_INFO_TAG;

  struct EnvVar {
    ACE_CString name;
    ACE_CString value;
    bool operator==(const EnvVar&) const; // To allow Vector explicit instantiation
    bool operator!=(const EnvVar&) const; // To allow Vector explicit instantiation
  };

  typedef ACE_Vector<EnvVar> EnvList;

  struct Callback {
    virtual ~Callback() {}

    virtual void next_server (const ACE_CString& server_name,
      const ACE_CString& aname, const ACE_CString& startup_cmd,
      const EnvList& env_vars, const ACE_CString& working_dir,
      const ACE_CString& actmode, int start_limit,
      const ACE_CString& partial_ior, const ACE_CString& ior) = 0;

    virtual void next_activator (const ACE_CString& activator_name,
                                 long token,
                                 const ACE_CString& ior) = 0;
  };

  Locator_XMLHandler (Callback& cb);

  virtual void startElement (const ACEXML_Char* namespaceURI,
                             const ACEXML_Char* localName,
                             const ACEXML_Char* qName,
                             ACEXML_Attributes* atts ACEXML_ENV_ARG_DECL);

  virtual void endElement (const ACEXML_Char* namespaceURI,
                           const ACEXML_Char* localName,
                           const ACEXML_Char* qName ACEXML_ENV_ARG_DECL);

 private:

  // callback on completion of an element
  Callback& callback_;

  ACE_CString server_name_;
  ACE_CString activator_name_;
  ACE_CString command_line_;
  ACE_CString activation_;
  ACE_CString working_dir_;
  ACE_CString server_object_ior_;
  ACE_CString partial_ior_;
  int start_limit_;
  EnvList env_vars_;
};

#endif /* Locator_XMLHandler_H */