public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); } catch (System.Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } return; } try { SocketHelper.TransferConnection(clientManager, cmdInfo.CacheId, command, acknowledgementId); } catch (System.Exception ex) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponseWithType(ex, command.requestID, command.commandID, clientManager.ClientVersion)); } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { long requestId; string taskId; Common.Protobuf.TaskProgressCommand taskProgressCommand = command.TaskProgressCommand; taskId = taskProgressCommand.taskId; requestId = command.requestID; try { ICommandExecuter tmpVar = clientManager.CmdExecuter; NCache nCache = (NCache)((tmpVar is NCache) ? tmpVar : null); Runtime.MapReduce.TaskStatus taskStatus = nCache.Cache.TaskStatus(taskId); Common.Protobuf.Response reponse = new Common.Protobuf.Response(); reponse.requestId = requestId; reponse.TaskProgressResponse = new Common.Protobuf.TaskProgressResponse(); reponse.TaskProgressResponse.progresses = Serialization.Formatters.CompactBinaryFormatter.ToByteBuffer(taskStatus, nCache.Cache.Name); reponse.responseType = Common.Protobuf.Response.Type.TASK_PROGRESS; reponse.commandID = command.commandID; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse)); } catch (Exception ex) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID)); } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { try { NCache cache = clientManager.CmdExecuter as NCache; SerializationFormat serializationFormat = cache.Cache.SerializationFormat; GetSerializationFormatResponse serializationFormatResponse = new GetSerializationFormatResponse() { serializationFormat = (int)serializationFormat }; if (clientManager.ClientVersion >= 5000) { Common.Util.ResponseHelper.SetResponse(serializationFormatResponse, command.requestID, command.commandID); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(serializationFormatResponse, Response.Type.GET_SERIALIZATION_FORMAT)); } else { //PROTOBUF:RESPONSE Response response = new Response(); response.getSerializationFormatResponse = serializationFormatResponse; Common.Util.ResponseHelper.SetResponse(response, command.requestID, command.commandID, Response.Type.GET_SERIALIZATION_FORMAT); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } } catch (System.Exception ex) { _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeExceptionResponseWithType(ex, command.requestID, command.commandID, clientManager.ClientVersion)); } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { // int overload; string exception = null; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); long messageCount = 0; try { NCache nCache = clientManager.CmdExecuter as NCache; if (nCache != null) { messageCount = nCache.Cache.GetMessageCount(command.messageCountCommand.topicName); _operationSuccessStatus = true; } stopwatch.Stop(); Common.Protobuf.MessageCountResponse messageCountResponse = new Common.Protobuf.MessageCountResponse(); messageCountResponse.messageCount = messageCount; if (clientManager.ClientVersion >= 5000) { Common.Util.ResponseHelper.SetResponse(messageCountResponse, command.requestID, command.commandID); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(messageCountResponse, Common.Protobuf.Response.Type.MESSAGE_COUNT)); } else { //PROTOBUF:RESPONSE Common.Protobuf.Response response = new Common.Protobuf.Response(); response.messageCountResponse = messageCountResponse; Common.Util.ResponseHelper.SetResponse(response, command.requestID, command.commandID, Common.Protobuf.Response.Type.MESSAGE_COUNT); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } } catch (Exception e) { exception = e.ToString(); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeExceptionResponseWithType(e, command.requestID, command.commandID, clientManager.ClientVersion)); } finally { TimeSpan executionTime = stopwatch.Elapsed; try { if (Management.APILogging.APILogManager.APILogManger != null && Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.MessageCount.ToLower()); log.GenerateCacheCountAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString(), messageCount); } } catch { } } }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.getConnectedClientsCommand = _getConnectedClients; _command.type = Common.Protobuf.Command.Type.GET_CONNECTED_CLIENTS; }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.addAttributeCommand = _addAttributeCommand; _command.type = Common.Protobuf.Command.Type.ADD_ATTRIBUTE; }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.initCommand = _initCommand; _command.type = Common.Protobuf.Command.Type.INIT; }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.touchCommand = _touchCommand; _command.type = Common.Protobuf.Command.Type.TOUCH; _command.MethodOverload = _methodOverload; }
private CommandInfo ParseCommand(Common.Protobuf.Command command) { CommandInfo cmdInfo = new CommandInfo(); Common.Protobuf.PingCommand pingCommand = command.pingCommand; cmdInfo.RequestId = pingCommand.requestId; return(cmdInfo); }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); int overload = 1; string exceptionMessage = null; bool result = false; try { NCache nCache = clientManager.CmdExecuter as NCache; var operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); if (command.commandVersion < 1) { operationContext.Add(OperationContextFieldName.ClientLastViewId, forcedViewId); } else { operationContext.Add(OperationContextFieldName.ClientLastViewId, command.clientLastViewId.ToString(CultureInfo.InvariantCulture)); } if (nCache != null) { _command = command.removeTopicCommand; TopicOperation topicOperation = new TopicOperation(_command.topicName, TopicOperationType.Remove); result = nCache.Cache.TopicOpertion(topicOperation, operationContext); Common.Protobuf.Response response = new Common.Protobuf.Response(); Common.Protobuf.RemoveTopicResponse removeTopicResponse = new Common.Protobuf.RemoveTopicResponse(); response.requestId = _command.requestId; response.commandID = command.commandID; removeTopicResponse.success = result; response.responseType = Common.Protobuf.Response.Type.REMOVE_TOPIC; response.removeTopicResponse = removeTopicResponse; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(response)); } } catch (Exception exc) { exceptionMessage = exc.ToString(); _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.DeleteTopic); log.GenerateGetCreateOrDeleteTopicAPILogItem(_command.topicName, executionTime, clientManager.ClientID, clientManager.ClientIP, overload, result, exceptionMessage); } } catch { } } }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.getReaderNextChunkCommand = _readerNextChunkCommand; _command.type = Common.Protobuf.Command.Type.GET_READER_CHUNK; _command.commandVersion = 1; _command.clientLastViewId = ClientLastViewId; }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { CommandInfo cmdInfo; int overload; string exception = null; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); try { overload = command.MethodOverload; cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); return; } int resultCount = 0; try { NCache cache = clientManager.CmdExecuter as NCache; List <ReaderResultSet> resultSetList = null; QueryDataFilters datafilters = new QueryDataFilters(cmdInfo.addDF, cmdInfo.updateDF, cmdInfo.removeDF); Alachisoft.NCache.Caching.OperationContext operationContext = new Caching.OperationContext(Alachisoft.NCache.Caching.OperationContextFieldName.OperationType, Alachisoft.NCache.Caching.OperationContextOperationType.CacheOperation); operationContext.Add(Caching.OperationContextFieldName.ClientId, clientManager.ClientID); operationContext.Add(Caching.OperationContextFieldName.ClientLastViewId, cmdInfo.ClientLastViewId); resultSetList = cache.Cache.ExecuteReaderCQ(cmdInfo.Query, cmdInfo.Values, cmdInfo.getData, cmdInfo.chunkSize, cmdInfo.clientUniqueId, clientManager.ClientID, cmdInfo.notifyAdd, cmdInfo.notifyUpdate, cmdInfo.notifyRemove, operationContext, datafilters); stopWatch.Stop(); ReaderResponseBuilder.Cache = cache.Cache; ReaderResponseBuilder.BuildExecuteReaderCQResponse(resultSetList, cmdInfo.CommandVersion, cmdInfo.RequestId, _serializedResponsePackets, command.commandID, clientManager.ClientVersion < 4620, out resultCount); } catch (Exception exc) { //PROTOBUF:RESPONSE exception = exc.ToString(); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.ExecuteReaderCQ.ToLower()); log.GenerateExecuteReaderCQAPILogItem(cmdInfo.Query, cmdInfo.Values, cmdInfo.getData, cmdInfo.chunkSize, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString(), resultCount); } } catch { } } }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.getCacheBindingCommand = _getCacheBinding; _command.type = Common.Protobuf.Command.Type.GET_CACHE_BINDING; _command.clientLastViewId = ClientLastViewId; _command.intendedRecipient = IntendedRecipient; }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { short callbackId; string taskId; int overload; string exception = null; System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); try { NCache nCache = clientManager.CmdExecuter as NCache; stopWatch.Start(); IEnumerable <ClientInfo> connectedClients = nCache.Cache.GetConnectedClientInfos(); Common.Protobuf.GetConnectedClientsResponse clientsResponse = new Common.Protobuf.GetConnectedClientsResponse(); Common.Protobuf.Response response = new Common.Protobuf.Response(); response.getConnectedClientsResponse = clientsResponse; response.requestId = command.getConnectedClientsCommand.requestId; response.commandID = command.commandID; response.responseType = Response.Type.GET_CONNECTED_CLIENTS; if (connectedClients != null) { foreach (var connectedClient in connectedClients) { clientsResponse.connectedClients.Add(new Common.Protobuf.ClientInfo { clientId = connectedClient.ClientID, processId = connectedClient.ProcessID, appName = connectedClient.AppName, ipAddress = connectedClient.IPAddress.ToString(), machineName = connectedClient.MachineName }); } } stopWatch.Stop(); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetConnectedClientList.ToLower()); log.GenerateGetConnectedClientsAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { string exception = null; int overload; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); try { overload = command.MethodOverload; cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } return; } try { NCache nCache = clientManager.CmdExecuter as NCache; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); nCache.Cache.Touch(cmdInfo.Keys, operationContext); stopWatch.Stop(); Common.Protobuf.Response response = new Common.Protobuf.Response(); Common.Protobuf.TouchResponse touchResponse = new Common.Protobuf.TouchResponse(); response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.commandID = command.commandID; response.responseType = Common.Protobuf.Response.Type.TOUCH; response.touchResponse = touchResponse; _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { exception = exc.ToString(); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Management.APILogging.APILogManager.APILogManger != null && Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.Touch.ToLower()); log.GenerateTouchCommandAPILogItem(cmdInfo.Keys.Count, overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = base.RequestId; _command.mesasgeAcknowledgmentCommand = _mesasgeAckCommand; _command.type = Common.Protobuf.Command.Type.MESSAGE_ACKNOWLEDGMENT; _command.clientLastViewId = ClientLastViewId; _command.intendedRecipient = IntendedRecipient; _command.version = "4200"; _command.commandVersion = 1; }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = base.RequestId; _command.unSubscribeTopicCommand = _unSubscribeTopicCommand; _command.type = Common.Protobuf.Command.Type.UNSUBSCRIBE_TOPIC; _command.clientLastViewId = ClientLastViewId; _command.intendedRecipient = IntendedRecipient; _command.version = "4200"; _command.commandVersion = 1; // NCache 4.1 Onwards }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.getMessageCommand = _getMessgaeCommand; _command.type = Common.Protobuf.Command.Type.GET_MESSAGE; _command.clientLastViewId = ClientLastViewId; _command.intendedRecipient = IntendedRecipient; _command.version = "4200"; _command.commandVersion = 1; }
public static bool Queable(object command) { if (!(command is Common.Protobuf.Command)) { return(false); } Common.Protobuf.Command cmd = (Common.Protobuf.Command)command; return(IsBasicCRUDOperation(cmd.type)); }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = base.RequestId; _command.removeTopicCommand = _removeTopicCommand; _command.type = Common.Protobuf.Command.Type.REMOVE_TOPIC; _command.clientLastViewId = ClientLastViewId; _command.intendedRecipient = IntendedRecipient; _command.version = "4200"; _command.commandVersion = 1; }
protected override void CreateCommand() { _command = new Common.Protobuf.Command(); _command.requestID = RequestId; _command.messagePublishCommand = _publishMessageCommand; _command.type = Common.Protobuf.Command.Type.MESSAGE_PUBLISH; _command.clientLastViewId = ClientLastViewId; _command.intendedRecipient = IntendedRecipient; _command.version = "4200"; _command.commandVersion = 1; }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { long requestId; int overload; string exception = null; System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); requestId = command.requestID; try { ICommandExecuter tmpVar = clientManager.CmdExecuter; NCache nCache = (NCache)((tmpVar is NCache) ? tmpVar : null); // the Actual Call. ArrayList runningTasks = nCache.Cache.RunningTasks; // Build response Common.Protobuf.Response reponse = new Common.Protobuf.Response(); reponse.requestId = requestId; reponse.commandID = command.commandID; reponse.RunningTasksResponse = new Common.Protobuf.GetRunningTasksResponse(); List <string> list = new List <string>(runningTasks.Count); foreach (string inst in runningTasks) { list.Add(inst); } reponse.RunningTasksResponse.runningTasks.AddRange(list); reponse.responseType = Common.Protobuf.Response.Type.RUNNING_TASKS; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse)); } catch (Exception ex) { exception = ex.ToString(); _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetRunningTasks.ToLower()); log.GenerateGetRunningTasksAPILogItem(1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); int overload = 1; string exceptionMessage = null; try { NCache nCache = clientManager.CmdExecuter as NCache; if (nCache != null) { _command = command.getMessageCommand; var operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); if (command.commandVersion < 1) { operationContext.Add(OperationContextFieldName.ClientLastViewId, forcedViewId); } else // NCache 4.1 SP1 or later { operationContext.Add(OperationContextFieldName.ClientLastViewId, command.clientLastViewId.ToString(CultureInfo.InvariantCulture)); } _clientId = clientManager.ClientID; SubscriptionInfo subInfo = new SubscriptionInfo() { ClientId = clientManager.ClientID }; _result = nCache.Cache.GetAssignedMessages(subInfo, operationContext); GetMessageResponseBuilder.BuildResponse(_result, command.commandVersion, _command.requestId.ToString(CultureInfo.InvariantCulture), _serializedResponsePackets, command.commandID, nCache.Cache); } } catch (System.Exception exc) { exceptionMessage = exc.ToString(); _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetTopicMessages); log.GenerateGetTopicMessagesAPILogItem(executionTime, clientManager.ClientID, clientManager.ClientIP, overload, _result, exceptionMessage); } } catch { } } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { long requestId; short callbackId; string taskId; string exception = null; System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); Common.Protobuf.TaskCallbackCommand taskCallbackCommand = command.TaskCallbackCommand; requestId = command.requestID; callbackId = (short)taskCallbackCommand.callbackId; taskId = taskCallbackCommand.taskId; try { stopWatch.Start(); ICommandExecuter tempVar = clientManager.CmdExecuter; NCache nCache = (NCache)((tempVar is NCache) ? tempVar : null); nCache.Cache.RegisterTaskNotificationCallback(taskId, new TaskCallbackInfo(clientManager.ClientID, callbackId), new Caching.OperationContext()); stopWatch.Stop(); Common.Protobuf.Response reponse = new Common.Protobuf.Response(); reponse.requestId = requestId; reponse.commandID = command.commandID; Common.Protobuf.TaskCallbackResponse taskCallbackResp = new Common.Protobuf.TaskCallbackResponse(); reponse.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.TASK_CALLBACK; reponse.TaskCallbackResponse = taskCallbackResp; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse)); } catch (Exception ex) { exception = exception.ToString(); _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.GetTaskResult.ToLower()); log.GenerateGetTaskResultAPILogItem(taskId.ToString(), 1, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } return; } try { Alachisoft.NCache.Common.ProductVersion _currentVersion = Alachisoft.NCache.Common.ProductVersion.ProductInfo; Alachisoft.NCache.Common.Protobuf.GetProductVersionResponse getProductVersionResponse = new Alachisoft.NCache.Common.Protobuf.GetProductVersionResponse(); getProductVersionResponse.productVersion.AddiotionalData = _currentVersion.AdditionalData; getProductVersionResponse.productVersion.EditionID = _currentVersion.EditionID; getProductVersionResponse.productVersion.MajorVersion1 = this.ParseToByteArray(_currentVersion.MajorVersion1); getProductVersionResponse.productVersion.MajorVersion2 = this.ParseToByteArray(_currentVersion.MajorVersion2); getProductVersionResponse.productVersion.MinorVersion1 = this.ParseToByteArray(_currentVersion.MinorVersion1); getProductVersionResponse.productVersion.MinorVersion2 = this.ParseToByteArray(_currentVersion.MinorVersion2); getProductVersionResponse.productVersion.ProductName = _currentVersion.ProductName; if (clientManager.ClientVersion >= 5000) { ResponseHelper.SetResponse(getProductVersionResponse, command.requestID, command.commandID); _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(getProductVersionResponse, Common.Protobuf.Response.Type.GET_PRODUCT_VERSION)); } else { Common.Protobuf.Response response = new Common.Protobuf.Response(); response.getProductVersionResponse = getProductVersionResponse; ResponseHelper.SetResponse(response, command.requestID, command.commandID, Common.Protobuf.Response.Type.GET_PRODUCT_VERSION); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { //_commandBytes = clientManager.ReplyPacket(base.ExceptionPacket(exc, base.immatureId), base.ParsingExceptionMessage(exc)); //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } return; } try { NCache nCache = clientManager.CmdExecuter as NCache; OperationContext context = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); context.Add(OperationContextFieldName.ClientId, clientManager.ClientID); nCache.Cache.RegisterPollingNotification(cmdInfo.PollingCallbackId, context); //PROTOBUF:RESPONSE Alachisoft.NCache.Common.Protobuf.RegisterPollNotifResponse registerNotifResponse = new Alachisoft.NCache.Common.Protobuf.RegisterPollNotifResponse(); if (clientManager.ClientVersion >= 5000) { Common.Util.ResponseHelper.SetResponse(registerNotifResponse, command.requestID, command.commandID); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(registerNotifResponse, Common.Protobuf.Response.Type.REGISTER_POLL_NOTIF)); } else { Common.Protobuf.Response response = new Common.Protobuf.Response(); response.registerPollNotifResponse = registerNotifResponse; Common.Util.ResponseHelper.SetResponse(response, command.requestID, command.commandID, Common.Protobuf.Response.Type.REGISTER_POLL_NOTIF); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } } catch (Exception exc) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager).clone(); } catch (System.Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponseWithoutType(exc, command.requestID, command.commandID)); } return; } try { if (!CacheProvider.Provider.IsRunning(cmdInfo.CacheId)) { throw new System.Exception("Specified cache is not running."); } int port = 0; #if NETCORE port = CacheProvider.Provider.GetCacheInfo(cmdInfo.CacheId).ManagementPort; #else port = CacheProvider.Provider.Renderer.Port; #endif string bindIP = ServiceConfiguration.BindToIP.ToString(); Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); GetCacheManagementPortResponse getCacheManagementPortResponse = new GetCacheManagementPortResponse(); getCacheManagementPortResponse.isRunning = true; getCacheManagementPortResponse.port = port; getCacheManagementPortResponse.server = bindIP; response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.commandID = command.commandID; response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.GET_CACHE_MANAGEMENT_PORT; response.getCacheManagementPortResponse = getCacheManagementPortResponse; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(response)); } catch (System.Exception ex) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponseWithoutType(ex, command.requestID, command.commandID)); } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { CommandInfo commandInfo; try { commandInfo = ParseCommand(command); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { //_resultPacket = clientManager.ReplyPacket(base.ExceptionPacket(exc, base.immatureId), base.ParsingExceptionMessage(exc)); //_resultPacket = Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } return; } NCache nCache = clientManager.CmdExecuter as NCache; Cache cache = nCache.Cache; Alachisoft.NCache.Config.Dom.ExpirationPolicy policy = null; policy = cache.Configuration.ExpirationPolicy; Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.GetExpirationResponse getExpirationResponse = new Alachisoft.NCache.Common.Protobuf.GetExpirationResponse(); getExpirationResponse.absDefault = policy.AbsoluteExpiration.Default; getExpirationResponse.absDefaultEnabled = policy.AbsoluteExpiration.DefaultEnabled; getExpirationResponse.sldDefault = policy.SlidingExpiration.Default; getExpirationResponse.sldDefaultEnabled = policy.SlidingExpiration.DefaultEnabled; getExpirationResponse.absLonger = policy.AbsoluteExpiration.Longer; getExpirationResponse.absLongerEnabled = policy.AbsoluteExpiration.LongerEnabled; getExpirationResponse.sldLonger = policy.SlidingExpiration.Longer; getExpirationResponse.sldLongerEnabled = policy.SlidingExpiration.LongerEnabled; response.getExpirationResponse = getExpirationResponse; response.requestId = Convert.ToInt64(commandInfo.requestId); response.commandID = command.commandID; response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.EXPIRATION_RESPONSE; //PROTOBUF:RESPONSE //_resultPacket = clientManager.ReplyPacket("GETCOMPACTTYPESRESULT \"" + cmdInfo.RequestId + "\"" + compactTypesString + "\"", new byte[0]); //_resultPacket = Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { #if !DEVELOPMENT try { ServerMapping serverMapping = Management.MappingConfiguration.MappingConfigurationManager.GetMappingConfiguration().ClientIPMapping; Mapping[] mappedServers = serverMapping.MappingServers; Common.Protobuf.Response response = new Common.Protobuf.Response(); Common.Protobuf.GetServerMappingResponse getServerMappingResponse = new Common.Protobuf.GetServerMappingResponse(); if (mappedServers != null) { for (int i = 0; i < mappedServers.Length; i++) { Common.Protobuf.ServerMapping mappingObject = new Common.Protobuf.ServerMapping(); //Map the server list to protobuf object mappingObject.privateIp = mappedServers[i].PrivateIP; mappingObject.privatePort = mappedServers[i].PrivatePort; mappingObject.publicIp = mappedServers[i].PublicIP; mappingObject.publicPort = mappedServers[i].PublicPort; //Adding to list to be sent as a response getServerMappingResponse.serverMapping.Add(mappingObject); } } else { SocketServer.Logger.NCacheLog.Error("Server Mapping is null"); } response.getServerMappingResponse = getServerMappingResponse; response.responseType = Common.Protobuf.Response.Type.GET_SERVER_MAPPING; response.requestId = command.requestID; response.commandID = command.commandID; _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponseWithoutType(exc, command.requestID, command.commandID)); } #endif }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { long requestId; string taskId; short callbackId; long clientLastViewId; Common.Protobuf.TaskEnumeratorCommand taskEnumeratorCommand = command.TaskEnumeratorCommand; taskId = taskEnumeratorCommand.TaskId; requestId = command.requestID; callbackId = (short)taskEnumeratorCommand.CallbackId; clientLastViewId = command.clientLastViewId; try { ICommandExecuter tempVar = clientManager.CmdExecuter; NCache nCache = (NCache)((tempVar is NCache) ? tempVar : null); OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientLastViewId, clientLastViewId); List <Common.MapReduce.TaskEnumeratorResult> enumerators = nCache.Cache.GetTaskEnumerator(new Common.MapReduce.TaskEnumeratorPointer( clientManager.ClientID, taskId, callbackId), operationContext); Common.Protobuf.Response reponse = new Common.Protobuf.Response(); reponse.requestId = requestId; reponse.commandID = command.commandID; Common.Protobuf.TaskEnumeratorResponse taskEnumResponse = new Common.Protobuf.TaskEnumeratorResponse(); foreach (Common.MapReduce.TaskEnumeratorResult rslt in enumerators) { taskEnumResponse.TaskEnumeratorResult.Add(Serialization.Formatters.CompactBinaryFormatter.ToByteBuffer(rslt, nCache.Cache.Name)); } reponse.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.TASK_ENUMERATOR; reponse.TaskEnumeratorResponse = taskEnumResponse; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(reponse)); } catch (Exception ex) { _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponse(ex, command.requestID, command.commandID)); } }