Collaboration diagram for NDB_CPC::Computer:

Public Types | |
| Disconnected = 1 | |
| Connected = 2 | |
| Unknown = 3 | |
| enum | Status { Disconnected = 1, Connected = 2, Unknown = 3 } |
Public Member Functions | |
| Computer (string name, int port) | |
| Computer (string name, string ip) | |
| void | connectToCpcd () |
| string | getName () |
| string | getIp () |
| ArrayList | getProcesses () |
| string | getStatusString () |
| bool | isConnected () |
| Status | getStatus () |
| void | setStatus (Status status) |
| void | addProcess (Process process) |
| Process | getProcessByName (string name) |
| bool | removeProcess (string name, string database) |
| void | disconnect () |
| Process | getProcess (string id) |
| int | listProcesses () |
| int | defineProcess (Process p) |
| int | startProcess (Process p) |
| int | stopProcess (Process p) |
| int | undefineProcess (Process p) |
| int | getCpcdPort () |
Private Member Functions | |
| bool | sendMessage (string str) |
Private Attributes | |
| string | m_ip |
| int | m_cpcdPort |
| string | m_name |
| Status | m_status |
| ArrayList | m_processes |
| SocketComm | m_socket |
Definition at line 17 of file Computer.cs.
| NDB_CPC::Computer::Computer | ( | string | name, | |
| int | port | |||
| ) | [inline] |
Definition at line 26 of file Computer.cs.
References m_cpcdPort, m_name, m_processes, m_socket, and m_status.
00027 { 00028 m_name = name; 00029 m_status = Status.Disconnected; 00030 m_processes = new ArrayList(); 00031 m_cpcdPort=port; 00032 m_socket = new SocketComm(m_name,m_cpcdPort); 00033 }
| NDB_CPC::Computer::Computer | ( | string | name, | |
| string | ip | |||
| ) | [inline] |
Definition at line 35 of file Computer.cs.
References m_cpcdPort, m_ip, m_name, m_processes, m_socket, and m_status.
00036 { 00037 m_ip = ip; 00038 m_name = name; 00039 m_status = Status.Disconnected; 00040 m_processes = new ArrayList(); 00041 m_cpcdPort=1234; //default port 00042 m_socket = new SocketComm(m_ip,m_cpcdPort); 00043 }
| void NDB_CPC::Computer::addProcess | ( | Process | process | ) | [inline] |
Definition at line 108 of file Computer.cs.
References m_processes.
Referenced by NDB_CPC::ProcessDefineDialog::btnAdd_Click(), and NDB_CPC::PanelWizard::prepareNodeConfigurationPanel().
00109 { 00110 m_processes.Add(process); 00111 }
Here is the caller graph for this function:

| void NDB_CPC::Computer::connectToCpcd | ( | ) | [inline] |
Definition at line 45 of file Computer.cs.
References NDB_CPC::socketcomm::SocketComm::doConnect(), and m_socket.
Referenced by NDB_CPC::startDatabaseDlg::defineProcesses(), and NDB_CPC::startDatabaseDlg::startProcesses().
Here is the call graph for this function:

Here is the caller graph for this function:

| int NDB_CPC::Computer::defineProcess | ( | Process | p | ) | [inline] |
Definition at line 162 of file Computer.cs.
References define(), m_socket, p, and sendMessage().
Referenced by NDB_CPC::startDatabaseDlg::defineProcesses(), and startProcess().
00163 { 00164 string define = "define process \n"; 00165 define = define + "name:" + p.getName() + "\n"; 00166 define = define + "group:" + p.getDatabase() + "\n"; 00167 define = define + "env:" + "NDB_CONNECTSTRING="+p.getConnectString() ; 00168 if(p.getEnv().Equals("")) 00169 define = define + "\n"; 00170 else 00171 define = define + " " + p.getEnv() + "\n"; 00172 00173 //if(p.getPath().EndsWith("\\")) 00174 // define = define + "path:" + p.getPath()+ "ndb" + "\n"; 00175 //else 00176 define = define + "path:" + p.getPath() + "\n"; 00177 define = define + "args:" + p.getArgs() + "\n"; 00178 define = define + "type:" + "permanent" + "\n"; 00179 define = define + "cwd:" + p.getCwd() + "\n"; 00180 define = define + "owner:" + "ejohson" + "\n\n"; 00181 00182 if(!sendMessage(define)) 00183 return -2; 00184 00185 SimpleCPCParser.parse(p, m_socket); 00186 if(p.isDefined()) 00187 return 1; 00188 else 00189 return -1; 00190 00191 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void NDB_CPC::Computer::disconnect | ( | ) | [inline] |
Definition at line 137 of file Computer.cs.
References NDB_CPC::socketcomm::SocketComm::disconnect(), and m_socket.
00138 { 00139 m_socket.disconnect(); 00140 }
Here is the call graph for this function:

| int NDB_CPC::Computer::getCpcdPort | ( | ) | [inline] |
| string NDB_CPC::Computer::getIp | ( | ) | [inline] |
| string NDB_CPC::Computer::getName | ( | ) | [inline] |
Definition at line 56 of file Computer.cs.
References m_name.
Referenced by NDB_CPC::PanelWizard::configureApi(), and NDB_CPC::PanelWizard::configureMgmt().
00056 {return m_name;}
Here is the caller graph for this function:

| Process NDB_CPC::Computer::getProcess | ( | string | id | ) | [inline] |
Definition at line 141 of file Computer.cs.
References m_processes.
00142 { 00143 foreach(Process process in m_processes) 00144 { 00145 if(process.getId().Equals(id)) 00146 return process; 00147 } 00148 return null; 00149 }
| Process NDB_CPC::Computer::getProcessByName | ( | string | name | ) | [inline] |
Definition at line 113 of file Computer.cs.
References m_processes.
Referenced by NDB_CPC::CPC::removeProcess(), NDB_CPC::CPC::startProcess(), and NDB_CPC::CPC::stopProcess().
00114 { 00115 foreach(Process process in m_processes) 00116 { 00117 if(process.getName().Equals(name)) 00118 return process; 00119 } 00120 return null; 00121 }
Here is the caller graph for this function:

| ArrayList NDB_CPC::Computer::getProcesses | ( | ) | [inline] |
Definition at line 58 of file Computer.cs.
References m_processes.
Referenced by NDB_CPC::CPC::removeComputer(), and NDB_CPC::CPC::tvComputerCluster_AfterSelect().
00059 { 00060 if(m_processes.Count>0) 00061 return m_processes; 00062 else 00063 return null; 00064 }
Here is the caller graph for this function:

| Status NDB_CPC::Computer::getStatus | ( | ) | [inline] |
Definition at line 88 of file Computer.cs.
References e, NDB_CPC::socketcomm::SocketComm::isConnected(), and m_socket.
00089 { 00090 try 00091 { 00092 if(m_socket.isConnected()) 00093 return Status.Connected; 00094 else 00095 return Status.Disconnected; 00096 } 00097 catch(Exception e) 00098 { 00099 return Status.Unknown; 00100 } 00101 }
Here is the call graph for this function:

| string NDB_CPC::Computer::getStatusString | ( | ) | [inline] |
Definition at line 65 of file Computer.cs.
References e, NDB_CPC::socketcomm::SocketComm::isConnected(), and m_socket.
00066 { 00067 try 00068 { 00069 if(m_socket.isConnected()) 00070 return "Connected"; 00071 else 00072 return "Disconnected"; 00073 } 00074 catch(Exception e) 00075 { 00076 return "Unknown"; 00077 } 00078 }
Here is the call graph for this function:

| bool NDB_CPC::Computer::isConnected | ( | ) | [inline] |
Definition at line 81 of file Computer.cs.
References NDB_CPC::socketcomm::SocketComm::isConnected(), and m_socket.
Referenced by NDB_CPC::startDatabaseDlg::defineProcesses(), and NDB_CPC::startDatabaseDlg::startProcesses().
00082 { 00083 if(m_socket.isConnected()) 00084 return true; 00085 return false; 00086 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NDB_CPC::Computer::listProcesses | ( | ) | [inline] |
Definition at line 151 of file Computer.cs.
References list(), m_processes, m_socket, and sendMessage().
00152 { 00153 string list = "list processes\n\n"; 00154 00155 if(!sendMessage(list)) 00156 return -2; 00157 00158 SimpleCPCParser.parse(m_processes, this, m_socket); 00159 return 1; 00160 }
Here is the call graph for this function:

| bool NDB_CPC::Computer::removeProcess | ( | string | name, | |
| string | database | |||
| ) | [inline] |
Definition at line 124 of file Computer.cs.
References m_processes, and p.
Referenced by NDB_CPC::Database::removeAllProcesses(), and NDB_CPC::CPC::removeProcess().
00125 { 00126 foreach(Process p in m_processes) 00127 { 00128 if(p.getName().Equals(name) && p.getDatabase().Equals(database)) 00129 { 00130 m_processes.Remove(p); 00131 return true; 00132 } 00133 } 00134 return false; 00135 }
Here is the caller graph for this function:

| bool NDB_CPC::Computer::sendMessage | ( | string | str | ) | [inline, private] |
Definition at line 50 of file Computer.cs.
References m_socket, and NDB_CPC::socketcomm::SocketComm::writeMessage().
Referenced by defineProcess(), listProcesses(), startProcess(), stopProcess(), and undefineProcess().
00051 { 00052 return m_socket.writeMessage(str); 00053 00054 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void NDB_CPC::Computer::setStatus | ( | Status | status | ) | [inline] |
| int NDB_CPC::Computer::startProcess | ( | Process | p | ) | [inline] |
Definition at line 193 of file Computer.cs.
References defineProcess(), m_socket, p, sendMessage(), and start().
Referenced by NDB_CPC::CPC::startProcess(), and NDB_CPC::startDatabaseDlg::startProcesses().
00194 { 00195 if(!p.isDefined()) 00196 { 00197 this.defineProcess(p); 00198 if(!p.isDefined()) 00199 return -4; //process misconfigured 00200 00201 } 00202 string start= "start process \n"; 00203 start = start + "id:" + p.getId() + "\n\n"; 00204 if(!sendMessage(start)) 00205 return -2; 00206 SimpleCPCParser.parse(p, m_socket); 00207 if(p.getStatus().Equals(Process.Status.Running)) 00208 return 1; 00209 else 00210 return -1; 00211 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NDB_CPC::Computer::stopProcess | ( | Process | p | ) | [inline] |
Definition at line 213 of file Computer.cs.
References m_socket, p, sendMessage(), and stop().
Referenced by NDB_CPC::CPC::stopProcess().
00214 { 00215 if(!p.isDefined()) 00216 { 00217 return -4; //process not defined 00218 } 00219 string stop= "stop process \n"; 00220 stop = stop + "id:" + p.getId() + "\n\n"; 00221 if(!sendMessage(stop)) 00222 return -2; 00223 SimpleCPCParser.parse(p, m_socket); 00224 00225 if(p.getStatus().Equals(Process.Status.Stopped)) 00226 return 1; 00227 else 00228 return -1; 00229 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int NDB_CPC::Computer::undefineProcess | ( | Process | p | ) | [inline] |
Definition at line 231 of file Computer.cs.
References m_socket, p, sendMessage(), and undefine().
Referenced by NDB_CPC::CPC::removeProcess().
00232 { 00233 if(!p.isDefined()) 00234 { 00235 return -4; //process not defined 00236 } 00237 string undefine= "undefine process \n"; 00238 undefine = undefine + "id:" + p.getId() + "\n\n"; 00239 if(!sendMessage(undefine)) 00240 return -2; 00241 SimpleCPCParser.parse(p, m_socket); 00242 if(!p.isDefined()) 00243 { 00244 return 1; 00245 00246 } 00247 return -1; 00248 }
Here is the call graph for this function:

Here is the caller graph for this function:

int NDB_CPC::Computer::m_cpcdPort [private] |
string NDB_CPC::Computer::m_ip [private] |
string NDB_CPC::Computer::m_name [private] |
ArrayList NDB_CPC::Computer::m_processes [private] |
Definition at line 24 of file Computer.cs.
Referenced by addProcess(), Computer(), getProcess(), getProcessByName(), getProcesses(), listProcesses(), and removeProcess().
SocketComm NDB_CPC::Computer::m_socket [private] |
Definition at line 25 of file Computer.cs.
Referenced by Computer(), connectToCpcd(), defineProcess(), disconnect(), getStatus(), getStatusString(), isConnected(), listProcesses(), sendMessage(), startProcess(), stopProcess(), and undefineProcess().
Status NDB_CPC::Computer::m_status [private] |
1.4.7

