summaryrefslogtreecommitdiff
path: root/TAO/tao/CORBALOC_Parser.h
blob: 39f9fcba0848e6ba32174c7cf8d57fc02a9988c9 (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
// $Id$

// ============================================================================
//
// = LIBRARY
//   TAO
//
// = FILENAME
//   CORBALOC_Parser.h
//
// = AUTHOR
//   Carlos O'Ryan (coryan@cs.wustl.edu)
//   Priyanka Gontla (pgontla@uci.edu)
//
// ============================================================================

#ifndef TAO_CORBALOC_PARSER_H
#define TAO_CORBALOC_PARSER_H
#include "ace/pre.h"

#include "tao/ORB.h"
#include "tao/Connector_Registry.h"
#include "tao/IOR_Parser.h"

#include "tao/Stub.h"
#include "tao/ORB_Core.h"

#include "tao/PortableServer/POA.h"
#include "tao/MProfile.h"

#include "ior_corbaloc_export.h"

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

class TAO_Export TAO_CORBALOC_Parser : public TAO_IOR_Parser
{
  // = TITLE
  //   Implements the <corbaloc:> IOR format
  //
  // = DESCRIPTION
  //   This class implements the <corbaloc:> IOR format.
  //   It is dynamically loaded by the ORB and used to parse the
  //   string to separate the individual <obj_addr> from the list of object
  //   addresses <obj_addr_list>.
  //
public:
  TAO_CORBALOC_Parser (void);
  // Constructor

  virtual ~TAO_CORBALOC_Parser (void);
  // The destructor

  virtual int match_prefix (const char *ior_string) const;
  // = The IOR_Parser methods, please read the documentation in
  //   IOR_Parser.h

  virtual CORBA::Object_ptr parse_string (const char *ior,
                                          CORBA::ORB_ptr orb,
                                          CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Parse the ior-string that is passed.

 private:

  CORBA::ORB_var orb_;
  // ORB

  TAO_MProfile mprofile_;
  // One big mprofile which consists the profiles of all the endpoints.

  virtual int check_prefix (const char *endpoint);
  // Checks the prefix to see if it is RIR.

  virtual void parse_string_count_helper (const char * &corbaloc_name,
                                          CORBA::ULong &addr_list_length,
                                          CORBA::ULong &count_addr,
                                          CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Helps count the length of the <obj_addr_list> and the number of
  // individual <obj_addr> in the <obj_addr_list>.

  virtual void
    parse_string_mprofile_helper (CORBA::String_var end_point,
                                  CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Creates a MProfile for the endpoint passed and each such mprofile
  // is added to the big mprofile <mprofile_> from which a pointer to
  // the Object represented by the key_string is obtained and passed
  // to the application.

  virtual CORBA::Object_ptr
    make_stub_from_mprofile (CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Make a stub from the MProfile that is created in
  // parse_string_mprofile_helper. Using this stub, create an object
  // reference which is sent to the application.

  virtual CORBA::Object_ptr
    parse_string_rir_helper (const char * &corbaloc_name,
                             CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Gets the pointer to the key_string when the protocol used is RIR

  virtual void parse_string_assign_helper (CORBA::ULong &addr_list_length,
                                           ACE_CString &key_string,
                                           ACE_CString &cloc_name,
                                           CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Tokenizes the <obj_addr_list> using "," as the seperator. Assigns
  // individual endpoints to the elements of the ACE_Array_Base.

  virtual void
    assign_key_string(char * &cloc_name_ptr,
                      ACE_CString &key_string,
                      CORBA::ULong &addr_list_length,
                      CORBA::Environment &)
    ACE_THROW_SPEC ((CORBA::SystemException));
  // Helps parse_string_assign_helper by assigning in the case when
  // the protocol name is present and we have to append jsut the key
  // string.

};

#if defined (__ACE_INLINE__)
# include "CORBALOC_Parser.i"
#endif /* __ACE_INLINE__ */

ACE_FACTORY_DECLARE (TAO, TAO_CORBALOC_Parser)

#include "ace/post.h"
#endif /* TAO_CORBALOC_PARSER_H */