2
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; version 2 of the
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
#ifndef _NEW_SERVER_INSTANCE_WIZARD_H_
21
#define _NEW_SERVER_INSTANCE_WIZARD_H_
23
#include "grt/common.h"
24
#include "grtui/grt_wizard_form.h"
25
#include "grtui/wizard_finished_page.h"
26
#include "grtui/wizard_progress_page.h"
27
#include "grtui/grtdb_connect_panel.h"
29
#include "workbench/wb_context.h"
30
#include "workbench/wb_module.h"
34
#include "mforms/fs_object_selector.h"
35
#include "mforms/radiobutton.h"
36
#include "mforms/checkbox.h"
39
* Implementation of a wizard to create a new server instance. This process involves selecting a proper connection
40
* of the target operating system, path selection of the config file or what monitoring commands must be executed.
43
using namespace grtui;
44
using namespace mforms;
46
class NewServerInstanceWizard;
48
class NewServerInstancePage : public WizardPage
51
NewServerInstancePage(WizardForm *form, const std::string &pageid);
53
NewServerInstanceWizard* wizard();
56
class HostMachinePage : public NewServerInstancePage
59
HostMachinePage(WizardForm* host, wb::WBContext *wb);
61
virtual bool advance();
63
void host_selection_changed();
64
void refresh_connections();
66
wb::WBContext *_context;
71
Label _host_description;
72
RadioButton _localhost_button;
73
RadioButton _networkhost_button;
74
RadioButton _dbhost_button;
75
Box _ip_address_block;
76
Label _ip_address_label;
77
TextEntry _ip_address;
78
Label _ip_address_help;
80
Selector _dbhost_selector;
83
class HostAndRemoteTypePage : public NewServerInstancePage
86
HostAndRemoteTypePage(WizardForm* host);
88
virtual void enter(bool advancing);
89
virtual bool advance();
90
virtual bool skip_page();
92
void refresh_profile_list();
93
void toggle_remote_admin();
95
Panel _management_type_panel; // Border.
96
Box _management_type_box; // Content.
97
Panel _os_panel; // Border.
98
Box _os_box; // Content.
100
Label _os_description;
104
Selector _os_selector;
107
Selector _type_selector;
109
mforms::RadioButton _no_remote_admin;
110
mforms::RadioButton _win_remote_admin;
111
mforms::RadioButton _ssh_remote_admin;
113
std::map<std::string, std::vector<std::pair<std::string,std::string> > > _presets;
116
class SSHConfigurationPage : public NewServerInstancePage
119
SSHConfigurationPage(WizardForm* host);
121
void use_ssh_key_changed();
123
virtual void enter(bool advancing);
124
virtual bool advance();
125
virtual void leave(bool advancing);
126
virtual bool skip_page();
129
Label _main_description1;
130
Label _main_description2;
132
Table _ssh_settings_table;
135
Label _host_name_label;
136
TextEntry _host_name;
140
Label _username_label;
143
CheckBox _use_ssh_key;
144
Label _ssh_path_label;
145
TextEntry _ssh_key_path;
146
Button _ssh_key_browse_button;
147
FsObjectSelector* _file_selector;
150
class WindowsManagementPage : public NewServerInstancePage
153
WindowsManagementPage(WizardForm* host, wb::WBContext* context);
155
void refresh_config_path();
157
virtual void enter(bool advancing);
158
virtual void leave(bool advancing);
160
virtual bool advance();
161
virtual bool skip_page();
163
wb::WBContext* _context;
164
std::vector<std::string> _config_paths;
165
std::vector<std::string> _service_names;
170
Label _main_description1;
171
Label _main_description2;
173
Label _service_label;
174
TextEntry _service_name;
175
Selector _service_selector;
176
Label _progress_label;
178
Label _config_path_label;
179
TextEntry _config_path;
180
Button _browse_button;
181
FsObjectSelector* _file_selector;
184
class TestHostMachineSettingsPage : public WizardProgressPage
187
TestHostMachineSettingsPage(WizardForm* host);
189
virtual void enter(bool advance);
190
virtual void leave(bool advancing);
192
bool connect_to_host();
193
bool find_config_file();
194
bool find_error_files();
195
bool check_admin_commands();
196
virtual void tasks_finished(bool success);
197
virtual bool skip_page();
199
NewServerInstanceWizard* wizard();
201
TaskRow* _connect_task;
202
TaskRow* _commands_task;
205
class DatabaseServerPage : public NewServerInstancePage
208
DatabaseServerPage(WizardForm* host, wb::WBContext* context);
210
virtual void enter(bool advancing);
211
virtual bool advance();
212
virtual void leave(bool advancing);
213
virtual bool skip_page();
217
grtui::DbConnectPanel _panel;
218
db_mgmt_ConnectionRef _connection;
220
mforms::TextEntry *_conn_name;
222
wb::WBContext* _context;
225
class TestDatabaseSettingsPage : public WizardProgressPage
228
TestDatabaseSettingsPage(WizardForm* host);
229
virtual void enter(bool advancing);
231
sql::ConnectionWrapper _dbc_conn;
232
std::string _message;
233
bool open_connection();
234
virtual void tasks_finished(bool success);
235
bool get_server_version();
236
bool get_server_platform();
238
NewServerInstanceWizard* wizard();
241
class ReviewPage : public NewServerInstancePage
244
ReviewPage(WizardForm* host);
246
virtual void enter(bool advancing);
247
virtual bool skip_page();
248
virtual void leave(bool advancing);
256
CheckBox _customize_check;
259
class PathsPage : public NewServerInstancePage
262
PathsPage(WizardForm* host, wb::WBContext* context);
264
virtual void enter(bool advancing);
265
virtual bool advance();
266
virtual bool skip_page();
267
void browse_remote_config_file();
271
wb::WBContext* _context;
276
Label _version_label;
279
Label _config_path_label;
280
TextEntry _config_path;
281
Button _browse_button;
282
FsObjectSelector* _file_selector;
283
Button _test_config_path_button;
284
Label _test_config_path_description;
286
Label _section_name_label;
287
TextEntry _section_name;
288
Button _test_section_button;
289
Label _test_section_description;
292
class CommandsPage : public NewServerInstancePage
295
CommandsPage(WizardForm* host);
297
virtual void enter(bool advancing);
298
virtual bool advance();
299
virtual bool skip_page();
305
TextEntry _start_command;
307
TextEntry _stop_command;
309
TextEntry _status_command;
314
class CompleteSetupPage : public NewServerInstancePage
317
CompleteSetupPage(WizardForm* host, wb::WBContext* context);
319
virtual bool advance();
320
virtual void enter(bool advancing);
321
virtual void leave(bool advancing);
322
void create_instance();
323
virtual bool next_closes_wizard() { return true; }
324
virtual std::string close_caption() const { return finish_caption(); }
326
wb::WBContext* _context;
329
Box _instance_name_box;
330
Label _instance_name_label;
331
TextEntry _instance_name;
334
class NewServerInstanceWizard : public WizardForm
337
NewServerInstanceWizard(wb::WBContext* context);
338
~NewServerInstanceWizard();
340
db_mgmt_ServerInstanceRef assemble_server_instance();
341
grt::ValueRef test_setting_grt(grt::GRT *grt, const std::string &name);
343
void load_defaults();
344
std::string get_server_info(const std::string& key);
346
wb::WBContext* wb() { return _context; }
348
bool is_admin_enabled();
350
bool test_setting(const std::string &name, std::string &detail);
353
wb::WBContext* _context;
354
db_mgmt_ServerInstanceRef _instance; // The server instance we are working on.
357
HostMachinePage* _host_machine_page;
358
HostAndRemoteTypePage* _os_page;
359
SSHConfigurationPage* _ssh_configuration_page;
360
WindowsManagementPage* _windows_connection_page;
361
TestHostMachineSettingsPage* _test_host_machine_settings_page;
362
ReviewPage* _review_page;
363
DatabaseServerPage* _database_server_page;
364
TestDatabaseSettingsPage* _test_database_settings_page;
365
PathsPage* _paths_page;
366
CommandsPage* _commands_page;
367
CompleteSetupPage* _complete_setup_page;
370
#endif // _NEW_SERVER_INSTANCE_WIZARD_H_