示例#1
0
        public CommandResponse[] ExecuteCommand(CommandRequest req)
        {
            JLogger.LogInfo(this, "ExecuteCommand:{0}", req.ToString());

            CommandResponse[] resp;
            try
            {
                var cmd = GetCommand(req.ServiceName, req.ServiceCommand);
                if (cmd != null)
                {
                    resp = (CommandResponse[])cmd.RunCommand(req);
                }
                else
                {
                    resp = new[]
                    {
                        new CommandResponse(CommandResponseCodes.ErrorCommandNotFound[0],
                                            CommandResponseCodes.ErrorCommandNotFound[1])
                    };
                }
            }
            catch (Exception ex)
            {
                resp = new[]
                {
                    new CommandResponse(CommandResponseCodes.ErrorExceptionFound[0],
                                        CommandResponseCodes.ErrorExceptionFound[1] + ex.Message)
                };
            }
            return(resp);
        }