1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
19
#include "MgmtErrorReporter.hpp"
20
#include <Properties.hpp>
22
//*****************************************************************************
24
//*****************************************************************************
32
if(m_configValues != 0){
40
/*****************************************************************************/
43
Config::printAllNameValuePairs(NdbOut &out,
44
const Properties *prop,
45
const char* s) const {
46
Properties::Iterator it(prop);
47
const Properties * section = m_info.getInfo(s);
48
for (const char* n = it.first(); n != NULL; n = it.next()) {
50
const char* str_value;
53
if(!section->contains(n))
55
if (m_info.getStatus(section, n) == ConfigInfo::CI_INTERNAL)
57
if (m_info.getStatus(section, n) == ConfigInfo::CI_DEPRICATED)
59
if (m_info.getStatus(section, n) == ConfigInfo::CI_NOTIMPLEMENTED)
64
switch (m_info.getType(section, n)) {
65
case ConfigInfo::CI_INT:
66
MGM_REQUIRE(prop->get(n, &int_value));
70
case ConfigInfo::CI_INT64:
71
MGM_REQUIRE(prop->get(n, &int_64));
75
case ConfigInfo::CI_BOOL:
76
MGM_REQUIRE(prop->get(n, &int_value));
83
case ConfigInfo::CI_STRING:
84
MGM_REQUIRE(prop->get(n, &str_value));
87
case ConfigInfo::CI_SECTION:
95
/*****************************************************************************/
97
void Config::printConfigFile(NdbOut &out) const {
99
Uint32 noOfNodes, noOfConnections, noOfComputers;
100
MGM_REQUIRE(get("NoOfNodes", &noOfNodes));
101
MGM_REQUIRE(get("NoOfConnections", &noOfConnections));
102
MGM_REQUIRE(get("NoOfComputers", &noOfComputers));
105
"######################################################################" <<
108
"# NDB Cluster System configuration" << endl <<
110
"######################################################################" <<
112
"# No of nodes (DB, API or MGM): " << noOfNodes << endl <<
113
"# No of connections: " << noOfConnections << endl <<
114
"######################################################################" <<
117
/**************************
118
* Print COMPUTER configs *
119
**************************/
121
Properties::Iterator it(this);
122
for(name = it.first(); name != NULL; name = it.next()){
123
if(strncasecmp("Computer_", name, 9) == 0){
125
const Properties *prop;
126
out << endl << "[COMPUTER]" << endl;
127
MGM_REQUIRE(get(name, &prop));
128
printAllNameValuePairs(out, prop, "COMPUTER");
131
"###################################################################" <<
134
} else if(strncasecmp("Node_", name, 5) == 0){
135
/**********************
136
* Print NODE configs *
137
**********************/
138
const Properties *prop;
141
MGM_REQUIRE(get(name, &prop));
142
MGM_REQUIRE(prop->get("Type", &s));
143
out << endl << "[" << s << "]" << endl;
144
printAllNameValuePairs(out, prop, s);
147
"###################################################################" <<
149
} else if(strncasecmp("Connection_", name, 11) == 0){
150
/****************************
151
* Print CONNECTION configs *
152
****************************/
153
const Properties *prop;
156
MGM_REQUIRE(get(name, &prop));
157
MGM_REQUIRE(prop->get("Type", &s));
158
out << endl << "[" << s << "]" << endl;
159
printAllNameValuePairs(out, prop, s);
162
"###################################################################" <<
164
} else if(strncasecmp("SYSTEM", name, strlen("SYSTEM")) == 0) {
165
/************************
166
* Print SYSTEM configs *
167
************************/
168
const Properties *prop;
170
MGM_REQUIRE(get(name, &prop));
171
out << endl << "[SYSTEM]" << endl;
172
printAllNameValuePairs(out, prop, "SYSTEM");
175
"###################################################################" <<