示例#1
0
        protected object ExecuteCommandOnCacehServer(Alachisoft.NCache.Common.Protobuf.ManagementCommand command)
        {
            ManagementResponse response = null;
            if (_requestManager != null)
            {
                try
                {
                    response = _requestManager.SendRequest(command) as ManagementResponse;
                }
                catch (System.Exception e)
                {
                    throw new ManagementException(e.Message,e);
                }

                if (response != null && response.exception != null)
                {
                    throw new ManagementException(response.exception.message);
                }
            }

            if (response != null)
                return response.ReturnValue;

            return null;
        }
示例#2
0
        protected object ExecuteCommandOnCacehServer(Alachisoft.NCache.Common.Protobuf.ManagementCommand command)
        {
            ManagementResponse response = null;

            if (_requestManager != null)
            {
                try
                {
                    response = _requestManager.SendRequest(command) as ManagementResponse;
                }
                catch (System.Exception e)
                {
                    throw new ManagementException(e.Message, e);
                }

                if (response != null && response.exception != null)
                {
                    if (response.exception.type == Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATON_EXCEPTION)
                    {
                        throw new VersionException(response.exception.message, response.exception.errorCode);
                    }

                    throw new ManagementException(response.exception.message);
                }
            }

            if (response != null)
            {
                return(response.ReturnValue);
            }

            return(null);
        }
示例#3
0
        private ManagementCommand GetManagementCommand(string method, int overload)
        {
            ManagementCommand command = new ManagementCommand();
            command.methodName = method;
            command.overload = overload;
            command.objectName = ManagementUtil.ManagementObjectName.CacheServer;

            if (!string.IsNullOrEmpty(Source))
            {
                if (Source.ToLower() == "manager")
                    command.source = ManagementCommand.SourceType.MANAGER;
                else
                    command.source = ManagementCommand.SourceType.TOOL;
            }
            else
                command.source = ManagementCommand.SourceType.TOOL;
            
            return command;
        }