summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tools/XML_Helpers/Softpkg_Handlers.h
blob: 943c984e404c0c55590f5765394791457edda8b5 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// $Id$

//=============================================================================
/**
 *  @file Softpkg_Handlers.h
 *
 *  $Id$
 *
 *  This file turned out to host only one handler.  We'll still keep
 *  the name as Softpkg_Handlers, however.
 *
 *  @author Nanbor Wang <nanbor@cs.wustl.edu>
 */
//=============================================================================

#ifndef CIAO_SOFTPKG_HANDLER_H
#define CIAO_SOFTPKG_HANDLER_H

#include "XML_Helpers_Export.h"
#include "Cascadable_DocHandler.h"

namespace CIAO
{
  /**
   * @class Svcconf_Handler
   *
   * @brief Svcconf_Handler is an example SAX event handler.
   *
   * This SAX event handler try to regenerate the XML document it
   * reads with correct indentation.
   */
  class CIAO_XML_HELPERS_Export Softpkg_Handler
    : public CIAO::XMLHelpers::Cascadable_DocHandler
  {
  public:
    /**
     * @enum
     *
     * @brief Softpkg type identifier
     */
    typedef enum
      {
        CSD,                    // CORBA's Component Softpkg Descriptor
        SSD                     // CIAO's Servent Softpkg Descriptor
      } Softpkg_Type;

    /**
     *
     */
    typedef enum
      {
        ROOT,
        DESCRIPTOR,
        IMPLEMENTATION,
        CIAODLL,
        CODE
      } Softpkg_State;

    /**
     * @struct Softpkg_Info
     *
     * @Brief Relevant information that we are interested in
     *
     * This Softpkg_Info combines information from both a component
     * softpkg descriptor and a servant softpkg descriptor.
     */
    typedef struct CIAO_XML_HELPERS_Export Struct_Softpkg_Info
    {
      /// Specify the pathname (should change to URI later) to the
      /// component descriptor file.
      ACE_TString descriptor_;

      /// Specify the pathname to the root softpkg (as defined in CCM.)
      ACE_TString csd_path_;

      /// Specify the pathname to component executor DLL.
      ACE_TString executor_UUID_;

      /// Specify the entrypoint to component executor DLL.
      ACE_TString executor_entrypt_;

      /// Specify the pathname to the servant softpkg (as defined in CIAO.)
      ACE_TString ssd_path_;

      /// Specify the pathname to component servant DLL.
      ACE_TString servant_UUID_;

      /// Specify the entrypoint to component servant DLL.
      ACE_TString servant_entrypt_;

      void dump (void) const;
    } Softpkg_Info;

  public:
    /**
     * Default constructor.
     */
    Softpkg_Handler (ACEXML_XMLReader *parser,
                     Softpkg_Info *info
                     ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException)) ;

    /**
     * Default destructor.
     */
    virtual ~Softpkg_Handler (void);

    // Methods inherit from ACEXML_ContentHandler.

    /**
     * Receive notification of character data.
     */
    virtual void characters (const ACEXML_Char *ch,
                             int start,
                             int length ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException))
      ;

    /**
     * Receive notification of the end of a document.
     */
    virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException))
      ;

    /**
     * Receive notification of the end of an element.
     */
    virtual void endElement (const ACEXML_Char *namespaceURI,
                             const ACEXML_Char *localName,
                             const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException))
      ;

    /**
     * Receive notification of the beginning of a document.
     */
    virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException))
      ;

    /**
     * Receive notification of the beginning of an element.
     */
    virtual void startElement (const ACEXML_Char *namespaceURI,
                               const ACEXML_Char *localName,
                               const ACEXML_Char *qName,
                               ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException))
      ;

  protected:

  private:
    /// if we need to trace the CDATA.
    bool rec_cdata_;

    /// Parse state
    Softpkg_State state_;

    /// Type of softpkg we are parsing.
    Softpkg_Type type_;

    /// Character info.
    ACE_TString characters_;

    /// Cached the Implementation UUID before it can be determined
    /// suitable for use.
    ACE_TString impluuid_;

    /// Cached the servant path before it can be determined
    /// suitable for use.
    ACE_TString ssd_;

    /// Cached the servant uuid before it can be determined
    /// suitable for use.
    ACE_TString ssd_id_;

    /// Cached the Implementation path before it can be determined
    /// suitable for use.
    ACE_TString path_;

    /// Cached the Implementation entry point before it can be
    /// determined suitable for use.
    ACE_TString entry_pt_;

    /// Parse result
    Softpkg_Info *softpkg_info_;
  };

}

#if defined (__ACE_INLINE__)
# include "Softpkg_Handlers.inl"
#endif /* __ACE_INLINE__ */
#endif /* CIAO_SOFTPKG_HANDLER_H */