Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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();
            }
        }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
        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;
        }