summaryrefslogtreecommitdiff
path: root/storage/ndb/src/cw
diff options
context:
space:
mode:
Diffstat (limited to 'storage/ndb/src/cw')
-rw-r--r--storage/ndb/src/cw/Makefile.am19
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.cpp215
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsp216
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsw29
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.h40
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.icobin1078 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.rc193
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.sln21
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.suobin8704 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.vcproj240
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/Closed.ICObin1078 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/NdbControls.cpp436
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/Open.ICObin1078 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/StdAfx.cpp24
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/StdAfx.h69
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp19
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/TreeView.h19
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/bmp00001.bmpbin622 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/resource.h90
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/small.icobin318 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/C++/toolbar.bmpbin622 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/App.icobin1078 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs1416
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/Computer.cs272
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs258
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs244
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/DATABASE.ICObin1078 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/Database.cs178
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj240
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj.user48
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.ncbbin19456 -> 0 bytes
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.sln21
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs1899
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/Process.cs160
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs451
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs57
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs376
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs223
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs42
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs267
-rw-r--r--storage/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs424
-rw-r--r--storage/ndb/src/cw/cpcd/APIService.cpp401
-rw-r--r--storage/ndb/src/cw/cpcd/APIService.hpp65
-rw-r--r--storage/ndb/src/cw/cpcd/CPCD.cpp435
-rw-r--r--storage/ndb/src/cw/cpcd/CPCD.hpp390
-rw-r--r--storage/ndb/src/cw/cpcd/Makefile.am32
-rw-r--r--storage/ndb/src/cw/cpcd/Monitor.cpp79
-rw-r--r--storage/ndb/src/cw/cpcd/Process.cpp486
-rw-r--r--storage/ndb/src/cw/cpcd/common.cpp98
-rw-r--r--storage/ndb/src/cw/cpcd/common.hpp36
-rw-r--r--storage/ndb/src/cw/cpcd/main.cpp183
-rw-r--r--storage/ndb/src/cw/test/socketclient/Makefile24
-rw-r--r--storage/ndb/src/cw/test/socketclient/socketClientTest.cpp64
-rw-r--r--storage/ndb/src/cw/util/ClientInterface.cpp185
-rw-r--r--storage/ndb/src/cw/util/ClientInterface.hpp49
-rw-r--r--storage/ndb/src/cw/util/Makefile10
-rw-r--r--storage/ndb/src/cw/util/SocketRegistry.cpp213
-rw-r--r--storage/ndb/src/cw/util/SocketRegistry.hpp290
-rw-r--r--storage/ndb/src/cw/util/SocketService.cpp60
-rw-r--r--storage/ndb/src/cw/util/SocketService.hpp46
60 files changed, 0 insertions, 11352 deletions
diff --git a/storage/ndb/src/cw/Makefile.am b/storage/ndb/src/cw/Makefile.am
deleted file mode 100644
index f354846a5b6..00000000000
--- a/storage/ndb/src/cw/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (C) 2004 MySQL AB
-# Use is subject to license terms
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-SUBDIRS = cpcd
-
-windoze-dsp:
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.cpp b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.cpp
deleted file mode 100644
index 068416b2f15..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include "stdafx.h"
-
-HINSTANCE hInst ;
-TCHAR szTitle[MAX_LOADSTRING] ;
-TCHAR szWindowClass[MAX_LOADSTRING] ;
-
-static CNdbControls controls ;
-
-int APIENTRY WinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
- int nCmdShow){
- MSG msg;
- HACCEL hAccelTable;
-
- LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING) ;
- LoadString(hInstance, IDC_CPC_GUI, szWindowClass, MAX_LOADSTRING) ;
- NdbRegisterClass(hInstance);
-
- if (!InitInstance (hInstance, nCmdShow)) {
- return FALSE;
- }
-
- hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_CPC_GUI);
-
- while (GetMessage(&msg, NULL, 0, 0)){
-
- if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)){
-
- TranslateMessage(&msg);
- DispatchMessage(&msg);
-
- }
-
- }
-
- return msg.wParam;
-}
-
-
-ATOM NdbRegisterClass(HINSTANCE hInstance){
- WNDCLASSEX wcex;
-
- wcex.cbSize = sizeof(WNDCLASSEX);
-
- wcex.style = CS_HREDRAW | CS_VREDRAW ;
- wcex.lpfnWndProc = (WNDPROC)WndProc;
- wcex.cbClsExtra = 0;
- wcex.cbWndExtra = 0;
- wcex.hInstance = hInstance;
- wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_CPC_GUI);
- wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
- wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW);
- wcex.lpszMenuName = (LPCSTR)IDC_CPC_GUI;
- wcex.lpszClassName = szWindowClass;
- wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
-
- return RegisterClassEx(&wcex);
-}
-
-
-BOOL InitInstance(HINSTANCE hInstance, int nCmdShow){
-
- HWND hWnd;
-
- hInst = hInstance;
-
- hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
-
- InitCommonControls();
-
- if (!hWnd) return FALSE ;
-
- ShowWindow(hWnd, nCmdShow) ;
- UpdateWindow(hWnd) ;
-
- return TRUE;
-}
-
-LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){
-
- int wmId, wmEvent;
- PAINTSTRUCT ps;
- HDC hdc;
- int c = 0 ;
-
- switch (message)
- {
-
- case WM_CREATE:
- _assert(controls.Create(hInst, hWnd)) ;
- return 0 ;
-
- case WM_COMMAND:
- wmId = LOWORD(wParam);
- wmEvent = HIWORD(wParam);
-
- switch (wmId){
- case IDM_ABOUT:
- DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
- break;
- case IDM_EXIT:
- DestroyWindow(hWnd);
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
- case TTN_GETDISPINFO: {
-
- LPTOOLTIPTEXT lpttt;
- lpttt = (LPTOOLTIPTEXT) lParam;
- lpttt->hinst = hInst;
-
- int idButton = lpttt->hdr.idFrom;
-
- switch (idButton){
- case IDM_NEW:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TIP_NEW);
- break;
- case IDM_DELETE:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TIP_DELETE);
- break;
- case IDM_PROPS:
- lpttt->lpszText = MAKEINTRESOURCE(IDS_TIP_PROPS);
- break;
- }
- break;
- }
- case TVN_SELCHANGED: {
- LPNMTREEVIEW pnmtv ;
-
- pnmtv = (LPNMTREEVIEW) lParam ;
- controls.ToggleListViews(pnmtv) ;
-
- break ;
- }
-
- case NM_RCLICK: {
- LPNMHDR lpnmh ;
- lpnmh = (LPNMHDR) lParam ;
- switch(lpnmh->idFrom){
- case ID_TREEVIEW:
- break;
- default:
- break ;
- }
- }
-
- default:
- break;
- }
-
-
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps) ;
- EndPaint(hWnd, &ps);
- break;
-
- case WM_SIZE:
- controls.Resize() ;
- return 0 ;
-
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- }
- return 0;
-}
-
-
-LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){
-
- switch (message){
-
- case WM_INITDIALOG:
- return TRUE;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL){
- EndDialog(hDlg, LOWORD(wParam));
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-
-
-
-
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsp b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsp
deleted file mode 100644
index 91007b0a47e..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsp
+++ /dev/null
@@ -1,216 +0,0 @@
-# Microsoft Developer Studio Project File - Name="CPC_GUI" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=CPC_GUI - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "CPC_GUI.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "CPC_GUI.mak" CFG="CPC_GUI - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "CPC_GUI - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "CPC_GUI - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "CPC_GUI - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib mfc42.lib /nologo /subsystem:windows /machine:I386
-
-!ELSEIF "$(CFG)" == "CPC_GUI - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib comctl32.lib mfc42d.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "CPC_GUI - Win32 Release"
-# Name "CPC_GUI - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\CPC_GUI.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\CPC_GUI.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\NdbControls.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"stdafx.h"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\CPC_GUI.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\NdbControls.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\bitmap1.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\bmp00001.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\C.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Closed.BMP
-# End Source File
-# Begin Source File
-
-SOURCE=.\Closed.ICO
-# End Source File
-# Begin Source File
-
-SOURCE=.\Closed24.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Computer24.BMP
-# End Source File
-# Begin Source File
-
-SOURCE=.\CPC_GUI.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\Db.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\icon1.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\O.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Open.BMP
-# End Source File
-# Begin Source File
-
-SOURCE=.\Open.ICO
-# End Source File
-# Begin Source File
-
-SOURCE=.\Open24.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\small.ico
-# End Source File
-# Begin Source File
-
-SOURCE=.\toolbar.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\toolbar1.bmp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Tower2.ICO
-# End Source File
-# Begin Source File
-
-SOURCE=.\TowerIC1.BMP
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsw b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsw
deleted file mode 100644
index 1f163a31662..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "CPC_GUI"=.\CPC_GUI.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.h b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.h
deleted file mode 100644
index bbf5115510a..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-
-#if !defined(AFX_CPC_GUI_H__EA01C861_C56D_48F1_856F_4935E20620B1__INCLUDED_)
-#define AFX_CPC_GUI_H__EA01C861_C56D_48F1_856F_4935E20620B1__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-
-#define MAX_LOADSTRING 100
-
-
-
-#define TV_ROOT_ITEMS 2
-
-
-// Global Variables
-
-ATOM NdbRegisterClass(HINSTANCE) ;
-BOOL InitInstance(HINSTANCE, int) ;
-LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM) ;
-LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
-
-#endif // !defined(AFX_CPC_GUI_H__EA01C861_C56D_48F1_856F_4935E20620B1__INCLUDED_)
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.ico b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.ico
deleted file mode 100644
index 386883523bc..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.ico
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.rc b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.rc
deleted file mode 100644
index 41d75b2b282..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.rc
+++ /dev/null
@@ -1,193 +0,0 @@
-//Microsoft Developer Studio generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#define APSTUDIO_HIDDEN_SYMBOLS
-#include "windows.h"
-#undef APSTUDIO_HIDDEN_SYMBOLS
-#include "resource.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_CPC_GUI ICON DISCARDABLE "CPC_GUI.ICO"
-IDI_SMALL ICON DISCARDABLE "SMALL.ICO"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Menu
-//
-
-IDM_CPC_GUI MENU DISCARDABLE
-BEGIN
- POPUP "&File"
- BEGIN
- MENUITEM "E&xit", IDM_EXIT
- END
- POPUP "&Actions"
- BEGIN
- MENUITEM "&Insert...", ID_ACTIONS_INSERT
- MENUITEM "&Delete", ID_ACTIONS_DELETE
- MENUITEM "&Properties", ID_ACTIONS_PROPERTIES
- END
- POPUP "&Help"
- BEGIN
- MENUITEM "&About ...", IDM_ABOUT
- END
-END
-
-IDM_TREEVIEW MENU DISCARDABLE
-BEGIN
- MENUITEM "&Insert", ID_TREEVIEW1
- MENUITEM "&Delete", ID_DELETE
- MENUITEM "&Properties", ID_PROPERTIES
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Accelerator
-//
-
-IDC_CPC_GUI ACCELERATORS MOVEABLE PURE
-BEGIN
- "?", IDM_ABOUT, ASCII, ALT
- "/", IDM_ABOUT, ASCII, ALT
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
-STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
-CAPTION "About"
-FONT 8, "MS Sans Serif"
-BEGIN
- LTEXT "NDB Cluster Process Control Applet v1.0",IDC_STATIC,7,8,
- 213,8,SS_NOPREFIX
- LTEXT "Copyright (C) 2003 MySQL AB",
- IDC_STATIC,7,20,213,20
- DEFPUSHBUTTON "OK",IDOK,185,55,41,16,WS_GROUP
-END
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-2 TEXTINCLUDE MOVEABLE PURE
-BEGIN
- "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
- "#include ""windows.h""\r\n"
- "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
- "#include ""resource.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE MOVEABLE PURE
-BEGIN
- "\r\n"
- "\0"
-END
-
-1 TEXTINCLUDE MOVEABLE PURE
-BEGIN
- "resource.h\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDR_TOOLBAR BITMAP MOVEABLE PURE "toolbar.bmp"
-IDB_TOOLBAR BITMAP MOVEABLE PURE "bitmap1.bmp"
-IDB_COMPUTER BITMAP MOVEABLE PURE "TowerIC1.BMP"
-IDB_OPEN BITMAP MOVEABLE PURE "Open.BMP"
-IDB_CLOSED BITMAP MOVEABLE PURE "Closed.BMP"
-IDB_DATABASE BITMAP MOVEABLE PURE "DB.bmp"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Toolbar
-//
-
-IDR_TOOLBAR TOOLBAR MOVEABLE PURE 18, 18
-BEGIN
- BUTTON ID_BUTTON32773
- BUTTON ID_BUTTON32783
- BUTTON ID_BUTTON32784
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_APP_TITLE "NDB Cluster Process Control Applet"
- IDS_TV_ROOT_COMPUTERS "Computers"
- IDS_TV_ROOT_DATABASES "Databases"
- IDS_LV_COMPUTER_HEADER_1 "Computer"
- IDS_LV_COMPUTER_HEADER_2 "Hostname"
- IDS_LV_PROCESS_HEADER_1 "Process"
- IDC_CPC_GUI "CPC_GUI"
- IDS_TIP_NEW "Add new computer or database"
- IDS_TIP_DELETE "Delete selected computer or database"
-END
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_TIP_PROPS "Display properties for selected computer or database"
- IDS_LV_PROCESS_HEADER_2 "Name"
- IDS_LV_PROCESS_HEADER_3 "Owner"
- IDS_LV_PROCESS_HEADER_4 "Status"
- IDS_LV_COMPUTER_HEADER_3 "Status"
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.sln b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.sln
deleted file mode 100644
index 86b574d851d..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.sln
+++ /dev/null
@@ -1,21 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPC_GUI", "CPC_GUI.vcproj", "{F5FADD9D-4353-4A73-88DC-474A4D17B485}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {F5FADD9D-4353-4A73-88DC-474A4D17B485}.Debug.ActiveCfg = Debug|Win32
- {F5FADD9D-4353-4A73-88DC-474A4D17B485}.Debug.Build.0 = Debug|Win32
- {F5FADD9D-4353-4A73-88DC-474A4D17B485}.Release.ActiveCfg = Release|Win32
- {F5FADD9D-4353-4A73-88DC-474A4D17B485}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.suo b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.suo
deleted file mode 100644
index e7d178f04c3..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.suo
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.vcproj b/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.vcproj
deleted file mode 100644
index fb1e2fd601c..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/CPC_GUI.vcproj
+++ /dev/null
@@ -1,240 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="CPC_GUI"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\release_obj"
- IntermediateDirectory=".\release_obj"
- ConfigurationType="1"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- InlineFunctionExpansion="1"
- PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="3"
- PrecompiledHeaderThrough="stdafx.h"
- PrecompiledHeaderFile=".\release_obj/CPC_GUI.pch"
- AssemblerListingLocation=".\release_obj/"
- ObjectFile=".\release_obj/"
- ProgramDataBaseFileName=".\release_obj/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="mfc42.lib"
- OutputFile=".\release_obj/CPC_GUI.exe"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- ProgramDatabaseFile=".\release_obj/CPC_GUI.pdb"
- SubSystem="2"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\release_obj/CPC_GUI.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\debug_obj"
- IntermediateDirectory=".\debug_obj"
- ConfigurationType="1"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="3"
- PrecompiledHeaderThrough="stdafx.h"
- PrecompiledHeaderFile=".\debug_obj/CPC_GUI.pch"
- AssemblerListingLocation=".\debug_obj/"
- ObjectFile=".\debug_obj/"
- ProgramDataBaseFileName=".\debug_obj/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/MACHINE:I386"
- AdditionalDependencies="comctl32.lib mfc70d.lib"
- OutputFile=".\debug_obj/CPC_GUI.exe"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\debug_obj/CPC_GUI.pdb"
- SubSystem="2"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\debug_obj/CPC_GUI.tlb"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1033"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
- <File
- RelativePath=".\CPC_GUI.cpp">
- </File>
- <File
- RelativePath=".\CPC_GUI.rc">
- </File>
- <File
- RelativePath=".\NdbControls.cpp">
- </File>
- <File
- RelativePath=".\StdAfx.cpp">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- UsePrecompiledHeader="1"/>
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl">
- <File
- RelativePath=".\CPC_GUI.h">
- </File>
- <File
- RelativePath=".\NdbControls.h">
- </File>
- <File
- RelativePath=".\StdAfx.h">
- </File>
- <File
- RelativePath=".\resource.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- <File
- RelativePath=".\C.bmp">
- </File>
- <File
- RelativePath=".\CPC_GUI.ico">
- </File>
- <File
- RelativePath=".\Closed.BMP">
- </File>
- <File
- RelativePath=".\Closed.ICO">
- </File>
- <File
- RelativePath=".\Closed24.bmp">
- </File>
- <File
- RelativePath=".\Computer24.BMP">
- </File>
- <File
- RelativePath=".\Db.bmp">
- </File>
- <File
- RelativePath=".\O.bmp">
- </File>
- <File
- RelativePath=".\Open.BMP">
- </File>
- <File
- RelativePath=".\Open.ICO">
- </File>
- <File
- RelativePath=".\Open24.bmp">
- </File>
- <File
- RelativePath=".\Tower2.ICO">
- </File>
- <File
- RelativePath=".\TowerIC1.BMP">
- </File>
- <File
- RelativePath=".\bitmap1.bmp">
- </File>
- <File
- RelativePath=".\bmp00001.bmp">
- </File>
- <File
- RelativePath=".\icon1.ico">
- </File>
- <File
- RelativePath=".\small.ico">
- </File>
- <File
- RelativePath=".\toolbar.bmp">
- </File>
- <File
- RelativePath=".\toolbar1.bmp">
- </File>
- </Filter>
- <File
- RelativePath=".\ReadMe.txt">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/Closed.ICO b/storage/ndb/src/cw/cpcc-win32/C++/Closed.ICO
deleted file mode 100644
index 044042b42fb..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/Closed.ICO
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/NdbControls.cpp b/storage/ndb/src/cw/cpcc-win32/C++/NdbControls.cpp
deleted file mode 100644
index 63383ad0990..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/NdbControls.cpp
+++ /dev/null
@@ -1,436 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include "stdafx.h"
-#include "NdbControls.h"
-
-
-/**
-* CNdbControl implementation
-*/
-
-BOOL CNdbControl::GetRect(LPRECT lprc) const {
-
- _ASSERT(this) ;
-
- return GetClientRect(m_hControl, lprc) ;
-
-}
-
-BOOL CNdbControl::Resize(LONG x, LONG y, LONG w, LONG h) const {
-
- _ASSERT(this) ;
-
- if(!MoveWindow(m_hControl, x, y, w, h, TRUE))
- return FALSE ;
- if(m_bVisible){
- ShowWindow(m_hControl, SW_SHOW) ;
- UpdateWindow(m_hControl) ;
- }
- return TRUE ;
-
-}
-
-BOOL CNdbControl::Show(BOOL bShow) {
-
- _ASSERT(this) ;
-
- if(bShow){
- ShowWindow(m_hControl, SW_SHOW);
- m_bVisible = TRUE ;
- }else{
- ShowWindow(m_hControl, SW_HIDE);
- m_bVisible = FALSE ;
- }
- EnableWindow(m_hControl, bShow) ;
- UpdateWindow(m_hControl) ;
-
- return TRUE ;
-}
-
-
-
-CNdbControl::~CNdbControl(){
-
- DestroyWindow(m_hControl) ;
- if(m_hMenu)
- DestroyMenu(m_hMenu) ;
-
-}
-
-
-/**
-* CNdbListView implementation
-*/
-
-BOOL CNdbListView::Create(HINSTANCE hInst, HWND hParent, DWORD dwId, NDB_ITEM_TYPE enType, PNDB_LV pstH, DWORD dwWidth) {
-
- if(!pstH)
- return FALSE ;
-
- LV_COLUMN lvC ;
- m_hInstance = hInst ;
- m_hParent = hParent ;
- m_dwId = dwId ;
- m_dwWidth = dwWidth ;
- m_dwWidth = 100 ;
- m_enType = enType;
- char* szLabels[MAX_LV_HEADERS] ;
- int count = 0 ;
-
- m_hControl = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, WC_LISTVIEW, TEXT(""),
- WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
- 0, 0, 0, 0, m_hParent, (HMENU)m_dwId, hInst, NULL );
-
- if(!m_hControl)
- return FALSE ;
-
- lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
- lvC.fmt = LVCFMT_LEFT;
-
- switch(enType){
- case ITEM_COMPR_ROOT:
- szLabels[0] = pstH->szComputer ;
- szLabels[1] = pstH->szHostname ;
- szLabels[2] = pstH->szStatus ;
- count = 3 ;
- break ;
- case ITEM_DB_ROOT:
- szLabels[0] = pstH->szDatabase ;
- szLabels[1] = pstH->szStatus ;
- count = 2 ;
- break ;
- case ITEM_COMPR:
- szLabels[0] = pstH->szProcess ;
- szLabels[1] = pstH->szDatabase;
- szLabels[2] = pstH->szOwner ;
- szLabels[3] = pstH->szStatus ;
- count = 4 ;
- case ITEM_DB:
- szLabels[0] = pstH->szProcess ;
- szLabels[1] = pstH->szComputer;
- szLabels[2] = pstH->szOwner ;
- szLabels[3] = pstH->szStatus ;
- count = 4 ;
- break ;
- NDB_DEFAULT_UNREACHABLE ;
- }
-
- for(int j = 0 ; j < count ; ++j){
- lvC.iSubItem = j ;
- lvC.cx = m_dwWidth ;
- lvC.pszText = szLabels[j] ;
- if(0xFFFFFFFF == ListView_InsertColumn(m_hControl, j, &lvC))
- return FALSE ;
- }
-
- SendMessage(m_hControl, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT,
- LVS_EX_FULLROWSELECT );
-
- ShowWindow(m_hControl, SW_SHOW) ;
-
- return TRUE ;
-
-}
-
-
-
-/**
-* CNdbToolBar implementation
-*/
-
-
-
-/**
-* CNdbTreeView implementation
-*/
-
-BOOL CNdbTreeView::Create(HINSTANCE hInst, HWND hParent, DWORD dwMenuId, DWORD dwId){
-
- if(!CreateTreeView(hInst, hParent, dwId))
- return FALSE ;
-
- m_hMenu = LoadMenu(m_hInstance,MAKEINTRESOURCE(dwMenuId)) ;
- if(!m_hMenu)
- return FALSE ;
-
- return TRUE ;
-}
-
-
-BOOL CNdbTreeView::CreateTreeView(HINSTANCE hInst, HWND hParent, DWORD dwId){
-
-
- m_hInstance = hInst ;
- m_hParent = hParent ;
- m_dwId = dwId ;
- HIMAGELIST himl ;
- HBITMAP hbmp ;
- DWORD dwCount = 0 ;
-
- m_hControl = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, WC_TREEVIEW, "Tree View",
- WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES |
- TVS_HASBUTTONS | TVS_LINESATROOT | TVS_SINGLEEXPAND,
- 0, 0, 0, 0, m_hParent, (HMENU)m_dwId, m_hInstance, NULL) ;
-
- if(!m_hControl)
- return FALSE ;
-
- if((himl = ImageList_Create(nX, nY, ILC_MASK | ILC_COLOR8, 4, 0)) == NULL)
- return FALSE ;
-
- hbmp = LoadBitmap(m_hInstance, MAKEINTRESOURCE(IDI_OPEN));
- hbmp = (HBITMAP)LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_OPEN), IMAGE_BITMAP, nX, 0, LR_DEFAULTSIZE);
- m_nOpen = ImageList_AddMasked(himl, hbmp, clr);
- DeleteObject(hbmp);
- hbmp = (HBITMAP)LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_CLOSED), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
- m_nClosed = ImageList_AddMasked(himl, hbmp, clr);
- DeleteObject(hbmp);
- hbmp = (HBITMAP)LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_COMPUTER),IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
- m_nComputer = ImageList_AddMasked(himl, hbmp, clr);
- DeleteObject(hbmp);
- hbmp = (HBITMAP)LoadImage(m_hInstance, MAKEINTRESOURCE(IDB_DATABASE), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE);
- m_nDatabase = ImageList_AddMasked(himl, hbmp, clr);
- DeleteObject(hbmp);
-
- if(ImageList_GetImageCount(himl) < 4)
- return FALSE ;
-
- TreeView_SetImageList(m_hControl, himl, TVSIL_NORMAL);
-
- ShowWindow(m_hControl, SW_SHOW) ;
-
- return TRUE ;
-
-}
-
-
-
-HTREEITEM CNdbTreeView::AddItem(LPSTR szText, NDB_ITEM_TYPE enType, DWORD dwLVId){
-
- TVITEM tvi ;
- TVINSERTSTRUCT tvins ;
- HTREEITEM hti ;
- HTREEITEM hTemp ;
- int nImage = m_nClosed ;
-
- tvi.mask = TVIF_TEXT | TVIF_IMAGE
- | TVIF_SELECTEDIMAGE | TVIF_PARAM;
-
- tvi.pszText = szText;
- tvi.cchTextMax = lstrlen(szText);
-
- switch(enType){
-
- case ITEM_COMPR_ROOT:
- nImage = m_nClosed ;
- if(!m_hPrevRoot)
- tvins.hParent = TVI_ROOT;
- else
- tvins.hInsertAfter = m_hPrevRoot ;
- break ;
-
- case ITEM_DB_ROOT:
- if(!m_hPrevRoot)
- tvins.hParent = TVI_ROOT;
- else
- tvins.hInsertAfter = m_hPrevRoot ;
- break ;
-
- case ITEM_COMPR:
- nImage = m_nComputer ;
- if(!m_hPrevComputersChild || !m_hComputersRoot)
- return 0 ;
- else
- tvins.hInsertAfter = m_hPrevComputersChild ;
- tvins.hParent = m_hComputersRoot ;
- break ;
-
- case ITEM_DB:
- nImage = m_nDatabase ;
- if(!m_hPrevComputersChild || !m_hComputersRoot)
- return 0 ;
- else
- tvins.hInsertAfter = m_hPrevDatabasesChild ;
- tvins.hParent = m_hDatabasesRoot ;
- break ;
-
- NDB_DEFAULT_UNREACHABLE ;
-
- }
-
- tvi.iImage = nImage ;
- tvi.iSelectedImage = nImage ;
- tvi.lParam = (LPARAM) dwLVId ;
- tvins.item = tvi ;
-
- hTemp = TreeView_InsertItem(m_hControl, &tvins);
- if(!hTemp)
- return NULL ;
-
- switch(enType){
-
- case ITEM_COMPR_ROOT:
- m_hComputersRoot = hTemp ;
- break ;
-
- case ITEM_DB_ROOT:
- m_hDatabasesRoot = hTemp ;
- break ;
-
- case ITEM_COMPR:
- m_hPrevComputersChild = hTemp ;
- break ;
-
- case ITEM_DB:
- m_hPrevComputersChild = hTemp ;
- break ;
-
- NDB_DEFAULT_UNREACHABLE ;
-
- }
-
- if (ITEM_COMPR_ROOT != enType && ITEM_DB_ROOT != enType) {
-
- hti = TreeView_GetParent(m_hControl, hTemp);
- tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvi.hItem = hti;
- tvi.iImage = m_nClosed;
- tvi.iSelectedImage = m_nClosed;
- TreeView_SetItem(m_hControl, &tvi);
-
- }
-
- return hTemp ;
-}
-
-
-BOOL CNdbControls::Create(HINSTANCE hInst, HWND hParent){
-
- m_hInstance = hInst ;
- m_hParent = hParent ;
- m_tb.Create(m_hInstance, m_hParent, ID_TOOLBAR, IDB_TOOLBAR) ;
- m_sb.Create(m_hInstance, m_hParent, ID_STATUSBAR) ;
- m_tv.Create(m_hInstance, m_hParent, IDM_TREEVIEW, ID_TREEVIEW) ;
- _assert(AddView("Computers", ITEM_COMPR_ROOT)) ;
- _assert(AddView("Databases", ITEM_DB_ROOT)) ;
-
- return TRUE ;
-}
-
-BOOL CNdbControls::AddListView(NDB_ITEM_TYPE enType, DWORD dwId){
-
- int count ;
- CNdbListView* plv ;
- PNDB_LV pst ;
-
- plv = new CNdbListView ;
-
- if(!plv)
- return FALSE ;
-
- count = m_map_lvc.GetCount() + m_dwFirstId_lv ;
-
- switch(enType){
- case ITEM_COMPR_ROOT:
- pst = &m_stlvcRoot ;
- break ;
- case ITEM_DB_ROOT:
- pst = &m_stlvdRoot ;
- break ;
- case ITEM_COMPR:
- pst = &m_stlvc ;
- break ;
- case ITEM_DB:
- pst = &m_stlvd ;
- break ;
- NDB_DEFAULT_UNREACHABLE ;
- }
-
- plv->Create(m_hInstance, m_hParent, dwId, enType, pst, LV_HEADER_WIDTH) ;
-
- m_map_lvc[count] = plv ;
-
- return TRUE ;
-}
-
-BOOL CNdbControls::AddView(LPSTR szText, NDB_ITEM_TYPE enType){
-
- DWORD dwId_lv = m_dwNextId_lv ;
-
- if(AddListView(enType, dwId_lv) && m_tv.AddItem(szText, enType, dwId_lv))
- m_dwNextId_lv++ ;
- else
- return FALSE ;
-
- return TRUE ;
-};
-
-
-VOID CNdbControls::ToggleListViews(LPNMTREEVIEW pnmtv){
-
- CNdbListView* plv ;
- int count = m_map_lvc.GetCount() + m_dwFirstId_lv ;
-
- for(int c = FIRST_ID_LV ; c < count; ++c){
- _assert(m_map_lvc.Lookup(c, plv)) ;
- if(pnmtv->itemNew.lParam == (c))
- plv->Show(TRUE) ;
- else
- plv->Show(FALSE) ;
- }
-}
-
-
-
-VOID CNdbControls::Resize(){
-
- RECT rc, rcTB, rcSB ;
- LONG tw, sw, lx, ly, lw, lh, tvw, tvh ;
- CNdbListView* plv ;
- int count ; //, id ;
-
- GetClientRect(m_hParent, &rc) ;
- m_tb.GetRect(&rcTB) ;
- m_sb.GetRect(&rcSB) ;
-
- sw = rcSB.bottom ;
- tw = rcTB.bottom ;
-
- m_tb.Resize(0, 0, rc.right, tw) ;
-
- tvw = rc.right / 4 ;
- tvh = rc.bottom - sw - tw - BORDER ;
-
- m_tv.Resize(0, tw + BORDER, tvw, tvh) ;
-
- m_sb.Resize(0, tvh, rc.left, sw) ;
-
- lx = tvw + BORDER - 2 ;
- ly = tw + BORDER ;
- lw = rc.right - tvw - BORDER + 1 ;
- lh = tvh ;
-
- count = m_map_lvc.GetCount() + FIRST_ID_LV ;
-
- for(int c = FIRST_ID_LV ; c < count; ++c){
- _assert(m_map_lvc.Lookup(c, plv)) ;
- plv->Resize(lx, ly, lw, lh) ;
- }
-
- return ;
-
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/Open.ICO b/storage/ndb/src/cw/cpcc-win32/C++/Open.ICO
deleted file mode 100644
index ab7b05d9df7..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/Open.ICO
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/StdAfx.cpp b/storage/ndb/src/cw/cpcc-win32/C++/StdAfx.cpp
deleted file mode 100644
index d2b002c3d90..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/StdAfx.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-// stdafx.cpp : source file that includes just the standard includes
-// CPC_GUI.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/StdAfx.h b/storage/ndb/src/cw/cpcc-win32/C++/StdAfx.h
deleted file mode 100644
index aedd535b205..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/StdAfx.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
-#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-
-#ifdef _DEBUG
-#define NDB_DEFAULT_UNREACHABLE default: _ASSERT(0); break
-#elif _MSC_VER >= 1200
-#define NDB_DEFAULT_UNREACHABLE default: __assume(0); break
-#else
-#define NDB_DEFAULT_UNREACHABLE default: break
-#endif;
-
-
-#ifdef _DEBUG
-#define _assert _ASSERT
-#else
-#define _assert(expr) expr
-#endif
-
-
-#include <afx.h>
-#include <afxtempl.h>
-
-// C RunTime Header Files
-#include <ndb_global.h>
-#include <memory.h>
-#include <tchar.h>
-#include <commctrl.h>
-#include <shlwapi.h>
-#include <crtdbg.h>
-
-// Local Header Files
-#include "resource.h"
-#include "NdbControls.h"
-#include "CPC_GUI.h"
-
-
-// TODO: reference additional headers your program requires here
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp b/storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp
deleted file mode 100644
index bcc7e67d06f..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include "StdAfx.h"
-#include "resource.h"
-#include "CPC_GUI.h"
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/TreeView.h b/storage/ndb/src/cw/cpcc-win32/C++/TreeView.h
deleted file mode 100644
index 68859693228..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/TreeView.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-
-
-
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/bmp00001.bmp b/storage/ndb/src/cw/cpcc-win32/C++/bmp00001.bmp
deleted file mode 100644
index e50af403eda..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/bmp00001.bmp
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/resource.h b/storage/ndb/src/cw/cpcc-win32/C++/resource.h
deleted file mode 100644
index 8270a3e9962..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/resource.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by CPC_GUI.rc
-//
-#define IDC_MYICON 2
-#define IDD_CPC_GUI_DIALOG 102
-#define IDD_ABOUTBOX 103
-#define IDS_APP_TITLE 103
-#define IDM_ABOUT 104
-#define IDS_LV_ROOT_COMPUTERS 104
-#define IDS_TV_ROOT_COMPUTERS 104
-#define IDM_EXIT 105
-#define IDS_LV_ROOT_DATABASES 105
-#define IDS_TV_ROOT_DATABASES 105
-#define IDS_HELLO 106
-#define IDS_LV_COMPUTER_HEADER_1 106
-#define IDI_CPC_GUI 107
-#define IDS_LV_COMPUTER_HEADER_2 107
-#define IDI_SMALL 108
-#define IDS_LV_PROCESS_HEADER_1 108
-#define IDC_CPC_GUI 109
-#define IDM_CPC_GUI 109
-#define IDS_TIP_NEW 110
-#define IDS_TIP_DELETE 111
-#define IDS_TIP_PROPS 112
-#define IDS_LV_PROCESS_HEADER_2 113
-#define IDS_LV_PROCESS_HEADER_3 114
-#define IDS_LV_PROCESS_HEADER_4 115
-#define IDS_LV_COMPUTER_HEADER_3 116
-#define IDR_MAINFRAME 128
-#define ID_TREEVIEW 130
-#define IDM_TREEVIEW 130
-#define IDB_TOOLBAR 137
-#define ID_TOOLBAR 158
-#define IDB_COMPUTER 168
-#define IDB_CLOSED 169
-#define IDB_OPEN 170
-#define IDI_DATABASE 172
-#define IDI_CLOSED 175
-#define IDI_OPEN 176
-#define IDI_COMPUTER 177
-#define IDB_MASK 178
-#define IDB_DATABASE 182
-#define IDM_TV 183
-#define ID_TREEVIEW1 32771
-#define ID_BUTTON32773 32773
-#define IDM_NEW 32774
-#define IDM_DELETE 32775
-#define IDM_PROPS 32776
-#define ID_LIST_C 32777
-#define ID_ACTIONS_INSERT 32778
-#define ID_ACTIONS_DELETE 32779
-#define ID_DELETE 32780
-#define ID_PROPERTIES 32781
-#define ID_ACTIONS_PROPERTIES 32782
-#define ID_BUTTON32783 32783
-#define ID_BUTTON32784 32784
-#define ID_LIST_P 32785
-#define ID_STATUSBAR 32786
-#define ID_LIST_C_ROOT 32787
-#define ID_LIST_D_ROOT 32788
-#define IDM_ADDNEW 32793
-#define IDC_STATIC -1
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 184
-#define _APS_NEXT_COMMAND_VALUE 32796
-#define _APS_NEXT_CONTROL_VALUE 1000
-#define _APS_NEXT_SYMED_VALUE 110
-#endif
-#endif
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/small.ico b/storage/ndb/src/cw/cpcc-win32/C++/small.ico
deleted file mode 100644
index 8f94d9aa828..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/small.ico
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/C++/toolbar.bmp b/storage/ndb/src/cw/cpcc-win32/C++/toolbar.bmp
deleted file mode 100644
index a1059352c66..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/C++/toolbar.bmp
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/App.ico b/storage/ndb/src/cw/cpcc-win32/csharp/App.ico
deleted file mode 100644
index 3a5525fd794..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/App.ico
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs b/storage/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs
deleted file mode 100644
index c29998ff178..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/CPC_Form.cs
+++ /dev/null
@@ -1,1416 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Data;
-using System.Threading;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for Form1.
- /// </summary>
- public class CPC : System.Windows.Forms.Form
- {
- private System.Windows.Forms.TreeView tvComputerCluster;
- private System.Windows.Forms.ContextMenu ctxTreeViewMenu;
- private System.Windows.Forms.ColumnHeader chComputer;
- private System.Windows.Forms.ColumnHeader chProcessName;
- private System.Windows.Forms.ContextMenu ctxListViewMenu;
- private System.Windows.Forms.MenuItem mainMenuItem;
- private System.Windows.Forms.ColumnHeader chProcesses;
- private System.Windows.Forms.MainMenu mainMenu;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.MenuItem menuItem7;
- private System.Windows.Forms.MenuItem menuItem10;
- private System.Windows.Forms.MenuItem mainMenuFile;
- private System.Windows.Forms.MenuItem mainMenuComputer;
- private System.Windows.Forms.MenuItem subMenuComputerAdd;
- private System.Windows.Forms.MenuItem subMenuComputerRemove;
- private System.Windows.Forms.MenuItem subMenuComputerDisconnect;
- private System.Windows.Forms.MenuItem subMenuComputerProperties;
- private System.ComponentModel.IContainer components;
-
- private System.Windows.Forms.MenuItem menuItem3;
- private System.Windows.Forms.MenuItem computerMenuAdd;
- private System.Windows.Forms.MenuItem computerMenuRemove;
- private System.Windows.Forms.MenuItem menuItem5;
- private System.Windows.Forms.MenuItem computerMenuDisconnect;
- private System.Windows.Forms.MenuItem computerMenuConnect;
- private System.Windows.Forms.MenuItem computerMenuProperties;
- private System.Windows.Forms.MenuItem menuItem11;
- private System.Windows.Forms.MenuItem tvCtxMenuComputerAdd;
- private System.Windows.Forms.MenuItem tvCtxMenuComputerRemove;
- private System.Windows.Forms.MenuItem tvCtxMenuComputerConnect;
- private System.Windows.Forms.MenuItem tvCtxMenuComputerDisconnect;
- private System.Windows.Forms.MenuItem tvCtxMenuComputerDefine;
- private System.Windows.Forms.MenuItem tvCtxMenuDatabaseNew;
- private System.Windows.Forms.MenuItem menuItem1;
- private System.Windows.Forms.MenuItem menuItem2;
- private System.Windows.Forms.MenuItem mainMenuDatabase;
- private System.Windows.Forms.MenuItem subMenuDatabaseCreate;
- private System.Windows.Forms.MenuItem menuItem8;
- private System.Windows.Forms.MenuItem tvCtxMenuProperties;
- private System.Windows.Forms.ImageList imageTV;
-
- private ComputerMgmt computerMgmt;
- private System.Windows.Forms.MenuItem computerMenuRefresh;
- private System.Windows.Forms.ListView listView;
- private System.Windows.Forms.ColumnHeader chComputerIP;
- private System.Windows.Forms.ColumnHeader chDatabase;
- private System.Windows.Forms.ColumnHeader chName;
- private System.Windows.Forms.ColumnHeader chOwner;
- private System.Windows.Forms.ColumnHeader chStatus;
- private System.Windows.Forms.Splitter splitter2;
- private System.Windows.Forms.Splitter splitterVertical;
- private System.Windows.Forms.Splitter splitterHorizont;
- private Thread guiThread;
- private float resizeWidthRatio;
- private System.Windows.Forms.MenuItem menuItem6;
- private System.Windows.Forms.MenuItem menuGetStatus;
- private System.Windows.Forms.MenuItem menuStartProcess;
- private System.Windows.Forms.MenuItem menuRestartProcess;
- private System.Windows.Forms.MenuItem menuStopProcess;
- private System.Windows.Forms.MenuItem menuRemoveProcess;
- private System.Windows.Forms.MenuItem menuRefresh;
- private System.Windows.Forms.OpenFileDialog openHostFileDialog;
- private System.Windows.Forms.SaveFileDialog saveHostFileDialog;
- private float resizeHeightRatio;
- private System.Windows.Forms.TextBox mgmConsole;
- int i;
- public CPC()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- // TODO: Add any constructor code after InitializeComponent call
- //
- computerMgmt = new ComputerMgmt();
- guiThread = new Thread(new ThreadStart(updateGuiThread));
-
- // guiThread.Start();
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
- //guiThread.Abort();
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CPC));
- this.tvComputerCluster = new System.Windows.Forms.TreeView();
- this.ctxTreeViewMenu = new System.Windows.Forms.ContextMenu();
- this.tvCtxMenuComputerAdd = new System.Windows.Forms.MenuItem();
- this.tvCtxMenuComputerRemove = new System.Windows.Forms.MenuItem();
- this.menuGetStatus = new System.Windows.Forms.MenuItem();
- this.menuItem6 = new System.Windows.Forms.MenuItem();
- this.tvCtxMenuComputerConnect = new System.Windows.Forms.MenuItem();
- this.tvCtxMenuComputerDisconnect = new System.Windows.Forms.MenuItem();
- this.tvCtxMenuDatabaseNew = new System.Windows.Forms.MenuItem();
- this.tvCtxMenuComputerDefine = new System.Windows.Forms.MenuItem();
- this.menuItem8 = new System.Windows.Forms.MenuItem();
- this.tvCtxMenuProperties = new System.Windows.Forms.MenuItem();
- this.imageTV = new System.Windows.Forms.ImageList(this.components);
- this.ctxListViewMenu = new System.Windows.Forms.ContextMenu();
- this.menuStartProcess = new System.Windows.Forms.MenuItem();
- this.menuRestartProcess = new System.Windows.Forms.MenuItem();
- this.menuStopProcess = new System.Windows.Forms.MenuItem();
- this.menuRemoveProcess = new System.Windows.Forms.MenuItem();
- this.menuRefresh = new System.Windows.Forms.MenuItem();
- this.computerMenuAdd = new System.Windows.Forms.MenuItem();
- this.menuItem3 = new System.Windows.Forms.MenuItem();
- this.computerMenuRemove = new System.Windows.Forms.MenuItem();
- this.menuItem5 = new System.Windows.Forms.MenuItem();
- this.computerMenuDisconnect = new System.Windows.Forms.MenuItem();
- this.computerMenuConnect = new System.Windows.Forms.MenuItem();
- this.menuItem11 = new System.Windows.Forms.MenuItem();
- this.computerMenuProperties = new System.Windows.Forms.MenuItem();
- this.computerMenuRefresh = new System.Windows.Forms.MenuItem();
- this.chComputer = new System.Windows.Forms.ColumnHeader();
- this.chProcessName = new System.Windows.Forms.ColumnHeader();
- this.mainMenuItem = new System.Windows.Forms.MenuItem();
- this.chProcesses = new System.Windows.Forms.ColumnHeader();
- this.mainMenu = new System.Windows.Forms.MainMenu();
- this.mainMenuFile = new System.Windows.Forms.MenuItem();
- this.menuItem2 = new System.Windows.Forms.MenuItem();
- this.menuItem1 = new System.Windows.Forms.MenuItem();
- this.mainMenuComputer = new System.Windows.Forms.MenuItem();
- this.subMenuComputerAdd = new System.Windows.Forms.MenuItem();
- this.menuItem7 = new System.Windows.Forms.MenuItem();
- this.subMenuComputerDisconnect = new System.Windows.Forms.MenuItem();
- this.subMenuComputerRemove = new System.Windows.Forms.MenuItem();
- this.menuItem10 = new System.Windows.Forms.MenuItem();
- this.subMenuComputerProperties = new System.Windows.Forms.MenuItem();
- this.mainMenuDatabase = new System.Windows.Forms.MenuItem();
- this.subMenuDatabaseCreate = new System.Windows.Forms.MenuItem();
- this.panel1 = new System.Windows.Forms.Panel();
- this.mgmConsole = new System.Windows.Forms.TextBox();
- this.splitterHorizont = new System.Windows.Forms.Splitter();
- this.splitter2 = new System.Windows.Forms.Splitter();
- this.listView = new System.Windows.Forms.ListView();
- this.chComputerIP = new System.Windows.Forms.ColumnHeader();
- this.chStatus = new System.Windows.Forms.ColumnHeader();
- this.chDatabase = new System.Windows.Forms.ColumnHeader();
- this.chName = new System.Windows.Forms.ColumnHeader();
- this.chOwner = new System.Windows.Forms.ColumnHeader();
- this.splitterVertical = new System.Windows.Forms.Splitter();
- this.openHostFileDialog = new System.Windows.Forms.OpenFileDialog();
- this.saveHostFileDialog = new System.Windows.Forms.SaveFileDialog();
- this.panel1.SuspendLayout();
- this.SuspendLayout();
- //
- // tvComputerCluster
- //
- this.tvComputerCluster.CausesValidation = false;
- this.tvComputerCluster.ContextMenu = this.ctxTreeViewMenu;
- this.tvComputerCluster.Dock = System.Windows.Forms.DockStyle.Left;
- this.tvComputerCluster.ImageList = this.imageTV;
- this.tvComputerCluster.Name = "tvComputerCluster";
- this.tvComputerCluster.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
- new System.Windows.Forms.TreeNode("Computer", 0, 0),
- new System.Windows.Forms.TreeNode("Database", 5, 5)});
- this.tvComputerCluster.Size = new System.Drawing.Size(104, 333);
- this.tvComputerCluster.TabIndex = 5;
- this.tvComputerCluster.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tvComputerCluster_MouseDown);
- this.tvComputerCluster.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvComputerCluster_AfterSelect);
- this.tvComputerCluster.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvComputerCluster_BeforeCollapse);
- this.tvComputerCluster.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvComputerCluster_BeforeExpand);
- //
- // ctxTreeViewMenu
- //
- this.ctxTreeViewMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.tvCtxMenuComputerAdd,
- this.tvCtxMenuComputerRemove,
- this.menuGetStatus,
- this.menuItem6,
- this.tvCtxMenuComputerConnect,
- this.tvCtxMenuComputerDisconnect,
- this.tvCtxMenuDatabaseNew,
- this.tvCtxMenuComputerDefine,
- this.menuItem8,
- this.tvCtxMenuProperties});
- this.ctxTreeViewMenu.Popup += new System.EventHandler(this.ctxTreeViewMenu_Popup);
- //
- // tvCtxMenuComputerAdd
- //
- this.tvCtxMenuComputerAdd.Index = 0;
- this.tvCtxMenuComputerAdd.Text = "Add computer";
- this.tvCtxMenuComputerAdd.Click += new System.EventHandler(this.computerMenuAdd_Click);
- //
- // tvCtxMenuComputerRemove
- //
- this.tvCtxMenuComputerRemove.Index = 1;
- this.tvCtxMenuComputerRemove.Text = "Remove computer";
- this.tvCtxMenuComputerRemove.Click += new System.EventHandler(this.computerMenuRemove_Click);
- //
- // menuGetStatus
- //
- this.menuGetStatus.Index = 2;
- this.menuGetStatus.Text = "Get Status";
- this.menuGetStatus.Click += new System.EventHandler(this.menuGetStatus_Click);
- //
- // menuItem6
- //
- this.menuItem6.Index = 3;
- this.menuItem6.Text = "-";
- //
- // tvCtxMenuComputerConnect
- //
- this.tvCtxMenuComputerConnect.Index = 4;
- this.tvCtxMenuComputerConnect.Text = "Connect";
- //
- // tvCtxMenuComputerDisconnect
- //
- this.tvCtxMenuComputerDisconnect.Index = 5;
- this.tvCtxMenuComputerDisconnect.Text = "Disconnect";
- //
- // tvCtxMenuDatabaseNew
- //
- this.tvCtxMenuDatabaseNew.Index = 6;
- this.tvCtxMenuDatabaseNew.Text = "Create database...";
- this.tvCtxMenuDatabaseNew.Click += new System.EventHandler(this.subMenuDatabaseCreate_Click);
- //
- // tvCtxMenuComputerDefine
- //
- this.tvCtxMenuComputerDefine.Index = 7;
- this.tvCtxMenuComputerDefine.Text = "Define process...";
- this.tvCtxMenuComputerDefine.Click += new System.EventHandler(this.tvCtxMenuComputerDefine_Click);
- //
- // menuItem8
- //
- this.menuItem8.Index = 8;
- this.menuItem8.Text = "-";
- //
- // tvCtxMenuProperties
- //
- this.tvCtxMenuProperties.Index = 9;
- this.tvCtxMenuProperties.Text = "Properties";
- //
- // imageTV
- //
- this.imageTV.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageTV.ImageSize = new System.Drawing.Size(16, 16);
- this.imageTV.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageTV.ImageStream")));
- this.imageTV.TransparentColor = System.Drawing.Color.Transparent;
- //
- // ctxListViewMenu
- //
- this.ctxListViewMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuStartProcess,
- this.menuRestartProcess,
- this.menuStopProcess,
- this.menuRemoveProcess,
- this.menuRefresh});
- this.ctxListViewMenu.Popup += new System.EventHandler(this.ctxListViewMenu_Popup);
- //
- // menuStartProcess
- //
- this.menuStartProcess.Index = 0;
- this.menuStartProcess.Text = "Start process";
- this.menuStartProcess.Click += new System.EventHandler(this.startProcess);
- //
- // menuRestartProcess
- //
- this.menuRestartProcess.Index = 1;
- this.menuRestartProcess.Text = "Restart process";
- this.menuRestartProcess.Click += new System.EventHandler(this.restartProcess);
- //
- // menuStopProcess
- //
- this.menuStopProcess.Index = 2;
- this.menuStopProcess.Text = "Stop process";
- this.menuStopProcess.Click += new System.EventHandler(this.stopProcess);
- //
- // menuRemoveProcess
- //
- this.menuRemoveProcess.Index = 3;
- this.menuRemoveProcess.Text = "Remove process";
- this.menuRemoveProcess.Click += new System.EventHandler(this.removeProcess);
- //
- // menuRefresh
- //
- this.menuRefresh.Index = 4;
- this.menuRefresh.Text = "Refresh";
- this.menuRefresh.Click += new System.EventHandler(this.menuRefresh_Click);
- //
- // computerMenuAdd
- //
- this.computerMenuAdd.Index = -1;
- this.computerMenuAdd.Text = "Add";
- this.computerMenuAdd.Click += new System.EventHandler(this.computerMenuAdd_Click);
- //
- // menuItem3
- //
- this.menuItem3.Index = -1;
- this.menuItem3.Text = "-";
- //
- // computerMenuRemove
- //
- this.computerMenuRemove.Index = -1;
- this.computerMenuRemove.Text = "Remove";
- this.computerMenuRemove.Click += new System.EventHandler(this.computerMenuRemove_Click);
- //
- // menuItem5
- //
- this.menuItem5.Index = -1;
- this.menuItem5.Text = "-";
- //
- // computerMenuDisconnect
- //
- this.computerMenuDisconnect.Index = -1;
- this.computerMenuDisconnect.Text = "Disconnect";
- //
- // computerMenuConnect
- //
- this.computerMenuConnect.Index = -1;
- this.computerMenuConnect.Text = "Connect";
- //
- // menuItem11
- //
- this.menuItem11.Index = -1;
- this.menuItem11.Text = "-";
- //
- // computerMenuProperties
- //
- this.computerMenuProperties.Index = -1;
- this.computerMenuProperties.Text = "Properties";
- //
- // computerMenuRefresh
- //
- this.computerMenuRefresh.Index = -1;
- this.computerMenuRefresh.Text = "Refresh";
- this.computerMenuRefresh.Click += new System.EventHandler(this.computerMenuRefresh_Click);
- //
- // chComputer
- //
- this.chComputer.Text = "Computer";
- //
- // chProcessName
- //
- this.chProcessName.Text = "Name";
- //
- // mainMenuItem
- //
- this.mainMenuItem.Index = -1;
- this.mainMenuItem.Text = "File";
- //
- // chProcesses
- //
- this.chProcesses.Text = "Id";
- //
- // mainMenu
- //
- this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.mainMenuFile,
- this.mainMenuComputer,
- this.mainMenuDatabase});
- //
- // mainMenuFile
- //
- this.mainMenuFile.Index = 0;
- this.mainMenuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem2,
- this.menuItem1});
- this.mainMenuFile.Text = "&File";
- //
- // menuItem2
- //
- this.menuItem2.Index = 0;
- this.menuItem2.Text = "&Import...";
- this.menuItem2.Click += new System.EventHandler(this.importHostFile);
- //
- // menuItem1
- //
- this.menuItem1.Index = 1;
- this.menuItem1.Text = "&Export...";
- this.menuItem1.Click += new System.EventHandler(this.exportHostFile);
- //
- // mainMenuComputer
- //
- this.mainMenuComputer.Index = 1;
- this.mainMenuComputer.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.subMenuComputerAdd,
- this.menuItem7,
- this.subMenuComputerDisconnect,
- this.subMenuComputerRemove,
- this.menuItem10,
- this.subMenuComputerProperties});
- this.mainMenuComputer.Text = "&Computer";
- //
- // subMenuComputerAdd
- //
- this.subMenuComputerAdd.Index = 0;
- this.subMenuComputerAdd.Text = "&Add Computer";
- this.subMenuComputerAdd.Click += new System.EventHandler(this.computerMenuAdd_Click);
- //
- // menuItem7
- //
- this.menuItem7.Index = 1;
- this.menuItem7.Text = "-";
- //
- // subMenuComputerDisconnect
- //
- this.subMenuComputerDisconnect.Index = 2;
- this.subMenuComputerDisconnect.Text = "&Disconnect";
- //
- // subMenuComputerRemove
- //
- this.subMenuComputerRemove.Index = 3;
- this.subMenuComputerRemove.Text = "&Remove Computer";
- this.subMenuComputerRemove.Click += new System.EventHandler(this.computerMenuRemove_Click);
- //
- // menuItem10
- //
- this.menuItem10.Index = 4;
- this.menuItem10.Text = "-";
- //
- // subMenuComputerProperties
- //
- this.subMenuComputerProperties.Index = 5;
- this.subMenuComputerProperties.Text = "&Properties";
- //
- // mainMenuDatabase
- //
- this.mainMenuDatabase.Index = 2;
- this.mainMenuDatabase.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.subMenuDatabaseCreate});
- this.mainMenuDatabase.Text = "&Database";
- this.mainMenuDatabase.Click += new System.EventHandler(this.subMenuDatabaseCreate_Click);
- //
- // subMenuDatabaseCreate
- //
- this.subMenuDatabaseCreate.Index = 0;
- this.subMenuDatabaseCreate.Text = "&Create database...";
- this.subMenuDatabaseCreate.Click += new System.EventHandler(this.subMenuDatabaseCreate_Click);
- //
- // panel1
- //
- this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.mgmConsole,
- this.splitterHorizont,
- this.splitter2,
- this.listView});
- this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.panel1.Location = new System.Drawing.Point(104, 0);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(384, 333);
- this.panel1.TabIndex = 6;
- //
- // mgmConsole
- //
- this.mgmConsole.AccessibleRole = System.Windows.Forms.AccessibleRole.StaticText;
- this.mgmConsole.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.mgmConsole.Location = new System.Drawing.Point(0, 231);
- this.mgmConsole.Multiline = true;
- this.mgmConsole.Name = "mgmConsole";
- this.mgmConsole.Size = new System.Drawing.Size(384, 96);
- this.mgmConsole.TabIndex = 5;
- this.mgmConsole.Text = "textBox1";
- this.mgmConsole.TextChanged += new System.EventHandler(this.mgmConsole_TextChanged);
- this.mgmConsole.Enter += new System.EventHandler(this.mgmConsole_Enter);
- //
- // splitterHorizont
- //
- this.splitterHorizont.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.splitterHorizont.Location = new System.Drawing.Point(0, 327);
- this.splitterHorizont.MinExtra = 100;
- this.splitterHorizont.MinSize = 100;
- this.splitterHorizont.Name = "splitterHorizont";
- this.splitterHorizont.Size = new System.Drawing.Size(384, 3);
- this.splitterHorizont.TabIndex = 4;
- this.splitterHorizont.TabStop = false;
- //
- // splitter2
- //
- this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.splitter2.Location = new System.Drawing.Point(0, 330);
- this.splitter2.Name = "splitter2";
- this.splitter2.Size = new System.Drawing.Size(384, 3);
- this.splitter2.TabIndex = 2;
- this.splitter2.TabStop = false;
- //
- // listView
- //
- this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.chComputerIP,
- this.chStatus,
- this.chDatabase,
- this.chName,
- this.chOwner});
- this.listView.ContextMenu = this.ctxListViewMenu;
- this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
- this.listView.FullRowSelect = true;
- this.listView.Name = "listView";
- this.listView.Size = new System.Drawing.Size(384, 333);
- this.listView.TabIndex = 0;
- this.listView.View = System.Windows.Forms.View.Details;
- this.listView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listView_ColumnClick_1);
- this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
- //
- // chComputerIP
- //
- this.chComputerIP.Text = "IP Adress";
- //
- // chStatus
- //
- this.chStatus.Text = "Status";
- //
- // chDatabase
- //
- this.chDatabase.Text = "Database";
- //
- // chName
- //
- this.chName.Text = "Name";
- //
- // chOwner
- //
- this.chOwner.Text = "Owner";
- //
- // splitterVertical
- //
- this.splitterVertical.Location = new System.Drawing.Point(104, 0);
- this.splitterVertical.MinSize = 100;
- this.splitterVertical.Name = "splitterVertical";
- this.splitterVertical.Size = new System.Drawing.Size(3, 333);
- this.splitterVertical.TabIndex = 7;
- this.splitterVertical.TabStop = false;
- this.splitterVertical.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitterVertical_SplitterMoved);
- //
- // openHostFileDialog
- //
- this.openHostFileDialog.DefaultExt = "cpc";
- this.openHostFileDialog.Filter = "CPCd configuration files (*.cpc)|*.cpc| All Files (*.*)|*.*";
- this.openHostFileDialog.Title = "Import a CPCd configuration file";
- this.openHostFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.openHostFileDialog_FileOk);
- //
- // saveHostFileDialog
- //
- this.saveHostFileDialog.Filter = "CPCd configuration files (*.cpc)|*.cpc| All Files (*.*)|*.*";
- this.saveHostFileDialog.Title = "Export a CPCd configuration file";
- this.saveHostFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.saveHostFileDialog_FileOk);
- //
- // CPC
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(488, 333);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.splitterVertical,
- this.panel1,
- this.tvComputerCluster});
- this.Menu = this.mainMenu;
- this.Name = "CPC";
- this.Text = "CPC";
- this.Resize += new System.EventHandler(this.CPC_Resize);
- this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CPC_MouseDown);
- this.Closing += new System.ComponentModel.CancelEventHandler(this.CPC_Closing);
- this.Load += new System.EventHandler(this.CPC_Load);
- this.Activated += new System.EventHandler(this.CPC_Activated);
- this.Paint += new System.Windows.Forms.PaintEventHandler(this.CPC_Paint);
- this.panel1.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.Run(new CPC());
-
- }
-
- private void tvComputerCluster_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
- {
- if(e.Node.Text.ToString().Equals("Database"))
- {
- updateListViews("Database");
-
- return;
- }
- if(e.Node.Text.ToString().Equals("Computer"))
- {
- //updateListViews();
-
- updateListViews("Computer");
- return;
- }
- if(e.Node.Parent.Text.ToString().Equals("Database"))
- {
- //updateListViews();
- listView.Columns.Clear();
- listView.Columns.Add(this.chName);
- listView.Columns.Add(this.chDatabase);
- listView.Columns.Add(this.chStatus);
- listView.Columns.Add(this.chOwner);
- updateDatabaseView(e.Node.Text.ToString());
- }
-
- if(e.Node.Parent.Text=="Computer")
- {
- //updateListViews();
-
- Computer c=computerMgmt.getComputer(e.Node.Text.ToString());
- string [] processcols= new string[5];
- ArrayList processes;
- processes = c.getProcesses();
- listView.Items.Clear();
- listView.Columns.Clear();
- listView.Columns.Add(this.chComputer);
- listView.Columns.Add(this.chDatabase);
- listView.Columns.Add(this.chName);
- listView.Columns.Add(this.chStatus);
- listView.Columns.Add(this.chOwner);
- if(processes != null )
- {
-
- listView.BeginUpdate();
- foreach(Process p in processes)
- {
- processcols[0]=p.getComputer().getName();
- processcols[1]=p.getDatabase();
- processcols[2]=p.getName();
- processcols[3]=p.getStatusString();
- processcols[4]=p.getOwner();
- ListViewItem lvp= new ListViewItem(processcols);
- listView.Items.Add(lvp);
- }
-
- listView.EndUpdate();
- }
-
-
- listView.Show();
- }
-
- }
-
-
-
- private void ctxTreeViewMenu_Popup(object sender, System.EventArgs e)
- {
- tvCtxMenuComputerAdd.Enabled=true;
- tvCtxMenuComputerRemove.Enabled=true;
- tvCtxMenuComputerConnect.Enabled=true;
- tvCtxMenuComputerDisconnect.Enabled=true;
- tvCtxMenuComputerDefine.Enabled=true;
- menuGetStatus.Enabled=true;
- tvCtxMenuDatabaseNew.Enabled=true;
- tvCtxMenuComputerAdd.Visible=true;
- tvCtxMenuComputerRemove.Visible=true;
- tvCtxMenuComputerConnect.Visible=true;
- tvCtxMenuComputerDisconnect.Visible=true;
- tvCtxMenuComputerDefine.Visible=true;
- tvCtxMenuDatabaseNew.Visible=true;
- tvCtxMenuProperties.Visible=true;
- menuGetStatus.Visible=true;
-
- if(tvComputerCluster.SelectedNode.Text.Equals("Computer"))
- {
- tvCtxMenuComputerAdd.Enabled=true;
- tvCtxMenuComputerRemove.Enabled=false;
- tvCtxMenuComputerConnect.Enabled=false;
- tvCtxMenuComputerDisconnect.Enabled=false;
- tvCtxMenuComputerDefine.Enabled=false;
- tvCtxMenuDatabaseNew.Visible=false;
- menuGetStatus.Visible=false;
- return;
- }
-
- if(tvComputerCluster.SelectedNode.Text.Equals("Database"))
- {
- // ctxTreeViewMenu.MenuItems.Add(menuDatabaseItem1);
- tvCtxMenuComputerAdd.Visible=false;
- tvCtxMenuComputerRemove.Visible=false;
- tvCtxMenuComputerConnect.Visible=false;
- tvCtxMenuComputerDisconnect.Visible=false;
- tvCtxMenuComputerDefine.Visible=false;
- tvCtxMenuDatabaseNew.Visible=true;
- tvCtxMenuDatabaseNew.Enabled=true;
- menuGetStatus.Visible=false;
- menuItem6.Visible=false;
- return;
- }
- if(tvComputerCluster.SelectedNode.Parent.Text.Equals("Computer"))
- {
-
- Computer c= computerMgmt.getComputer(tvComputerCluster.SelectedNode.Text.ToString());
- if(c.getStatus().Equals(Computer.Status.Disconnected))
- {
- tvCtxMenuComputerConnect.Enabled=true;
- tvCtxMenuComputerDisconnect.Enabled=false;
- }
- else
- {
- tvCtxMenuComputerDisconnect.Enabled=true;
- tvCtxMenuComputerConnect.Enabled=false;
- }
-
- tvCtxMenuComputerAdd.Enabled=false;
- tvCtxMenuComputerRemove.Enabled=true;
- menuGetStatus.Visible=false;
-
- tvCtxMenuComputerDefine.Enabled=true;
- tvCtxMenuDatabaseNew.Visible=false;
- return;
- }
-
- if(tvComputerCluster.SelectedNode.Parent.Text.Equals("Database"))
- {
- tvCtxMenuComputerAdd.Enabled=true;
- tvCtxMenuComputerRemove.Enabled=false;
- tvCtxMenuComputerConnect.Enabled=false;
- tvCtxMenuComputerDisconnect.Enabled=false;
- tvCtxMenuComputerDefine.Enabled=false;
- tvCtxMenuDatabaseNew.Visible=true;
- menuGetStatus.Visible=true;
- return;
- }
-
-
- }
-
-
- private void listView_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- //MessageBox.Show(listView.SelectedItems[0].Text);
- }
-
-
- private void tvComputerCluster_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- { /*
- TreeNode node = tvComputerCluster.GetNodeAt(e.X,e.Y);
- if(node==null)
- {
- return;
- }
- tvComputerCluster.SelectedNode=node;
-// updateListViews();
- tvComputerCluster.SelectedNode.Expand();
- */
- }
-
-
- private void subMenuComputerRemove_Click(object sender, System.EventArgs e)
- {
- //ComputerRemoveDialog crd=new ComputerRemoveDialog(computerMgmt);
- //crd.Show();
- //updateListViews();
-/* string computer = tvComputerCluster.SelectedNode.Text.ToString();
- if(MessageBox.Show(this,"Are you sure you want to remove: " +computer+ "?","Remove computer",MessageBoxButtons.YesNo)==DialogResult.Yes)
- {
- computerMgmt.RemoveComputer(computer);
- }
-*/
- }
-
- private void subMenuComputerAdd_Click(object sender, System.EventArgs e)
- {
- ComputerAddDialog cad=new ComputerAddDialog(computerMgmt);
- cad.ShowDialog();
- cad.Dispose();
-/// updateListViews(tvComputerCluster.SelectedNode.Text.ToString());
- }
-
-
-
- private void updateListViews(string node)
- {
- if(node.Equals("Computer"))
- {
- listView.Columns.Clear();
- listView.Items.Clear();
- ArrayList list= computerMgmt.getComputerCollection();
- string [] computercols= new string[2];
-
-
- listView.BeginUpdate();
- listView.Columns.Add(this.chComputer);
- listView.Columns.Add(this.chStatus);
- foreach (Computer computer in list)
- {
- computercols[0]=computer.getName();
- computercols[1]=computer.getStatusString();
-
- ListViewItem lvc= new ListViewItem(computercols);
-
- listView.Items.Add(lvc);
-
- }
- listView.EndUpdate();
- listView.Show();
- }
-
- if(node.Equals("Database"))
- {
-
- ArrayList databases= computerMgmt.getDatabaseCollection();
- string [] dbcols= new string[3];
-
-
- listView.BeginUpdate();
- listView.Items.Clear();
- listView.Columns.Clear();
- listView.Columns.Add(this.chDatabase);
- listView.Columns.Add(this.chStatus);
- listView.Columns.Add(this.chOwner);
- foreach (Database db in databases)
- {
- dbcols[0]=db.getName();
- dbcols[1]=db.getStatusString();
- dbcols[2]=db.getOwner();
-
- ListViewItem lvc= new ListViewItem(dbcols);
-
- listView.Items.Add(lvc);
-
- }
- listView.EndUpdate();
-
- listView.Show();
- }
-
- }
-
- public void updateDatabaseView(string database)
- {
- Database d=computerMgmt.getDatabase(database);
- string [] processcols= new string[5];
- ArrayList processes = d.getProcesses();
- listView.Items.Clear();
- if(processes != null )
- {
-
- listView.BeginUpdate();
- listView.Columns.Clear();
- listView.Columns.Add(this.chComputer);
- listView.Columns.Add(this.chDatabase);
- listView.Columns.Add(this.chName);
- listView.Columns.Add(this.chStatus);
- listView.Columns.Add(this.chOwner);
-
- foreach(Process p in processes)
- {
- processcols[0]=p.getComputer().getName();
- processcols[1]=p.getDatabase();
- processcols[2]=p.getName();
- processcols[3]=p.getStatusString();
- processcols[4]=p.getOwner();
- ListViewItem lvp= new ListViewItem(processcols);
- listView.Items.Add(lvp);
- }
-
- listView.EndUpdate();
- }
-
- listView.Show();
- }
-
- private void updateTreeViews()
- {
- //tvComputerCluster.Nodes.Clear();
- ArrayList computers= computerMgmt.getComputerCollection();
-
- ArrayList databases= computerMgmt.getDatabaseCollection();
-
- tvComputerCluster.BeginUpdate();
- tvComputerCluster.Nodes[0].Nodes.Clear();
- tvComputerCluster.Nodes[1].Nodes.Clear();
- if(computers != null)
- {
- foreach (Computer computer in computers)
- {
- tvComputerCluster.Nodes[0].Nodes.Add(new TreeNode(computer.getName().ToString()));
- }
- }
- if(databases != null)
- {
- foreach (Database db in databases)
- {
- tvComputerCluster.Nodes[1].Nodes.Add(new TreeNode(db.getName().ToString()));
- }
- }
-
- tvComputerCluster.EndUpdate();
- }
-
-
- private void CPC_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- //updateListViews();
- //updateTreeViews();
-
- }
-
- private void CPC_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
- if(tvComputerCluster.SelectedNode!=null)
- {
- if(tvComputerCluster.SelectedNode.Text.ToString().Equals("Computer"))
- updateListViews("Computer");
- }
-
- //updateListViews();
- //updateTreeViews();
- }
-
- private void CPC_Activated(object sender, System.EventArgs e)
- {
- updateListViews(tvComputerCluster.SelectedNode.Text.ToString());
- //updateListViews();
- updateTreeViews();
- }
-
-
- private void computerMenuAdd_Click(object sender, System.EventArgs e)
- {
- ComputerAddDialog cad=new ComputerAddDialog(computerMgmt);
- cad.ShowDialog();
- cad.Dispose();
-
- }
-
- private void computerMenuRemove_Click(object sender, System.EventArgs e)
- {
-
- string computer = tvComputerCluster.SelectedNode.Text.ToString();
- if(MessageBox.Show("Are you sure you want to remove: " + computer +"?\n" + "This will remove all processes on the computer!" ,"Remove selected computer",MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)
- {
- removeComputer(computer);
- }
- }
-
- private void removeComputer(string computer)
- {
- ArrayList processes;
- Computer c=computerMgmt.getComputer(computer);
- processes = c.getProcesses();
-
- /*foreach(Process p in processes)
- {
- removeProcess(computer,p.getName());
- processes=c.getProcesses();
- }
-*/
- if(computerMgmt.RemoveComputer(computer))
- {
- tvComputerCluster.SelectedNode=tvComputerCluster.SelectedNode.PrevVisibleNode;
- this.updateTreeViews();
- this.updateListViews("Computer");
-
- if(tvComputerCluster.SelectedNode!=null)
- this.updateListViews(tvComputerCluster.SelectedNode.Text.ToString());
- //updateListViews();
- }
- }
-
- private void listView_ColumnClick(object sender, System.Windows.Forms.ColumnClickEventArgs e)
- {
-
- if(listView.Sorting.Equals(SortOrder.Ascending))
- listView.Sorting=SortOrder.Descending;
- else
- listView.Sorting=SortOrder.Ascending;
-
- }
-
-
- private void subMenuDatabaseCreate_Click(object sender, System.EventArgs e)
- {
- PanelWizard p = new PanelWizard(this.computerMgmt);
- p.ShowDialog();
- }
-
- private void tvCtxMenuComputerDefine_Click(object sender, System.EventArgs e)
- {
- ProcessDefineDialog pdd = new ProcessDefineDialog(this.computerMgmt,
- tvComputerCluster.SelectedNode.Text.ToString());
- pdd.Show();
- }
-
- private void listView_ItemActivate(object sender, System.EventArgs e)
- {
- updateDatabaseView(listView.SelectedItems[0].Text.ToString());
- for(int i=0;i<tvComputerCluster.Nodes[1].Nodes.Count;i++)
- {
- if(tvComputerCluster.Nodes[1].Nodes[i].Text.ToString().Equals(listView.SelectedItems[0].Text.ToString()))
- {
- tvComputerCluster.SelectedNode=tvComputerCluster.Nodes[1].Nodes[i];
- break;
- }
- }
-
-
- }
-
- private void CPC_Resize(object sender, System.EventArgs e)
- {
- if(this.Width < 200) this.Width=200;
- if(this.Height <200) this.Height=200;
- this.tvComputerCluster.Width=(int)(this.Width*this.resizeWidthRatio);
- this.listView.Height=(int)(this.Height*this.resizeHeightRatio);
-
- //this.Size=new System.Drawing.Size((int)(this.Size.Width*this.tvComputerCluster.Width
-
- }
-
-
-
- private void updateGuiThread()
- {
- while(true) {
- if(tvComputerCluster.SelectedNode!=null)
- {
- if(tvComputerCluster.SelectedNode.Text.ToString().Equals("Computer"))
- updateListViews("Computer");
- }
- Thread.Sleep(1000);
- }
- }
-
- private void computerMenuRefresh_Click(object sender, System.EventArgs e)
- {
- updateListViews("Computer");
- }
-
- private void CPC_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- /*clean up*/
- ArrayList comp = this.computerMgmt.getComputerCollection();
- foreach(Computer c in comp)
- {
- c.disconnect();
- }
- }
-
- private void CPC_Load(object sender, System.EventArgs e)
- {
- this.tvComputerCluster.Width=104;
- resizeWidthRatio =(float) ((float)(this.tvComputerCluster.Width)/(float)(this.Width));
- resizeHeightRatio = (float) ((float)(this.listView.Height)/(float)(this.Height));
- listView.Columns.Clear();
- listView.Columns.Add(this.chComputer);
- listView.Columns.Add(this.chStatus);
-
- }
-
- private void splitterVertical_SplitterMoved(object sender, System.Windows.Forms.SplitterEventArgs e)
- {
- if(this.Width < 500)
- this.Width=500;
- }
-
- private void menuGetStatus_Click(object sender, System.EventArgs e)
- {
-
- }
-
- private void tvComputerCluster_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
- {
- if (e.Node.Parent!=null && e.Node.Nodes.Count !=0)
- e.Cancel=true;
- if(e.Node.IsExpanded)
- e.Cancel=true;
- }
-
- private void tvComputerCluster_BeforeCollapse(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
- {
- e.Cancel=true;
- if (e.Node.Parent!=null && e.Node.Nodes.Count !=0)
- e.Cancel=true;
- if(e.Node.IsExpanded)
- e.Cancel=false;
- }
-
-
-
- private void ctxListViewMenu_Popup(object sender, System.EventArgs e)
- {
-
- menuStartProcess.Visible=false;
- menuStopProcess.Visible=false;
- menuRestartProcess.Visible=false;
- menuRemoveProcess.Visible=false;
- menuRefresh.Visible=false;
-
-
- if(this.tvComputerCluster.SelectedNode.Text.Equals("Computer"))
- {
- return;
- }
-
- if(this.tvComputerCluster.SelectedNode.Text.Equals("Database"))
- {
- return;
- }
-
- if(this.tvComputerCluster.SelectedNode.Parent.Text.Equals("Computer"))
- {
- if(listView.SelectedItems==null)
- return;
- menuRefresh.Visible=true;
- }
- if(this.tvComputerCluster.SelectedNode.Parent.Text.Equals("Database"))
- {
- if(listView.SelectedItems==null)
- return;
- menuStartProcess.Visible=true;
- menuStopProcess.Visible=true;
- menuRestartProcess.Visible=true;
- menuRemoveProcess.Visible=true;
- menuRefresh.Visible=true;
- menuStopProcess.Enabled=true;
- menuStartProcess.Enabled=true;
- menuRestartProcess.Enabled=true;
- menuRemoveProcess.Enabled=true;
- menuRefresh.Enabled=true;
- }
-
-
- computerMenuRemove.Enabled=true;
- computerMenuConnect.Enabled=true;
- computerMenuDisconnect.Enabled=true;
- computerMenuRefresh.Enabled=true;
- string selectedItem="";
- if(listView.SelectedItems.Count>0)
- selectedItem=listView.FocusedItem.Text.ToString();
-
-
- if(selectedItem.Equals(""))
- {
- computerMenuAdd.Enabled=true;
- computerMenuRemove.Enabled=false;
- computerMenuConnect.Enabled=false;
- computerMenuDisconnect.Enabled=false;
- return;
- }
- else
- {
- computerMenuAdd.Enabled=false;
- if(computerMgmt.getStatus(selectedItem).Equals(Computer.Status.Connected))
- {
- computerMenuConnect.Enabled=false;
- computerMenuRemove.Enabled=true;
- }
- if(computerMgmt.getStatus(selectedItem).Equals(Computer.Status.Disconnected))
- computerMenuDisconnect.Enabled=false;
- }
-
-
- }
-
- private void startProcess(object sender, System.EventArgs e)
- {
- if(listView.SelectedItems.Count==0)
- return;
-
- string computer = listView.SelectedItems[0].SubItems[0].Text.ToString();
- string process = listView.SelectedItems[0].SubItems[2].Text.ToString();
-
- if(computerMgmt.getComputer(computer).getProcessByName(process).getStatus()==Process.Status.Running)
- {
- MessageBox.Show(this,"The process is already started!" ,"Process failed to start",MessageBoxButtons.OK);
- return;
- }
-
- int status = startProcess(listView.SelectedItems[0].SubItems[0].Text.ToString(),listView.SelectedItems[0].SubItems[2].Text.ToString());
-
-
- if(status < 0)
- MessageBox.Show(this,"Either the link is not OK, or the process is misconfigured! Status : " + status,"Process failed to start",MessageBoxButtons.OK);
- else
- MessageBox.Show(this,"The process was sucessfully started!","Process started",MessageBoxButtons.OK);
-
- }
-
- private int startProcess(string computer, string process)
- {
- Computer c=computerMgmt.getComputer(computer);
- int status = c.startProcess(c.getProcessByName(process));
- return status;
- }
-
- private void listView_ColumnClick_1(object sender, System.Windows.Forms.ColumnClickEventArgs e)
- {
- // if(listView.Columns[e.Column].Text.Equals("Computer"))
- // {
- if(listView.Sorting.Equals(SortOrder.Ascending))
- {
- listView.Sorting=SortOrder.Descending;
- }
- else
- {
- listView.Sorting=SortOrder.Ascending;
- }
- // }
- }
-
- private void removeProcess(object sender, System.EventArgs e)
- {
- if(listView.SelectedItems.Count==0)
- return;
- string process = listView.SelectedItems[0].SubItems[2].Text.ToString();
- string computer = listView.SelectedItems[0].SubItems[0].Text.ToString();
-
- if(MessageBox.Show("Are you sure that you want to remove " + process + " permanently?","Remove process",MessageBoxButtons.YesNo) == DialogResult.No)
- return;
- removeProcess(computer,process);
- MessageBox.Show(this,"The process was sucessfully removed!","Remove process",MessageBoxButtons.OK);
- }
-
- private void removeProcess(string computer, string process)
- {
-
- Computer c=computerMgmt.getComputer(computer);
- stopProcess(computer,process);
- int status = c.undefineProcess(c.getProcessByName(process));
- //if(status < 0)
- // MessageBox.Show(this,"The process could not be removed!","Failed to remove process",MessageBoxButtons.OK);
- // else
- // {
- Database db = computerMgmt.getDatabase((c.getProcessByName(process).getDatabase()));
- db.removeProcess(process);
- c.removeProcess(process,db.getName());
- updateListViews("Database");
- // }
- }
-
- private void stopProcess(object sender, System.EventArgs e)
- {
- if(listView.SelectedItems.Count==0)
- return;
- string computer = listView.SelectedItems[0].SubItems[0].Text.ToString();
- string process = listView.SelectedItems[0].SubItems[2].Text.ToString();
- if(computerMgmt.getComputer(computer).getProcessByName(process).getStatus()==Process.Status.Stopped)
- {
- MessageBox.Show(this,"The process is already stopped!" ,"Process failed to stop",MessageBoxButtons.OK);
- return;
- }
-
- if(DialogResult.No==MessageBox.Show(this,"Are you sure you want to stop the " + process + " process?","Stop process!", MessageBoxButtons.YesNo))
- return;
-
- int status = stopProcess(computer, process);
- if(status < 0)
- MessageBox.Show(this,"The process could not be stopped. Status: " + status ,"Process failed to stop",MessageBoxButtons.OK);
- else
- MessageBox.Show(this,"The process was sucessfully stopped!","Process stopped",MessageBoxButtons.OK);
- }
-
- private int stopProcess(string computer, string process)
- {
- Computer c=computerMgmt.getComputer(computer);
- int status = c.stopProcess(c.getProcessByName(process));
- return status;
- }
-
- private void restartProcess(object sender, System.EventArgs e)
- {
- if(listView.SelectedItems.Count==0)
- return;
- string computer = listView.SelectedItems[0].SubItems[0].Text.ToString();
- string process = listView.SelectedItems[0].SubItems[2].Text.ToString();
- if(stopProcess(computer, process)<0)
- {
- MessageBox.Show("Restart process failed!!!", "Restart process");
- return;
- }
- if(startProcess(computer, process)<0)
- {
- MessageBox.Show("Restart process failed!!!", "Restart process");
- return;
- }
- MessageBox.Show("Succesfully restarted the process!","Restart process");
- }
-
- private void menuRefresh_Click(object sender, System.EventArgs e)
- {
- //string computer = tvComputerCluster.SelectedNode.Text;
-
- this.listProcesses();
- }
-
- private void importHostFile(object sender, System.EventArgs e)
- {
- openHostFileDialog.ShowDialog();
- }
-
- private void exportHostFile(object sender, System.EventArgs e)
- {
- saveHostFileDialog.ShowDialog();
- }
-
- private void listProcesses()
- {
- /* add process in computer list*/
- ArrayList computers = computerMgmt.getComputerCollection();
- foreach(Computer c in computers)
- {
- c.listProcesses();
- ArrayList processes = c.getProcesses();
- if(processes!=null)
- {
- foreach(Process p in processes)
- {
- Database db = computerMgmt.getDatabase(p.getDatabase());
- if(db!=null)
- {
- p.setDefined(true);
- db.addProcessCheck(p);
- }
- }
- }
- }
- updateListViews("Computer");
- updateListViews("Database");
- }
-
- private void openHostFileDialog_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
- {
- computerMgmt.importHostFile(openHostFileDialog.FileName);
- this.updateTreeViews();
- openHostFileDialog.Dispose();
- listProcesses();
- }
-
- private void saveHostFileDialog_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
- {
- computerMgmt.exportHostFile(saveHostFileDialog.FileName);
- saveHostFileDialog.Dispose();
- }
-
- private void mgmConsole_Enter(object sender, System.EventArgs e)
- {/*
- //telnetclient.telnetClient tc= new telnetclient.telnetClient("10.0.13.1",10000,mgmConsole);
- socketcomm.SocketComm sc = new socketcomm.SocketComm("10.0.13.1",10000);
- sc.doConnect();
- while(!sc.isConnected())
- {
- Thread.Sleep(100);
- }
- sc.writeMessage("get status\r");
- string line = sc.readLine();
- while(!line.Equals(""))
- {
- MessageBox.Show(line);
- line=sc.readLine();
- }
-*/
- }
-
- private void mgmConsole_TextChanged(object sender, System.EventArgs e)
- {
-
- }
-
-
-
-
-
-
-
-
-
- }
-
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/Computer.cs b/storage/ndb/src/cw/cpcc-win32/csharp/Computer.cs
deleted file mode 100644
index 879605dbd23..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/Computer.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Data;
-using System.IO;
-using NDB_CPC.socketcomm;
-using NDB_CPC.simpleparser;
-
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for Computer.
- /// </summary>
- public class Computer
- {
- public enum Status {Disconnected=1,Connected=2, Unknown=3}
- private string m_ip;
- private int m_cpcdPort;
- private string m_name;
- private Status m_status;
- private ArrayList m_processes;
- private SocketComm m_socket;
- public Computer(string name, int port)
- {
- m_name = name;
- m_status = Status.Disconnected;
- m_processes = new ArrayList();
- m_cpcdPort=port;
- m_socket = new SocketComm(m_name,m_cpcdPort);
- }
-
- public Computer(string name, string ip)
- {
- m_ip = ip;
- m_name = name;
- m_status = Status.Disconnected;
- m_processes = new ArrayList();
- m_cpcdPort=1234; //default port
- m_socket = new SocketComm(m_ip,m_cpcdPort);
- }
-
- public void connectToCpcd()
- {
- m_socket.doConnect();
- }
-
- private bool sendMessage(string str)
- {
- return m_socket.writeMessage(str);
-
- }
-
- public string getName() {return m_name;}
- public string getIp() {return m_ip;}
- public ArrayList getProcesses()
- {
- if(m_processes.Count>0)
- return m_processes;
- else
- return null;
- }
- public string getStatusString()
- {
- try
- {
- if(m_socket.isConnected())
- return "Connected";
- else
- return "Disconnected";
- }
- catch(Exception e)
- {
- return "Unknown";
- }
- }
-
-
- public bool isConnected()
- {
- if(m_socket.isConnected())
- return true;
- return false;
- }
-
- public Status getStatus()
- {
- try
- {
- if(m_socket.isConnected())
- return Status.Connected;
- else
- return Status.Disconnected;
- }
- catch(Exception e)
- {
- return Status.Unknown;
- }
- }
-
- public void setStatus(Status status)
- {
- m_status=status;
- }
-
- public void addProcess(Process process)
- {
- m_processes.Add(process);
- }
-
- public Process getProcessByName(string name)
- {
- foreach(Process process in m_processes)
- {
- if(process.getName().Equals(name))
- return process;
- }
- return null;
- }
-
-
- public bool removeProcess(string name, string database)
- {
- foreach(Process p in m_processes)
- {
- if(p.getName().Equals(name) && p.getDatabase().Equals(database))
- {
- m_processes.Remove(p);
- return true;
- }
- }
- return false;
- }
-
- public void disconnect()
- {
- m_socket.disconnect();
- }
- public Process getProcess(string id)
- {
- foreach(Process process in m_processes)
- {
- if(process.getId().Equals(id))
- return process;
- }
- return null;
- }
-
- public int listProcesses()
- {
- string list = "list processes\n\n";
-
- if(!sendMessage(list))
- return -2;
-
- SimpleCPCParser.parse(m_processes, this, m_socket);
- return 1;
- }
-
- public int defineProcess(Process p)
- {
- string define = "define process \n";
- define = define + "name:" + p.getName() + "\n";
- define = define + "group:" + p.getDatabase() + "\n";
- define = define + "env:" + "NDB_CONNECTSTRING="+p.getConnectString() ;
- if(p.getEnv().Equals(""))
- define = define + "\n";
- else
- define = define + " " + p.getEnv() + "\n";
-
- //if(p.getPath().EndsWith("\\"))
- // define = define + "path:" + p.getPath()+ "ndb" + "\n";
- //else
- define = define + "path:" + p.getPath() + "\n";
- define = define + "args:" + p.getArgs() + "\n";
- define = define + "type:" + "permanent" + "\n";
- define = define + "cwd:" + p.getCwd() + "\n";
- define = define + "owner:" + "ejohson" + "\n\n";
-
- if(!sendMessage(define))
- return -2;
-
- SimpleCPCParser.parse(p, m_socket);
- if(p.isDefined())
- return 1;
- else
- return -1;
-
- }
-
- public int startProcess(Process p)
- {
- if(!p.isDefined())
- {
- this.defineProcess(p);
- if(!p.isDefined())
- return -4; //process misconfigured
-
- }
- string start= "start process \n";
- start = start + "id:" + p.getId() + "\n\n";
- if(!sendMessage(start))
- return -2;
- SimpleCPCParser.parse(p, m_socket);
- if(p.getStatus().Equals(Process.Status.Running))
- return 1;
- else
- return -1;
- }
-
- public int stopProcess(Process p)
- {
- if(!p.isDefined())
- {
- return -4; //process not defined
- }
- string stop= "stop process \n";
- stop = stop + "id:" + p.getId() + "\n\n";
- if(!sendMessage(stop))
- return -2;
- SimpleCPCParser.parse(p, m_socket);
-
- if(p.getStatus().Equals(Process.Status.Stopped))
- return 1;
- else
- return -1;
- }
-
- public int undefineProcess(Process p)
- {
- if(!p.isDefined())
- {
- return -4; //process not defined
- }
- string undefine= "undefine process \n";
- undefine = undefine + "id:" + p.getId() + "\n\n";
- if(!sendMessage(undefine))
- return -2;
- SimpleCPCParser.parse(p, m_socket);
- if(!p.isDefined())
- {
- return 1;
-
- }
- return -1;
- }
-
- public int getCpcdPort()
- {
- return this.m_cpcdPort;
- }
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs b/storage/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs
deleted file mode 100644
index bdd8b04c0ae..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/ComputerAddDialog.cs
+++ /dev/null
@@ -1,258 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for ComputerAddDialog.
- /// </summary>
- public class ComputerAddDialog : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox textboxComputerName;
- private System.Windows.Forms.Button btnAdd;
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Label label2;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.CheckBox checkBoxDefault;
- private System.Windows.Forms.TextBox textBoxPort;
-
- private ComputerMgmt mgmt;
- public ComputerAddDialog(ComputerMgmt mgmt)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- this.mgmt=mgmt;
- }
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.textboxComputerName = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.btnAdd = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.label2 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.textBoxPort = new System.Windows.Forms.TextBox();
- this.checkBoxDefault = new System.Windows.Forms.CheckBox();
- this.SuspendLayout();
- //
- // textboxComputerName
- //
- this.textboxComputerName.Location = new System.Drawing.Point(128, 16);
- this.textboxComputerName.Name = "textboxComputerName";
- this.textboxComputerName.Size = new System.Drawing.Size(136, 20);
- this.textboxComputerName.TabIndex = 0;
- this.textboxComputerName.Text = "";
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(40, 16);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(88, 23);
- this.label1.TabIndex = 1;
- this.label1.Text = "Computer name:";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // btnAdd
- //
- this.btnAdd.Location = new System.Drawing.Point(112, 128);
- this.btnAdd.Name = "btnAdd";
- this.btnAdd.Size = new System.Drawing.Size(80, 24);
- this.btnAdd.TabIndex = 4;
- this.btnAdd.Text = "Add";
- this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
- //
- // btnCancel
- //
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(200, 128);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(80, 24);
- this.btnCancel.TabIndex = 5;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(128, 40);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(136, 16);
- this.label2.TabIndex = 4;
- this.label2.Text = "(e.g. Ndb01 or 10.0.1.1)";
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(48, 64);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(80, 24);
- this.label6.TabIndex = 9;
- this.label6.Text = "CPCd port:";
- this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // textBoxPort
- //
- this.textBoxPort.Enabled = false;
- this.textBoxPort.Location = new System.Drawing.Point(128, 64);
- this.textBoxPort.Name = "textBoxPort";
- this.textBoxPort.Size = new System.Drawing.Size(136, 20);
- this.textBoxPort.TabIndex = 2;
- this.textBoxPort.TabStop = false;
- this.textBoxPort.Text = "";
- //
- // checkBoxDefault
- //
- this.checkBoxDefault.Checked = true;
- this.checkBoxDefault.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBoxDefault.Location = new System.Drawing.Point(96, 96);
- this.checkBoxDefault.Name = "checkBoxDefault";
- this.checkBoxDefault.Size = new System.Drawing.Size(168, 16);
- this.checkBoxDefault.TabIndex = 3;
- this.checkBoxDefault.Text = "Use default port (1234)?";
- this.checkBoxDefault.CheckedChanged += new System.EventHandler(this.checkBoxDefault_CheckedChanged);
- //
- // ComputerAddDialog
- //
- this.AcceptButton = this.btnAdd;
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(298, 159);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.checkBoxDefault,
- this.label6,
- this.textBoxPort,
- this.label2,
- this.btnCancel,
- this.btnAdd,
- this.label1,
- this.textboxComputerName});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "ComputerAddDialog";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Add a computer";
- this.Load += new System.EventHandler(this.ComputerAddDialog_Load);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void btnCancel_Click(object sender, System.EventArgs e)
- {
- this.Close();
- this.Dispose();
- }
-
- private void btnAdd_Click(object sender, System.EventArgs e)
- {
- int port;
- if(this.textboxComputerName.Text.Equals(""))
- {
- MessageBox.Show(this,"A computer must have an IP address or a host name","Warning!",MessageBoxButtons.OK);
- return;
- }
- if(this.checkBoxDefault.Checked)
- {
- port=1234;
- }
- else
- {
- if(this.textBoxPort.Text.Equals(""))
- {
- MessageBox.Show(this,"You must specify a port number!!!","Warning!",MessageBoxButtons.OK);
- return;
- }
- else
- {
- try
- {
- port=Convert.ToInt32(this.textBoxPort.Text.ToString());
-
- }
- catch (Exception exception)
- {
- MessageBox.Show(this,"Port number must be numeric!!!","Warning!",MessageBoxButtons.OK);
- return;
- }
- }
- }
-
- if(mgmt.getComputer(this.textboxComputerName.Text)==null)
- {
- mgmt.AddComputer(this.textboxComputerName.Text.ToString(),port);}
- else
- {
- MessageBox.Show("This computer does already exist!", "Add computer");
- return;
- }
-
- this.Dispose();
- }
-
- private void ComputerAddDialog_Load(object sender, System.EventArgs e)
- {
-
- }
-
- private void checkBoxDefault_CheckedChanged(object sender, System.EventArgs e)
- {
- if(checkBoxDefault.Checked)
- textBoxPort.Enabled=false;
- else
- textBoxPort.Enabled=true;
- }
-
-
-
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs b/storage/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs
deleted file mode 100644
index e2f32637a8c..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/ComputerRemoveDialog.cs
+++ /dev/null
@@ -1,244 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for ComputerRemoveDialog.
- /// </summary>
- public class ComputerRemoveDialog : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.ComboBox comboComputer;
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Button btnRemove;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private ComputerMgmt mgmt;
-
- public ComputerRemoveDialog(ComputerMgmt mgmt)
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- this.mgmt=mgmt;
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ComputerRemoveDialog));
- this.label1 = new System.Windows.Forms.Label();
- this.comboComputer = new System.Windows.Forms.ComboBox();
- this.btnCancel = new System.Windows.Forms.Button();
- this.btnRemove = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AccessibleDescription = ((string)(resources.GetObject("label1.AccessibleDescription")));
- this.label1.AccessibleName = ((string)(resources.GetObject("label1.AccessibleName")));
- this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("label1.Anchor")));
- this.label1.AutoSize = ((bool)(resources.GetObject("label1.AutoSize")));
- this.label1.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("label1.Dock")));
- this.label1.Enabled = ((bool)(resources.GetObject("label1.Enabled")));
- this.label1.Font = ((System.Drawing.Font)(resources.GetObject("label1.Font")));
- this.label1.Image = ((System.Drawing.Image)(resources.GetObject("label1.Image")));
- this.label1.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.ImageAlign")));
- this.label1.ImageIndex = ((int)(resources.GetObject("label1.ImageIndex")));
- this.label1.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("label1.ImeMode")));
- this.label1.Location = ((System.Drawing.Point)(resources.GetObject("label1.Location")));
- this.label1.Name = "label1";
- this.label1.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("label1.RightToLeft")));
- this.label1.Size = ((System.Drawing.Size)(resources.GetObject("label1.Size")));
- this.label1.TabIndex = ((int)(resources.GetObject("label1.TabIndex")));
- this.label1.Text = resources.GetString("label1.Text");
- this.label1.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("label1.TextAlign")));
- this.label1.Visible = ((bool)(resources.GetObject("label1.Visible")));
- //
- // comboComputer
- //
- this.comboComputer.AccessibleDescription = ((string)(resources.GetObject("comboComputer.AccessibleDescription")));
- this.comboComputer.AccessibleName = ((string)(resources.GetObject("comboComputer.AccessibleName")));
- this.comboComputer.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("comboComputer.Anchor")));
- this.comboComputer.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("comboComputer.BackgroundImage")));
- this.comboComputer.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("comboComputer.Dock")));
- this.comboComputer.Enabled = ((bool)(resources.GetObject("comboComputer.Enabled")));
- this.comboComputer.Font = ((System.Drawing.Font)(resources.GetObject("comboComputer.Font")));
- this.comboComputer.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("comboComputer.ImeMode")));
- this.comboComputer.IntegralHeight = ((bool)(resources.GetObject("comboComputer.IntegralHeight")));
- this.comboComputer.ItemHeight = ((int)(resources.GetObject("comboComputer.ItemHeight")));
- this.comboComputer.Location = ((System.Drawing.Point)(resources.GetObject("comboComputer.Location")));
- this.comboComputer.MaxDropDownItems = ((int)(resources.GetObject("comboComputer.MaxDropDownItems")));
- this.comboComputer.MaxLength = ((int)(resources.GetObject("comboComputer.MaxLength")));
- this.comboComputer.Name = "comboComputer";
- this.comboComputer.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("comboComputer.RightToLeft")));
- this.comboComputer.Size = ((System.Drawing.Size)(resources.GetObject("comboComputer.Size")));
- this.comboComputer.Sorted = true;
- this.comboComputer.TabIndex = ((int)(resources.GetObject("comboComputer.TabIndex")));
- this.comboComputer.Text = resources.GetString("comboComputer.Text");
- this.comboComputer.Visible = ((bool)(resources.GetObject("comboComputer.Visible")));
- this.comboComputer.SelectedIndexChanged += new System.EventHandler(this.comboComputer_SelectedIndexChanged);
- //
- // btnCancel
- //
- this.btnCancel.AccessibleDescription = ((string)(resources.GetObject("btnCancel.AccessibleDescription")));
- this.btnCancel.AccessibleName = ((string)(resources.GetObject("btnCancel.AccessibleName")));
- this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnCancel.Anchor")));
- this.btnCancel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnCancel.BackgroundImage")));
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnCancel.Dock")));
- this.btnCancel.Enabled = ((bool)(resources.GetObject("btnCancel.Enabled")));
- this.btnCancel.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnCancel.FlatStyle")));
- this.btnCancel.Font = ((System.Drawing.Font)(resources.GetObject("btnCancel.Font")));
- this.btnCancel.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.Image")));
- this.btnCancel.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnCancel.ImageAlign")));
- this.btnCancel.ImageIndex = ((int)(resources.GetObject("btnCancel.ImageIndex")));
- this.btnCancel.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnCancel.ImeMode")));
- this.btnCancel.Location = ((System.Drawing.Point)(resources.GetObject("btnCancel.Location")));
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnCancel.RightToLeft")));
- this.btnCancel.Size = ((System.Drawing.Size)(resources.GetObject("btnCancel.Size")));
- this.btnCancel.TabIndex = ((int)(resources.GetObject("btnCancel.TabIndex")));
- this.btnCancel.Text = resources.GetString("btnCancel.Text");
- this.btnCancel.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnCancel.TextAlign")));
- this.btnCancel.Visible = ((bool)(resources.GetObject("btnCancel.Visible")));
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // btnRemove
- //
- this.btnRemove.AccessibleDescription = ((string)(resources.GetObject("btnRemove.AccessibleDescription")));
- this.btnRemove.AccessibleName = ((string)(resources.GetObject("btnRemove.AccessibleName")));
- this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnRemove.Anchor")));
- this.btnRemove.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnRemove.BackgroundImage")));
- this.btnRemove.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnRemove.Dock")));
- this.btnRemove.Enabled = ((bool)(resources.GetObject("btnRemove.Enabled")));
- this.btnRemove.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnRemove.FlatStyle")));
- this.btnRemove.Font = ((System.Drawing.Font)(resources.GetObject("btnRemove.Font")));
- this.btnRemove.Image = ((System.Drawing.Image)(resources.GetObject("btnRemove.Image")));
- this.btnRemove.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnRemove.ImageAlign")));
- this.btnRemove.ImageIndex = ((int)(resources.GetObject("btnRemove.ImageIndex")));
- this.btnRemove.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnRemove.ImeMode")));
- this.btnRemove.Location = ((System.Drawing.Point)(resources.GetObject("btnRemove.Location")));
- this.btnRemove.Name = "btnRemove";
- this.btnRemove.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnRemove.RightToLeft")));
- this.btnRemove.Size = ((System.Drawing.Size)(resources.GetObject("btnRemove.Size")));
- this.btnRemove.TabIndex = ((int)(resources.GetObject("btnRemove.TabIndex")));
- this.btnRemove.Text = resources.GetString("btnRemove.Text");
- this.btnRemove.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnRemove.TextAlign")));
- this.btnRemove.Visible = ((bool)(resources.GetObject("btnRemove.Visible")));
- this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
- //
- // ComputerRemoveDialog
- //
- this.AcceptButton = this.btnRemove;
- this.AccessibleDescription = ((string)(resources.GetObject("$this.AccessibleDescription")));
- this.AccessibleName = ((string)(resources.GetObject("$this.AccessibleName")));
- this.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("$this.Anchor")));
- this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
- this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
- this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
- this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
- this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
- this.CancelButton = this.btnCancel;
- this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.btnRemove,
- this.btnCancel,
- this.comboComputer,
- this.label1});
- this.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("$this.Dock")));
- this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
- this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
- this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
- this.MaximizeBox = false;
- this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
- this.MinimizeBox = false;
- this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
- this.Name = "ComputerRemoveDialog";
- this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
- this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
- this.Text = resources.GetString("$this.Text");
- this.Visible = ((bool)(resources.GetObject("$this.Visible")));
- this.Load += new System.EventHandler(this.ComputerRemoveDialog_Load);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void btnRemove_Click(object sender, System.EventArgs e)
- {
- mgmt.RemoveComputer(comboComputer.SelectedItem.ToString());
- this.Dispose();
- }
-
- private void ComputerRemoveDialog_Load(object sender, System.EventArgs e)
- {
- ArrayList list = mgmt.getComputerCollection();
- foreach (Computer computer in list)
- {
- comboComputer.Items.Add(computer.getName());
- }
- }
-
- private void btnCancel_Click(object sender, System.EventArgs e)
- {
- this.Close();
- this.Dispose();
- }
-
- private void comboComputer_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- }
-
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/DATABASE.ICO b/storage/ndb/src/cw/cpcc-win32/csharp/DATABASE.ICO
deleted file mode 100644
index 9689aa88361..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/DATABASE.ICO
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/Database.cs b/storage/ndb/src/cw/cpcc-win32/csharp/Database.cs
deleted file mode 100644
index d08d3464b18..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/Database.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Data;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for Database.
- /// </summary>
- public class Database
- {
- public enum Status {Disconnected=1,Connected=2, Unknown=3}
- private string m_name;
- private string m_owner;
- private int m_mgmtPort;
- private Status m_status;
- private ArrayList m_processes;
- public Database(string name)
- {
- m_name=name;
- m_processes = new ArrayList();
- }
- public Database(string name, string owner)
- {
- m_name=name;
- m_owner=owner;
- m_processes = new ArrayList();
- }
- public Database()
- {
- m_processes = new ArrayList();
- }
-
- public string getName()
- {
- return m_name;
- }
-
- public void setName(string name)
- {
- m_name=name;
- }
-
- public void setMgmtPort(int port)
- {
- m_mgmtPort=port;
- }
-
- public string getOwner()
- {
- return m_owner;
- }
-
- public void setOwner(string name)
- {
- m_owner=name;
- }
-
-
- public Status getStatus()
- {
- return m_status;
- }
-
- public string getStatusString()
- {
- if(m_status.Equals(Status.Connected))
- return "Connected";
- if(m_status.Equals(Status.Disconnected))
- return "Disconnected";
- if(m_status.Equals(Status.Unknown))
- return "Unknown";
- return "Unknown";
- }
- public void setStatus(Status status)
- {
- m_status=status;
- }
-
- public void addProcess(Process process)
- {
- /*if(check)
- {
- if(m_processes==null)
- return;
- if(m_processes.Count>0)
- {
- foreach (Process p in m_processes)
- {
- if(process.getId().Equals(p.getId()))
- return;
- }
- }
- }
- */
- m_processes.Add(process);
- }
- public void addProcessCheck(Process process)
- {
-
- if(m_processes==null)
- return;
- if(m_processes.Count>0)
- {
- foreach (Process p in m_processes)
- {
- if(process.getId().Equals(p.getId()))
- return;
- }
- }
- m_processes.Add(process);
- }
-
- public Process getProcess(string id)
- {
- foreach(Process process in m_processes)
- {
- if(process.getId().Equals(id))
- return process;
- }
- return null;
- }
-
- public Process getProcessByName(string name)
- {
- foreach(Process process in m_processes)
- {
- if(process.getName().Equals(name))
- return process;
- }
- return null;
- }
-
- public void removeProcess( string processName)
- {
- Process p = this.getProcessByName(processName);
- m_processes.Remove(p);
- }
-
- public void removeAllProcesses()
- {
- Computer c;
- foreach(Process p in m_processes)
- {
- c=p.getComputer();
- if(c.removeProcess(p.getName(),m_name).Equals(false))
- {
-
- }
- }
- m_processes.Clear();
- }
-
- public ArrayList getProcesses()
- {
- return m_processes;
- }
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj b/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj
deleted file mode 100644
index 6384eff8329..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj
+++ /dev/null
@@ -1,240 +0,0 @@
-<VisualStudioProject>
- <CSHARP
- ProjectType = "Local"
- ProductVersion = "7.0.9466"
- SchemaVersion = "1.0"
- ProjectGuid = "{B78F6720-D36C-43DD-B442-F583718D0286}"
- >
- <Build>
- <Settings
- ApplicationIcon = "App.ico"
- AssemblyKeyContainerName = ""
- AssemblyName = "NDB_CPC"
- AssemblyOriginatorKeyFile = ""
- DefaultClientScript = "JScript"
- DefaultHTMLPageLayout = "Grid"
- DefaultTargetSchema = "IE50"
- DelaySign = "false"
- OutputType = "WinExe"
- RootNamespace = "NDB_CPC"
- StartupObject = ""
- >
- <Config
- Name = "Debug"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "DEBUG;TRACE"
- DocumentationFile = ""
- DebugSymbols = "true"
- FileAlignment = "4096"
- IncrementalBuild = "true"
- Optimize = "false"
- OutputPath = "bin\Debug\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- <Config
- Name = "Release"
- AllowUnsafeBlocks = "false"
- BaseAddress = "285212672"
- CheckForOverflowUnderflow = "false"
- ConfigurationOverrideFile = ""
- DefineConstants = "TRACE"
- DocumentationFile = ""
- DebugSymbols = "false"
- FileAlignment = "4096"
- IncrementalBuild = "false"
- Optimize = "true"
- OutputPath = "bin\Release\"
- RegisterForComInterop = "false"
- RemoveIntegerChecks = "false"
- TreatWarningsAsErrors = "false"
- WarningLevel = "4"
- />
- </Settings>
- <References>
- <Reference
- Name = "System.Data"
- AssemblyName = "System.Data"
- HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
- />
- <Reference
- Name = "System.Drawing"
- AssemblyName = "System.Drawing"
- HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
- />
- <Reference
- Name = "System.Windows.Forms"
- AssemblyName = "System.Windows.Forms"
- HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
- />
- <Reference
- Name = "System.XML"
- AssemblyName = "System.Xml"
- HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
- />
- <Reference
- Name = "System"
- AssemblyName = "System"
- HintPath = "..\..\..\..\..\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
- />
- <Reference
- Name = "VBIDE"
- Guid = "{0002E157-0000-0000-C000-000000000046}"
- VersionMajor = "5"
- VersionMinor = "3"
- Lcid = "0"
- WrapperTool = "tlbimp"
- />
- <Reference
- Name = "stdole"
- Guid = "{00020430-0000-0000-C000-000000000046}"
- VersionMajor = "2"
- VersionMinor = "0"
- Lcid = "0"
- WrapperTool = "primary"
- />
- <Reference
- Name = "Microsoft.Office.Core"
- Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}"
- VersionMajor = "2"
- VersionMinor = "2"
- Lcid = "0"
- WrapperTool = "tlbimp"
- />
- </References>
- </Build>
- <Files>
- <Include>
- <File
- RelPath = "app.config"
- BuildAction = "None"
- />
- <File
- RelPath = "App.ico"
- BuildAction = "Content"
- />
- <File
- RelPath = "AssemblyInfo.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "Computer.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ComputerAddDialog.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ComputerAddDialog.resx"
- DependentUpon = "ComputerAddDialog.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "ComputerMgmt.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ComputerRemoveDialog.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ComputerRemoveDialog.af.resx"
- DependentUpon = "ComputerRemoveDialog.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "ComputerRemoveDialog.resx"
- DependentUpon = "ComputerRemoveDialog.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "CPC_Form.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "CPC_Form.resx"
- DependentUpon = "CPC_Form.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "Database.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "PanelWizard.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "PanelWizard.resx"
- DependentUpon = "PanelWizard.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "Process.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ProcessDefineDialog.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "ProcessDefineDialog.resx"
- DependentUpon = "ProcessDefineDialog.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "startDatabaseDlg.cs"
- SubType = "Form"
- BuildAction = "Compile"
- />
- <File
- RelPath = "startDatabaseDlg.resx"
- DependentUpon = "startDatabaseDlg.cs"
- BuildAction = "EmbeddedResource"
- />
- <File
- RelPath = "fileaccess\FileMgmt.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "simpleparser\SimpleCPCParser.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "socketcomm\myTcpClient.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "socketcomm\SocketComm.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "telnetclient\telnetClient.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- </Include>
- </Files>
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj.user b/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj.user
deleted file mode 100644
index 68937906d93..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.csproj.user
+++ /dev/null
@@ -1,48 +0,0 @@
-<VisualStudioProject>
- <CSHARP>
- <Build>
- <Settings ReferencePath = "" >
- <Config
- Name = "Debug"
- EnableASPDebugging = "false"
- EnableASPXDebugging = "false"
- EnableUnmanagedDebugging = "false"
- EnableSQLServerDebugging = "false"
- RemoteDebugEnabled = "false"
- RemoteDebugMachine = ""
- StartAction = "Project"
- StartArguments = ""
- StartPage = ""
- StartProgram = ""
- StartURL = ""
- StartWorkingDirectory = ""
- StartWithIE = "false"
- />
- <Config
- Name = "Release"
- EnableASPDebugging = "false"
- EnableASPXDebugging = "false"
- EnableUnmanagedDebugging = "false"
- EnableSQLServerDebugging = "false"
- RemoteDebugEnabled = "false"
- RemoteDebugMachine = ""
- StartAction = "Project"
- StartArguments = ""
- StartPage = ""
- StartProgram = ""
- StartURL = ""
- StartWorkingDirectory = ""
- StartWithIE = "true"
- />
- </Settings>
- </Build>
- <OtherProjectSettings
- CopyProjectDestinationFolder = ""
- CopyProjectUncPath = ""
- CopyProjectOption = "0"
- ProjectView = "ProjectFiles"
- ProjectTrust = "0"
- />
- </CSHARP>
-</VisualStudioProject>
-
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.ncb b/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.ncb
deleted file mode 100644
index ed3460476b0..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.ncb
+++ /dev/null
Binary files differ
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.sln b/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.sln
deleted file mode 100644
index ef18b5e94ce..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/NDB_CPC.sln
+++ /dev/null
@@ -1,21 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDB_CPC", "NDB_CPC.csproj", "{B78F6720-D36C-43DD-B442-F583718D0286}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {B78F6720-D36C-43DD-B442-F583718D0286}.Debug.ActiveCfg = Debug|.NET
- {B78F6720-D36C-43DD-B442-F583718D0286}.Debug.Build.0 = Debug|.NET
- {B78F6720-D36C-43DD-B442-F583718D0286}.Release.ActiveCfg = Release|.NET
- {B78F6720-D36C-43DD-B442-F583718D0286}.Release.Build.0 = Release|.NET
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs b/storage/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs
deleted file mode 100644
index e4cfc37e850..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/PanelWizard.cs
+++ /dev/null
@@ -1,1899 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-//author:Arun
-//date:Nov 13,2002
-//Wizard using panel
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for MDXQueryBuilderWizard.
- /// </summary>
- public class PanelWizard : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Button btnback;
- private System.Windows.Forms.Button btnNext;
- private System.Windows.Forms.Button btnFinish;
-
- //---enabling and disabling the buttons
- private bool cancelEnabled;
- private bool backEnabled;
- private bool nextEnabled;
- private bool finishEnabled;
- //--------
- //--set the next and back panel
- private Panel nextPanel;
- private Panel backPanel;
- private Panel presentPanel;
- //
- private Panel[] arrayPanel;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Panel panel2;
- private System.Windows.Forms.Panel panel3;
- private System.Windows.Forms.RadioButton radioBtnYes;
- private System.Windows.Forms.RadioButton radioBtnNo;
- private System.Windows.Forms.ListBox listBoxComputers;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label1;
- private System.ComponentModel.IContainer components;
- private System.Windows.Forms.Button buttonComputerAdd;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.ComboBox comboNDB;
- private System.Windows.Forms.ComboBox comboAPI;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.ComboBox comboMGM;
- private System.Windows.Forms.Button btnTransferNodeToComp;
- private System.Windows.Forms.TreeView tvComputer;
- private System.Windows.Forms.ListView lvNode;
- private System.Windows.Forms.Button btnTransferCompToNode;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.Label label10;
- private int m_nMGM;
- private ComputerMgmt mgmt;
- private int m_nNDB;
- private int m_nAPI;
- private Database m_db;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.TextBox textDbName;
- private System.Windows.Forms.Label label31;
- private System.Windows.Forms.Label label32;
- private System.Windows.Forms.Label label33;
- private System.Windows.Forms.Label label18;
- private System.Windows.Forms.Label labelTitle;
- private System.Windows.Forms.Label labelCwd;
- private System.Windows.Forms.Label labelArgs;
- private System.Windows.Forms.Label labelOther;
- private System.Windows.Forms.Label labelPath;
- private int m_noOfConfiguredNodes;
- private int m_noOfConfiguredMgmt;
- private int m_noOfConfiguredNdb;
- private string m_mgmHost;
- private string m_mgmPort;
- private System.Windows.Forms.TextBox textCwd;
- private System.Windows.Forms.TextBox textArgs;
- private System.Windows.Forms.TextBox textOther;
- private System.Windows.Forms.TextBox textPath;
- private System.Windows.Forms.TextBox textComputer;
- private System.Windows.Forms.TextBox textDatabase;
- private System.Windows.Forms.TextBox textName;
- private int m_noOfConfiguredApi;
- private bool m_bMgmt;
- private System.Windows.Forms.Button buttonSave;
- private System.Windows.Forms.CheckBox checkBoxReuse;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Panel panel4;
- private System.Windows.Forms.CheckBox checkBoxLater;
- private System.Windows.Forms.RadioButton radioYes;
- private System.Windows.Forms.RadioButton radioNo;
- private System.Windows.Forms.Panel panel6;
- private System.Windows.Forms.Panel panel5;
- private System.Windows.Forms.RadioButton radioStartNo;
- private System.Windows.Forms.RadioButton radioStartYes;
- private System.Windows.Forms.ImageList imageListComp;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.TextBox textOwner;
- private System.Windows.Forms.Label label13;
- private System.Windows.Forms.TextBox textEnv;
- private bool m_bNdb;
- public PanelWizard(ComputerMgmt comp)
- {
- mgmt=comp;
- m_noOfConfiguredNodes=0;
- m_noOfConfiguredMgmt=0;
- m_noOfConfiguredNdb=0;
- m_noOfConfiguredApi=0;
- Size panelSize= new Size(350,300);
- Size s= new Size(355,360);
- Point cancel= new Point(8,310);
- Point back= new Point(96,310);
- Point next = new Point(184,310);
- Point finish= new Point(272,310);
- InitializeComponent();
- this.Size=s;
- this.btnCancel.Location=cancel;
-
- this.btnback.Location=back;
- this.btnNext.Location=next;
- this.btnFinish.Location=finish;
-
- arrayPanel=new Panel[]{panel1,panel2,panel3,panel4,panel5,panel6};//,panel5, panel6};
- panel1.Size=panelSize;
-
- comboNDB.SelectedIndex=0;
- comboAPI.SelectedIndex=0;
- comboMGM.SelectedIndex=0;
- m_bMgmt=false;
- m_bNdb=false;
-
- m_db = new Database();
- if(listBoxComputers.Items.Count.Equals(0))
- btnNext.Enabled=false;
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PanelWizard));
- this.panel1 = new System.Windows.Forms.Panel();
- this.buttonComputerAdd = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.listBoxComputers = new System.Windows.Forms.ListBox();
- this.radioBtnNo = new System.Windows.Forms.RadioButton();
- this.radioBtnYes = new System.Windows.Forms.RadioButton();
- this.panel2 = new System.Windows.Forms.Panel();
- this.label12 = new System.Windows.Forms.Label();
- this.textOwner = new System.Windows.Forms.TextBox();
- this.label11 = new System.Windows.Forms.Label();
- this.textDbName = new System.Windows.Forms.TextBox();
- this.label8 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.comboMGM = new System.Windows.Forms.ComboBox();
- this.comboAPI = new System.Windows.Forms.ComboBox();
- this.comboNDB = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.panel3 = new System.Windows.Forms.Panel();
- this.checkBoxLater = new System.Windows.Forms.CheckBox();
- this.label10 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.btnTransferCompToNode = new System.Windows.Forms.Button();
- this.btnTransferNodeToComp = new System.Windows.Forms.Button();
- this.lvNode = new System.Windows.Forms.ListView();
- this.tvComputer = new System.Windows.Forms.TreeView();
- this.imageListComp = new System.Windows.Forms.ImageList(this.components);
- this.panel6 = new System.Windows.Forms.Panel();
- this.radioStartNo = new System.Windows.Forms.RadioButton();
- this.radioStartYes = new System.Windows.Forms.RadioButton();
- this.label18 = new System.Windows.Forms.Label();
- this.btnCancel = new System.Windows.Forms.Button();
- this.btnback = new System.Windows.Forms.Button();
- this.btnNext = new System.Windows.Forms.Button();
- this.btnFinish = new System.Windows.Forms.Button();
- this.panel4 = new System.Windows.Forms.Panel();
- this.textEnv = new System.Windows.Forms.TextBox();
- this.label13 = new System.Windows.Forms.Label();
- this.checkBoxReuse = new System.Windows.Forms.CheckBox();
- this.buttonSave = new System.Windows.Forms.Button();
- this.labelTitle = new System.Windows.Forms.Label();
- this.textComputer = new System.Windows.Forms.TextBox();
- this.textCwd = new System.Windows.Forms.TextBox();
- this.textArgs = new System.Windows.Forms.TextBox();
- this.textOther = new System.Windows.Forms.TextBox();
- this.textPath = new System.Windows.Forms.TextBox();
- this.textDatabase = new System.Windows.Forms.TextBox();
- this.textName = new System.Windows.Forms.TextBox();
- this.labelCwd = new System.Windows.Forms.Label();
- this.labelArgs = new System.Windows.Forms.Label();
- this.labelOther = new System.Windows.Forms.Label();
- this.labelPath = new System.Windows.Forms.Label();
- this.label31 = new System.Windows.Forms.Label();
- this.label32 = new System.Windows.Forms.Label();
- this.label33 = new System.Windows.Forms.Label();
- this.panel5 = new System.Windows.Forms.Panel();
- this.radioNo = new System.Windows.Forms.RadioButton();
- this.radioYes = new System.Windows.Forms.RadioButton();
- this.label4 = new System.Windows.Forms.Label();
- this.panel1.SuspendLayout();
- this.panel2.SuspendLayout();
- this.panel3.SuspendLayout();
- this.panel6.SuspendLayout();
- this.panel4.SuspendLayout();
- this.panel5.SuspendLayout();
- this.SuspendLayout();
- //
- // panel1
- //
- this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.buttonComputerAdd,
- this.label1,
- this.label5,
- this.listBoxComputers,
- this.radioBtnNo,
- this.radioBtnYes});
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(344, 312);
- this.panel1.TabIndex = 0;
- this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
- //
- // buttonComputerAdd
- //
- this.buttonComputerAdd.Enabled = false;
- this.buttonComputerAdd.Location = new System.Drawing.Point(192, 232);
- this.buttonComputerAdd.Name = "buttonComputerAdd";
- this.buttonComputerAdd.Size = new System.Drawing.Size(96, 24);
- this.buttonComputerAdd.TabIndex = 3;
- this.buttonComputerAdd.Text = "Add computer...";
- this.buttonComputerAdd.Click += new System.EventHandler(this.buttonComputerAdd_Click);
- //
- // label1
- //
- this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label1.Location = new System.Drawing.Point(80, 8);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(200, 23);
- this.label1.TabIndex = 5;
- this.label1.Text = "Configure computers";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(24, 40);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(128, 23);
- this.label5.TabIndex = 4;
- this.label5.Text = "Available computers:";
- this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // listBoxComputers
- //
- this.listBoxComputers.Location = new System.Drawing.Point(24, 64);
- this.listBoxComputers.Name = "listBoxComputers";
- this.listBoxComputers.Size = new System.Drawing.Size(128, 212);
- this.listBoxComputers.TabIndex = 3;
- this.listBoxComputers.SelectedIndexChanged += new System.EventHandler(this.listBoxComputers_SelectedIndexChanged);
- //
- // radioBtnNo
- //
- this.radioBtnNo.AutoCheck = false;
- this.radioBtnNo.Location = new System.Drawing.Point(168, 168);
- this.radioBtnNo.Name = "radioBtnNo";
- this.radioBtnNo.Size = new System.Drawing.Size(152, 64);
- this.radioBtnNo.TabIndex = 2;
- this.radioBtnNo.Text = "No, I have to add more computers in order to deploy NDB Cluster. ";
- this.radioBtnNo.Click += new System.EventHandler(this.radioBtnNo_Click);
- //
- // radioBtnYes
- //
- this.radioBtnYes.AutoCheck = false;
- this.radioBtnYes.Location = new System.Drawing.Point(168, 72);
- this.radioBtnYes.Name = "radioBtnYes";
- this.radioBtnYes.Size = new System.Drawing.Size(152, 80);
- this.radioBtnYes.TabIndex = 1;
- this.radioBtnYes.Text = "Yes, all the computers that I need to deploy NDB Cluster exists in the list \"Avai" +
- "lable computers\"";
- this.radioBtnYes.Click += new System.EventHandler(this.radioBtnYes_Click);
- //
- // panel2
- //
- this.panel2.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.label12,
- this.textOwner,
- this.label11,
- this.textDbName,
- this.label8,
- this.label7,
- this.label6,
- this.comboMGM,
- this.comboAPI,
- this.comboNDB,
- this.label2});
- this.panel2.Location = new System.Drawing.Point(0, 320);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(344, 312);
- this.panel2.TabIndex = 1;
- this.panel2.Validating += new System.ComponentModel.CancelEventHandler(this.panel2_Validating);
- this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
- //
- // label12
- //
- this.label12.Location = new System.Drawing.Point(72, 216);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(112, 24);
- this.label12.TabIndex = 16;
- this.label12.Text = "Database owner:";
- this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // textOwner
- //
- this.textOwner.Location = new System.Drawing.Point(192, 216);
- this.textOwner.Name = "textOwner";
- this.textOwner.TabIndex = 5;
- this.textOwner.Text = "";
- this.textOwner.TextChanged += new System.EventHandler(this.textOwner_TextChanged);
- //
- // label11
- //
- this.label11.Location = new System.Drawing.Point(72, 184);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(112, 24);
- this.label11.TabIndex = 14;
- this.label11.Text = "Database name:";
- this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.label11.Click += new System.EventHandler(this.label11_Click);
- //
- // textDbName
- //
- this.textDbName.Location = new System.Drawing.Point(192, 184);
- this.textDbName.Name = "textDbName";
- this.textDbName.TabIndex = 4;
- this.textDbName.Text = "";
-
- this.textDbName.TextChanged += new System.EventHandler(this.textDbName_TextChanged);
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(16, 120);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(176, 24);
- this.label8.TabIndex = 12;
- this.label8.Text = "Number of management servers:";
- this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(16, 88);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(120, 24);
- this.label7.TabIndex = 11;
- this.label7.Text = "Number of API nodes:";
- this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(16, 56);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(144, 24);
- this.label6.TabIndex = 10;
- this.label6.Text = "Number of database nodes:";
- this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // comboMGM
- //
- this.comboMGM.DisplayMember = "0";
- this.comboMGM.Items.AddRange(new object[] {
- "1"});
- this.comboMGM.Location = new System.Drawing.Point(192, 120);
- this.comboMGM.Name = "comboMGM";
- this.comboMGM.Size = new System.Drawing.Size(104, 21);
- this.comboMGM.TabIndex = 3;
- this.comboMGM.Text = "comboBox3";
- //
- // comboAPI
- //
- this.comboAPI.DisplayMember = "0";
- this.comboAPI.Items.AddRange(new object[] {
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- "10"});
- this.comboAPI.Location = new System.Drawing.Point(192, 88);
- this.comboAPI.Name = "comboAPI";
- this.comboAPI.Size = new System.Drawing.Size(104, 21);
- this.comboAPI.TabIndex = 2;
- this.comboAPI.Text = "comboBox2";
- //
- // comboNDB
- //
- this.comboNDB.DisplayMember = "0";
- this.comboNDB.Items.AddRange(new object[] {
- "1",
- "2",
- "4",
- "8"});
- this.comboNDB.Location = new System.Drawing.Point(192, 56);
- this.comboNDB.Name = "comboNDB";
- this.comboNDB.Size = new System.Drawing.Size(104, 21);
- this.comboNDB.TabIndex = 1;
- this.comboNDB.Text = "comboBox1";
- //
- // label2
- //
- this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label2.Location = new System.Drawing.Point(80, 8);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(208, 23);
- this.label2.TabIndex = 6;
- this.label2.Text = "Setup NDB Cluster nodes";
- this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // panel3
- //
- this.panel3.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.checkBoxLater,
- this.label10,
- this.label9,
- this.label3,
- this.btnTransferCompToNode,
- this.btnTransferNodeToComp,
- this.lvNode,
- this.tvComputer});
- this.panel3.Location = new System.Drawing.Point(360, 8);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(320, 312);
- this.panel3.TabIndex = 2;
- //
- // checkBoxLater
- //
- this.checkBoxLater.Location = new System.Drawing.Point(40, 256);
- this.checkBoxLater.Name = "checkBoxLater";
- this.checkBoxLater.Size = new System.Drawing.Size(240, 16);
- this.checkBoxLater.TabIndex = 9;
- this.checkBoxLater.Text = "I will configure these nodes manually, later.";
- //
- // label10
- //
- this.label10.Location = new System.Drawing.Point(16, 40);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(104, 16);
- this.label10.TabIndex = 8;
- this.label10.Text = "NDB Cluster nodes:";
- this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label9
- //
- this.label9.Location = new System.Drawing.Point(192, 40);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(100, 16);
- this.label9.TabIndex = 7;
- this.label9.Text = "Computers:";
- this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label3
- //
- this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label3.Location = new System.Drawing.Point(40, 8);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(280, 23);
- this.label3.TabIndex = 6;
- this.label3.Text = "Assign NDB nodes to computers";
- this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // btnTransferCompToNode
- //
- this.btnTransferCompToNode.Location = new System.Drawing.Point(144, 160);
- this.btnTransferCompToNode.Name = "btnTransferCompToNode";
- this.btnTransferCompToNode.Size = new System.Drawing.Size(40, 24);
- this.btnTransferCompToNode.TabIndex = 4;
- this.btnTransferCompToNode.Text = "<---";
- //
- // btnTransferNodeToComp
- //
- this.btnTransferNodeToComp.Location = new System.Drawing.Point(144, 128);
- this.btnTransferNodeToComp.Name = "btnTransferNodeToComp";
- this.btnTransferNodeToComp.Size = new System.Drawing.Size(40, 24);
- this.btnTransferNodeToComp.TabIndex = 3;
- this.btnTransferNodeToComp.Text = "--->";
- this.btnTransferNodeToComp.Click += new System.EventHandler(this.btnTransferNodeToComp_Click);
- //
- // lvNode
- //
- this.lvNode.HideSelection = false;
- this.lvNode.Location = new System.Drawing.Point(16, 56);
- this.lvNode.Name = "lvNode";
- this.lvNode.Size = new System.Drawing.Size(112, 192);
- this.lvNode.TabIndex = 2;
- this.lvNode.View = System.Windows.Forms.View.List;
- this.lvNode.SelectedIndexChanged += new System.EventHandler(this.lvNode_SelectedIndexChanged);
- //
- // tvComputer
- //
- this.tvComputer.HideSelection = false;
- this.tvComputer.ImageList = this.imageListComp;
- this.tvComputer.Location = new System.Drawing.Point(192, 56);
- this.tvComputer.Name = "tvComputer";
- this.tvComputer.Size = new System.Drawing.Size(120, 192);
- this.tvComputer.TabIndex = 1;
- this.tvComputer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tvComputer_MouseDown);
- this.tvComputer.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvComputer_AfterSelect);
- this.tvComputer.MouseLeave += new System.EventHandler(this.tvComputer_MouseLeave);
- this.tvComputer.DragDrop += new System.Windows.Forms.DragEventHandler(this.tvComputer_DragDrop);
- //
- // imageListComp
- //
- this.imageListComp.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageListComp.ImageSize = new System.Drawing.Size(16, 16);
- this.imageListComp.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListComp.ImageStream")));
- this.imageListComp.TransparentColor = System.Drawing.Color.Transparent;
- //
- // panel6
- //
- this.panel6.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.radioStartNo,
- this.radioStartYes,
- this.label18});
- this.panel6.Location = new System.Drawing.Point(344, 336);
- this.panel6.Name = "panel6";
- this.panel6.Size = new System.Drawing.Size(344, 312);
- this.panel6.TabIndex = 3;
- this.panel6.Paint += new System.Windows.Forms.PaintEventHandler(this.panel4_Paint);
- //
- // radioStartNo
- //
- this.radioStartNo.Location = new System.Drawing.Point(40, 144);
- this.radioStartNo.Name = "radioStartNo";
- this.radioStartNo.Size = new System.Drawing.Size(272, 48);
- this.radioStartNo.TabIndex = 81;
- this.radioStartNo.Text = "Manually start NDB Cluster. The Magician will exit and you must start NDB Cluster" +
- " manually.";
- this.radioStartNo.CheckedChanged += new System.EventHandler(this.radioStartNo_CheckedChanged);
- //
- // radioStartYes
- //
- this.radioStartYes.Location = new System.Drawing.Point(40, 40);
- this.radioStartYes.Name = "radioStartYes";
- this.radioStartYes.Size = new System.Drawing.Size(272, 88);
- this.radioStartYes.TabIndex = 80;
- this.radioStartYes.Text = "Start NDB Cluster now. The Magician will start NDB Cluster and exit. MAKE SURE YO" +
- "U HAVE STARTED THE MGMTSRVR WITH THE CORRECT CONFIGURATION FILE!!!";
- this.radioStartYes.CheckedChanged += new System.EventHandler(this.radioStartYes_CheckedChanged);
- //
- // label18
- //
- this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label18.Location = new System.Drawing.Point(56, 8);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(224, 24);
- this.label18.TabIndex = 79;
- this.label18.Text = "Start NDB Cluster and finish";
- //
- // btnCancel
- //
- this.btnCancel.Location = new System.Drawing.Point(8, 656);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(70, 23);
- this.btnCancel.TabIndex = 10;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // btnback
- //
- this.btnback.Location = new System.Drawing.Point(96, 656);
- this.btnback.Name = "btnback";
- this.btnback.Size = new System.Drawing.Size(70, 23);
- this.btnback.TabIndex = 11;
- this.btnback.Text = "< Back";
- this.btnback.Click += new System.EventHandler(this.btnback_Click);
- //
- // btnNext
- //
- this.btnNext.Location = new System.Drawing.Point(184, 656);
- this.btnNext.Name = "btnNext";
- this.btnNext.Size = new System.Drawing.Size(70, 23);
- this.btnNext.TabIndex = 12;
- this.btnNext.Text = "Next >";
- this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
- //
- // btnFinish
- //
- this.btnFinish.Location = new System.Drawing.Point(272, 656);
- this.btnFinish.Name = "btnFinish";
- this.btnFinish.Size = new System.Drawing.Size(70, 23);
- this.btnFinish.TabIndex = 13;
- this.btnFinish.Text = "Finish";
- this.btnFinish.Click += new System.EventHandler(this.btnFinish_Click);
- //
- // panel4
- //
- this.panel4.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.textEnv,
- this.label13,
- this.checkBoxReuse,
- this.buttonSave,
- this.labelTitle,
- this.textComputer,
- this.textCwd,
- this.textArgs,
- this.textOther,
- this.textPath,
- this.textDatabase,
- this.textName,
- this.labelCwd,
- this.labelArgs,
- this.labelOther,
- this.labelPath,
- this.label31,
- this.label32,
- this.label33});
- this.panel4.Location = new System.Drawing.Point(672, 8);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(344, 312);
- this.panel4.TabIndex = 62;
- this.panel4.Paint += new System.Windows.Forms.PaintEventHandler(this.panel5_Paint);
- //
- // textEnv
- //
- this.textEnv.Location = new System.Drawing.Point(136, 136);
- this.textEnv.Name = "textEnv";
- this.textEnv.Size = new System.Drawing.Size(184, 20);
- this.textEnv.TabIndex = 2;
- this.textEnv.TabStop = false;
- this.textEnv.Text = "";
- //
- // label13
- //
- this.label13.Location = new System.Drawing.Point(8, 136);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(136, 24);
- this.label13.TabIndex = 81;
- this.label13.Text = "Environment variables:";
- //
- // checkBoxReuse
- //
- this.checkBoxReuse.Location = new System.Drawing.Point(88, 232);
- this.checkBoxReuse.Name = "checkBoxReuse";
- this.checkBoxReuse.Size = new System.Drawing.Size(240, 32);
- this.checkBoxReuse.TabIndex = 5;
- this.checkBoxReuse.TabStop = false;
- this.checkBoxReuse.Text = "Use the same configuration for ALL NDB nodes?";
- //
- // buttonSave
- //
- this.buttonSave.Location = new System.Drawing.Point(184, 264);
- this.buttonSave.Name = "buttonSave";
- this.buttonSave.Size = new System.Drawing.Size(88, 24);
- this.buttonSave.TabIndex = 6;
- this.buttonSave.Text = "Save";
- this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
- //
- // labelTitle
- //
- this.labelTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.labelTitle.Location = new System.Drawing.Point(80, 16);
- this.labelTitle.Name = "labelTitle";
- this.labelTitle.Size = new System.Drawing.Size(192, 23);
- this.labelTitle.TabIndex = 79;
- this.labelTitle.Text = "Mgmtsrvr configuration";
- //
- // textComputer
- //
- this.textComputer.Location = new System.Drawing.Point(136, 40);
- this.textComputer.Name = "textComputer";
- this.textComputer.ReadOnly = true;
- this.textComputer.Size = new System.Drawing.Size(184, 20);
- this.textComputer.TabIndex = 77;
- this.textComputer.TabStop = false;
- this.textComputer.Text = "";
- //
- // textCwd
- //
- this.textCwd.Location = new System.Drawing.Point(136, 208);
- this.textCwd.Name = "textCwd";
- this.textCwd.Size = new System.Drawing.Size(184, 20);
- this.textCwd.TabIndex = 5;
- this.textCwd.TabStop = false;
- this.textCwd.Text = "";
- //
- // textArgs
- //
- this.textArgs.Location = new System.Drawing.Point(136, 184);
- this.textArgs.Name = "textArgs";
- this.textArgs.Size = new System.Drawing.Size(184, 20);
- this.textArgs.TabIndex = 4;
- this.textArgs.TabStop = false;
- this.textArgs.Text = "";
- //
- // textOther
- //
- this.textOther.Location = new System.Drawing.Point(136, 160);
- this.textOther.Name = "textOther";
- this.textOther.Size = new System.Drawing.Size(184, 20);
- this.textOther.TabIndex = 3;
- this.textOther.TabStop = false;
- this.textOther.Text = "";
- //
- // textPath
- //
- this.textPath.Location = new System.Drawing.Point(136, 112);
- this.textPath.Name = "textPath";
- this.textPath.Size = new System.Drawing.Size(184, 20);
- this.textPath.TabIndex = 1;
- this.textPath.TabStop = false;
- this.textPath.Text = "";
- this.textPath.TextChanged += new System.EventHandler(this.textPath_TextChanged);
- //
- // textDatabase
- //
- this.textDatabase.Location = new System.Drawing.Point(136, 88);
- this.textDatabase.Name = "textDatabase";
- this.textDatabase.ReadOnly = true;
- this.textDatabase.Size = new System.Drawing.Size(184, 20);
- this.textDatabase.TabIndex = 62;
- this.textDatabase.TabStop = false;
- this.textDatabase.Text = "";
- //
- // textName
- //
- this.textName.Location = new System.Drawing.Point(136, 64);
- this.textName.Name = "textName";
- this.textName.ReadOnly = true;
- this.textName.Size = new System.Drawing.Size(184, 20);
- this.textName.TabIndex = 60;
- this.textName.TabStop = false;
- this.textName.Text = "";
- //
- // labelCwd
- //
- this.labelCwd.Location = new System.Drawing.Point(8, 208);
- this.labelCwd.Name = "labelCwd";
- this.labelCwd.Size = new System.Drawing.Size(112, 24);
- this.labelCwd.TabIndex = 72;
- this.labelCwd.Text = "Current working dir.:";
- //
- // labelArgs
- //
- this.labelArgs.Location = new System.Drawing.Point(8, 184);
- this.labelArgs.Name = "labelArgs";
- this.labelArgs.Size = new System.Drawing.Size(128, 24);
- this.labelArgs.TabIndex = 70;
- this.labelArgs.Text = "Arguments to mgmtsrvr:";
- //
- // labelOther
- //
- this.labelOther.Location = new System.Drawing.Point(8, 160);
- this.labelOther.Name = "labelOther";
- this.labelOther.Size = new System.Drawing.Size(136, 24);
- this.labelOther.TabIndex = 69;
- this.labelOther.Text = "Mgmtsrvr port:";
- //
- // labelPath
- //
- this.labelPath.Location = new System.Drawing.Point(8, 112);
- this.labelPath.Name = "labelPath";
- this.labelPath.Size = new System.Drawing.Size(128, 24);
- this.labelPath.TabIndex = 67;
- this.labelPath.Text = "Path to mgmtsrvr binary:";
- //
- // label31
- //
- this.label31.Location = new System.Drawing.Point(8, 88);
- this.label31.Name = "label31";
- this.label31.Size = new System.Drawing.Size(88, 24);
- this.label31.TabIndex = 65;
- this.label31.Text = "Database:";
- //
- // label32
- //
- this.label32.Location = new System.Drawing.Point(8, 64);
- this.label32.Name = "label32";
- this.label32.Size = new System.Drawing.Size(88, 24);
- this.label32.TabIndex = 63;
- this.label32.Text = "Process name:";
- //
- // label33
- //
- this.label33.Location = new System.Drawing.Point(8, 40);
- this.label33.Name = "label33";
- this.label33.Size = new System.Drawing.Size(64, 24);
- this.label33.TabIndex = 61;
- this.label33.Text = "Computer:";
- //
- // panel5
- //
- this.panel5.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.radioNo,
- this.radioYes,
- this.label4});
- this.panel5.Location = new System.Drawing.Point(672, 328);
- this.panel5.Name = "panel5";
- this.panel5.Size = new System.Drawing.Size(344, 312);
- this.panel5.TabIndex = 63;
- //
- // radioNo
- //
- this.radioNo.Location = new System.Drawing.Point(72, 160);
- this.radioNo.Name = "radioNo";
- this.radioNo.Size = new System.Drawing.Size(240, 48);
- this.radioNo.TabIndex = 1;
- this.radioNo.Text = "I already have a configuration file that I want to use for this configuration.";
- this.radioNo.CheckedChanged += new System.EventHandler(this.radioNo_CheckedChanged);
- //
- // radioYes
- //
- this.radioYes.Checked = true;
- this.radioYes.Location = new System.Drawing.Point(72, 56);
- this.radioYes.Name = "radioYes";
- this.radioYes.Size = new System.Drawing.Size(240, 88);
- this.radioYes.TabIndex = 0;
- this.radioYes.TabStop = true;
- this.radioYes.Text = "Generate a configuration file template (initconfig.txt) for the mgmtsrvr based on" +
- " the specified configuration? Notepad will be started with a template that you m" +
- "ust complete and save in the cwd of the mgmtsrvr.";
- this.radioYes.CheckedChanged += new System.EventHandler(this.radioYes_CheckedChanged);
- //
- // label4
- //
- this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
- this.label4.Location = new System.Drawing.Point(88, 8);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(192, 40);
- this.label4.TabIndex = 79;
- this.label4.Text = "Tying up the configuration";
- this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
- //
- // PanelWizard
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(1030, 755);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.panel5,
- this.panel4,
- this.panel1,
- this.btnFinish,
- this.btnNext,
- this.btnback,
- this.btnCancel,
- this.panel6,
- this.panel3,
- this.panel2});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "PanelWizard";
- this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
- this.Text = "Create Database Magician";
- this.Load += new System.EventHandler(this.MDXQueryBuilderWizard_Load);
- this.Activated += new System.EventHandler(this.PanelWizard_Activated);
- this.panel1.ResumeLayout(false);
- this.panel2.ResumeLayout(false);
- this.panel3.ResumeLayout(false);
- this.panel6.ResumeLayout(false);
- this.panel4.ResumeLayout(false);
- this.panel5.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void MDXQueryBuilderWizard_Load(object sender, System.EventArgs e)
- {
-
- foreach(Control ct in this.Controls)
- {
- if(ct.GetType().Name=="Panel")
- {
- ct.Left=0;
- ct.Top=0;
- ct.Visible=false;
- }
-
- }
- presentPanel=arrayPanel[0];
- //--set the properties
- setBtnPanProperty(getPosition(presentPanel));
- //------
- refreshLook();
- }
-
- //-set the buttons and panel
- private void refreshLook()
- {
- if(cancelEnabled)
- btnCancel.Enabled=true;
- else
- btnCancel.Enabled=false;
-
- if(backEnabled)
- btnback.Enabled=true;
- else
- btnback.Enabled=false;
-
- if(nextEnabled)
- btnNext.Enabled=true;
- else
- btnNext.Enabled=false;
-
- if(finishEnabled)
- btnFinish.Enabled=true;
- else
- btnFinish.Enabled=false;
-
- if(presentPanel!=null)
- {
- presentPanel.Show();
- presentPanel.BringToFront();
- }
- }
- //--------
- private int getPosition(Panel p)
- {
- int result=-1;
- for(int i=0;i<arrayPanel.Length;i++)
- {
- if(arrayPanel[i]==p)
- {
- result=i;
- break;
- }
- }
- return result ;
- }
- //----
-
- private void setBtnPanProperty(int presentPanelPosition )
- {
- int panelLength=arrayPanel.Length-1;
- if(presentPanelPosition==0)
- {
- //first panel...no back ,no finish
- cancelEnabled=true;
- backEnabled=false;
- nextEnabled=false;
- finishEnabled=false;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=arrayPanel[presentPanelPosition+1];
- backPanel=null;
-
- }
- else if(presentPanelPosition==1)
- {
- cancelEnabled=true;
- backEnabled=true;
- nextEnabled=false;
- finishEnabled=false;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=arrayPanel[presentPanelPosition+1];
- backPanel=arrayPanel[presentPanelPosition-1];
- }
-
- else if(presentPanelPosition==2)
- {
- cancelEnabled=true;
- backEnabled=true;
- nextEnabled=false;
- finishEnabled=false;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=arrayPanel[presentPanelPosition+1];
- backPanel=arrayPanel[presentPanelPosition-1];
- }
-
- else if(presentPanelPosition==3)
- {
- //last panel...no next,finish
- cancelEnabled=true;
- backEnabled=true;
- nextEnabled=true;
- finishEnabled=false;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=arrayPanel[presentPanelPosition+1];
- backPanel=arrayPanel[presentPanelPosition-1];
- }
- else if(presentPanelPosition==4)
- {
- //last panel...no next,finish
- cancelEnabled=true;
- backEnabled=true;
- nextEnabled=true;
- finishEnabled=false;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=presentPanel;
- backPanel=arrayPanel[presentPanelPosition-1];
- }
-
- else if(presentPanelPosition==5)
- {
- //last panel...no next,finish yes
- cancelEnabled=true;
- backEnabled=true;
- nextEnabled=false;
- finishEnabled=false;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=null;
- backPanel=arrayPanel[presentPanelPosition-1];
- }
-
- else
- {
- //no finish,next and back
- cancelEnabled=true;
- backEnabled=true;
- nextEnabled=false;
- finishEnabled=true;
- presentPanel=arrayPanel[presentPanelPosition];
- nextPanel=null;
- backPanel=arrayPanel[presentPanelPosition-1];
- }
- }
-
- private void btnNext_Click(object sender, System.EventArgs e)
- {
-
- if(arrayPanel[getPosition(presentPanel)].Equals(panel1))
- {
- presentPanel=arrayPanel[getPosition(presentPanel)+1];
- setBtnPanProperty(getPosition(presentPanel));
- refreshLook();
- return;
- }
- if(arrayPanel[getPosition(presentPanel)].Equals(panel2))
- {
- m_db.setName(textDbName.Text.ToString());
- m_db.setOwner(textOwner.Text.ToString());
- presentPanel=arrayPanel[getPosition(presentPanel)+1];
- //presentPanel
- setBtnPanProperty(getPosition(presentPanel));
- prepareNodeAssignmentPanel();
- refreshLook();
-
- return;
- }
- if(arrayPanel[getPosition(presentPanel)].Equals(panel3))
- {
- prepareNodeConfigurationPanel();
- presentPanel=arrayPanel[getPosition(presentPanel)+1];
- setBtnPanProperty(getPosition(presentPanel));
- refreshLook();
- return;
- }
- if(arrayPanel[getPosition(presentPanel)].Equals(panel4))
- {
- nextEnabled=true;
- finishEnabled=true;
- backEnabled=true;
- cancelEnabled=true;
- presentPanel=arrayPanel[getPosition(presentPanel)+1];
- setBtnPanProperty(getPosition(presentPanel));
- refreshLook();
- return;
- }
- if(arrayPanel[getPosition(presentPanel)].Equals(panel5))
- {
- generateInitConfig();
- presentPanel=arrayPanel[getPosition(presentPanel)+1];
- setBtnPanProperty(getPosition(presentPanel));
- refreshLook();
- return;
- }
-
- if(arrayPanel[getPosition(presentPanel)].Equals(panel6))
- {
- // presentPanel=arrayPanel[getPosition(presentPanel)+1];
- setBtnPanProperty(getPosition(presentPanel));
- refreshLook();
- return;
- }
- /*else
- {
- presentPanel=arrayPanel[getPosition(presentPanel)+1];
- setBtnPanProperty(getPosition(presentPanel));
- updateListViews();
- refreshLook();
- }*/
- }
-
-
- private void btnback_Click(object sender, System.EventArgs e)
- {
- presentPanel=arrayPanel[getPosition(presentPanel)-1];
- setBtnPanProperty(getPosition(presentPanel));
- m_noOfConfiguredNodes=0;
- m_noOfConfiguredNodes=0;
- m_noOfConfiguredMgmt=0;
- m_noOfConfiguredNdb=0;
- m_noOfConfiguredApi=0;
- m_bNdb=false;
- m_bMgmt=false;
- refreshLook();
- }
-
-
- private void btnCancel_Click(object sender, System.EventArgs e)
- {
- m_db.removeAllProcesses();
- this.Dispose(true);
- }
-
-
-
-
- private void radioBtnYes_Click(object sender, System.EventArgs e)
- {
- if(radioBtnNo.Checked.Equals(false))
- {
- if(radioBtnYes.Checked.Equals(true))
- radioBtnYes.Checked=false;
- else
- {
- radioBtnYes.Checked=true;
- this.btnNext.Enabled=true;
- }
-
- }
- if(radioBtnNo.Checked.Equals(true))
- {
- radioBtnNo.Checked=false;
- radioBtnYes.Checked=true;
- buttonComputerAdd.Enabled=false;
- this.btnNext.Enabled=true;
- }
-
- }
-
- private void radioBtnNo_Click(object sender, System.EventArgs e)
- {
- if(radioBtnYes.Checked.Equals(false))
- {
- if(radioBtnNo.Checked.Equals(true))
- {
- radioBtnNo.Checked=false;
- buttonComputerAdd.Enabled=false;
- }
- else
- {
- radioBtnNo.Checked=true;
- buttonComputerAdd.Enabled=true;
- this.btnNext.Enabled=false;
- }
-
- }
- if(radioBtnYes.Checked.Equals(true))
- {
- radioBtnYes.Checked=false;
- radioBtnNo.Checked=true;
- buttonComputerAdd.Enabled=true;
- this.btnNext.Enabled=false;
- }
- }
-
- private void buttonComputerAdd_Click(object sender, System.EventArgs e)
- {
- if(getPosition(presentPanel)==0)
- {
- if(radioBtnNo.Checked.Equals(true))
- {
- ComputerAddDialog cad = new ComputerAddDialog(mgmt);
- cad.ShowDialog();
- }
- }
- }
-
- private void PanelWizard_Activated(object sender, System.EventArgs e)
- {
- updateComputers();
- }
-
- private void updateComputers()
- {
- ArrayList list = mgmt.getComputerCollection();
- this.listBoxComputers.BeginUpdate();
- this.listBoxComputers.Items.Clear();
- foreach(Computer c in list)
- {
- this.listBoxComputers.Items.Add(c.getName());
- }
- if(listBoxComputers.Items.Count > 0)
- {
- btnNext.Enabled=true;
- }
- this.listBoxComputers.EndUpdate();
- this.listBoxComputers.Refresh();
- }
-
-
- private void tvComputer_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
- {
- tvComputer.SelectedNode.Expand();
-
- }
-
- private void tvComputer_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
- {
-
- }
-
- private void tvComputer_MouseLeave(object sender, System.EventArgs e)
- {
-
- }
-
- private void tvComputer_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- TreeNode prevNode = tvComputer.SelectedNode;
- if(prevNode!=null)
- {
- prevNode.BackColor=Color.White;
- }
- TreeNode node = tvComputer.GetNodeAt(e.X,e.Y);
- if(node==null)
- {
- return;
- }
-
- tvComputer.SelectedNode=node;
- tvComputer.SelectedNode.BackColor=Color.LightGray;
-
- }
-
- private void btnTransferNodeToComp_Click(object sender, System.EventArgs e)
- {
-
- if(tvComputer.SelectedNode==null)
- return;
- if(lvNode.SelectedItems.Equals(null))
- return;
- int itemCount=lvNode.SelectedItems.Count;
- lvNode.BeginUpdate();
- tvComputer.BeginUpdate();
- for(int i=0;i < itemCount;i++)
- {
- tvComputer.SelectedNode.Nodes.Add(lvNode.SelectedItems[i].Text.ToString());
- }
-
- for(int i=0;i < itemCount;i++)
- {
- lvNode.Items.RemoveAt(lvNode.SelectedIndices[0]);
-
- }
- if(lvNode.Items.Count.Equals(0))
- btnNext.Enabled=true;
- else
- btnNext.Enabled=false;
- tvComputer.SelectedNode.Expand();
- lvNode.EndUpdate();
- tvComputer.EndUpdate();
- }
-
- private void lvNode_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- }
-
- private void prepareNodeAssignmentPanel()
- {
- ArrayList computers = mgmt.getComputerCollection();
- m_nNDB=Convert.ToInt32(comboNDB.SelectedItem.ToString());
- m_nAPI=Convert.ToInt32(comboAPI.SelectedItem.ToString());
- m_nMGM=Convert.ToInt32(comboMGM.SelectedItem.ToString());
-
- lvNode.Items.Clear();
- tvComputer.Nodes.Clear();
- for (int i=1;i<=m_nMGM;i++)
- lvNode.Items.Add("mgm."+i);
-
- for (int i=m_nMGM+1;i<=(m_nNDB+m_nMGM);i++)
- lvNode.Items.Add("ndb."+i);
-
- for (int i=m_nMGM+m_nNDB+1;i<=(m_nNDB+m_nMGM+m_nAPI);i++)
- lvNode.Items.Add("api."+i);
-
- foreach(Computer c in computers)
- {
- if(c.getStatus() == Computer.Status.Connected)
- tvComputer.Nodes.Add(c.getName());
- }
-
- }
- private void prepareNodeConfigurationPanel()
- {
- Computer c;
- for(int i=0;i<tvComputer.Nodes.Count;i++)
- {
- c=mgmt.getComputer(tvComputer.Nodes[i].Text.ToString());
- for(int j=0; j < tvComputer.Nodes[i].Nodes.Count;j++)
- {
- m_db.addProcess(new Process(tvComputer.Nodes[i].Nodes[j].Text.ToString(),m_db.getOwner(),m_db.getName(),c));
- c.addProcess(m_db.getProcessByName(tvComputer.Nodes[i].Nodes[j].Text.ToString()));
- }
- }
- }
-
- private void updateListViews()
- {/*
- lvConfig.Items.Clear();
- ArrayList processes = m_db.getProcesses();
- string [] processcols= new string[5];
- foreach (Process process in processes)
- {
- processcols[0]=process.getName();
- processcols[1]=process.getComputer().getName();
- processcols[2]=process.getPath();
- processcols[3]="";
- processcols[4]="";
-
- ListViewItem lvc= new ListViewItem(processcols);
-
-
- lvConfig.Items.Add(lvc);
- }
- lvConfig.EndUpdate();
- */
- }
-
- private void btnConfigure_Click(object sender, System.EventArgs e)
- {
-
- }
-
- private void textDbName_TextChanged(object sender, System.EventArgs e)
- {
- if(textOwner.TextLength>0 && textDbName.TextLength > 0)
- nextEnabled=true;
- else
- nextEnabled=false;
-
- refreshLook();
-
- }
-
- private void checkBoxLater_CheckedChanged(object sender, System.EventArgs e)
- {
- if(checkBoxLater.Checked.Equals(true))
- {
- this.finishEnabled=true;
- this.nextEnabled=false;
- }
- else
- {
- this.finishEnabled=false;
- this.nextEnabled=true;
- }
- this.refreshLook();
- }
-
- private void btnFinish_Click(object sender, System.EventArgs e)
- {
- mgmt.AddDatabase(this.m_db);
-
- if(radioStartYes.Checked==true)
- startDatabase();
- this.Dispose();
- }
-
- private void panel4_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
-
- // Point location= new Point(8,40);
- // Size s= new Size(panel4.Size.Width-8,panel4.Size.Height-120);
- // lvConfig.Location=location;
- // lvConfig.Size=s;
-
-
- }
-
- private void configureMgmt()
- {
- //clear old
- textOther.Text="";
- textArgs.Text="";
- textCwd.Text="";
- textPath.Text="";
-
- textPath.Clear();
- textEnv.Clear();
- textOther.Clear();
- textCwd.Clear();
- textArgs.Clear();
-
- textPath.ClearUndo();
- textEnv.ClearUndo();
- textOther.ClearUndo();
- textCwd.ClearUndo();
- textArgs.ClearUndo();
-
-
- textOther.Enabled=true;
- textArgs.Enabled=true;
- textCwd.Enabled=true;
- textPath.Enabled=true;
-
- textPath.TabStop=true;
- textOther.TabStop=true;
- textArgs.TabStop=true;
- textCwd.TabStop=true;
- textEnv.TabStop=true;
-
- labelTitle.Text="Mgmtsrvr configuration";
- labelPath.Text="Path to mgmtsrvr binary:";
- labelArgs.Text="Arguments to mgmtsrvr:";
- labelOther.Text="Mgmtsrvr port (-p X):";
-
- //get new
- String process="mgm." + Convert.ToString(m_noOfConfiguredMgmt+1);
- Process mgmt=m_db.getProcessByName(process);
- textComputer.Text=mgmt.getComputer().getName();
- textName.Text=mgmt.getName().ToString();
- textDatabase.Text=mgmt.getDatabase().ToString();
- m_mgmHost=mgmt.getComputer().getName();
- textPath.Focus();
- }
- private void configureApi()
- {
- checkBoxReuse.Text="Use the same configuration for ALL API nodes?";
- if(m_nAPI > 1)
- {
- checkBoxReuse.Visible=true;
- checkBoxReuse.Enabled=true;
-
- }
- else
- {
- checkBoxReuse.Enabled=false;
- checkBoxReuse.Visible=true;
- }
-
- // clear previous and get a new api
-
- textOther.Text="";
- textArgs.Text="";
- //textCwd.Text="";
- //textPath.Text="";
- //get new api
- textOther.Enabled=false;
- textArgs.Enabled=true;
- labelTitle.Text="API node configuration";
- labelPath.Text="Path to api binary:";
- labelArgs.Text="Arguments to api:";
- labelOther.Text="NDB_CONNECTSTRING";
- String process="api." + Convert.ToString(m_noOfConfiguredApi+m_nMGM+m_nNDB+1);
- Process api=m_db.getProcessByName(process);
- textComputer.Text=api.getComputer().getName();
- textName.Text=api.getName().ToString();
- textOther.Text="nodeid=" + Convert.ToString(m_noOfConfiguredApi+m_nMGM+m_nNDB+1) + ";host="+this.m_mgmHost + ":" + this.m_mgmPort;
- textDatabase.Text=api.getDatabase().ToString();
- textPath.Focus();
- }
-
- private void configureNdb()
- {
-
-
- checkBoxReuse.Text="Use the same configuration for ALL NDB nodes?";
-
-
- if(this.m_nNDB > 1)
- {
- checkBoxReuse.Visible=true;
- checkBoxReuse.Enabled=true;
-
- }
- else
- {
- checkBoxReuse.Enabled=false;
- checkBoxReuse.Visible=true;
- }
-
-
-
- labelPath.Text="Path to ndb binary:";
- labelArgs.Text="Arguments to ndb:";
-
- // clear previous and get a new ndb
-
- labelOther.Text="NDB_CONNECTSTRING";
- textArgs.Text="-i";
- textOther.Enabled=false;
- textArgs.Enabled=false;
-
- textPath.TabStop=true;
- textEnv.TabStop=true;
- textOther.TabStop=false;
- textArgs.TabStop=false;
- textCwd.TabStop=true;
-
- //textCwd.Text="";
- //textPath.Text="";
- //get new
-
- String process="ndb." + Convert.ToString(m_noOfConfiguredNdb+m_nMGM+1);
- textOther.Text="nodeid=" + Convert.ToString(m_noOfConfiguredNdb+m_nMGM+1) + ";host="+this.m_mgmHost + ":" + this.m_mgmPort;
- Process ndb=m_db.getProcessByName(process);
- textComputer.Text=ndb.getComputer().getName();
- textName.Text=ndb.getName().ToString();
- textDatabase.Text=ndb.getDatabase().ToString();
- textPath.Focus();
- }
-
-
- public void saveMgm()
- {
- String process="mgm." + Convert.ToString(m_noOfConfiguredMgmt+1);
- Process mgmt=m_db.getProcessByName(process);
- mgmt.setOther(textOther.Text.ToString());
- mgmt.setEnv(textEnv.Text.ToString());
- m_mgmPort = textOther.Text.ToString();
- try
- {
- m_db.setMgmtPort(Convert.ToInt32(m_mgmPort));
- }
- catch(Exception e)
- {
- MessageBox.Show("Port number must be numeric!!!", "Error",MessageBoxButtons.OK);
- this.configureMgmt();
- return;
- }
- mgmt.setPath(textPath.Text.ToString());
- mgmt.setCwd(textCwd.Text.ToString());
- mgmt.setProcessType("permanent");
- mgmt.setArgs("-i initconfig.txt");
- mgmt.setConnectString("nodeid=" + Convert.ToString(m_noOfConfiguredMgmt+1)+";host="+m_mgmHost+":" + m_mgmPort);
- this.m_noOfConfiguredMgmt++;
- }
-
- public void saveApi()
- {
- if(checkBoxReuse.Checked)
- {
- for(;m_noOfConfiguredApi<m_nAPI;m_noOfConfiguredApi++)
- {
- String process="api." + Convert.ToString(m_noOfConfiguredApi+m_nMGM+m_nNDB+1);
- Process api=m_db.getProcessByName(process);
- textName.Text=process;
- api.setPath(textPath.Text.ToString());
- api.setArgs(textArgs.Text.ToString());
- api.setCwd(textCwd.Text.ToString());
- api.setEnv(textEnv.Text.ToString());
- api.setConnectString("nodeid=" + Convert.ToString(m_noOfConfiguredApi+m_nNDB+m_nMGM+1)+";host="+m_mgmHost+":" + m_mgmPort);
- api.setProcessType("permanent");
- }
-
- }
- else
- {
- String process="api." + Convert.ToString(m_noOfConfiguredApi+m_nMGM+m_nNDB+1);
- Process api=m_db.getProcessByName(process);
- api.setPath(textPath.Text.ToString());
- api.setCwd(textCwd.Text.ToString());
- api.setEnv(textEnv.Text.ToString());
- api.setConnectString("nodeid=" + Convert.ToString(m_noOfConfiguredApi+m_nNDB+m_nMGM+1)+";host="+m_mgmHost+":" + m_mgmPort);
- api.setArgs(textArgs.Text.ToString());
- api.setProcessType("permanent");
- this.m_noOfConfiguredApi++;
- }
- }
-
- public void saveNdb()
- {
-
- if(checkBoxReuse.Checked)
- {
- for(;m_noOfConfiguredNdb<m_nNDB;m_noOfConfiguredNdb++)
- {
- String process="ndb." + Convert.ToString(m_noOfConfiguredNdb+m_nMGM+1);
- Process ndb=m_db.getProcessByName(process);
- ndb.setConnectString("nodeid=" + Convert.ToString(m_noOfConfiguredNdb+m_nMGM+1)+";host="+m_mgmHost+":" + m_mgmPort);
- ndb.setPath(textPath.Text.ToString());
- ndb.setArgs(textArgs.Text.ToString());
- ndb.setEnv(textEnv.Text.ToString());
- ndb.setCwd(textCwd.Text.ToString());
- ndb.setProcessType("permanent");
- }
- checkBoxReuse.Checked=false;
- return;
- }
- else
- {
- String process="ndb." + Convert.ToString(m_noOfConfiguredNdb+m_nMGM+1);
- Process ndb=m_db.getProcessByName(process);
- ndb.setConnectString("nodeid=" + Convert.ToString(m_noOfConfiguredNdb+m_nMGM+1)+";host="+m_mgmHost+":" + m_mgmPort);
- ndb.setPath(textPath.Text.ToString());
- ndb.setCwd(textCwd.Text.ToString());
- ndb.setArgs(textArgs.Text.ToString());
- ndb.setEnv(textEnv.Text.ToString());
- ndb.setProcessType("permanent");
- m_noOfConfiguredNdb++;
- }
-
- }
-
-
- private void panel5_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
- nextEnabled=false;
- buttonSave.Enabled=true;
- checkBoxReuse.Visible=false;
- refreshLook();
- configureMgmt();
- }
-
- private void buttonSave_Click(object sender, System.EventArgs e)
- {
- Process p = m_db.getProcessByName(textName.Text.ToString());
-
- if(textOther.Text.ToString().Equals(""))
- {
- if(textName.Text.StartsWith("mgm"))
- {
- MessageBox.Show("You have to specify a port.","Warning",MessageBoxButtons.OK);
- return;
- }
- if(textName.Text.StartsWith("ndb"))
- {
- MessageBox.Show("You have to specify a filesystem path.","Warning",MessageBoxButtons.OK);
- return;
- }
-
- }
-
- if(textPath.Text.ToString().Equals(""))
- {
- if(textName.Text.StartsWith("mgm"))
- {
- MessageBox.Show("You have to specify the path to the mgmtsrvr.","Warning",MessageBoxButtons.OK);
- return;
- }
- if(textName.Text.StartsWith("ndb"))
- {
- MessageBox.Show("You have to specify the path to ndb.","Warning",MessageBoxButtons.OK);
- return;
- }
- }
-
- if(textArgs.Text.ToString().Equals(""))
- {
- if(textName.Text.StartsWith("mgm"))
- {
- MessageBox.Show("You have to specify the arguments to the mgmtsrvr.","Warning",MessageBoxButtons.OK);
- return;
- }
- }
-
- if(textCwd.Text.ToString().Equals(""))
- {
- if(textCwd.Text.StartsWith("mgm"))
- {
- MessageBox.Show("You have to specify the current working directory for the mgmtsrvr.","Warning",MessageBoxButtons.OK);
- return;
- }
- }
-
-
- /*
- * INPUT IS FINE AT THIS POINT
- * Everything needed for respective process is ok
- * */
-
- if(textName.Text.StartsWith("mgm"))
- {
- //MessageBox.Show(textOther.Text.ToString());
- saveMgm();
-
- }
-
- if(textName.Text.StartsWith("ndb"))
- {
- saveNdb();
-
- }
-
- if(textName.Text.StartsWith("api"))
- {
- saveApi();
-
- }
-
- if(m_noOfConfiguredMgmt < m_nMGM)
- {
- //load another Mgmt
- labelTitle.Text="Mgmtsrvr configuration";
- configureMgmt();
- }
- else
- {
- m_bMgmt=true;
- }
-
- if(m_bMgmt)
- {
- labelTitle.Text="NDB node configuration";
- if(m_noOfConfiguredNdb < m_nNDB)
- {
- configureNdb();
- }
- else
- m_bNdb=true;
- }
-
- if(m_bNdb && m_bMgmt)
- {
- labelTitle.Text="API node configuration";
- if(m_noOfConfiguredApi < m_nAPI)
- configureApi();
- else
- {
- nextEnabled=true;
- buttonSave.Enabled=false;
- refreshLook();
- }
- }
-
- }
-
- private void listBoxComputers_SelectedIndexChanged(object sender, System.EventArgs e)
- {
-
- }
-
- private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
- updateComputers();
- }
-
- private void radioYes_CheckedChanged(object sender, System.EventArgs e)
- {
- if(radioYes.Checked==true)
- {
- radioNo.Checked=false;
- }
- if(radioYes.Checked==false)
- {
- radioNo.Checked=true;
- }
-
- }
-
- private void radioNo_CheckedChanged(object sender, System.EventArgs e)
- {
- if(radioNo.Checked==true)
- {
- radioYes.Checked=false;
- }
- if(radioNo.Checked==false)
- {
- radioYes.Checked=true;
- }
- }
-
- private void radioStartYes_CheckedChanged(object sender, System.EventArgs e)
- {
-
- if(radioStartYes.Checked==true)
- {
- radioStartNo.Checked=false;
- }
- if(radioStartYes.Checked==false)
- {
- radioStartNo.Checked=true;
- }
- finishEnabled=true;
- refreshLook();
- }
-
- private void radioStartNo_CheckedChanged(object sender, System.EventArgs e)
- {
- if(radioStartNo.Checked==true)
- {
- radioStartYes.Checked=false;
- }
- if(radioStartNo.Checked==false)
- {
- radioStartYes.Checked=true;
- }
- finishEnabled=true;
- refreshLook();
- }
-
-
-
-
- public void startDatabase()
- {
- startDatabaseDlg x = new startDatabaseDlg(this.m_db);
-
-
- x.ShowDialog();
-
-
- }
-
-
- public void generateInitConfig()
- {
- MessageBox.Show("Generate initconfig.txt");
- }
-
- private void label11_Click(object sender, System.EventArgs e)
- {
-
- }
-
- private void textOwner_TextChanged(object sender, System.EventArgs e)
- {
- if(textDbName.TextLength > 0 && textOwner.TextLength > 0)
- nextEnabled=true;
- else
- nextEnabled=false;
-
- refreshLook();
- }
-
- private void panel2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
- textOwner.Text=System.Environment.UserName;
- this.Validate();
- if(textDbName.TextLength > 0 && textOwner.TextLength>0)
- {
- nextEnabled=true;
- }
- else
- {
- nextEnabled=false;
- }
- refreshLook();
- }
-
- private void textPath_TextChanged(object sender, System.EventArgs e)
- {
- try
- {
-
- }
- catch (Exception exc)
- {
- MessageBox.Show(exc.ToString());
- }
- }
-
- private void panel2_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- if(textOwner.TextLength>0 && textDbName.TextLength > 0)
- nextEnabled=true;
- else
- nextEnabled=false;
- }
-
-
-
-
-
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/Process.cs b/storage/ndb/src/cw/cpcc-win32/csharp/Process.cs
deleted file mode 100644
index d861781c737..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/Process.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Data;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for Process.
- /// </summary>
- public class Process
- {
- public enum Status {Running, Stopped, Unknown}
- private string m_id;
- protected string m_name;
- private Status m_status;
- private Computer m_computer;
- private string m_owner;
- private string m_cwd;
- private string m_type;
- private string m_path;
- private string m_other;
- private string m_args;
- private string m_env;
- private string m_database;
- private string m_connectString;
- private bool m_defined;
- public Process( string name,
- string owner, string database,
- Computer computer)
- {
- m_name=name;
- m_owner=owner;
- m_computer=computer;
- m_status=Status.Unknown;
- m_database=database;
- m_defined=false;
- m_path="";
- m_cwd="";
- m_args="";
- m_other="";
- }
- public Process()
- {
-
- }
- public Process(string id)
- {
- m_id=id;
- }
-
- public Process( string name,
- string database,
- Computer computer)
- {
- m_name=name;
- m_computer=computer;
- m_status=Status.Unknown;
- m_database=database;
- m_defined=false;
- }
-
- public Process( string name,
- Computer computer)
- {
- m_name=name;
- m_computer=computer;
- m_status=Status.Unknown;
- m_defined=false;
- }
-
-
- public string getStatusString()
- {
- if(m_status.Equals(Status.Running))
- return "Running";
- if(m_status.Equals(Status.Stopped))
- return "Stopped";
- return "Unknown";
- }
-
- public Computer getComputer() {return m_computer;}
- public string getName() {return m_name;}
- public string getDatabase() {return m_database;}
- public string getOwner() {return m_owner;}
- public string getId() {return m_id;}
- public void setId(string id) {m_id=id;}
-
- public void setCwd(string cwd) {m_cwd=cwd;}
- public void setPath(string path) {m_path=path;}
- public void setArgs(string args) {m_args=args;}
- public void setOther(string other) {m_other=other;}
- public void setEnv(string env) {m_env=env;}
- public void setName(string name) {m_name=name;}
- public void setOwner(string owner) {m_owner=owner;}
- public void setDatabase(string db) {m_database=db;}
- public void setComputer(Computer c) {m_computer=c;}
-
-
- public string getCwd() {return m_cwd;}
- public string getPath() {return m_path;}
- public string getArgs() {return m_args;}
- public string getOther() {return m_other;}
- public string getEnv() {return m_env;}
-
- public bool isDefined() {return m_defined;}
- public void setDefined(bool defined)
- {
- m_defined=defined;
- }
-
- public Status getStatus()
- {
- return m_status;
- }
-
- public void setConnectString(string cs)
- {
- m_connectString=cs;
- }
-
- public string getConnectString()
- {
- return m_connectString;
- }
- public void setStatus(Status status)
- {
- m_status=status;
- }
-
-
- public void setProcessType(string type)
- {
- m_type=type;
- }
- public string getProcessType()
- {
- return m_type;
- }
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs b/storage/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs
deleted file mode 100644
index 814b820c53d..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/ProcessDefineDialog.cs
+++ /dev/null
@@ -1,451 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for ProcessDefineDialog.
- /// </summary>
- public class ProcessDefineDialog : System.Windows.Forms.Form
- {
- private System.Windows.Forms.ComboBox comboComputer;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.TextBox textProcessName;
- private System.Windows.Forms.TextBox textProcessGroup;
- private System.Windows.Forms.TextBox textProcessEnv;
- private System.Windows.Forms.TextBox textProcessPath;
- private System.Windows.Forms.TextBox textProcessArgs;
- private System.Windows.Forms.TextBox textProcessCWD;
- private System.Windows.Forms.TextBox textProcessOwner;
- private System.Windows.Forms.ComboBox comboType;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.Label label13;
- private System.Windows.Forms.Label label15;
- private System.Windows.Forms.Label label16;
- private System.Windows.Forms.Label label14;
- private System.Windows.Forms.Label label17;
- private System.Windows.Forms.Label label18;
- private System.Windows.Forms.Button btnAdd;
- private System.Windows.Forms.Button btnCancel;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private ComputerMgmt c_mgmt;
- private string m_selComputer;
- public ProcessDefineDialog(ComputerMgmt mgmt, string computer)
- {
-
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- m_selComputer =computer; //the selected computer in the TreeView
- c_mgmt=mgmt;
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.comboComputer = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.textProcessName = new System.Windows.Forms.TextBox();
- this.textProcessGroup = new System.Windows.Forms.TextBox();
- this.textProcessEnv = new System.Windows.Forms.TextBox();
- this.textProcessPath = new System.Windows.Forms.TextBox();
- this.textProcessArgs = new System.Windows.Forms.TextBox();
- this.textProcessCWD = new System.Windows.Forms.TextBox();
- this.textProcessOwner = new System.Windows.Forms.TextBox();
- this.comboType = new System.Windows.Forms.ComboBox();
- this.label10 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.label12 = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.label15 = new System.Windows.Forms.Label();
- this.label16 = new System.Windows.Forms.Label();
- this.label14 = new System.Windows.Forms.Label();
- this.label17 = new System.Windows.Forms.Label();
- this.label18 = new System.Windows.Forms.Label();
- this.btnAdd = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // comboComputer
- //
- this.comboComputer.ItemHeight = 13;
- this.comboComputer.Location = new System.Drawing.Point(152, 24);
- this.comboComputer.Name = "comboComputer";
- this.comboComputer.Size = new System.Drawing.Size(112, 21);
- this.comboComputer.TabIndex = 0;
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(24, 24);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(64, 24);
- this.label1.TabIndex = 1;
- this.label1.Text = "Computer:";
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(24, 48);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(88, 24);
- this.label2.TabIndex = 2;
- this.label2.Text = "Process name:";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(24, 72);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(88, 24);
- this.label3.TabIndex = 3;
- this.label3.Text = "Group:";
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(24, 96);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(88, 24);
- this.label4.TabIndex = 4;
- this.label4.Text = "Env. variables:";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(24, 120);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(88, 24);
- this.label5.TabIndex = 5;
- this.label5.Text = "Path to binary:";
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(24, 144);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(112, 24);
- this.label6.TabIndex = 6;
- this.label6.Text = "Arguments to binary:";
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(24, 168);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(112, 24);
- this.label7.TabIndex = 7;
- this.label7.Text = "Type of process:";
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(24, 192);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(112, 24);
- this.label8.TabIndex = 8;
- this.label8.Text = "Current working dir.:";
- //
- // label9
- //
- this.label9.Location = new System.Drawing.Point(24, 216);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(112, 24);
- this.label9.TabIndex = 9;
- this.label9.Text = "Owner:";
- //
- // textProcessName
- //
- this.textProcessName.Location = new System.Drawing.Point(152, 48);
- this.textProcessName.Name = "textProcessName";
- this.textProcessName.Size = new System.Drawing.Size(112, 20);
- this.textProcessName.TabIndex = 1;
- this.textProcessName.Text = "";
- //
- // textProcessGroup
- //
- this.textProcessGroup.Location = new System.Drawing.Point(152, 72);
- this.textProcessGroup.Name = "textProcessGroup";
- this.textProcessGroup.Size = new System.Drawing.Size(112, 20);
- this.textProcessGroup.TabIndex = 2;
- this.textProcessGroup.Text = "";
- //
- // textProcessEnv
- //
- this.textProcessEnv.Location = new System.Drawing.Point(152, 96);
- this.textProcessEnv.Name = "textProcessEnv";
- this.textProcessEnv.Size = new System.Drawing.Size(112, 20);
- this.textProcessEnv.TabIndex = 3;
- this.textProcessEnv.Text = "";
- //
- // textProcessPath
- //
- this.textProcessPath.Location = new System.Drawing.Point(152, 120);
- this.textProcessPath.Name = "textProcessPath";
- this.textProcessPath.Size = new System.Drawing.Size(112, 20);
- this.textProcessPath.TabIndex = 4;
- this.textProcessPath.Text = "";
- //
- // textProcessArgs
- //
- this.textProcessArgs.Location = new System.Drawing.Point(152, 144);
- this.textProcessArgs.Name = "textProcessArgs";
- this.textProcessArgs.Size = new System.Drawing.Size(112, 20);
- this.textProcessArgs.TabIndex = 5;
- this.textProcessArgs.Text = "";
- //
- // textProcessCWD
- //
- this.textProcessCWD.Location = new System.Drawing.Point(152, 192);
- this.textProcessCWD.Name = "textProcessCWD";
- this.textProcessCWD.Size = new System.Drawing.Size(112, 20);
- this.textProcessCWD.TabIndex = 7;
- this.textProcessCWD.Text = "";
- //
- // textProcessOwner
- //
- this.textProcessOwner.Location = new System.Drawing.Point(152, 216);
- this.textProcessOwner.Name = "textProcessOwner";
- this.textProcessOwner.Size = new System.Drawing.Size(112, 20);
- this.textProcessOwner.TabIndex = 8;
- this.textProcessOwner.Text = "";
- //
- // comboType
- //
- this.comboType.ItemHeight = 13;
- this.comboType.Items.AddRange(new object[] {
- "Permanent",
- "Interactive"});
- this.comboType.Location = new System.Drawing.Point(152, 168);
- this.comboType.Name = "comboType";
- this.comboType.Size = new System.Drawing.Size(112, 21);
- this.comboType.TabIndex = 6;
- //
- // label10
- //
- this.label10.Location = new System.Drawing.Point(272, 32);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(88, 16);
- this.label10.TabIndex = 19;
- this.label10.Text = "(Mandatory)";
- //
- // label11
- //
- this.label11.Location = new System.Drawing.Point(272, 56);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(88, 16);
- this.label11.TabIndex = 20;
- this.label11.Text = "(Mandatory)";
- //
- // label12
- //
- this.label12.Location = new System.Drawing.Point(272, 80);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(88, 16);
- this.label12.TabIndex = 21;
- this.label12.Text = "(Mandatory)";
- //
- // label13
- //
- this.label13.Location = new System.Drawing.Point(272, 127);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(88, 16);
- this.label13.TabIndex = 22;
- this.label13.Text = "(Mandatory)";
- //
- // label15
- //
- this.label15.Location = new System.Drawing.Point(272, 176);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(88, 16);
- this.label15.TabIndex = 24;
- this.label15.Text = "(Mandatory)";
- //
- // label16
- //
- this.label16.Location = new System.Drawing.Point(272, 200);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(88, 16);
- this.label16.TabIndex = 25;
- this.label16.Text = "(Mandatory)";
- //
- // label14
- //
- this.label14.Location = new System.Drawing.Point(272, 224);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(88, 16);
- this.label14.TabIndex = 26;
- this.label14.Text = "(Mandatory)";
- //
- // label17
- //
- this.label17.Location = new System.Drawing.Point(272, 104);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(88, 16);
- this.label17.TabIndex = 27;
- this.label17.Text = "(Optional)";
- //
- // label18
- //
- this.label18.Location = new System.Drawing.Point(272, 152);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(88, 16);
- this.label18.TabIndex = 28;
- this.label18.Text = "(Optional)";
- //
- // btnAdd
- //
- this.btnAdd.Location = new System.Drawing.Point(288, 248);
- this.btnAdd.Name = "btnAdd";
- this.btnAdd.TabIndex = 9;
- this.btnAdd.Text = "Define...";
- this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
- //
- // btnCancel
- //
- this.btnCancel.Location = new System.Drawing.Point(152, 248);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.TabIndex = 10;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // ProcessDefineDialog
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(370, 279);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.btnCancel,
- this.btnAdd,
- this.label18,
- this.label17,
- this.label14,
- this.label16,
- this.label15,
- this.label13,
- this.label12,
- this.label11,
- this.label10,
- this.comboType,
- this.textProcessOwner,
- this.textProcessCWD,
- this.textProcessArgs,
- this.textProcessPath,
- this.textProcessEnv,
- this.textProcessGroup,
- this.textProcessName,
- this.label9,
- this.label8,
- this.label7,
- this.label6,
- this.label5,
- this.label4,
- this.label3,
- this.label2,
- this.label1,
- this.comboComputer});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "ProcessDefineDialog";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Define Process";
- this.Load += new System.EventHandler(this.ProcessDefineDialog_Load);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void btnCancel_Click(object sender, System.EventArgs e)
- {
- this.Dispose();
- this.Close();
- }
-
- private void btnAdd_Click(object sender, System.EventArgs e)
- {
- //TODO: ERROR CHECK
-
- Computer c;
- c=c_mgmt.getComputer(this.m_selComputer);
-
- c.addProcess(new Process(this.textProcessName.Text.ToString(),
- this.textProcessOwner.Text.ToString(),
- this.textProcessGroup.Text.ToString(),
- c));
- this.Close();
- this.Dispose();
- }
-
- private void ProcessDefineDialog_Load(object sender, System.EventArgs e)
- {
- comboType.SelectedIndex=0;
- ArrayList list = c_mgmt.getComputerCollection();
- int i=0, selIndex=0;
- foreach(Computer computer in list)
- {
- this.comboComputer.Items.Add(computer.getName());
- if(computer.getName().Equals(m_selComputer))
- selIndex=i;
- i++;
- }
- comboComputer.SelectedIndex=selIndex;
- }
-
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs b/storage/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs
deleted file mode 100644
index 246c108c661..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/fileaccess/FileMgmt.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Text;
-using System.Collections.Specialized;
-using System.IO;
-using System.Windows.Forms;
-namespace NDB_CPC.fileaccess
-{
- /// <summary>
- /// Summary description for FileMgmt.
- /// </summary>
- public class FileMgmt
- {
- public FileMgmt()
- {
- }
-
- public StringCollection importHostFile(string filename)
- {
- StringCollection sc = new StringCollection();
- StreamReader SR = new StreamReader(filename);
- string line ="";
- line = SR.ReadLine();
- while(!line.Equals(""))
- {
- sc.Add(line);
- line = SR.ReadLine();
- }
- return sc;
- }
-
- public void exportHostFile(string filename, string content)
- {
- StreamWriter SW = new StreamWriter(filename,false);
- SW.Write(content);
- SW.WriteLine("");
- SW.WriteLine("");
- SW.Close();
- }
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs b/storage/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs
deleted file mode 100644
index 1b55d2c2ab8..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/simpleparser/SimpleCPCParser.cs
+++ /dev/null
@@ -1,376 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Collections;
-using System.IO;
-using System.Windows.Forms;
-using NDB_CPC;
-using NDB_CPC.socketcomm;
-
-namespace NDB_CPC.simpleparser
-{
- /// <summary>
- /// Summary description for SimpleCPCParser.
- /// </summary>
- public class SimpleCPCParser
- {
- public SimpleCPCParser()
- {
- //
- // TODO: Add constructor logic here
- //
- }
-
- public static void parse(Process p, SocketComm comm)
- {
-
- string line=comm.readLine();//reader.ReadLine();
- while(line.Equals(""))
- {
- line=comm.readLine();
- }
- if(line.Equals("define process"))
- {
- defineProcess(p, comm);
- line="";
- return;
- }
- if(line.Equals("start process"))
- {
- startProcess(p,comm);
- line="";
- return;
- }
- if(line.Equals("stop process"))
- {
- stopProcess(p,comm);
- line="";
- return;
- }
- if(line.Equals("undefine process"))
- {
- undefineProcess(p,comm);
- line="";
- return;
- }
-
- }
-
- public static void parse(ArrayList processes, Computer c, SocketComm comm)
- {
-
- string line=comm.readLine();//reader.ReadLine();
- while(line.Equals(""))
- {
- line=comm.readLine();
- }
-
- if(line.Equals("start processes"))
- {
- listProcesses(processes, c, comm);
- line="";
- return;
- }
-
- }
-
- private static void defineProcess(Process p, SocketComm comm)
- {
- string line=comm.readLine();//reader.ReadLine();
- while(!line.Equals(""))
- {
- if(line.StartsWith("status:"))
- {
- line=line.Remove(0,7);
- line=line.Trim();
- if(line.Equals("1"))
- {
- p.setDefined(true);
- p.setStatus(Process.Status.Stopped);
- }
- else
- p.setDefined(false);
- }
- if(line.StartsWith("id:"))
- {
- line=line.Remove(0,3);
- line=line.Trim();
- p.setId(line);
- }
- line=comm.readLine();
- }
- }
-
-
- private static void startProcess(Process p, SocketComm comm)
- {
- string line=comm.readLine();//reader.ReadLine();
- while(!line.Equals(""))
- {
- if(line.StartsWith("status:"))
- {
- line=line.Remove(0,7);
- line=line.Trim();
- if(line.Equals("1"))
- p.setStatus(NDB_CPC.Process.Status.Running);
- else
- p.setStatus(NDB_CPC.Process.Status.Unknown);
-
- }
- if(line.StartsWith("id:"))
- {
- line=line.Remove(0,3);
- line=line.Trim();
- if(p.getId().Equals(line))
- {
- ;
- }
- else
- {
- //damn something is wrong
- p.setStatus(NDB_CPC.Process.Status.Unknown);
- }
-
- }
- line=comm.readLine();
- }
- }
- private static void undefineProcess(Process p, SocketComm comm)
- {
- string line=comm.readLine();//reader.ReadLine();
- while(!line.Equals(""))
- {
- if(line.StartsWith("status:"))
- {
-
- line=line.Remove(0,7);
- line=line.Trim();
- if(line.Equals("1"))
- p.setDefined(false);
- else
- p.setDefined(true);
-
- }
- if(line.StartsWith("id:"))
- {
- line=line.Remove(0,3);
- line=line.Trim();
- }
- line=comm.readLine();
- }
- }
-
- private static void stopProcess(Process p, SocketComm comm)
- {
- string line=comm.readLine();//reader.ReadLine();
- while(!line.Equals(""))
- {
- if(line.StartsWith("status:"))
- {
- line=line.Remove(0,7);
- line=line.Trim();
- if(line.Equals("1"))
- p.setStatus(NDB_CPC.Process.Status.Stopped);
- else
- p.setStatus(NDB_CPC.Process.Status.Unknown);
-
- }
- if(line.StartsWith("id:"))
- {
- line=line.Remove(0,3);
- line=line.Trim();
- if(p.getId().Equals(line))
- {
- ;
- }
- else
- {
- //damn something is wrong
- p.setStatus(NDB_CPC.Process.Status.Unknown);
- }
-
- }
- line=comm.readLine();
- }
- }
- private static void listProcesses(ArrayList processes, Computer c, SocketComm comm)
- {
- bool processExist = false;
-
- string line=comm.readLine();//reader.ReadLine();
- while(!line.Equals("end processes"))
- {
- if(line.Equals("process"))
- {
- line=comm.readLine();
- Process p = new Process();
-
- while(!line.Equals(""))
- {
- if(line.StartsWith("id:"))
- {
- string pid;
- line=line.Remove(0,3);
- pid=line.Trim();
- /*check if process already exist*/
- processExist=findProcess(processes,pid);
- if(!processExist)
- {
- p.setId(pid);
- }
- }
-
- if(line.StartsWith("name:"))
- {
-
- line=line.Remove(0,5);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setName(line);
- }
- }
-
- if(line.StartsWith("path:"))
- {
-
- line=line.Remove(0,5);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setPath(line);
- }
- }
-
- if(line.StartsWith("args:"))
- {
-
- line=line.Remove(0,5);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setArgs(line);
- }
- }
-
- if(line.StartsWith("type:"))
- {
-
- line=line.Remove(0,5);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
-
- }
- }
-
- if(line.StartsWith("cwd:"))
- {
-
- line=line.Remove(0,4);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setCwd(line);
- }
- }
-
- if(line.StartsWith("env:"))
- {
-
- line=line.Remove(0,4);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setEnv(line);
- }
- }
-
- if(line.StartsWith("owner:"))
- {
-
- line=line.Remove(0,6);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setOwner(line);
- }
- }
- if(line.StartsWith("group:"))
- {
-
- line=line.Remove(0,6);
- line=line.Trim();
- /*check if process already exist*/
- if(!processExist)
- {
- p.setDatabase(line);
- }
- }
-
- if(line.StartsWith("status:"))
- {
-
- line=line.Remove(0,7);
- line=line.Trim();
- /*check if process already exist*/
- //if(!processExist)
- //{
- if(line.Equals("0"))
- p.setStatus(Process.Status.Stopped);
- if(line.Equals("1"))
- p.setStatus(Process.Status.Running);
- if(line.Equals("2"))
- p.setStatus(Process.Status.Unknown);
- //}
- }
-
-
- line=comm.readLine();
- }
- if(!processExist)
- {
- p.setComputer(c);
- p.setDefined(true);
- processes.Add(p);
- }
- processExist=false;
- }
- line=comm.readLine();
-
- }
- }
-
- private static bool findProcess(ArrayList processes, string pid)
- {
- foreach (Process p in processes)
- {
- if(p.getId().Equals(pid))
- return true;
- }
- return false;
-
- }
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs b/storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs
deleted file mode 100644
index 34678086057..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/SocketComm.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using System.Windows.Forms;
-using System.Threading;
-using System.IO;
-
-namespace NDB_CPC.socketcomm
-{
- /// <summary>
- /// Summary description for SocketComm.
- /// </summary>
- public class SocketComm
- {
- private myTcpClient sender;
- private StreamWriter writer;
- private StreamReader reader;
- private string m_host;
- private int m_port;
- private bool m_connected;
- private bool m_connecting;
- private Thread connectThread;
- public SocketComm(string host, int port)
- {
-
- m_host=host;
- m_port=port;
- m_connected=false;
- m_connecting=false;
- }
-
-
-
- public bool isConnected()
- {
- return m_connected;
- }
-
- public void doConnect()
- {
- if(!m_connecting && !m_connected)
- {
- connectThread= new Thread(new ThreadStart(connect));
- connectThread.Start();
- }
-
- }
-
- private void connect()
- {
- m_connecting=true;
- while(true)
- {
- if(!m_connected)
- {
- try
- {
- // Establish the remote endpoint for the socket.
- // The name of the
- // remote device is "host.contoso.com".
-
- // Create a TCP/IP socket.
- sender = new myTcpClient();
- // Connect the socket to the remote endpoint. Catch any errors.
- try
- {
- /*
- IPAddress ipAddress = Dns.Resolve(host).AddressList[0];
- IPEndPoint ipLocalEndPoint = new IPEndPoint(ipAddress, 11000);
-*/
-
-
- sender.Connect(m_host,m_port);;
-
- writer = new StreamWriter(sender.GetStream(), Encoding.ASCII);
- reader = new StreamReader(sender.GetStream(), Encoding.ASCII);
- m_connected=true;
- m_connecting=false;
- // break;
- Console.WriteLine("Socket connected to {0}",
- sender.ToString());
-
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("ArgumentNullException : {0}",ane.ToString());
- m_connected=false;
- }
- catch (SocketException se)
- {
- Console.WriteLine("SocketException : {0}",se.ToString());
- m_connected=false;
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("Unexpected exception : {0}", e.ToString());
- m_connected=false;
- }
-
- }
-
- Thread.Sleep(200);
- }
- }
-
- public bool disconnect()
- {
- try
- {
- this.m_connected=false;
- this.m_connecting=false;
- sender.GetUnderlyingSocket().Shutdown(SocketShutdown.Both);
- sender.GetUnderlyingSocket().Close();
- writer.Close();
- reader.Close();
- sender.Close();
-
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("ArgumentNullException : {0}",ane.ToString());
- connectThread.Abort();
- return false;
- }
- catch (SocketException se)
- {
- Console.WriteLine("SocketException : {0}",se.ToString());
- connectThread.Abort();
- return false;
- }
- catch (Exception e)
- {
- Console.WriteLine("Unexpected exception : {0}", e.ToString());
- connectThread.Abort();
- return false;
- }
- connectThread.Abort();
- return true;
- }
-
- public bool writeMessage(string message)
- {
- int attempts=0;
- while (attempts < 10)
- {
- try
- {
- writer.WriteLine(message);
- writer.Flush();
- message="";
- return true;
- }
- catch(IOException e)
- {
- this.disconnect();
- this.doConnect();
- Thread.Sleep(200);
- attempts++;
- }
- catch(System.NullReferenceException)
- {
- this.disconnect();
- this.doConnect();
-
- Thread.Sleep(200);
- attempts++;
- }
- }
- return false;
- }
-
- public string readLine()
- {
- int attempts=0;
- string line="";
- while (attempts < 10){
- try
- {
- line = reader.ReadLine();
- if(line==null)
- line="";
- return line;
- }
- catch(IOException e)
- {
- this.disconnect();
- this.doConnect();
- Thread.Sleep(400);
- attempts++;
- }
- catch(System.NullReferenceException)
- {
- this.disconnect();
- this.doConnect();
- Thread.Sleep(400);
- attempts++;
- }
- }
- return "";
-
- }
-
- }
-}
-
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs b/storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs
deleted file mode 100644
index 20d86477b3a..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/socketcomm/myTcpClient.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using System.Threading;
-using System.IO;
-
-
-namespace NDB_CPC.socketcomm
-{
- public class myTcpClient : TcpClient
- {
- private Socket s;
- public myTcpClient(): base()
- {
- if(this.Active)
- {
- s = this.Client;
- }
- }
- public Socket GetUnderlyingSocket()
- {
- return s;
- }
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs b/storage/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs
deleted file mode 100644
index 9a702b9fc9e..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/startDatabaseDlg.cs
+++ /dev/null
@@ -1,267 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using NDB_CPC.simpleparser;
-
-namespace NDB_CPC
-{
- /// <summary>
- /// Summary description for startDatabase.
- /// </summary>
- public class startDatabaseDlg : System.Windows.Forms.Form
- {
- private System.Windows.Forms.TextBox textAction;
- private System.Windows.Forms.Label label1;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
- private System.Windows.Forms.ProgressBar progressBar;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Button buttonGo;
- private Database m_db;
- public startDatabaseDlg(Database db)
- {
-
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- m_db=db;
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.textAction = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.progressBar = new System.Windows.Forms.ProgressBar();
- this.label2 = new System.Windows.Forms.Label();
- this.buttonGo = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // textAction
- //
- this.textAction.Location = new System.Drawing.Point(104, 40);
- this.textAction.Name = "textAction";
- this.textAction.ReadOnly = true;
- this.textAction.Size = new System.Drawing.Size(256, 20);
- this.textAction.TabIndex = 0;
- this.textAction.Text = "";
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(8, 40);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(96, 16);
- this.label1.TabIndex = 1;
- this.label1.Text = "Current activity:";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // progressBar
- //
- this.progressBar.Location = new System.Drawing.Point(104, 88);
- this.progressBar.Name = "progressBar";
- this.progressBar.Size = new System.Drawing.Size(152, 16);
- this.progressBar.TabIndex = 2;
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(8, 88);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(96, 16);
- this.label2.TabIndex = 3;
- this.label2.Text = "Activity progress:";
- this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // buttonGo
- //
- this.buttonGo.Location = new System.Drawing.Point(152, 136);
- this.buttonGo.Name = "buttonGo";
- this.buttonGo.Size = new System.Drawing.Size(96, 24);
- this.buttonGo.TabIndex = 4;
- this.buttonGo.Text = "Go!";
- this.buttonGo.Click += new System.EventHandler(this.buttonGo_Click);
- //
- // startDatabaseDlg
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(378, 167);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.buttonGo,
- this.label2,
- this.progressBar,
- this.label1,
- this.textAction});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "startDatabaseDlg";
- this.Text = "Starting database";
- this.Load += new System.EventHandler(this.startDatabase_Load);
- this.Paint += new System.Windows.Forms.PaintEventHandler(this.startDatabase_Paint);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void startDatabase_Load(object sender, System.EventArgs e)
- {
-
- }
-
- private void startDatabase_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
- {
-
-
-
- }
- private void defineProcesses()
- {
- ArrayList processes = m_db.getProcesses();
- progressBar.Maximum = processes.Count;
- progressBar.Minimum = 0;
-
- int retry=0;
- //sc.connect("130.100.232.7");
- foreach (Process p in processes)
- {
- Computer comp;
- retry=0;
- //if(p.getName().StartsWith("ndb") || p.getName().StartsWith("mgm"))
- //{
- textAction.Text="Defining process " + p.getName();
- textAction.Refresh();
- comp=p.getComputer();
- while(retry<10)
- {
- if(!comp.isConnected())
- {
- comp.connectToCpcd();
-
- }
- else
- {
- if(comp.defineProcess(p)<0)
- {
- ;
- }
- else
- break;
- }
- if(retry==9)
- {
- if(MessageBox.Show(this,"Failed to define process. Try again?","Warning!!!",MessageBoxButtons.YesNo)==DialogResult.Yes)
- retry=0;
- }
- retry++;
- //comp.undefineProcess(p);
- }
- //}
- progressBar.PerformStep();
- }
- }
-
- private void startProcesses()
- {
-
- ArrayList processes = m_db.getProcesses();
- progressBar.Maximum = processes.Count;
- progressBar.Minimum = 0;
- string start = "start process \n";
-
- int retry=0;
- //sc.connect("130.100.232.7");
- foreach (Process p in processes)
- {
- Computer comp;
- if((p.getName().StartsWith("ndb")) || (p.getName().StartsWith("mgm")))
- {
- textAction.Text="Starting process " + p.getName();
- textAction.Refresh();
- start = start + "id:" + p.getId() + "\n\n";
- comp=p.getComputer();
- while(retry<10)
- {
- if(!comp.isConnected())
- {
- comp.connectToCpcd();
- }
- else
- {
- if(comp.startProcess(p)<0)
- {
- ;
- }
- else
- break;
- }
- if(retry==9)
- {
- if(MessageBox.Show(this,"Failed to start process. Retry again?","Warning!!!",MessageBoxButtons.YesNo)==DialogResult.Yes)
- retry=0;
- }
-
- retry++;
- }
- }
- progressBar.PerformStep();
-
- }
-
- }
-
- private void buttonGo_Click(object sender, System.EventArgs e)
- {
- buttonGo.Enabled=false;
- progressBar.Step=1;
- defineProcesses();
- progressBar.Value=0;
- startProcesses();
-
- }
-
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs b/storage/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs
deleted file mode 100644
index fda0fc937e1..00000000000
--- a/storage/ndb/src/cw/cpcc-win32/csharp/telnetclient/telnetClient.cs
+++ /dev/null
@@ -1,424 +0,0 @@
-/* Copyright (c) 2004, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-using System.Data;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using System.IO;
-using System.Threading ;
-
-namespace NDB_CPC.telnetclient
-{
- /// <summary>
- /// Summary description for telnetClient.
- /// </summary>
- public class telnetClient
- {
- Char IAC = Convert.ToChar(255);
- Char DO = Convert.ToChar(253);
- Char DONT = Convert.ToChar(254);
- Char WILL = Convert.ToChar(251);
- Char WONT = Convert.ToChar(252);
- Char SB = Convert.ToChar(250);
- Char SE = Convert.ToChar(240);
- const Char IS = '0';
- const Char SEND = '1';
- const Char INFO = '2';
- const Char VAR = '0';
- const Char VALUE = '1';
- const Char ESC = '2';
- const Char USERVAR = '3';
- string m_strResp;
-
- private ArrayList m_ListOptions = new ArrayList();
- private IPEndPoint iep ;
- private AsyncCallback callbackProc ;
- private string address ;
- private int port ;
- private Socket s ;
- private TextBox textBox1;
- Byte[] m_byBuff = new Byte[32767];
-
-
- public telnetClient(string ip, int p, TextBox tb)
- {
-
- address = ip;
- port = p;
- textBox1=tb;
- IPHostEntry IPHost = Dns.Resolve(address);
- string []aliases = IPHost.Aliases;
- IPAddress[] addr = IPHost.AddressList;
-
- try
- {
- // Create New Socket
- s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- // Create New EndPoint
- iep = new IPEndPoint(addr[0],port);
- // This is a non blocking IO
- s.Blocking = false ;
- // Assign Callback function to read from Asyncronous Socket
- callbackProc = new AsyncCallback(ConnectCallback);
- // Begin Asyncronous Connection
- s.BeginConnect(iep , callbackProc, s ) ;
-
- }
- catch(Exception eeeee )
- {
- MessageBox.Show(eeeee.Message , "Application Error!!!" , MessageBoxButtons.OK , MessageBoxIcon.Stop );
- Application.Exit();
- }
- }
-
- public void ConnectCallback( IAsyncResult ar )
- {
- try
- {
- // Get The connection socket from the callback
- Socket sock1 = (Socket)ar.AsyncState;
- if ( sock1.Connected )
- {
- // Define a new Callback to read the data
- AsyncCallback recieveData = new AsyncCallback( OnRecievedData );
- // Begin reading data asyncronously
- sock1.BeginReceive( m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData , sock1 );
- }
- }
- catch( Exception ex )
- {
- MessageBox.Show(ex.Message, "Setup Recieve callbackProc failed!" );
- }
- }
-
-
- public void OnRecievedData( IAsyncResult ar )
- {
- // Get The connection socket from the callback
- Socket sock = (Socket)ar.AsyncState;
- // Get The data , if any
- int nBytesRec = sock.EndReceive( ar );
- if( nBytesRec > 0 )
- {
- string sRecieved = Encoding.ASCII.GetString( m_byBuff, 0, nBytesRec );
- string m_strLine="";
- for ( int i=0; i < nBytesRec;i++)
- {
- Char ch = Convert.ToChar(m_byBuff[i]);
- switch( ch )
- {
- case '\r':
- m_strLine += Convert.ToString("\r\n");
- break;
- case '\n':
- break;
- default:
- m_strLine += Convert.ToString(ch);
- break;
- }
- }
- try
- {
- int strLinelen = m_strLine.Length ;
- if ( strLinelen == 0 )
- {
- m_strLine = Convert.ToString("\r\n");
- }
-
- Byte[] mToProcess = new Byte[strLinelen];
- for ( int i=0; i < strLinelen ; i++)
- mToProcess[i] = Convert.ToByte(m_strLine[i]);
- // Process the incoming data
- string mOutText = ProcessOptions(mToProcess);
- if ( mOutText != "" )
- textBox1.AppendText(mOutText);
-
- // Respond to any incoming commands
- RespondToOptions();
- }
- catch( Exception ex )
- {
- Object x = this ;
- MessageBox.Show(ex.Message , "Information!" );
- }
- }
- else
- {
- // If no data was recieved then the connection is probably dead
- Console.WriteLine( "Disconnected", sock.RemoteEndPoint );
- sock.Shutdown( SocketShutdown.Both );
- sock.Close();
- Application.Exit();
- }
- }
-
- private string ProcessOptions(byte[] m_strLineToProcess)
- {
- string m_DISPLAYTEXT ="";
- string m_strTemp ="" ;
- string m_strOption ="";
- string m_strNormalText ="";
- bool bScanDone =false;
- int ndx =0;
- int ldx =0;
- char ch ;
- try
- {
- for ( int i=0; i < m_strLineToProcess.Length ; i++)
- {
- Char ss = Convert.ToChar(m_strLineToProcess[i]);
- m_strTemp = m_strTemp + Convert.ToString(ss);
- }
-
- while(bScanDone != true )
- {
- int lensmk = m_strTemp.Length;
- ndx = m_strTemp.IndexOf(Convert.ToString(IAC));
- if ( ndx > lensmk )
- ndx = m_strTemp.Length;
-
- if(ndx != -1)
- {
- m_DISPLAYTEXT+= m_strTemp.Substring(0,ndx);
- ch = m_strTemp[ndx + 1];
- if ( ch == DO || ch == DONT || ch == WILL || ch == WONT )
- {
- m_strOption = m_strTemp.Substring(ndx, 3);
- string txt = m_strTemp.Substring(ndx + 3);
- m_DISPLAYTEXT+= m_strTemp.Substring(0,ndx);
- m_ListOptions.Add(m_strOption);
- m_strTemp = txt ;
- }
- else
- if ( ch == IAC)
- {
- m_DISPLAYTEXT= m_strTemp.Substring(0,ndx);
- m_strTemp = m_strTemp.Substring(ndx + 1);
- }
- else
- if ( ch == SB )
- {
- m_DISPLAYTEXT= m_strTemp.Substring(0,ndx);
- ldx = m_strTemp.IndexOf(Convert.ToString(SE));
- m_strOption = m_strTemp.Substring(ndx, ldx);
- m_ListOptions.Add(m_strOption);
- m_strTemp = m_strTemp.Substring(ldx);
- }
- }
- else
- {
- m_DISPLAYTEXT = m_DISPLAYTEXT + m_strTemp;
- bScanDone = true ;
- }
- }
- m_strNormalText = m_DISPLAYTEXT;
- }
- catch(Exception eP)
- {
- MessageBox.Show(eP.Message , "Application Error!!!" , MessageBoxButtons.OK , MessageBoxIcon.Stop );
- Application.Exit();
- }
- return m_strNormalText ;
- }
-
- void DispatchMessage(string strText)
- {
- try
- {
- Byte[] smk = new Byte[strText.Length];
- for ( int i=0; i < strText.Length ; i++)
- {
- Byte ss = Convert.ToByte(strText[i]);
- smk[i] = ss ;
- }
-
- IAsyncResult ar2 = s.BeginSend(smk , 0 , smk.Length , SocketFlags.None , callbackProc , s );
- s.EndSend(ar2);
- }
- catch(Exception ers)
- {
- MessageBox.Show("ERROR IN RESPOND OPTIONS");
- }
- }
-
- void RespondToOptions()
- {
- try
- {
- string strOption;
- for ( int i=0; i < m_ListOptions.Count; i++)
- {
- strOption = (string)m_ListOptions[i];
- ArrangeReply(strOption);
- }
- DispatchMessage(m_strResp);
- m_strResp ="";
- m_ListOptions.Clear();
- }
- catch(Exception ers)
- {
- MessageBox.Show("ERROR IN RESPOND OPTIONS");
- }
- }
- void ArrangeReply(string strOption)
- {
- try
- {
-
- Char Verb;
- Char Option;
- Char Modifier;
- Char ch;
- bool bDefined = false;
-
- if(strOption.Length < 3) return;
-
- Verb = strOption[1];
- Option = strOption[2];
-
- if ( Option == 1 || Option == 3 )
- {
- // case 1: // Echo
- // case 3: // Suppress Go-Ahead
- bDefined = true;
- // break;
- }
-
- m_strResp += IAC;
-
- if(bDefined == true )
- {
- if ( Verb == DO )
- {
- // case DO:
- ch = WILL;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- if ( Verb == DONT )
- {
- ch = WONT;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- if ( Verb == WILL )
- {
- ch = DO;
- m_strResp += ch;
- m_strResp += Option;
- //break;
- }
- if ( Verb == WONT)
- {
- ch = DONT;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- if ( Verb == SB)
- {
- Modifier = strOption[3];
- if(Modifier == SEND)
- {
- ch = SB;
- m_strResp += ch;
- m_strResp += Option;
- m_strResp += IS;
- m_strResp += IAC;
- m_strResp += SE;
- }
- // break;
- }
- }
- else
- {
- // switch(Verb)
- // {
- if ( Verb == DO )
- {
- ch = WONT;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- if ( Verb == DONT)
- {
- ch = WONT;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- if ( Verb == WILL)
- {
- ch = DONT;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- if ( Verb == WONT)
- {
- ch = DONT;
- m_strResp += ch;
- m_strResp += Option;
- // break;
- }
- }
- }
- catch(Exception eeeee )
- {
- MessageBox.Show(eeeee.Message , "Application Error!!!" , MessageBoxButtons.OK , MessageBoxIcon.Stop );
- Application.Exit();
- }
-
- }
-
- private void textBox1_KeyPress_1(object sender, System.Windows.Forms.KeyPressEventArgs e)
- {
- if ( e.KeyChar == 13 )
- {
- DispatchMessage("\r\n");
- }
- else
- if ( e.KeyChar == 8 )
- {
- try
- {
-// string mtmp = textBox1.Text.Substring(0,textBox1.Text.Length-1);
-// textBox1.Text = "" ;
- }
- catch(Exception ebs)
- {
- MessageBox.Show("ERROR IN BACKSPACE");
- }
- }
- else
- {
- string str = e.KeyChar.ToString();
- DispatchMessage(str);
- }
- }
-
-
- }
-}
diff --git a/storage/ndb/src/cw/cpcd/APIService.cpp b/storage/ndb/src/cw/cpcd/APIService.cpp
deleted file mode 100644
index b8f2b7d5f05..00000000000
--- a/storage/ndb/src/cw/cpcd/APIService.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/* Copyright (c) 2003-2007 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-
-#include <Parser.hpp>
-#include <NdbOut.hpp>
-#include <Properties.hpp>
-#include <socket_io.h>
-
-#include "APIService.hpp"
-#include "CPCD.hpp"
-#include <NdbMutex.h>
-#include <OutputStream.hpp>
-
-/**
- const char * name;
- const char * realName;
- const Type type;
- const ArgType argType;
- const ArgRequired argRequired;
- const ArgMinMax argMinMax;
- const int minVal;
- const int maxVal;
- void (T::* function)(const class Properties & args);
- const char * description;
-*/
-
-#define CPCD_CMD(name, fun, desc) \
- { name, \
- 0, \
- ParserRow<CPCDAPISession>::Cmd, \
- ParserRow<CPCDAPISession>::String, \
- ParserRow<CPCDAPISession>::Optional, \
- ParserRow<CPCDAPISession>::IgnoreMinMax, \
- 0, 0, \
- fun, \
- desc, 0 }
-
-#define CPCD_ARG(name, type, opt, desc) \
- { name, \
- 0, \
- ParserRow<CPCDAPISession>::Arg, \
- ParserRow<CPCDAPISession>::type, \
- ParserRow<CPCDAPISession>::opt, \
- ParserRow<CPCDAPISession>::IgnoreMinMax, \
- 0, 0, \
- 0, \
- desc, 0 }
-
-#define CPCD_ARG2(name, type, opt, min, max, desc) \
- { name, \
- 0, \
- ParserRow<CPCDAPISession>::Arg, \
- ParserRow<CPCDAPISession>::type, \
- ParserRow<CPCDAPISession>::opt, \
- ParserRow<CPCDAPISession>::IgnoreMinMax, \
- min, max, \
- 0, \
- desc, 0 }
-
-#define CPCD_END() \
- { 0, \
- 0, \
- ParserRow<CPCDAPISession>::Arg, \
- ParserRow<CPCDAPISession>::Int, \
- ParserRow<CPCDAPISession>::Optional, \
- ParserRow<CPCDAPISession>::IgnoreMinMax, \
- 0, 0, \
- 0, \
- 0, 0 }
-
-#define CPCD_CMD_ALIAS(name, realName, fun) \
- { name, \
- realName, \
- ParserRow<CPCDAPISession>::CmdAlias, \
- ParserRow<CPCDAPISession>::Int, \
- ParserRow<CPCDAPISession>::Optional, \
- ParserRow<CPCDAPISession>::IgnoreMinMax, \
- 0, 0, \
- 0, \
- 0, 0 }
-
-#define CPCD_ARG_ALIAS(name, realName, fun) \
- { name, \
- realName, \
- ParserRow<CPCDAPISession>::ArgAlias, \
- ParserRow<CPCDAPISession>::Int, \
- ParserRow<CPCDAPISession>::Optional, \
- ParserRow<CPCDAPISession>::IgnoreMinMax, \
- 0, 0, \
- 0, \
- 0, 0 }
-
-const
-ParserRow<CPCDAPISession> commands[] =
-{
- CPCD_CMD("define process" , &CPCDAPISession::defineProcess, ""),
- CPCD_ARG("id", Int, Optional, "Id of process."),
- CPCD_ARG("name", String, Mandatory, "Name of process"),
- CPCD_ARG("group", String, Mandatory, "Group of process"),
- CPCD_ARG("env", String, Optional, "Environment variables for process"),
- CPCD_ARG("path", String, Mandatory, "Path to binary"),
- CPCD_ARG("args", String, Optional, "Arguments to process"),
- CPCD_ARG("type", String, Mandatory, "Type of process"),
- CPCD_ARG("cwd", String, Mandatory, "Working directory of process"),
- CPCD_ARG("owner", String, Mandatory, "Owner of process"),
- CPCD_ARG("runas", String, Optional, "Run as user"),
- CPCD_ARG("stdout", String, Optional, "Redirection of stdout"),
- CPCD_ARG("stderr", String, Optional, "Redirection of stderr"),
- CPCD_ARG("stdin", String, Optional, "Redirection of stderr"),
- CPCD_ARG("ulimit", String, Optional, "ulimit"),
- CPCD_ARG("shutdown", String, Optional, "shutdown options"),
-
- CPCD_CMD("undefine process", &CPCDAPISession::undefineProcess, ""),
- CPCD_CMD_ALIAS("undef", "undefine process", 0),
- CPCD_ARG("id", Int, Mandatory, "Id of process"),
- CPCD_ARG_ALIAS("i", "id", 0),
-
- CPCD_CMD("start process", &CPCDAPISession::startProcess, ""),
- CPCD_ARG("id", Int, Mandatory, "Id of process"),
-
- CPCD_CMD("stop process", &CPCDAPISession::stopProcess, ""),
- CPCD_ARG("id", Int, Mandatory, "Id of process"),
-
- CPCD_CMD("list processes", &CPCDAPISession::listProcesses, ""),
-
- CPCD_CMD("show version", &CPCDAPISession::showVersion, ""),
-
- CPCD_END()
-};
-CPCDAPISession::CPCDAPISession(NDB_SOCKET_TYPE sock,
- CPCD & cpcd)
- : SocketServer::Session(sock)
- , m_cpcd(cpcd)
-{
- m_input = new SocketInputStream(sock, 7*24*60*60000);
- m_output = new SocketOutputStream(sock);
- m_parser = new Parser<CPCDAPISession>(commands, *m_input, true, true, true);
-}
-
-CPCDAPISession::CPCDAPISession(FILE * f, CPCD & cpcd)
- : SocketServer::Session(1)
- , m_cpcd(cpcd)
-{
- m_input = new FileInputStream(f);
- m_parser = new Parser<CPCDAPISession>(commands, *m_input, true, true, true);
-}
-
-CPCDAPISession::~CPCDAPISession() {
- delete m_input;
- delete m_parser;
-}
-
-void
-CPCDAPISession::runSession(){
- Parser_t::Context ctx;
- while(!m_stop){
- m_parser->run(ctx, * this);
- if(ctx.m_currentToken == 0)
- break;
-
- switch(ctx.m_status){
- case Parser_t::Ok:
- for(size_t i = 0; i<ctx.m_aliasUsed.size(); i++)
- ndbout_c("Used alias: %s -> %s",
- ctx.m_aliasUsed[i]->name, ctx.m_aliasUsed[i]->realName);
- break;
- case Parser_t::NoLine:
- case Parser_t::EmptyLine:
- break;
- default:
- break;
- }
- }
- NDB_CLOSE_SOCKET(m_socket);
-}
-
-void
-CPCDAPISession::stopSession(){
- CPCD::RequestStatus rs;
- for(size_t i = 0; i<m_temporaryProcesses.size(); i++){
- Uint32 id = m_temporaryProcesses[i];
- m_cpcd.undefineProcess(&rs, id);
- }
-}
-
-void
-CPCDAPISession::loadFile(){
- Parser_t::Context ctx;
- while(!m_stop){
- m_parser->run(ctx, * this);
- if(ctx.m_currentToken == 0)
- break;
-
- switch(ctx.m_status){
- case Parser_t::Ok:
- for(size_t i = 0; i<ctx.m_aliasUsed.size(); i++)
- ndbout_c("Used alias: %s -> %s",
- ctx.m_aliasUsed[i]->name, ctx.m_aliasUsed[i]->realName);
- break;
- case Parser_t::NoLine:
- case Parser_t::EmptyLine:
- break;
- default:
- break;
- }
- }
-}
-
-static const int g_TimeOut = 1000;
-
-void
-CPCDAPISession::defineProcess(Parser_t::Context & /* unused */,
- const class Properties & args){
-
- CPCD::Process * p = new CPCD::Process(args, &m_cpcd);
-
- CPCD::RequestStatus rs;
-
- bool ret = m_cpcd.defineProcess(&rs, p);
- if(!m_cpcd.loadingProcessList) {
- m_output->println("define process");
- m_output->println("status: %d", rs.getStatus());
- if(ret == true){
- m_output->println("id: %d", p->m_id);
- if(p->m_processType == TEMPORARY){
- m_temporaryProcesses.push_back(p->m_id);
- }
- } else {
- m_output->println("errormessage: %s", rs.getErrMsg());
- }
- m_output->println("");
- }
-}
-
-void
-CPCDAPISession::undefineProcess(Parser_t::Context & /* unused */,
- const class Properties & args){
- Uint32 id;
- CPCD::RequestStatus rs;
-
- args.get("id", &id);
- bool ret = m_cpcd.undefineProcess(&rs, id);
-
- m_output->println("undefine process");
- m_output->println("id: %d", id);
- m_output->println("status: %d", rs.getStatus());
- if(!ret)
- m_output->println("errormessage: %s", rs.getErrMsg());
-
- m_output->println("");
-}
-
-void
-CPCDAPISession::startProcess(Parser_t::Context & /* unused */,
- const class Properties & args){
- Uint32 id;
- CPCD::RequestStatus rs;
-
- args.get("id", &id);
- const int ret = m_cpcd.startProcess(&rs, id);
-
- if(!m_cpcd.loadingProcessList) {
- m_output->println("start process");
- m_output->println("id: %d", id);
- m_output->println("status: %d", rs.getStatus());
- if(!ret)
- m_output->println("errormessage: %s", rs.getErrMsg());
- m_output->println("");
- }
-}
-
-void
-CPCDAPISession::stopProcess(Parser_t::Context & /* unused */,
- const class Properties & args){
- Uint32 id;
- CPCD::RequestStatus rs;
-
- args.get("id", &id);
- int ret = m_cpcd.stopProcess(&rs, id);
-
- m_output->println("stop process");
- m_output->println("id: %d", id);
- m_output->println("status: %d", rs.getStatus());
- if(!ret)
- m_output->println("errormessage: %s", rs.getErrMsg());
-
- m_output->println("");
-}
-
-static const char *
-propToString(Properties *prop, const char *key) {
- static char buf[32];
- const char *retval = NULL;
- PropertiesType pt;
-
- prop->getTypeOf(key, &pt);
- switch(pt) {
- case PropertiesType_Uint32:
- Uint32 val;
- prop->get(key, &val);
- BaseString::snprintf(buf, sizeof buf, "%d", val);
- retval = buf;
- break;
- case PropertiesType_char:
- const char *str;
- prop->get(key, &str);
- retval = str;
- break;
- default:
- BaseString::snprintf(buf, sizeof buf, "(unknown)");
- retval = buf;
- }
- return retval;
-}
-
-void
-CPCDAPISession::printProperty(Properties *prop, const char *key) {
- m_output->println("%s: %s", key, propToString(prop, key));
-}
-
-void
-CPCDAPISession::listProcesses(Parser_t::Context & /* unused */,
- const class Properties & /* unused */){
- m_cpcd.m_processes.lock();
- MutexVector<CPCD::Process *> *proclist = m_cpcd.getProcessList();
-
- m_output->println("start processes");
- m_output->println("");
-
-
- for(size_t i = 0; i < proclist->size(); i++) {
- CPCD::Process *p = (*proclist)[i];
-
- m_output->println("process");
-
- m_output->println("id: %d", p->m_id);
- m_output->println("name: %s", p->m_name.c_str());
- m_output->println("path: %s", p->m_path.c_str());
- m_output->println("args: %s", p->m_args.c_str());
- m_output->println("type: %s", p->m_type.c_str());
- m_output->println("cwd: %s", p->m_cwd.c_str());
- m_output->println("env: %s", p->m_env.c_str());
- m_output->println("owner: %s", p->m_owner.c_str());
- m_output->println("group: %s", p->m_group.c_str());
- m_output->println("runas: %s", p->m_runas.c_str());
- m_output->println("stdin: %s", p->m_stdin.c_str());
- m_output->println("stdout: %s", p->m_stdout.c_str());
- m_output->println("stderr: %s", p->m_stderr.c_str());
- m_output->println("ulimit: %s", p->m_ulimit.c_str());
- m_output->println("shutdown: %s", p->m_shutdown_options.c_str());
- switch(p->m_status){
- case STOPPED:
- m_output->println("status: stopped");
- break;
- case STARTING:
- m_output->println("status: starting");
- break;
- case RUNNING:
- m_output->println("status: running");
- break;
- case STOPPING:
- m_output->println("status: stopping");
- break;
- }
-
- m_output->println("");
-
- }
-
- m_output->println("end processes");
- m_output->println("");
-
- m_cpcd.m_processes.unlock();
-}
-
-void
-CPCDAPISession::showVersion(Parser_t::Context & /* unused */,
- const class Properties & args){
- CPCD::RequestStatus rs;
-
- m_output->println("show version");
- m_output->println("compile time: %s %s", __DATE__, __TIME__);
-
- m_output->println("");
-}
-
-template class Vector<ParserRow<CPCDAPISession> const*>;
diff --git a/storage/ndb/src/cw/cpcd/APIService.hpp b/storage/ndb/src/cw/cpcd/APIService.hpp
deleted file mode 100644
index d6a45dc26a4..00000000000
--- a/storage/ndb/src/cw/cpcd/APIService.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef CPCD_API_HPP
-#define CPCD_API_HPP
-
-#include <Parser.hpp>
-#include <InputStream.hpp>
-#include <SocketServer.hpp>
-
-class CPCD;
-
-class CPCDAPISession : public SocketServer::Session {
- typedef Parser<CPCDAPISession> Parser_t;
-
- class CPCD & m_cpcd;
- InputStream *m_input;
- OutputStream *m_output;
- Parser_t *m_parser;
-
- Vector<int> m_temporaryProcesses;
-
- void printProperty(Properties *prop, const char *key);
-public:
- CPCDAPISession(NDB_SOCKET_TYPE, class CPCD &);
- CPCDAPISession(FILE * f, CPCD & cpcd);
- ~CPCDAPISession();
-
- virtual void runSession();
- virtual void stopSession();
- void loadFile();
-
- void defineProcess(Parser_t::Context & ctx, const class Properties & args);
- void undefineProcess(Parser_t::Context & ctx, const class Properties & args);
- void startProcess(Parser_t::Context & ctx, const class Properties & args);
- void stopProcess(Parser_t::Context & ctx, const class Properties & args);
- void showProcess(Parser_t::Context & ctx, const class Properties & args);
- void listProcesses(Parser_t::Context & ctx, const class Properties & args);
- void showVersion(Parser_t::Context & ctx, const class Properties & args);
-};
-
-class CPCDAPIService : public SocketServer::Service {
- class CPCD & m_cpcd;
-public:
- CPCDAPIService(class CPCD & cpcd) : m_cpcd(cpcd) {}
-
- CPCDAPISession * newSession(NDB_SOCKET_TYPE theSock){
- return new CPCDAPISession(theSock, m_cpcd);
- }
-};
-
-#endif
diff --git a/storage/ndb/src/cw/cpcd/CPCD.cpp b/storage/ndb/src/cw/cpcd/CPCD.cpp
deleted file mode 100644
index 48e946f58b8..00000000000
--- a/storage/ndb/src/cw/cpcd/CPCD.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-
-#include <ndb_global.h>
-#include <NdbOut.hpp>
-
-#include "APIService.hpp"
-#include "CPCD.hpp"
-#include <NdbMutex.h>
-
-#include "common.hpp"
-
-extern const ParserRow<CPCDAPISession> commands[];
-
-
-CPCD::CPCD() {
- loadingProcessList = false;
- m_processes.clear();
- m_monitor = NULL;
- m_monitor = new Monitor(this);
- m_procfile = "ndb_cpcd.db";
-}
-
-CPCD::~CPCD() {
- if(m_monitor != NULL) {
- delete m_monitor;
- m_monitor = NULL;
- }
-}
-
-int
-CPCD::findUniqueId() {
- int id;
- bool ok = false;
- m_processes.lock();
-
- while(!ok) {
- ok = true;
- id = random() % 8192; /* Don't want so big numbers */
-
- if(id == 0)
- ok = false;
-
- for(size_t i = 0; i<m_processes.size(); i++) {
- if(m_processes[i]->m_id == id)
- ok = false;
- }
- }
- m_processes.unlock();
- return id;
-}
-
-bool
-CPCD::defineProcess(RequestStatus * rs, Process * arg){
- if(arg->m_id == -1)
- arg->m_id = findUniqueId();
-
- Guard tmp(m_processes);
-
- for(size_t i = 0; i<m_processes.size(); i++) {
- Process * proc = m_processes[i];
-
- if((strcmp(arg->m_name.c_str(), proc->m_name.c_str()) == 0) &&
- (strcmp(arg->m_group.c_str(), proc->m_group.c_str()) == 0)) {
- /* Identical names in the same group */
- rs->err(AlreadyExists, "Name already exists");
- return false;
- }
-
- if(arg->m_id == proc->m_id) {
- /* Identical ID numbers */
- rs->err(AlreadyExists, "Id already exists");
- return false;
- }
- }
-
- m_processes.push_back(arg, false);
-
- notifyChanges();
- report(arg->m_id, CPCEvent::ET_PROC_USER_DEFINE);
-
- return true;
-}
-
-bool
-CPCD::undefineProcess(CPCD::RequestStatus *rs, int id) {
-
- Guard tmp(m_processes);
-
- Process * proc = 0;
- size_t i;
- for(i = 0; i < m_processes.size(); i++) {
- if(m_processes[i]->m_id == id) {
- proc = m_processes[i];
- break;
- }
- }
-
- if(proc == 0){
- rs->err(NotExists, "No such process");
- return false;
- }
-
- switch(proc->m_status){
- case RUNNING:
- case STOPPED:
- case STOPPING:
- case STARTING:
- proc->stop();
- m_processes.erase(i, false /* Already locked */);
- }
-
-
- notifyChanges();
-
- report(id, CPCEvent::ET_PROC_USER_UNDEFINE);
-
- return true;
-}
-
-bool
-CPCD::startProcess(CPCD::RequestStatus *rs, int id) {
-
- Process * proc = 0;
- {
-
- Guard tmp(m_processes);
-
- for(size_t i = 0; i < m_processes.size(); i++) {
- if(m_processes[i]->m_id == id) {
- proc = m_processes[i];
- break;
- }
- }
-
- if(proc == 0){
- rs->err(NotExists, "No such process");
- return false;
- }
-
- switch(proc->m_status){
- case STOPPED:
- proc->m_status = STARTING;
- if(proc->start() != 0){
- rs->err(Error, "Failed to start");
- return false;
- }
- break;
- case STARTING:
- rs->err(Error, "Already starting");
- return false;
- case RUNNING:
- rs->err(Error, "Already started");
- return false;
- case STOPPING:
- rs->err(Error, "Currently stopping");
- return false;
- }
-
- notifyChanges();
- }
- report(id, CPCEvent::ET_PROC_USER_START);
-
- return true;
-}
-
-bool
-CPCD::stopProcess(CPCD::RequestStatus *rs, int id) {
-
- Guard tmp(m_processes);
-
- Process * proc = 0;
- for(size_t i = 0; i < m_processes.size(); i++) {
- if(m_processes[i]->m_id == id) {
- proc = m_processes[i];
- break;
- }
- }
-
- if(proc == 0){
- rs->err(NotExists, "No such process");
- return false;
- }
-
- switch(proc->m_status){
- case STARTING:
- case RUNNING:
- proc->stop();
- break;
- case STOPPED:
- rs->err(AlreadyStopped, "Already stopped");
- return false;
- break;
- case STOPPING:
- rs->err(Error, "Already stopping");
- return false;
- }
-
- notifyChanges();
-
- report(id, CPCEvent::ET_PROC_USER_START);
-
- return true;
-}
-
-bool
-CPCD::notifyChanges() {
- bool ret = true;
- if(!loadingProcessList)
- ret = saveProcessList();
-
- m_monitor->signal();
-
- return ret;
-}
-
-/* Must be called with m_processlist locked */
-bool
-CPCD::saveProcessList(){
- char newfile[PATH_MAX+4];
- char oldfile[PATH_MAX+4];
- char curfile[PATH_MAX];
- FILE *f;
-
- /* Create the filenames that we will use later */
- BaseString::snprintf(newfile, sizeof(newfile), "%s.new", m_procfile.c_str());
- BaseString::snprintf(oldfile, sizeof(oldfile), "%s.old", m_procfile.c_str());
- BaseString::snprintf(curfile, sizeof(curfile), "%s", m_procfile.c_str());
-
- f = fopen(newfile, "w");
-
- if(f == NULL) {
- /* XXX What should be done here? */
- logger.critical("Cannot open `%s': %s\n", newfile, strerror(errno));
- return false;
- }
-
- for(size_t i = 0; i<m_processes.size(); i++){
- m_processes[i]->print(f);
- fprintf(f, "\n");
-
- if(m_processes[i]->m_processType == TEMPORARY){
- /**
- * Interactive process should never be "restarted" on cpcd restart
- */
- continue;
- }
-
- if(m_processes[i]->m_status == RUNNING ||
- m_processes[i]->m_status == STARTING){
- fprintf(f, "start process\nid: %d\n\n", m_processes[i]->m_id);
- }
- }
-
- fclose(f);
- f = NULL;
-
- /* This will probably only work on reasonably Unix-like systems. You have
- * been warned...
- *
- * The motivation behind all this link()ing is that the daemon might
- * crash right in the middle of updating the configuration file, and in
- * that case we want to be sure that the old file is around until we are
- * guaranteed that there is always at least one copy of either the old or
- * the new configuration file left.
- */
-
- /* Remove an old config file if it exists */
- unlink(oldfile);
-
- if(link(curfile, oldfile) != 0) /* make a backup of the running config */
- logger.error("Cannot rename '%s' -> '%s'", curfile, oldfile);
- else {
- if(unlink(curfile) != 0) { /* remove the running config file */
- logger.critical("Cannot remove file '%s'", curfile);
- return false;
- }
- }
-
- if(link(newfile, curfile) != 0) { /* put the new config file in place */
- printf("-->%d\n", __LINE__);
-
- logger.critical("Cannot rename '%s' -> '%s': %s",
- curfile, newfile, strerror(errno));
- return false;
- }
-
- /* XXX Ideally we would fsync() the directory here, but I'm not sure if
- * that actually works.
- */
-
- unlink(newfile); /* remove the temporary file */
- unlink(oldfile); /* remove the old file */
-
- logger.info("Process list saved as '%s'", curfile);
-
- return true;
-}
-
-bool
-CPCD::loadProcessList(){
- BaseString secondfile;
- FILE *f;
-
- loadingProcessList = true;
-
- secondfile.assfmt("%s.new", m_procfile.c_str());
-
- /* Try to open the config file */
- f = fopen(m_procfile.c_str(), "r");
-
- /* If it did not exist, try to open the backup. See the saveProcessList()
- * method for an explanation why it is done this way.
- */
- if(f == NULL) {
- f = fopen(secondfile.c_str(), "r");
-
- if(f == NULL) {
- /* XXX What to do here? */
- logger.info("Configuration file `%s' not found",
- m_procfile.c_str());
- logger.info("Starting with empty configuration");
- loadingProcessList = false;
- return false;
- } else {
- logger.info("Configuration file `%s' missing",
- m_procfile.c_str());
- logger.info("Backup configuration file `%s' is used",
- secondfile.c_str());
- /* XXX Maybe we should just rename the backup file to the official
- * name, and be done with it?
- */
- }
- }
-
- CPCDAPISession sess(f, *this);
- sess.loadFile();
- loadingProcessList = false;
-
- size_t i;
- Vector<int> temporary;
- for(i = 0; i<m_processes.size(); i++){
- Process * proc = m_processes[i];
- proc->readPid();
- if(proc->m_processType == TEMPORARY){
- temporary.push_back(proc->m_id);
- }
- }
-
- for(i = 0; i<temporary.size(); i++){
- RequestStatus rs;
- undefineProcess(&rs, temporary[i]);
- }
-
- /* Don't call notifyChanges here, as that would save the file we just
- loaded */
- m_monitor->signal();
- return true;
-}
-
-MutexVector<CPCD::Process *> *
-CPCD::getProcessList() {
- return &m_processes;
-}
-
-void
-CPCD::RequestStatus::err(enum RequestStatusCode status, const char *msg) {
- m_status = status;
- BaseString::snprintf(m_errorstring, sizeof(m_errorstring), "%s", msg);
-}
-
-#if 0
-void
-CPCD::sigchild(int pid){
- m_processes.lock();
- for(size_t i = 0; i<m_processes.size(); i++){
- if(m_processes[i].m_pid == pid){
- }
- }
- wait(pid, 0, 0);
-}
-#endif
-
- /** Register event subscriber */
-void
-CPCD::do_register(EventSubscriber * sub){
- m_subscribers.lock();
- m_subscribers.push_back(sub, false);
- m_subscribers.unlock();
-}
-
-EventSubscriber*
-CPCD::do_unregister(EventSubscriber * sub){
- m_subscribers.lock();
-
- for(size_t i = 0; i<m_subscribers.size(); i++){
- if(m_subscribers[i] == sub){
- m_subscribers.erase(i);
- m_subscribers.unlock();
- return sub;
- }
- }
-
- m_subscribers.unlock();
- return 0;
-}
-
-void
-CPCD::report(int id, CPCEvent::EventType t){
- CPCEvent e;
- e.m_time = time(0);
- e.m_proc = id;
- e.m_type = t;
- m_subscribers.lock();
- for(size_t i = 0; i<m_subscribers.size(); i++){
- (* m_subscribers[i]).report(e);
- }
- m_subscribers.unlock();
-}
-
-template class MutexVector<EventSubscriber*>;
diff --git a/storage/ndb/src/cw/cpcd/CPCD.hpp b/storage/ndb/src/cw/cpcd/CPCD.hpp
deleted file mode 100644
index 3c2934c0f49..00000000000
--- a/storage/ndb/src/cw/cpcd/CPCD.hpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/* Copyright (c) 2003-2007 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef CPCD_HPP
-#define CPCD_HPP
-
-#include <Vector.hpp>
-#include <Properties.hpp>
-#include <NdbOut.hpp>
-#include <NdbThread.h>
-#include <NdbCondition.h>
-#include <BaseString.hpp>
-
-/* XXX Need to figure out how to do this for non-Unix systems */
-#define CPCD_DEFAULT_WORK_DIR "/var/run/ndb_cpcd"
-#define CPCD_DEFAULT_PROC_FILE "ndb_cpcd.conf"
-#define CPCD_DEFAULT_TCP_PORT 1234
-#define CPCD_DEFAULT_POLLING_INTERVAL 5 /* seconds */
-#define CPCD_DEFAULT_CONFIG_FILE "/etc/ndb_cpcd.conf"
-
-enum ProcessStatus {
- STOPPED = 0,
- STARTING = 1,
- RUNNING = 2,
- STOPPING = 3
-};
-
-enum ProcessType {
- PERMANENT = 0,
- TEMPORARY = 1
-};
-
-struct CPCEvent {
- enum EventType {
- ET_USER_CONNECT,
- ET_USER_DISCONNECT,
-
- ET_PROC_USER_DEFINE, // Defined proc
- ET_PROC_USER_UNDEFINE, // Undefined proc
- ET_PROC_USER_START, // Proc ordered to start
- ET_PROC_USER_STOP, // Proc ordered to stop
- ET_PROC_STATE_RUNNING, // exec returned(?) ok
- ET_PROC_STATE_STOPPED // detected that proc is ! running
- };
-
- int m_proc;
- time_t m_time;
- EventType m_type;
-};
-
-struct EventSubscriber {
- virtual void report(const CPCEvent &) = 0;
- EventSubscriber() {}
- virtual ~EventSubscriber() {}
-};
-
-/**
- * @brief Error codes for CPCD requests
- */
-enum RequestStatusCode {
- OK = 0, ///< Everything OK
- Error = 1, ///< Generic error
- AlreadyExists = 2, ///< Entry already exists in list
- NotExists = 3, ///< Entry does not exist in list
- AlreadyStopped = 4
-};
-
-/**
- * @class CPCD
- * @brief Manages processes, letting them be controlled with a TCP connection.
- *
- * The class implementing the Cluster Process Control Daemon
- */
-class CPCD {
-public:
- /** @brief Describes the status of a client request */
- class RequestStatus {
- public:
- /** @brief Constructs an empty RequestStatus */
- RequestStatus() { m_status = OK; m_errorstring[0] = '\0'; };
-
- /** @brief Sets an errorcode and a printable message */
- void err(enum RequestStatusCode, const char *);
-
- /** @brief Returns the error message */
- char *getErrMsg() { return m_errorstring; };
-
- /** @brief Returns the error code */
- enum RequestStatusCode getStatus() { return m_status; };
- private:
- enum RequestStatusCode m_status;
- char m_errorstring[256];
- };
- /**
- * @brief Manages a process
- */
- class Process {
- int m_pid;
- public:
- /**
- * @brief Constructs and empty Process
- */
- Process(const Properties & props, class CPCD *cpcd);
- /**
- * @brief Monitors the process
- *
- * The process is started or stopped as needed.
- */
- void monitor();
-
- /**
- * @brief Checks if the process is running or not
- *
- * @return
- * - true if the process is running,
- * - false if the process is not running
- */
- bool isRunning();
-
- /** @brief Starts the process */
- int start();
-
- /** @brief Stops the process */
- void stop();
-
- /**
- * @brief Reads the pid from stable storage
- *
- * @return The pid number
- */
- int readPid();
-
- /**
- * @brief Writes the pid from stable storage
- *
- * @return
- * - 0 if successful
- - -1 and sets errno if an error occured
- */
- int writePid(int pid);
-
- /**
- * @brief Prints a textual description of the process on a file
- */
- void print(FILE *);
-
- /** Id number of the Process.
- *
- * @note This is not the same as a pid. This number is used in the
- * protocol, and will not be changed if a processes is restarted.
- */
- int m_id;
-
- /** @brief The name shown to the user */
- BaseString m_name;
-
- /** @brief Used to group a number of processes */
- BaseString m_group;
-
- /** @brief Environment variables
- *
- * Environmentvariables to add for the process.
- *
- * @note
- * - The environment cpcd started with is preserved
- * - There is no way to delete variables
- */
- BaseString m_env;
-
- /** @brief Path to the binary to run */
- BaseString m_path;
-
- /** @brief Arguments to the process.
- *
- * @note
- * - This includes argv[0].
- * - If no argv[0] is given, argv[0] will be set to m_path.
- */
- BaseString m_args;
-
- /**
- * @brief Type of process
- *
- * Either set to "interactive" or "permanent".
- */
- BaseString m_type;
- ProcessType m_processType;
-
- /**
- * @brief Working directory
- *
- * Working directory the process will start in.
- */
- BaseString m_cwd;
-
- /**
- * @brief Owner of the process.
- *
- * @note This will not affect the process' uid or gid;
- * it is only used for managemental purposes.
- * @see m_runas
- */
- BaseString m_owner;
-
- /**
- * @bried Run as
- * @note This affects uid
- * @see m_owner
- */
- BaseString m_runas;
-
- /**
- * @brief redirection for stdin
- */
- BaseString m_stdin;
-
- /**
- * @brief redirection for stdout
- */
- BaseString m_stdout;
-
- /**
- * @brief redirection for stderr
- */
- BaseString m_stderr;
-
- /** @brief Status of the process */
- enum ProcessStatus m_status;
-
- /**
- * @brief ulimits for process
- * @desc Format c:unlimited d:0 ...
- */
- BaseString m_ulimit;
-
- /**
- * @brief shutdown options
- */
- BaseString m_shutdown_options;
-
- private:
- class CPCD *m_cpcd;
- void do_exec();
- };
-
- /**
- * @brief Starts and stops processes as needed
- *
- * At a specified interval (default 5 seconds) calls the monitor function
- * of all the processes in the CPCDs list, causing the to start or
- * stop, depending on the configuration.
- */
- class Monitor {
- public:
- /** Creates a new CPCD::Monitor object, connected to the specified
- * CPCD.
- * A new thread will be created, which will poll the processes of
- * the CPCD at the specifed interval.
- */
- Monitor(CPCD *cpcd, int poll = CPCD_DEFAULT_POLLING_INTERVAL);
-
- /** Stops the monitor, but does not stop the processes */
- ~Monitor();
-
- /** Runs the monitor thread. */
- void run();
-
- /** Signals configuration changes to the monitor thread, causing it to
- * do the check without waiting for the timeout */
- void signal();
- private:
- class CPCD *m_cpcd;
- struct NdbThread *m_monitorThread;
- bool m_monitorThreadQuitFlag;
- struct NdbCondition *m_changeCondition;
- NdbMutex *m_changeMutex;
- int m_pollingInterval; /* seconds */
- };
-
- /** @brief Constructs a CPCD object */
- CPCD();
-
- /**
- * @brief Destroys a CPCD object,
- * but does not stop the processes it manages
- */
- ~CPCD();
-
- /** Adds a Process to the CPCDs list of managed Processes.
- *
- * @note The process will not be started until it is explicitly
- * marked as running with CPCD::startProcess().
- *
- * @return
- * - true if the addition was successful,
- * - false if not
- * - RequestStatus will be filled in with a suitable error
- * if an error occured.
- */
- bool defineProcess(RequestStatus *rs, Process * arg);
-
- /** Removes a Process from the CPCD.
- *
- * @note A Process that is running cannot be removed.
- *
- * @return
- * - true if the removal was successful,
- * - false if not
- * - The RequestStatus will be filled in with a suitable error
- * if an error occured.
- */
- bool undefineProcess(RequestStatus *rs, int id);
-
- /** Marks a Process for starting.
- *
- * @note The fact that a process has started does not mean it will actually
- * start properly. This command only makes sure the CPCD will
- * try to start it.
- *
- * @return
- * - true if the marking was successful
- * - false if not
- * - RequestStatus will be filled in with a suitable error
- * if an error occured.
- */
- bool startProcess(RequestStatus *rs, int id);
-
- /** Marks a Process for stopping.
- *
- * @return
- * - true if the marking was successful
- * - false if not
- * - The RequestStatus will be filled in with a suitable error
- * if an error occured.
- */
- bool stopProcess(RequestStatus *rs, int id);
-
- /** Generates a list of processes, and sends them to the CPCD client */
- bool listProcesses(RequestStatus *rs, MutexVector<const char *> &);
-
- /** Set to true while the CPCD is reading the configuration file */
- bool loadingProcessList;
-
- /** Saves the list of Processes and their status to the configuration file.
- * Called whenever the configuration is changed.
- */
- bool saveProcessList();
-
- /** Loads the list of Processes and their status from the configuration
- * file.
- * @note This function should only be called when the CPCD is starting,
- * calling it at other times will cause unspecified behaviour.
- */
- bool loadProcessList();
-
- /** Returns the list of processes */
- MutexVector<Process *> *getProcessList();
-
- /** The list of processes. Should not be used directly */
- MutexVector<Process *> m_processes;
-
- /** Register event subscriber */
- void do_register(EventSubscriber * sub);
- EventSubscriber* do_unregister(EventSubscriber * sub);
-
-private:
- friend class Process;
- bool notifyChanges();
- int findUniqueId();
- BaseString m_procfile;
- Monitor *m_monitor;
-
- void report(int id, CPCEvent::EventType);
- MutexVector<EventSubscriber *> m_subscribers;
-};
-
-#endif
diff --git a/storage/ndb/src/cw/cpcd/Makefile.am b/storage/ndb/src/cw/cpcd/Makefile.am
deleted file mode 100644
index 58092dd6025..00000000000
--- a/storage/ndb/src/cw/cpcd/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2004 MySQL AB
-# Use is subject to license terms
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-ndbbin_PROGRAMS = ndb_cpcd
-
-ndb_cpcd_SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp
-
-LDADD_LOC = \
- $(top_builddir)/storage/ndb/src/libndbclient.la \
- $(top_builddir)/dbug/libdbug.a \
- $(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
-
-include $(top_srcdir)/storage/ndb/config/common.mk.am
-include $(top_srcdir)/storage/ndb/config/type_util.mk.am
-
-ndb_cpcd_LDFLAGS = -static @ndb_bin_am_ldflags@
-
-windoze-dsp:
diff --git a/storage/ndb/src/cw/cpcd/Monitor.cpp b/storage/ndb/src/cw/cpcd/Monitor.cpp
deleted file mode 100644
index c096bb85029..00000000000
--- a/storage/ndb/src/cw/cpcd/Monitor.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include <ndb_global.h>
-
-#include <NdbThread.h>
-#include <NdbOut.hpp>
-#include <NdbSleep.h>
-
-#include "CPCD.hpp"
-#include "common.hpp"
-
-static void *
-monitor_thread_create_wrapper(void * arg) {
- CPCD::Monitor *mon = (CPCD::Monitor *)arg;
- mon->run();
- return NULL;
-}
-
-CPCD::Monitor::Monitor(CPCD *cpcd, int poll) {
- m_cpcd = cpcd;
- m_pollingInterval = poll;
- m_changeCondition = NdbCondition_Create();
- m_changeMutex = NdbMutex_Create();
- m_monitorThread = NdbThread_Create(monitor_thread_create_wrapper,
- (NDB_THREAD_ARG*) this,
- 32768,
- "ndb_cpcd_monitor",
- NDB_THREAD_PRIO_MEAN);
- m_monitorThreadQuitFlag = false;
-}
-
-CPCD::Monitor::~Monitor() {
- NdbThread_Destroy(&m_monitorThread);
- NdbCondition_Destroy(m_changeCondition);
- NdbMutex_Destroy(m_changeMutex);
-}
-
-void
-CPCD::Monitor::run() {
- while(1) {
- NdbMutex_Lock(m_changeMutex);
- NdbCondition_WaitTimeout(m_changeCondition,
- m_changeMutex,
- m_pollingInterval * 1000);
-
- MutexVector<CPCD::Process *> &proc = *m_cpcd->getProcessList();
-
- proc.lock();
-
- for(size_t i = 0; i < proc.size(); i++) {
- proc[i]->monitor();
- }
-
- proc.unlock();
-
- NdbMutex_Unlock(m_changeMutex);
- }
-}
-
-void
-CPCD::Monitor::signal() {
- NdbCondition_Signal(m_changeCondition);
-}
-
-template class MutexVector<CPCD::Process*>;
diff --git a/storage/ndb/src/cw/cpcd/Process.cpp b/storage/ndb/src/cw/cpcd/Process.cpp
deleted file mode 100644
index c2e24cecd77..00000000000
--- a/storage/ndb/src/cw/cpcd/Process.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include <ndb_global.h>
-
-#include <BaseString.hpp>
-#include <InputStream.hpp>
-
-#include "common.hpp"
-#include "CPCD.hpp"
-
-#include <pwd.h>
-#ifdef HAVE_GETRLIMIT
-#include <sys/resource.h>
-#endif
-
-void
-CPCD::Process::print(FILE * f){
- fprintf(f, "define process\n");
- fprintf(f, "id: %d\n", m_id);
- fprintf(f, "name: %s\n", m_name.c_str() ? m_name.c_str() : "");
- fprintf(f, "group: %s\n", m_group.c_str() ? m_group.c_str() : "");
- fprintf(f, "env: %s\n", m_env.c_str() ? m_env.c_str() : "");
- fprintf(f, "path: %s\n", m_path.c_str() ? m_path.c_str() : "");
- fprintf(f, "args: %s\n", m_args.c_str() ? m_args.c_str() : "");
- fprintf(f, "type: %s\n", m_type.c_str() ? m_type.c_str() : "");
- fprintf(f, "cwd: %s\n", m_cwd.c_str() ? m_cwd.c_str() : "");
- fprintf(f, "owner: %s\n", m_owner.c_str() ? m_owner.c_str() : "");
- fprintf(f, "runas: %s\n", m_runas.c_str() ? m_runas.c_str() : "");
- fprintf(f, "stdin: %s\n", m_stdin.c_str() ? m_stdin.c_str() : "");
- fprintf(f, "stdout: %s\n", m_stdout.c_str() ? m_stdout.c_str() : "");
- fprintf(f, "stderr: %s\n", m_stderr.c_str() ? m_stderr.c_str() : "");
- fprintf(f, "ulimit: %s\n", m_ulimit.c_str() ? m_ulimit.c_str() : "");
- fprintf(f, "shutdown: %s\n", m_shutdown_options.c_str() ?
- m_shutdown_options.c_str() : "");
-}
-
-CPCD::Process::Process(const Properties & props, class CPCD *cpcd) {
- m_id = -1;
- m_pid = -1;
- props.get("id", (Uint32 *) &m_id);
- props.get("name", m_name);
- props.get("group", m_group);
- props.get("env", m_env);
- props.get("path", m_path);
- props.get("args", m_args);
- props.get("cwd", m_cwd);
- props.get("owner", m_owner);
- props.get("type", m_type);
- props.get("runas", m_runas);
-
- props.get("stdin", m_stdin);
- props.get("stdout", m_stdout);
- props.get("stderr", m_stderr);
- props.get("ulimit", m_ulimit);
- props.get("shutdown", m_shutdown_options);
- m_status = STOPPED;
-
- if(strcasecmp(m_type.c_str(), "temporary") == 0){
- m_processType = TEMPORARY;
- } else {
- m_processType = PERMANENT;
- }
-
- m_cpcd = cpcd;
-}
-
-void
-CPCD::Process::monitor() {
- switch(m_status) {
- case STARTING:
- break;
- case RUNNING:
- if(!isRunning()){
- m_cpcd->report(m_id, CPCEvent::ET_PROC_STATE_STOPPED);
- if(m_processType == TEMPORARY){
- m_status = STOPPED;
- } else {
- start();
- }
- }
- break;
- case STOPPED:
- assert(!isRunning());
- break;
- case STOPPING:
- break;
- }
-}
-
-bool
-CPCD::Process::isRunning() {
-
- if(m_pid <= 1){
- //logger.critical("isRunning(%d) invalid pid: %d", m_id, m_pid);
- return false;
- }
- /* Check if there actually exists a process with such a pid */
- errno = 0;
- int s = kill((pid_t)-m_pid, 0); /* Sending "signal" 0 to a process only
- * checkes if the process actually exists */
- if(s != 0) {
- switch(errno) {
- case EPERM:
- logger.critical("Not enough privileges to control pid %d\n", m_pid);
- break;
- case ESRCH:
- /* The pid in the file does not exist, which probably means that it
- has died, or the file contains garbage for some other reason */
- break;
- default:
- logger.critical("Cannot not control pid %d: %s\n", m_pid, strerror(errno));
- break;
- }
- return false;
- }
- return true;
-}
-
-int
-CPCD::Process::readPid() {
- if(m_pid != -1){
- logger.critical("Reading pid while != -1(%d)", m_pid);
- return m_pid;
- }
-
- char filename[PATH_MAX*2+1];
- char buf[1024];
- FILE *f;
-
- memset(buf, 0, sizeof(buf));
-
- BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
-
- f = fopen(filename, "r");
-
- if(f == NULL){
- return -1; /* File didn't exist */
- }
-
- errno = 0;
- size_t r = fread(buf, 1, sizeof(buf), f);
- fclose(f);
- if(r > 0)
- m_pid = strtol(buf, (char **)NULL, 0);
-
- if(errno == 0){
- return m_pid;
- }
-
- return -1;
-}
-
-int
-CPCD::Process::writePid(int pid) {
- char tmpfilename[PATH_MAX+1+4+8];
- char filename[PATH_MAX*2+1];
- FILE *f;
-
- BaseString::snprintf(tmpfilename, sizeof(tmpfilename), "tmp.XXXXXX");
- BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
-
- int fd = mkstemp(tmpfilename);
- if(fd < 0) {
- logger.error("Cannot open `%s': %s\n", tmpfilename, strerror(errno));
- return -1; /* Couldn't open file */
- }
-
- f = fdopen(fd, "w");
-
- if(f == NULL) {
- logger.error("Cannot open `%s': %s\n", tmpfilename, strerror(errno));
- return -1; /* Couldn't open file */
- }
-
- fprintf(f, "%d", pid);
- fclose(f);
-
- if(rename(tmpfilename, filename) == -1){
- logger.error("Unable to rename from %s to %s", tmpfilename, filename);
- return -1;
- }
- return 0;
-}
-
-static void
-setup_environment(const char *env) {
- char **p;
- p = BaseString::argify("", env);
- for(int i = 0; p[i] != NULL; i++){
- /*int res = */ putenv(p[i]);
- }
-}
-
-static
-int
-set_ulimit(const BaseString & pair){
-#ifdef HAVE_GETRLIMIT
- errno = 0;
- Vector<BaseString> list;
- pair.split(list, ":");
- if(list.size() != 2){
- logger.error("Unable to process ulimit: split >%s< list.size()=%d",
- pair.c_str(), list.size());
- return -1;
- }
-
- int res;
- rlim_t value = RLIM_INFINITY;
- if(!(list[1].trim() == "unlimited")){
- value = atoi(list[1].c_str());
- }
-
- struct rlimit rlp;
-#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }}
-
- if(list[0].trim() == "c"){
- _RLIMIT_FIX(RLIMIT_CORE);
- } else if(list[0] == "d"){
- _RLIMIT_FIX(RLIMIT_DATA);
- } else if(list[0] == "f"){
- _RLIMIT_FIX(RLIMIT_FSIZE);
- } else if(list[0] == "n"){
- _RLIMIT_FIX(RLIMIT_NOFILE);
- } else if(list[0] == "s"){
- _RLIMIT_FIX(RLIMIT_STACK);
- } else if(list[0] == "t"){
- _RLIMIT_FIX(RLIMIT_CPU);
- } else {
- res= -11;
- errno = EINVAL;
- }
- if(res){
- logger.error("Unable to process ulimit: %s res=%d error=%d(%s)",
- pair.c_str(), res, errno, strerror(errno));
- return -1;
- }
-#endif
- return 0;
-}
-
-void
-CPCD::Process::do_exec() {
- size_t i;
- setup_environment(m_env.c_str());
-
- char **argv = BaseString::argify(m_path.c_str(), m_args.c_str());
-
- if(strlen(m_cwd.c_str()) > 0) {
- int err = chdir(m_cwd.c_str());
- if(err == -1) {
- BaseString err;
- logger.error("%s: %s\n", m_cwd.c_str(), strerror(errno));
- _exit(1);
- }
- }
-
- Vector<BaseString> ulimit;
- m_ulimit.split(ulimit);
- for(i = 0; i<ulimit.size(); i++){
- if(ulimit[i].trim().length() > 0 && set_ulimit(ulimit[i]) != 0){
- _exit(1);
- }
- }
-
- int fd = open("/dev/null", O_RDWR, 0);
- if(fd == -1) {
- logger.error("Cannot open `/dev/null': %s\n", strerror(errno));
- _exit(1);
- }
-
- BaseString * redirects[] = { &m_stdin, &m_stdout, &m_stderr };
- int fds[3];
- for(i = 0; i<3; i++){
- if(redirects[i]->empty()){
-#ifndef DEBUG
- dup2(fd, i);
-#endif
- continue;
- }
-
- if((* redirects[i]) == "2>&1" && i == 2){
- dup2(fds[1], 2);
- continue;
- }
-
- /**
- * Make file
- */
- int flags = 0;
- int mode = S_IRUSR | S_IWUSR ;
- if(i == 0){
- flags |= O_RDONLY;
- } else {
- flags |= O_WRONLY | O_CREAT | O_APPEND;
- }
- int f = fds[i]= open(redirects[i]->c_str(), flags, mode);
- if(f == -1){
- logger.error("Cannot redirect %d to/from '%s' : %s\n", i,
- redirects[i]->c_str(), strerror(errno));
- _exit(1);
- }
- dup2(f, i);
- }
-
- /* Close all filedescriptors */
- for(i = STDERR_FILENO+1; (int)i < getdtablesize(); i++)
- close(i);
-
- execv(m_path.c_str(), argv);
- /* XXX If we reach this point, an error has occurred, but it's kind of hard
- * to report it, because we've closed all files... So we should probably
- * create a new logger here */
- logger.error("Exec failed: %s\n", strerror(errno));
- /* NOTREACHED */
-}
-
-int
-CPCD::Process::start() {
- /* We need to fork() twice, so that the second child (grandchild?) can
- * become a daemon. The original child then writes the pid file,
- * so that the monitor knows the pid of the new process, and then
- * exit()s. That way, the monitor process can pickup the pid, and
- * the running process is a daemon.
- *
- * This is a bit tricky but has the following advantages:
- * - the cpcd can die, and "reconnect" to the monitored clients
- * without restarting them.
- * - the cpcd does not have to wait() for the childs. init(1) will
- * take care of that.
- */
- logger.info("Starting %d: %s", m_id, m_name.c_str());
- m_status = STARTING;
-
- int pid = -1;
- switch(m_processType){
- case TEMPORARY:{
- /**
- * Simple fork
- * don't ignore child
- */
- switch(pid = fork()) {
- case 0: /* Child */
- setsid();
- writePid(getpgrp());
- if(runas(m_runas.c_str()) == 0){
- signal(SIGCHLD, SIG_DFL);
- do_exec();
- }
- _exit(1);
- break;
- case -1: /* Error */
- logger.error("Cannot fork: %s\n", strerror(errno));
- m_status = STOPPED;
- return -1;
- break;
- default: /* Parent */
- logger.debug("Started temporary %d : pid=%d", m_id, pid);
- m_cpcd->report(m_id, CPCEvent::ET_PROC_STATE_RUNNING);
- break;
- }
- break;
- }
- case PERMANENT:{
- /**
- * PERMANENT
- */
- switch(fork()) {
- case 0: /* Child */
- signal(SIGCHLD, SIG_IGN);
- switch(pid = fork()) {
- case 0: /* Child */
- setsid();
- writePid(getpgrp());
- if(runas(m_runas.c_str()) != 0){
- _exit(1);
- }
- signal(SIGCHLD, SIG_DFL);
- do_exec();
- _exit(1);
- /* NOTREACHED */
- break;
- case -1: /* Error */
- logger.error("Cannot fork: %s\n", strerror(errno));
- writePid(-1);
- _exit(1);
- break;
- default: /* Parent */
- logger.debug("Started permanent %d : pid=%d", m_id, pid);
- _exit(0);
- break;
- }
- break;
- case -1: /* Error */
- logger.error("Cannot fork: %s\n", strerror(errno));
- m_status = STOPPED;
- return -1;
- break;
- default: /* Parent */
- m_cpcd->report(m_id, CPCEvent::ET_PROC_STATE_RUNNING);
- break;
- }
- break;
- }
- default:
- logger.critical("Unknown process type");
- return -1;
- }
-
- while(readPid() < 0){
- sched_yield();
- }
-
- errno = 0;
- pid_t pgid = getpgid(pid);
-
- if(pgid != -1 && pgid != m_pid){
- logger.error("pgid and m_pid don't match: %d %d (%d)", pgid, m_pid, pid);
- }
-
- if(isRunning()){
- m_status = RUNNING;
- return 0;
- }
- m_status = STOPPED;
- return -1;
-}
-
-void
-CPCD::Process::stop() {
-
- char filename[PATH_MAX*2+1];
- BaseString::snprintf(filename, sizeof(filename), "%d", m_id);
- unlink(filename);
-
- if(m_pid <= 1){
- logger.critical("Stopping process with bogus pid: %d id: %d",
- m_pid, m_id);
- return;
- }
- m_status = STOPPING;
-
- errno = 0;
- int signo= SIGTERM;
- if(m_shutdown_options == "SIGKILL")
- signo= SIGKILL;
-
- int ret = kill(-m_pid, signo);
- switch(ret) {
- case 0:
- logger.debug("Sent SIGTERM to pid %d", (int)-m_pid);
- break;
- default:
- logger.debug("kill pid: %d : %s", (int)-m_pid, strerror(errno));
- break;
- }
-
- if(isRunning()){
- errno = 0;
- ret = kill(-m_pid, SIGKILL);
- switch(ret) {
- case 0:
- logger.debug("Sent SIGKILL to pid %d", (int)-m_pid);
- break;
- default:
- logger.debug("kill pid: %d : %s\n", (int)-m_pid, strerror(errno));
- break;
- }
- }
-
- m_pid = -1;
- m_status = STOPPED;
-}
diff --git a/storage/ndb/src/cw/cpcd/common.cpp b/storage/ndb/src/cw/cpcd/common.cpp
deleted file mode 100644
index 1a799bc2bd5..00000000000
--- a/storage/ndb/src/cw/cpcd/common.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include <ndb_global.h>
-
-#include "common.hpp"
-#include <logger/Logger.hpp>
-#include <pwd.h>
-
-#include <Properties.hpp>
-#include <BaseString.hpp>
-
-int debug = 0;
-
-Logger logger;
-
-int
-runas(const char * user){
- if(user == 0 || strlen(user) == 0){
- return 0;
- }
- struct passwd * pw = getpwnam(user);
- if(pw == 0){
- logger.error("Can't find user to %s", user);
- return -1;
- }
- uid_t uid = pw->pw_uid;
- gid_t gid = pw->pw_gid;
- int res = setgid(gid);
- if(res != 0){
- logger.error("Can't change group to %s(%d)", user, gid);
- return res;
- }
-
- res = setuid(uid);
- if(res != 0){
- logger.error("Can't change user to %s(%d)", user, uid);
- }
- return res;
-}
-
-int
-insert(const char * pair, Properties & p){
- BaseString tmp(pair);
-
- tmp.trim(" \t\n\r");
-
- Vector<BaseString> split;
- tmp.split(split, ":=", 2);
-
- if(split.size() != 2)
- return -1;
-
- p.put(split[0].trim().c_str(), split[1].trim().c_str());
-
- return 0;
-}
-
-int
-insert_file(FILE * f, class Properties& p, bool break_on_empty){
- if(f == 0)
- return -1;
-
- while(!feof(f)){
- char buf[1024];
- fgets(buf, 1024, f);
- BaseString tmp = buf;
-
- if(tmp.length() > 0 && tmp.c_str()[0] == '#')
- continue;
-
- if(insert(tmp.c_str(), p) != 0 && break_on_empty)
- break;
- }
-
- return 0;
-}
-
-int
-insert_file(const char * filename, class Properties& p){
- FILE * f = fopen(filename, "r");
- int res = insert_file(f, p);
- if(f) fclose(f);
- return res;
-}
diff --git a/storage/ndb/src/cw/cpcd/common.hpp b/storage/ndb/src/cw/cpcd/common.hpp
deleted file mode 100644
index eb984696f00..00000000000
--- a/storage/ndb/src/cw/cpcd/common.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef __CPCD_COMMON_HPP_INCLUDED__
-#define __CPCD_COMMON_HPP_INCLUDED__
-
-#include <ndb_global.h>
-#include <logger/Logger.hpp>
-#if 0
-#include <getarg.h>
-#endif
-
-extern int debug;
-
-extern Logger logger;
-
-int runas(const char * user);
-int insert(const char * pair, class Properties & p);
-
-int insert_file(const char * filename, class Properties&);
-int insert_file(FILE *, class Properties&, bool break_on_empty = false);
-
-#endif /* ! __CPCD_COMMON_HPP_INCLUDED__ */
diff --git a/storage/ndb/src/cw/cpcd/main.cpp b/storage/ndb/src/cw/cpcd/main.cpp
deleted file mode 100644
index c90d0f43f1b..00000000000
--- a/storage/ndb/src/cw/cpcd/main.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include <ndb_global.h> /* Needed for mkdir(2) */
-#include <my_sys.h>
-#include <my_getopt.h>
-#include <mysql_version.h>
-#include <ndb_version.h>
-
-#include "CPCD.hpp"
-#include "APIService.hpp"
-#include <NdbMain.h>
-#include <NdbSleep.h>
-#include <BaseString.hpp>
-#include <logger/Logger.hpp>
-#include <logger/FileLogHandler.hpp>
-#include <logger/SysLogHandler.hpp>
-
-#include "common.hpp"
-
-static const char *work_dir = CPCD_DEFAULT_WORK_DIR;
-static int unsigned port;
-static int use_syslog;
-static const char *logfile = NULL;
-static const char *user = 0;
-
-static struct my_option my_long_options[] =
-{
- { "work-dir", 'w', "Work directory",
- &work_dir, &work_dir, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "port", 'p', "TCP port to listen on",
- &port, &port, 0,
- GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 },
- { "syslog", 'S', "Log events to syslog",
- &use_syslog, &use_syslog, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "logfile", 'L', "File to log events to",
- &logfile, &logfile, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "debug", 'D', "Enable debug mode",
- &debug, &debug, 0,
- GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "user", 'u', "Run as user",
- &user, &user, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
-};
-
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- char *argument)
-{
- return 0;
-}
-
-static CPCD * g_cpcd = 0;
-#if 0
-extern "C" static void sig_child(int signo, siginfo_t*, void*);
-#endif
-
-const char *progname = "ndb_cpcd";
-
-int main(int argc, char** argv){
- const char *load_default_groups[]= { "ndb_cpcd",0 };
- MY_INIT(argv[0]);
-
- load_defaults("ndb_cpcd",load_default_groups,&argc,&argv);
- if (handle_options(&argc, &argv, my_long_options, get_one_option)) {
- print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
- puts("");
- my_print_help(my_long_options);
- my_print_variables(my_long_options);
- exit(1);
- }
-
- logger.setCategory(progname);
- logger.enable(Logger::LL_ALL);
-
- if(debug)
- logger.createConsoleHandler();
-
- if(user && runas(user) != 0){
- logger.critical("Unable to change user: %s", user);
- _exit(1);
- }
-
- if(logfile != NULL){
- BaseString tmp;
- if(logfile[0] != '/')
- tmp.append(work_dir);
- tmp.append(logfile);
- logger.addHandler(new FileLogHandler(tmp.c_str()));
- }
-
- if(use_syslog)
- logger.addHandler(new SysLogHandler());
-
- logger.info("Starting");
-
- CPCD cpcd;
- g_cpcd = &cpcd;
-
- /* XXX This will probably not work on !unix */
- int err = mkdir(work_dir, S_IRWXU | S_IRGRP | S_IROTH);
- if(err != 0) {
- switch(errno) {
- case EEXIST:
- break;
- default:
- fprintf(stderr, "Cannot mkdir %s: %s\n", work_dir, strerror(errno));
- exit(1);
- }
- }
-
- if(strlen(work_dir) > 0){
- logger.debug("Changing dir to '%s'", work_dir);
- if((err = chdir(work_dir)) != 0){
- fprintf(stderr, "Cannot chdir %s: %s\n", work_dir, strerror(errno));
- exit(1);
- }
- }
-
- cpcd.loadProcessList();
-
- SocketServer * ss = new SocketServer();
- CPCDAPIService * serv = new CPCDAPIService(cpcd);
- unsigned short real_port= port; // correct type
- if(!ss->setup(serv, &real_port)){
- logger.critical("Cannot setup server: %s", strerror(errno));
- sleep(1);
- delete ss;
- delete serv;
- return 1;
- }
-
- ss->startServer();
-
- {
- signal(SIGPIPE, SIG_IGN);
- signal(SIGCHLD, SIG_IGN);
-#if 0
- struct sigaction act;
- act.sa_handler = 0;
- act.sa_sigaction = sig_child;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO;
- sigaction(SIGCHLD, &act, 0);
-#endif
- }
-
- logger.debug("Start completed");
- while(true) NdbSleep_MilliSleep(1000);
-
- delete ss;
- return 0;
-}
-
-#if 0
-extern "C"
-void
-sig_child(int signo, siginfo_t* info, void*){
- printf("signo: %d si_signo: %d si_errno: %d si_code: %d si_pid: %d\n",
- signo,
- info->si_signo,
- info->si_errno,
- info->si_code,
- info->si_pid);
-
-}
-#endif
diff --git a/storage/ndb/src/cw/test/socketclient/Makefile b/storage/ndb/src/cw/test/socketclient/Makefile
deleted file mode 100644
index 04f11f031e5..00000000000
--- a/storage/ndb/src/cw/test/socketclient/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-include .defs.mk
-
-TYPE :=
-
-BIN_TARGET := socketclient
-
-
-
-CCFLAGS_LOC += -I../../util/ -I../../cpcd/
-
-LIBS_LOC += -L$(NDB_TOP)/lib/ -L$(EXTERNAL_LIB_DIR)/sci
-
-LIBS_SPEC += -lsocketclient
-
-
-SOURCES = socketClientTest.cpp
-
-
-include $(NDB_TOP)/Epilogue.mk
-
-
-
-
-
diff --git a/storage/ndb/src/cw/test/socketclient/socketClientTest.cpp b/storage/ndb/src/cw/test/socketclient/socketClientTest.cpp
deleted file mode 100644
index 6b17d072f64..00000000000
--- a/storage/ndb/src/cw/test/socketclient/socketClientTest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-
-#include <ndb_global.h>
-#include <NdbOut.hpp>
-#include <Properties.hpp>
-#include <socket_io.h>
-#include <NdbTick.h>
-#include <NdbMain.h>
-#include <NdbSleep.h>
-#include "SocketService.hpp"
-#include "SocketRegistry.hpp"
-#include "SocketClient.hpp"
-#include "ClientInterface.hpp"
-
-#include <InputStream.hpp>
-
-#include <Parser.hpp>
-
-NDB_MAIN(socketclient) {
-
-
- if(argc<3) {
- printf("wrong args: socketclient <hostname> <port>\n");
- return 0;
- }
- const char * remotehost = argv[1];
- const int port = atoi(argv[2]);
-
-
- ClientInterface * ci = new ClientInterface(2);
- ci->connectCPCDdaemon(remotehost,port);
-
- /*ci->listProcesses(remotehost);
-
- ci->startProcess(remotehost, "1247");
-
- ci->stopProcess(remotehost, "1247");*/
-
- ci->defineProcess(remotehost, "ndb", "ndb-cluster1", "envirnm", "/ndb/bin",
- "-i", "permanent", "/ndb/ndb.2", "team");
-
- ci->startProcess(remotehost, "1247");
-
- ci->listProcesses(remotehost);
-
- //ci->undefineProcess(remotehost, "1247");
-
- ci->disconnectCPCDdaemon(remotehost);
-}
diff --git a/storage/ndb/src/cw/util/ClientInterface.cpp b/storage/ndb/src/cw/util/ClientInterface.cpp
deleted file mode 100644
index 725a9d47d43..00000000000
--- a/storage/ndb/src/cw/util/ClientInterface.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include "ClientInterface.hpp"
-
-
-
-ClientInterface::ClientInterface(Uint32 maxNoOfCPCD) {
- sr = new SocketRegistry<SocketService>(maxNoOfCPCD);
- ss = new SocketService();
-}
-
-
-ClientInterface::~ClientInterface() {
- delete sr;
- delete ss;
-
-}
-
-
-void ClientInterface::connectCPCDdaemon(const char * remotehost, Uint16 port)
-{
- sr->createSocketClient(remotehost, port);
-}
-
-void ClientInterface::disconnectCPCDdaemon(const char * remotehost)
-{
- sr->removeSocketClient(remotehost);
-}
-
-void ClientInterface::removeCPCDdaemon(const char * remotehost)
-{
- sr->removeSocketClient(remotehost);
-}
-
-void ClientInterface::startProcess(const char * remotehost, char * id) {
- char buf[255] = "start process ";
- char str[80];
- char line[10];
-
- strcpy(line, id);
- strcpy(str, "id:");
- strcat(str, line);
- strcat(str, "\n\n");
- strcat(buf, str);
- printf("Request: %s\n", buf);
-
- sr->performSend(buf,255,remotehost);
- sr->syncPerformReceive(remotehost, *ss, 0);
- ss->getPropertyObject();
-}
-
-void ClientInterface::stopProcess(const char * remotehost, char * id) {
- char buf[255] = "stop process ";
- char str[80];
- char line[10];
-
- strcpy(line, id);
- strcpy(str, "id:");
- strcat(str, line);
- strcat(str, "\n\n");
- strcat(buf, str);
- printf("Request: %s\n", buf);
-
- sr->performSend(buf,255,remotehost);
- sr->syncPerformReceive(remotehost, *ss, 0);
- ss->getPropertyObject();
-}
-
-void ClientInterface::defineProcess(const char * remotehost, char * name,
- char * group, char * env, char * path,
- char * args, char * type, char * cwd, char * owner){
- char buf[255] = "define process ";
- char str[80];
- char line[10];
-
- strcpy(line, name);
- strcpy(str, "name:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, group);
- strcpy(str, "group:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, env);
- strcpy(str, "env:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, path);
- strcpy(str, "path:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, args);
- strcpy(str, "args:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, type);
- strcpy(str, "type:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, cwd);
- strcpy(str, "cwd:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, " \n");
-
- strcpy(line, owner);
- strcpy(str, "owner:");
- strcat(str, line);
- strcat(buf, str);
- strcat(buf, "\n\n");
-
- printf("Request: %s\n", buf);
-
- sr->performSend(buf,255,remotehost);
- sr->syncPerformReceive(remotehost, *ss, 0);
- ss->getPropertyObject();
-}
-
-void ClientInterface::undefineProcess(const char * remotehost, char * id){
- char buf[255] = "undefine process ";
- char str[80];
- char line[10];
-
- strcpy(line, id);
- strcpy(str, "id:");
- strcat(str, line);
- strcat(str, "\n\n");
- strcat(buf, str);
- printf("Request: %s\n", buf);
-
- sr->performSend(buf,255,remotehost);
- sr->syncPerformReceive(remotehost, *ss, 0);
- ss->getPropertyObject();
-}
-
-void ClientInterface::listProcesses(const char * remotehost) {
- char buf[255]="list processes\n\n";
- printf("Request: %s\n", buf);
- sr->performSend(buf,255,remotehost);
- sr->syncPerformReceive(remotehost, *ss, 0);
- ss->getPropertyObject();
-}
-
-void ClientInterface::showProcess(const char * remotehost, char * id) {
- char buf[255] = "show process ";
- char str[80];
- char line[10];
-
- strcpy(line, id);
- strcpy(str, "id:");
- strcat(str, line);
- strcat(str, "\n\n");
- strcat(buf, str);
- printf("Request: %s\n", buf);
-
- sr->performSend(buf,255,remotehost);
- sr->syncPerformReceive(remotehost, *ss, 0);
- ss->getPropertyObject();
-}
diff --git a/storage/ndb/src/cw/util/ClientInterface.hpp b/storage/ndb/src/cw/util/ClientInterface.hpp
deleted file mode 100644
index 798f9c80a3a..00000000000
--- a/storage/ndb/src/cw/util/ClientInterface.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (c) 2003-2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef CLIENT_IF_HPP
-#define CLIENT_IF_HPP
-#include <ndb_global.h>
-#include <Parser.hpp>
-#include <InputStream.hpp>
-#include <Parser.hpp>
-#include <NdbOut.hpp>
-#include <Properties.hpp>
-#include "SocketRegistry.hpp"
-#include "SocketService.hpp"
-
-class ClientInterface {
-private:
- SocketService * ss;
- SocketRegistry<SocketService> * sr;
-
-public:
- ClientInterface(Uint32 maxNoOfCPC);
- ~ClientInterface();
- void startProcess(const char * remotehost, char * id);
- void stopProcess(const char * remotehost, char * id);
- void defineProcess(const char * remotehost, char * name, char * group,
- char * env, char * path, char * args, char * type,
- char * cwd, char * owner);
- void undefineProcess(const char * remotehost, char * id);
- void listProcesses(const char * remotehost);
- void showProcess(const char * remotehost, char * id);
- void connectCPCDdaemon(const char * remotehost, Uint16 port);
- void disconnectCPCDdaemon(const char * remotehost);
- void removeCPCDdaemon(const char * remotehost);
-
-};
-#endif
diff --git a/storage/ndb/src/cw/util/Makefile b/storage/ndb/src/cw/util/Makefile
deleted file mode 100644
index f5ab16721be..00000000000
--- a/storage/ndb/src/cw/util/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-include .defs.mk
-TYPE := ndbapi
-
-PIC_ARCHIVE := Y
-ARCHIVE_TARGET := socketclient
-
-# Source files of non-templated classes (.cpp files)
-SOURCES = ClientInterface.cpp SocketService.cpp SocketClient.cpp
-
-include $(NDB_TOP)/Epilogue.mk
diff --git a/storage/ndb/src/cw/util/SocketRegistry.cpp b/storage/ndb/src/cw/util/SocketRegistry.cpp
deleted file mode 100644
index 0bda227be6e..00000000000
--- a/storage/ndb/src/cw/util/SocketRegistry.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#include "SocketRegistry.hpp"
-#include <Parser.hpp>
-
-template<class T>
-SocketRegistry<T>::SocketRegistry(Uint32 maxSocketClients) {
-
-}
-
-
-template<class T>
-SocketRegistry<T>::~SocketRegistry() {
- delete [] m_socketClients;
-}
-
-template<class T>
-bool
-SocketRegistry<T>::createSocketClient(const char * host, Uint16 port) {
-
- if(port == 0)
- return false;
- if(host==NULL)
- return false;
-
- SocketClient * socketClient = new SocketClient(host, port);
-
- if(socketClient->openSocket() < 0 || socketClient == NULL) {
- ndbout << "could not connect" << endl;
- delete socketClient;
- return false;
- }
- else {
- m_socketClients[m_nSocketClients] = socketClient;
- m_nSocketClients++;
- }
- return true;
-}
-
-template<class T>
-int
-SocketRegistry<T>::pollSocketClients(Uint32 timeOutMillis) {
-
-
-
- // Return directly if there are no TCP transporters configured
- if (m_nSocketClients == 0){
- tcpReadSelectReply = 0;
- return 0;
- }
- struct timeval timeout;
- timeout.tv_sec = timeOutMillis / 1000;
- timeout.tv_usec = (timeOutMillis % 1000) * 1000;
-
-
- NDB_SOCKET_TYPE maxSocketValue = 0;
-
- // Needed for TCP/IP connections
- // The read- and writeset are used by select
-
- FD_ZERO(&tcpReadset);
-
- // Prepare for sending and receiving
- for (Uint32 i = 0; i < m_nSocketClients; i++) {
- SocketClient * t = m_socketClients[i];
-
- // If the socketclient is connected
- if (t->isConnected()) {
-
- const NDB_SOCKET_TYPE socket = t->getSocket();
- // Find the highest socket value. It will be used by select
- if (socket > maxSocketValue)
- maxSocketValue = socket;
-
- // Put the connected transporters in the socket read-set
- FD_SET(socket, &tcpReadset);
- }
- }
-
- // The highest socket value plus one
- maxSocketValue++;
-
- tcpReadSelectReply = select(maxSocketValue, &tcpReadset, 0, 0, &timeout);
-#ifdef NDB_WIN32
- if(tcpReadSelectReply == SOCKET_ERROR)
- {
- NdbSleep_MilliSleep(timeOutMillis);
- }
-#endif
-
- return tcpReadSelectReply;
-
-}
-
-template<class T>
-bool
-SocketRegistry<T>::performSend(const char * buf,
- Uint32 len,
- const char * remotehost)
-{
- SocketClient * socketClient;
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- socketClient = m_socketClients[i];
- if(strcmp(socketClient->gethostname(), remotehost)==0) {
- if(socketClient->isConnected()) {
- if(socketClient->writeSocket(buf, len)>0)
- return true;
- else
- return false;
- }
- }
- }
- return false;
-}
-
-template<class T>
-int
-SocketRegistry<T>::performReceive(T & t) {
- char buf[255] ; //temp. just for testing. must fix better
-
- if(tcpReadSelectReply > 0){
- for (Uint32 i=0; i<m_nSocketClients; i++) {
- SocketClient *sc = m_socketClients[i];
- const NDB_SOCKET_TYPE socket = sc->getSocket();
- if(sc->isConnected() && FD_ISSET(socket, &tcpReadset)) {
- t->runSession(socket,t);
- }
- }
- return 1;
- }
- return 0;
-
-}
-
-
-
-template<class T>
-inline
-int
-SocketRegistry<T>::syncPerformReceive(char * host,
- T & t,
- Uint32 timeOutMillis) {
- char buf[255] ; //temp. just for testing. must fix better
- struct timeval timeout;
- timeout.tv_sec = timeOutMillis / 1000;
- timeout.tv_usec = (timeOutMillis % 1000) * 1000;
- int reply;
- SocketClient * sc;
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- sc = m_socketClients[i];
- if(strcmp(sc->gethostname(), remotehost)==0) {
- if(sc->isConnected()) {
- FD_ZERO(&tcpReadset);
- reply = select(sc->getSocket(), &tcpReadset, 0, 0, &timeout);
- if(reply > 0) {
- return t->runSession(sc->getSocket(), t);
- }
- }
-
- }
- }
- return 0;
-}
-
-
-
-template<class T>
-bool
-SocketRegistry<T>::reconnect(const char * host){
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- SocketClient * socketClient = m_socketClients[i];
- if(strcmp(socketClient->gethostname(), host)==0) {
- if(!socketClient->isConnected()) {
- if(socketClient->openSocket() > 0)
- return true;
- else return false;
- }
- }
- }
- return false;
-}
-
-template<class T>
-bool
-SocketRegistry<T>::removeSocketClient(const char * host){
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- SocketClient * socketClient = m_socketClients[i];
- if(strcmp(socketClient->gethostname(), host)==0) {
- if(!socketClient->isConnected()) {
- if(socketClient->closeSocket() > 0) {
- delete socketClient;
- return true;
- }
- else return false;
- }
- }
- }
- return false;
-}
diff --git a/storage/ndb/src/cw/util/SocketRegistry.hpp b/storage/ndb/src/cw/util/SocketRegistry.hpp
deleted file mode 100644
index 9e1b737f224..00000000000
--- a/storage/ndb/src/cw/util/SocketRegistry.hpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef SocketClientRegistry_H
-#define SocketClientRegistry_H
-
-#include <NdbTCP.h>
-#include <NdbOut.hpp>
-
-#include "SocketClient.hpp"
-
-template<class T>
-class SocketRegistry {
-
-public:
- SocketRegistry(Uint32 maxSocketClients);
- ~SocketRegistry();
- /**
- * creates and adds a SocketClient to m_socketClients[]
- * @param host - host name
- * @param port - port to connect to
- */
- bool createSocketClient(const char * host, const Uint16 port);
-
- /**
- * performReceive reads from sockets should do more stuff
- */
- int performReceive(T &);
-
-
- /**
- * performReceive reads from sockets should do more stuff
- */
- int syncPerformReceive(const char* ,T &, Uint32);
-
-
- /**
- * performSend sends a command to a host
- */
- bool performSend(const char * buf, Uint32 len, const char * remotehost);
-
- /**
- * pollSocketClients performs a select (for a max. of timeoutmillis) or
- * until there is data to be read from any SocketClient
- * @param timeOutMillis - select timeout
- */
- int pollSocketClients(Uint32 timeOutMillis);
-
- /**
- * reconnect tries to reconnect to a cpcd given its hostname
- * @param host - name of host to reconnect to.
- */
- bool reconnect(const char * host);
-
-
- /**
- * removeSocketClient
- * @param host - name of host for which to remove the SocketConnection
- */
- bool removeSocketClient(const char * host);
-
-private:
- SocketClient** m_socketClients;
- Uint32 m_maxSocketClients;
- Uint32 m_nSocketClients;
- int tcpReadSelectReply;
- fd_set tcpReadset;
-
-
-};
-
-
-template<class T>
-inline
-SocketRegistry<T>::SocketRegistry(Uint32 maxSocketClients) {
- m_maxSocketClients = maxSocketClients;
- m_socketClients = new SocketClient * [m_maxSocketClients];
- m_nSocketClients = 0;
-}
-
-
-template<class T>
-inline
-SocketRegistry<T>::~SocketRegistry() {
- delete [] m_socketClients;
-}
-
-template<class T>
-inline
-bool
-SocketRegistry<T>::createSocketClient(const char * host, Uint16 port) {
-
- if(port == 0)
- return false;
- if(host==NULL)
- return false;
-
- SocketClient * socketClient = new SocketClient(host, port);
-
- if(socketClient->openSocket() < 0 || socketClient == NULL) {
- ndbout << "could not connect" << endl;
- delete socketClient;
- return false;
- }
- else {
- m_socketClients[m_nSocketClients] = socketClient;
- m_nSocketClients++;
- }
- return true;
-}
-
-template<class T>
-inline
-int
-SocketRegistry<T>::pollSocketClients(Uint32 timeOutMillis) {
-
-
-
- // Return directly if there are no TCP transporters configured
- if (m_nSocketClients == 0){
- tcpReadSelectReply = 0;
- return 0;
- }
- struct timeval timeout;
- timeout.tv_sec = timeOutMillis / 1000;
- timeout.tv_usec = (timeOutMillis % 1000) * 1000;
-
-
- NDB_SOCKET_TYPE maxSocketValue = 0;
-
- // Needed for TCP/IP connections
- // The read- and writeset are used by select
-
- FD_ZERO(&tcpReadset);
-
- // Prepare for sending and receiving
- for (Uint32 i = 0; i < m_nSocketClients; i++) {
- SocketClient * t = m_socketClients[i];
-
- // If the socketclient is connected
- if (t->isConnected()) {
-
- const NDB_SOCKET_TYPE socket = t->getSocket();
- // Find the highest socket value. It will be used by select
- if (socket > maxSocketValue)
- maxSocketValue = socket;
-
- // Put the connected transporters in the socket read-set
- FD_SET(socket, &tcpReadset);
- }
- }
-
- // The highest socket value plus one
- maxSocketValue++;
-
- tcpReadSelectReply = select(maxSocketValue, &tcpReadset, 0, 0, &timeout);
-#ifdef NDB_WIN32
- if(tcpReadSelectReply == SOCKET_ERROR)
- {
- NdbSleep_MilliSleep(timeOutMillis);
- }
-#endif
-
- return tcpReadSelectReply;
-
-}
-
-template<class T>
-inline
-bool
-SocketRegistry<T>::performSend(const char * buf, Uint32 len, const char * remotehost)
-{
- SocketClient * socketClient;
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- socketClient = m_socketClients[i];
- if(strcmp(socketClient->gethostname(), remotehost)==0) {
- if(socketClient->isConnected()) {
- if(socketClient->writeSocket(buf, len)>0)
- return true;
- else
- return false;
- }
- }
- }
- return false;
-}
-
-template<class T>
-inline
-int
-SocketRegistry<T>::performReceive(T & t) {
- char buf[255] ; //temp. just for testing. must fix better
-
- if(tcpReadSelectReply > 0){
- for (Uint32 i=0; i<m_nSocketClients; i++) {
- SocketClient *sc = m_socketClients[i];
- const NDB_SOCKET_TYPE socket = sc->getSocket();
- if(sc->isConnected() && FD_ISSET(socket, &tcpReadset)) {
- t->runSession(socket,t);
- }
- }
- return 1;
- }
- return 0;
-
-}
-
-
-
-template<class T>
-inline
-int
-SocketRegistry<T>::syncPerformReceive(const char * remotehost,
- T & t,
- Uint32 timeOutMillis) {
- char buf[255] ; //temp. just for testing. must fix better
- struct timeval timeout;
- timeout.tv_sec = timeOutMillis / 1000;
- timeout.tv_usec = (timeOutMillis % 1000) * 1000;
- int reply;
- SocketClient * sc;
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- sc = m_socketClients[i];
- if(strcmp(sc->gethostname(), remotehost)==0) {
- if(sc->isConnected()) {
- /*FD_ZERO(&tcpReadset);
- reply = select(sc->getSocket()+1, 0, 0, 0, &timeout);
- reply=1;
- if(reply > 0) {*/
- t.runSession(sc->getSocket(), t);
- //}
- }
-
- }
- }
-}
-
-
-
-template<class T>
-inline
-bool
-SocketRegistry<T>::reconnect(const char * host){
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- SocketClient * socketClient = m_socketClients[i];
- if(strcmp(socketClient->gethostname(), host)==0) {
- if(!socketClient->isConnected()) {
- if(socketClient->openSocket() > 0)
- return true;
- else return false;
- }
- }
- }
- return false;
-}
-
-template<class T>
-inline
-bool
-SocketRegistry<T>::removeSocketClient(const char * host){
- for(Uint32 i=0; i < m_nSocketClients; i++) {
- SocketClient * socketClient = m_socketClients[i];
- if(strcmp(socketClient->gethostname(), host)==0) {
- if(!socketClient->isConnected()) {
- if(socketClient->closeSocket() > 0) {
- delete socketClient;
- return true;
- }
- else return false;
- }
- }
- }
- return false;
-}
-
-
-#endif // Define of SocketRegistry
diff --git a/storage/ndb/src/cw/util/SocketService.cpp b/storage/ndb/src/cw/util/SocketService.cpp
deleted file mode 100644
index ee64f3bc4f1..00000000000
--- a/storage/ndb/src/cw/util/SocketService.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-
-#include <Parser.hpp>
-#include <NdbOut.hpp>
-#include <Properties.hpp>
-#include "SocketService.hpp"
-
-SocketService::SocketService() {
-
-}
-
-SocketService::~SocketService() {
-
-}
-
-int
-SocketService::runSession(NDB_SOCKET_TYPE socket, SocketService & ss){
- InputStream *m_input = new SocketInputStream(socket);
- char buf[255];
-
- m_input->gets(buf,255);
- ndbout_c("SocketService:received: %s\n", buf);
- ndbout_c("This should now be parsed\n");
- ndbout_c("and put in a property object.\n");
- ndbout_c("The propery is then accessible from the ClientInterface.\n");
- ndbout_c("by getPropertyObject.\n");
- ndbout_c("At least this is the idea.");
- /*Parser_t *m_parser =
- new Parser<SocketService>(commands, *m_input, true, true, true);
- */
- /** to do
- * add a proprty object to which the parser will put its result.
- */
-
- return 1 ; //succesful
- //return 0; //unsuccesful
-
-}
-
-void
-SocketService::getPropertyObject() {
- ndbout << "get property object. return to front end or something" << endl;
-}
-
-
diff --git a/storage/ndb/src/cw/util/SocketService.hpp b/storage/ndb/src/cw/util/SocketService.hpp
deleted file mode 100644
index 5a860f3aee1..00000000000
--- a/storage/ndb/src/cw/util/SocketService.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (c) 2003, 2005 MySQL AB
- Use is subject to license terms
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
-
-#ifndef SOCKET_SERVICE_HPP
-#define SOCKET_SERVICE_HPP
-#include <Parser.hpp>
-#include <InputStream.hpp>
-#include <Parser.hpp>
-#include <NdbOut.hpp>
-#include <Properties.hpp>
-#include "SocketRegistry.hpp"
-
-
-
-
-class SocketService {
- friend class SocketRegistry<SocketService>;
-private:
- typedef Parser<SocketService> Parser_t;
- int runSession(NDB_SOCKET_TYPE socket, SocketService &);
-public:
- void getPropertyObject();
- SocketService();
- ~SocketService();
-
-};
-
-
-
-
-
-
-#endif