public object Deserialize(Stream buffer) { Alachisoft.NCache.Common.Protobuf.ManagementCommand command = null; command = ProtoBuf.Serializer.Deserialize <Alachisoft.NCache.Common.Protobuf.ManagementCommand>(buffer); buffer.Close(); return(command); }
//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.ManagementCommand command) { object result = null; try { if (command.objectName == ManagementUtil.ManagementObjectName.CacheServer) { result = CacheProvider.ManagementRpcService.InvokeMethodOnTarget(command.methodName, command.overload, GetTargetMethodParameters(command.arguments)); } //_resultPacket = clientManager.ReplyPacket("COUNTRESULT \"" + cmdInfo.RequestId + "\"", data); Alachisoft.NCache.Common.Protobuf.ManagementResponse response = new Alachisoft.NCache.Common.Protobuf.ManagementResponse(); response.methodName = command.methodName; response.version = command.commandVersion; response.requestId = command.requestId; response.returnVal = SerializeResponse(result); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, Convert.ToInt32(command.requestId), -1, clientManager.ClientVersion)); } }
public object Deserialize(byte[] buffer, long commandSize) { Alachisoft.NCache.Common.Protobuf.ManagementCommand command = null; using (MemoryStream stream = new MemoryStream(buffer, 0, (int)commandSize)) { command = ProtoBuf.Serializer.Deserialize <Alachisoft.NCache.Common.Protobuf.ManagementCommand>(stream); stream.Close(); } return(command); }
public void ProcessCommand(ClientManager clientManager, object command, long acknowledgementId, UsageStats stats) { Alachisoft.NCache.Common.Protobuf.ManagementCommand cmd = command as Alachisoft.NCache.Common.Protobuf.ManagementCommand; if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "enter"); } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "" + cmd); } if (SocketServer.Logger.IsDetailedLogsEnabled) { SocketServer.Logger.NCacheLog.Info("ConnectionManager.ReceiveCallback", clientManager.ToString() + " COMMAND to be executed : " + "Management Command" + " RequestId :" + cmd.requestId); } NCManagementCommandBase incommingCmd = null; incommingCmd = new ManagementCommand(); incommingCmd.ExecuteCommand(clientManager, cmd); if (SocketServer.Logger.IsDetailedLogsEnabled) { SocketServer.Logger.NCacheLog.Info("ConnectionManager.ReceiveCallback", clientManager.ToString() + " after executing COMMAND : " + "Management Command" + " RequestId :" + cmd.requestId); } #if COMMUNITY if (clientManager != null && incommingCmd.OperationResult == OperationResult.Success) { if (clientManager.CmdExecuter != null) { clientManager.CmdExecuter.UpdateSocketServerStats(new SocketServerStats(clientManager.ClientsRequests, clientManager.ClientsBytesSent, clientManager.ClientsBytesRecieved)); } } #endif if (clientManager != null && incommingCmd.SerializedResponsePackets != null && !clientManager.IsCacheStopped) { foreach (IList reponse in incommingCmd.SerializedResponsePackets) { ConnectionManager.AssureSend(clientManager, reponse, Common.Enum.Priority.Normal); } } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "exit"); } }
public void ProcessCommand(ClientManager clientManager, object command) { Alachisoft.NCache.Common.Protobuf.ManagementCommand cmd = command as Alachisoft.NCache.Common.Protobuf.ManagementCommand; if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "enter"); } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "" + cmd); } if (SocketServer.Logger.IsDetailedLogsEnabled) { SocketServer.Logger.NCacheLog.Info("ConnectionManager.ReceiveCallback", clientManager.ToString() + " COMMAND to be executed : " + "Management Command" + " RequestId :" + cmd.requestId); } NCManagementCommandBase incommingCmd = null; incommingCmd = new ManagementCommand(); //PROTOBUF /*****************************************************************/ /**/ incommingCmd.ExecuteCommand(clientManager, cmd);/**/ /*****************************************************************/ if (SocketServer.Logger.IsDetailedLogsEnabled) { SocketServer.Logger.NCacheLog.Info("ConnectionManager.ReceiveCallback", clientManager.ToString() + " after executing COMMAND : " + "Management Command" + " RequestId :" + cmd.requestId); } if (clientManager != null && incommingCmd.SerializedResponsePackets != null && !clientManager.IsCacheStopped) { foreach (byte[] reponse in incommingCmd.SerializedResponsePackets) { ConnectionManager.AssureSend(clientManager, reponse, Common.Enum.Priority.Normal); } } if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("CmdMgr.PrsCmd", "exit"); } }
abstract public void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.ManagementCommand command);