public IActionResult EsriMap(string cmd, string ServiceName, string content) { if (cmd == "ping") { return(Result("gView MapServer Instance v" + gView.Framework.system.SystemVariables.gViewVersion.ToString(), "text/plain")); } if (cmd == "getversion") { return(Result(gView.Framework.system.SystemVariables.gViewVersion.ToString(), "text/plain")); } if (cmd == "capabilities") { content = @"<?xml version=""1.0"" encoding=""UTF-8""?><ARCXML version=""1.1""><REQUEST><GET_SERVICE_INFO fields=""true"" envelope=""true"" renderer=""true"" extensions=""true"" /></REQUEST></ARCXML>"; } var interpreter = InternetMapServer.GetInterpreter(typeof(ArcXMLRequest)); #region Request if (String.IsNullOrEmpty(content) && Request.Body.CanRead) { MemoryStream ms = new MemoryStream(); byte[] bodyData = new byte[1024]; int bytesRead; while ((bytesRead = Request.Body.Read(bodyData, 0, bodyData.Length)) > 0) { ms.Write(bodyData, 0, bytesRead); } content = Encoding.UTF8.GetString(ms.ToArray()); } ServiceRequest serviceRequest = new ServiceRequest(ServiceName, content); serviceRequest.OnlineResource = InternetMapServer.OnlineResource; #endregion #region Security Identity identity = Identity.FromFormattedString(String.Empty); identity.HashedPassword = String.Empty; serviceRequest.Identity = identity; #endregion #region Queue & Wait IServiceRequestContext context = new ServiceRequestContext( InternetMapServer.Instance, interpreter, serviceRequest); InternetMapServer.ThreadQueue.AddQueuedThreadSync(interpreter.Request, context); #endregion return(Result(serviceRequest.Response, "text/xml")); }
private void Seed() { using (var context = new ServiceRequestContext()) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.SaveChanges(); } }
internal string[] GetCommandsStartingWith(ServiceRequestContext context) { string lowerCommand = context.Command.ToLowerInvariant(); return (_commandFactory.Commands.Where(x => x.Command.ToLowerInvariant().StartsWith(lowerCommand)) .Select(x => x.Keyword) .OrderBy(x => x.Length) .ToArray()); }
public string[] GetCommandsStartingWith(string command) { ServiceRequestContext context = new ServiceRequestContext { SessionId = Guid.NewGuid().ToString(), Token = null, Command = command }; return(_core.GetCommandsStartingWith(context)); }
private async Task <List <ServiceObject> > FilterServiceObjects(int id, string parameters, int?pageIndex, int?pageSize, List <ObjectKeyValuePair> filters, ServiceRequestContext svcRequestContext) { logger.LogDebug("Start FilterServiceObjects"); var objectList = await getAllServiceObjectAsync(id, 1, int.MaxValue, svcRequestContext, string.IsNullOrEmpty(parameters)?null : parameters.Split(new char[] { ',' })); logger.LogDebug(string.Format("filters : {0}", filters)); List <ServiceObject> foundObjects = new List <ServiceObject>(); if (filters != null) { foreach (var obj in objectList) { bool isFilterMatched = true; foreach (var f in filters) { var kvp = (from k in obj.Properties where k.KeyName.Equals(f.KeyName, StringComparison.InvariantCultureIgnoreCase) select k).FirstOrDefault(); isFilterMatched = kvp != null && isFilterMatched && IsFieldValueMatched((ServiceObjectField)kvp.Value, (string)f.Value, f.IsArray); //if there is a filter is not matched, then the complete record is not matched. if (!isFilterMatched) { break; } } if (isFilterMatched) { foundObjects.Add(obj); } } } else { foundObjects.AddRange(objectList); } logger.LogDebug("End FilterServiceObjects"); return(foundObjects .Skip((pageIndex.Value - 1) * pageSize.Value) .Take(pageSize.Value) .ToList()); }
public void Delete_ServiceRequest_Return_NotFound() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); var controller = new ServiceRequestController(context); sr.id = new Guid("dadd45b9-d13d-4fd1-9f29-514aa8459e0d"); var contentStatus = (NotFoundResult)controller.DeleteServiceRequest(sr.id).Result.Result; Assert.NotNull(contentStatus); Assert.Equal(404, contentStatus.StatusCode); } }
public void Put_ServiceRequest_Return_BadRequest_For_CurrentStatus() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); sr.currentStatus = "Invalid code"; var controller = new ServiceRequestController(context); var contentStatus = (BadRequestObjectResult)controller.PutServiceRequest(sr.id, sr).Result; Assert.NotNull(contentStatus); Assert.Equal(400, contentStatus.StatusCode); } }
public void Put_ServiceRequest_Return_BadRequest_For_Id() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); sr.currentStatus = "InProgress"; var controller = new ServiceRequestController(context); var contentStatus = (BadRequestObjectResult)controller.PutServiceRequest(new Guid("dadd45b9-d13d-4fd1-9f29-514aa8459e0d"), sr).Result; Assert.NotNull(contentStatus); Assert.Equal(400, contentStatus.StatusCode); } }
public ServiceCommandOutput <string> ExecuteCommand(string command, string token) { ServiceRequestContext context = new ServiceRequestContext { SessionId = token, Token = token, Command = command }; var commandOutput = _core.ExecuteCommand(context); return(commandOutput.ConvertForJson()); }
public IActionResult Legend(string folder, string id) { try { if (folder != DefaultFolder) { throw new Exception("Unknown folder: " + folder); } var interpreter = InternetMapServer.GetInterpreter(typeof(ArcGisServerInterperter)); #region Request ServiceRequest serviceRequest = new ServiceRequest(id, String.Empty) { OnlineResource = InternetMapServer.OnlineResource, Method = "legend" }; #endregion #region Security Identity identity = Identity.FromFormattedString(String.Empty); identity.HashedPassword = String.Empty; serviceRequest.Identity = identity; #endregion #region Queue & Wait IServiceRequestContext context = new ServiceRequestContext( InternetMapServer.Instance, interpreter, serviceRequest); InternetMapServer.ThreadQueue.AddQueuedThreadSync(interpreter.Request, context); #endregion return(Result(JsonConvert.DeserializeObject <LegendResponse>(serviceRequest.Response))); } catch (Exception ex) { return(Json(new JsonError() { error = new JsonError.Error() { code = 999, message = ex.Message } })); } }
public void GetAll_ServiceRequests_Return_NoContent() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); var controller = new ServiceRequestController(context); var contentStatus = (NoContentResult)controller.GetserviceRequests().Result.Result; Assert.NotNull(contentStatus); Assert.Equal(204, contentStatus.StatusCode); } }
public void Delete_ServiceRequest_Request_Is_Deleted() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); var controller = new ServiceRequestController(context); _ = controller.PostServiceRequest(sr); var result = controller.DeleteServiceRequest(sr.id); var deletedItem = controller.GetServiceRequest(sr.id); Assert.NotNull(result); Assert.Equal(sr, result.Result.Value); Assert.Null(deletedItem.Result.Value); } }
public void Post_ServiceRequest_Return_201() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); var controller = new ServiceRequestController(context); var result = (CreatedAtActionResult)controller.PostServiceRequest(sr).Result.Result; Assert.NotNull(result); Assert.NotNull(result.StatusCode); Assert.Equal(201, result.StatusCode); } }
public void Put_ServiceRequest_Return_ServiceRequest() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); sr.currentStatus = "InProgress"; var controller = new ServiceRequestController(context); _ = controller.PutServiceRequest(sr.id, sr); var result = controller.GetServiceRequest(sr.id); Assert.NotNull(result); Assert.Equal(sr, result.Result.Value); } }
async public Task <IActionResult> EsriMap(string cmd, string ServiceName, string content) { return(await SecureMethodHandler(async (identity) => { if (cmd == "ping") { return Result("gView MapServer Instance v" + gView.Framework.system.SystemVariables.gViewVersion.ToString(), "text/plain"); } if (cmd == "getversion") { return Result(gView.Framework.system.SystemVariables.gViewVersion.ToString(), "text/plain"); } if (cmd == "capabilities") { content = @"<?xml version=""1.0"" encoding=""UTF-8""?><ARCXML version=""1.1""><REQUEST><GET_SERVICE_INFO fields=""true"" envelope=""true"" renderer=""true"" extensions=""true"" /></REQUEST></ARCXML>"; } var interpreter = _mapServerService.GetInterpreter(typeof(ArcXMLRequest)); #region Request if (String.IsNullOrEmpty(content)) { content = await GetBody(); } ServiceRequest serviceRequest = new ServiceRequest(ServiceName.ServiceName(), ServiceName.FolderName(), content) { Identity = identity, OnlineResource = _mapServerService.Options.OnlineResource, OutputUrl = _mapServerService.Options.OutputUrl, }; #endregion #region Queue & Wait IServiceRequestContext context = await ServiceRequestContext.TryCreate( _mapServerService.Instance, interpreter, serviceRequest, checkSecurity: ServiceName.ToLower() != "catalog"); await _mapServerService.TaskQueue.AwaitRequest(interpreter.Request, context); #endregion return Result(serviceRequest.ResponseAsString, "text/xml"); })); }
// https://localhost:44331/tilewmts/tor_tiles/compact/ul/31256/default/8/14099/16266.jpg async public Task <IActionResult> TileWmts(string name, string cachetype, string origin, string epsg, string style, string level, string row, string col, string folder = "") { if (IfMatch()) { return(base.NotModified()); } #region Security Identity identity = Identity.FromFormattedString(_loginMananger.GetAuthToken(this.Request).Username); #endregion var interpreter = _mapServiceMananger.GetInterpreter(typeof(WMTSRequest)); #region Request string requestString = cachetype + "/" + origin + "/" + epsg + "/" + style + "/~" + level + "/" + row + "/" + col; ServiceRequest serviceRequest = new ServiceRequest(name, folder, requestString) { OnlineResource = _mapServiceMananger.Options.OnlineResource + "/ogc/" + name, OutputUrl = _mapServiceMananger.Options.OutputUrl, Identity = identity }; #endregion IServiceRequestContext context = await ServiceRequestContext.TryCreate( _mapServiceMananger.Instance, interpreter, serviceRequest); //await interpreter.Request(context); await _mapServiceMananger.TaskQueue.AwaitRequest(interpreter.Request, context); var imageData = serviceRequest.Response as byte[]; if (imageData != null) { if (serviceRequest.ResponseExpries.HasValue) { base.AppendEtag(serviceRequest.ResponseExpries.Value); } return(Result(imageData, serviceRequest.ResponseContentType)); } return(null); }
public void Post_ServiceRequest_Return_BadRequest() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); sr.currentStatus = "invalid status"; var controller = new ServiceRequestController(context); var content = (BadRequestObjectResult)controller.PostServiceRequest(sr).Result.Result; Assert.NotNull(content); Assert.NotNull(content.StatusCode); Assert.Equal(400, content.StatusCode); } }
public void Get_ServiceRequest_Return_ServiceRequest() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); var controller = new ServiceRequestController(context); var result = controller.PostServiceRequest(sr); result = controller.GetServiceRequest(sr.id); Assert.NotNull(result); Assert.NotNull(result.Result); Assert.Equal(sr, result.Result.Value); } }
public void GetAll_ServiceRequests_Return_ServiceRequest() { using (var context = new ServiceRequestContext()) { ServiceRequest sr = GetServiceRequest(); var controller = new ServiceRequestController(context); _ = controller.PostServiceRequest(sr); ServiceRequest sr2 = GetServiceRequest(); sr2.id = new Guid("dadd45b9-d13d-4fd1-9f29-514aa8459e0d"); List <ServiceRequest> srs = new List <ServiceRequest>(); srs.Add(sr); srs.Add(sr2); _ = controller.PostServiceRequest(sr2); var results = controller.GetserviceRequests(); Assert.NotNull(results); Assert.NotNull(results.Result); Assert.Equal(srs, results.Result.Value); } }
private async Task <ActionResult> FindServiceObjects(int id, ServiceRequestContext svcRequestContext, string parameters = null, int?pageIndex = 1, int?pageSize = int.MaxValue, List <ObjectKeyValuePair> filters = null) { if (!pageIndex.HasValue || pageIndex <= 0) { pageIndex = 1; } if (!pageSize.HasValue || pageSize <= 0) { pageSize = int.MaxValue; } List <ServiceObject> foundObjects = await FilterServiceObjects(id, parameters, pageIndex, pageSize, filters, svcRequestContext); logger.LogDebug(string.Format("foundObjects {0}", foundObjects != null ? foundObjects.Count : 0)); return(Ok(foundObjects)); }
// GET api/values public async Task <IEnumerable <string> > Get() { var tasks = new List <Task>(); var names = new List <string>(); var random = new Random(Environment.TickCount); for (int i = 0; i < 20; i++) { var next = random.Next(0, _names.Length); var user = _names[next]; names.Add(user); var index = i; var task = ServiceRequestContext.RunInRequestContext(async() => { var firstService = ServiceProxyFactory.CreateServiceProxy <IFirstService>(new Uri($"{FabricRuntime.GetActivationContext().ApplicationName}/FirstService")); await firstService.DoStuffAsync(index.ToString(), CancellationToken.None); }, Guid.NewGuid(), user); tasks.Add(task); } Task.WaitAll(tasks.ToArray()); return(names.ToArray()); }
public IActionResult OgcRequest(string id, string service = "") { try { IServiceRequestInterpreter interpreter = null; switch (service.ToLower().Split(',')[0]) { case "wms": interpreter = InternetMapServer.GetInterpreter(typeof(WMSRequest)); break; case "wfs": interpreter = InternetMapServer.GetInterpreter(typeof(WFSRequest)); break; case "wmts": interpreter = InternetMapServer.GetInterpreter(typeof(WMTSRequest)); break; default: throw new Exception("Missing or unknow service: " + service); } #region Request string requestString = Request.QueryString.ToString(); if (Request.Method.ToLower() == "post" && Request.Body.CanRead) { MemoryStream ms = new MemoryStream(); byte[] bodyData = new byte[1024]; int bytesRead; while ((bytesRead = Request.Body.Read(bodyData, 0, bodyData.Length)) > 0) { ms.Write(bodyData, 0, bytesRead); } string body = Encoding.UTF8.GetString(ms.ToArray()); if (!String.IsNullOrWhiteSpace(body)) { requestString = body; } } while (requestString.StartsWith("?")) { requestString = requestString.Substring(1); } ServiceRequest serviceRequest = new ServiceRequest(id, requestString); serviceRequest.OnlineResource = InternetMapServer.OnlineResource + "/ogc/" + id; #endregion #region Security Identity identity = Identity.FromFormattedString(String.Empty); identity.HashedPassword = String.Empty; serviceRequest.Identity = identity; #endregion IServiceRequestContext context = new ServiceRequestContext( InternetMapServer.Instance, interpreter, serviceRequest); InternetMapServer.ThreadQueue.AddQueuedThreadSync(interpreter.Request, context); return(Result(serviceRequest.Response, "text/xml")); } catch (Exception ex) { // ToDo: OgcXmlExcpetion return(Result(ex.Message, "text/plain")); } }
public ServiceRequestController(ServiceRequestContext context) { _context = context; }
internal static void LoadConfig() { try { if (mapDocument == null) { return; } DirectoryInfo di = new DirectoryInfo(ServicesPath); if (!di.Exists) { di.Create(); } acl = new Acl(new FileInfo(ServicesPath + @"\acl.xml")); foreach (FileInfo fi in di.GetFiles("*.mxl")) { try { if (mapServices.Count < mapServer.MaxServices) { MapService service = new MapService(fi.FullName, MapServiceType.MXL); mapServices.Add(service); Console.WriteLine("service " + service.Name + " added"); } } catch (Exception ex) { if (Functions.log_errors) { Logger.Log(loggingMethod.error, "LoadConfig - " + fi.Name + ": " + ex.Message); } } } foreach (FileInfo fi in di.GetFiles("*.svc")) { try { if (mapServices.Count < mapServer.MaxServices) { MapService service = new MapService(fi.FullName, MapServiceType.SVC); mapServices.Add(service); Console.WriteLine("service " + service.Name + " added"); } } catch (Exception ex) { if (Functions.log_errors) { Logger.Log(loggingMethod.error, "LoadConfig - " + fi.Name + ": " + ex.Message); } } } try { // Config Datei laden... FileInfo fi = new FileInfo(ServicesPath + @"\config.xml"); if (fi.Exists) { XmlDocument doc = new XmlDocument(); doc.Load(fi.FullName); #region onstart - alias foreach (XmlNode serviceNode in doc.SelectNodes("MapServer/onstart/alias/services/service[@alias]")) { string serviceName = serviceNode.InnerText; MapService ms = new MapServiceAlias( serviceNode.Attributes["alias"].Value, serviceName.Contains(",") ? MapServiceType.GDI : MapServiceType.SVC, serviceName); mapServices.Add(ms); } #endregion #region onstart - load foreach (XmlNode serviceNode in doc.SelectNodes("MapServer/onstart/load/services/service")) { ServiceRequest serviceRequest = new ServiceRequest( serviceNode.InnerText, String.Empty); ServiceRequestContext context = new ServiceRequestContext( mapServer, null, serviceRequest); IServiceMap sm = mapServer[context]; /* * // Initalisierung...?! * sm.Display.iWidth = sm.Display.iHeight = 50; * IEnvelope env = null; * foreach (IDatasetElement dsElement in sm.MapElements) * { * if (dsElement != null && dsElement.Class is IFeatureClass) * { * if (env == null) * env = new Envelope(((IFeatureClass)dsElement.Class).Envelope); * else * env.Union(((IFeatureClass)dsElement.Class).Envelope); * } * } * sm.Display.ZoomTo(env); * sm.Render(); * */ } #endregion Console.WriteLine("config.xml loaded..."); } } catch (Exception ex) { if (Functions.log_errors) { Logger.Log(loggingMethod.error, "LoadConfig - config.xml: " + ex.Message); } } } catch (Exception ex) { if (Functions.log_errors) { Logger.Log(loggingMethod.error, "LoadConfig: " + ex.Message); } } }
public IActionResult FeatureServerDeleteFeatures(string folder, string id, int layerId) { try { if (folder != DefaultFolder) { throw new Exception("Unknown folder: " + folder); } var interpreter = InternetMapServer.GetInterpreter(typeof(ArcGisServerInterperter)); #region Request JsonFeatureServerEditRequest editRequest = Deserialize <JsonFeatureServerEditRequest>( Request.HasFormContentType ? (IEnumerable <KeyValuePair <string, StringValues> >)Request.Form : (IEnumerable <KeyValuePair <string, StringValues> >)Request.Query); editRequest.LayerId = layerId; ServiceRequest serviceRequest = new ServiceRequest(id, JsonConvert.SerializeObject(editRequest)) { OnlineResource = InternetMapServer.OnlineResource, Method = "featureserver_deletefeatures" }; #endregion #region Security Identity identity = Identity.FromFormattedString(String.Empty); identity.HashedPassword = String.Empty; serviceRequest.Identity = identity; #endregion #region Queue & Wait IServiceRequestContext context = new ServiceRequestContext( InternetMapServer.Instance, interpreter, serviceRequest); InternetMapServer.ThreadQueue.AddQueuedThreadSync(interpreter.Request, context); #endregion return(Result(JsonConvert.DeserializeObject <JsonFeatureServerResponse>(serviceRequest.Response))); } catch (Exception ex) { return(Result(new JsonFeatureServerResponse() { DeleteResults = new JsonFeatureServerResponse.JsonResponse[] { new JsonFeatureServerResponse.JsonResponse() { Success = false, Error = new JsonFeatureServerResponse.JsonError() { Code = 999, Description = ex.Message } } } })); } }
private Task <IEnumerable <ServiceObject> > getAllServiceObjectAsync(int id, int pageIndex, int pageSize, ServiceRequestContext svcRequestContext, string[] properties = null) { logger.LogDebug("Start getAllServiceObjectAsync"); var objectList = objectService.GetServiceObjects(id, properties, pageIndex, pageSize, svcRequestContext); logger.LogDebug("End getAllServiceObjectAsync"); return(Task.FromResult <IEnumerable <ServiceObject> >(objectList)); }
public IActionResult Query(string folder, string id, int layerId) { try { if (folder != DefaultFolder) { throw new Exception("Unknown folder: " + folder); } var interpreter = InternetMapServer.GetInterpreter(typeof(ArcGisServerInterperter)); #region Request JsonQueryLayer queryLayer = Deserialize <JsonQueryLayer>( Request.HasFormContentType ? (IEnumerable <KeyValuePair <string, StringValues> >)Request.Form : (IEnumerable <KeyValuePair <string, StringValues> >)Request.Query); queryLayer.LayerId = layerId; ServiceRequest serviceRequest = new ServiceRequest(id, JsonConvert.SerializeObject(queryLayer)) { OnlineResource = InternetMapServer.OnlineResource, Method = "query" }; #endregion #region Security Identity identity = Identity.FromFormattedString(String.Empty); identity.HashedPassword = String.Empty; serviceRequest.Identity = identity; #endregion #region Queue & Wait IServiceRequestContext context = new ServiceRequestContext( InternetMapServer.Instance, interpreter, serviceRequest); InternetMapServer.ThreadQueue.AddQueuedThreadSync(interpreter.Request, context); #endregion if (serviceRequest.Succeeded) { if (queryLayer.ReturnCountOnly == true) { return(Result(JsonConvert.DeserializeObject <JsonFeatureCountResponse>(serviceRequest.Response))); } else { return(Result(JsonConvert.DeserializeObject <JsonFeatureResponse>(serviceRequest.Response))); } } else { return(Result(JsonConvert.DeserializeObject <JsonError>(serviceRequest.Response))); } } catch (Exception ex) { return(Json(new JsonError() { error = new JsonError.Error() { code = 999, message = ex.Message } })); } }
async public Task <IActionResult> MapRequest(string guid, string name, string folder) { try { if (IfMatch()) { return(NotModified()); } #region Security Identity identity = Identity.FromFormattedString(_loginMananger.GetAuthToken(this.Request).Username); #endregion if (!String.IsNullOrWhiteSpace(folder)) { name = folder + "/" + name; } //DateTime td = DateTime.Now; //Console.WriteLine("Start Map Request " + td.ToLongTimeString() + "." + td.Millisecond + " (" + name + ")"); //System.Threading.Thread.Sleep(10000); //string user, pwd; //var request = Request(out user, out pwd); #region Request string input = await GetBody(); if (String.IsNullOrEmpty(input)) { input = this.Request.QueryString.ToString(); } if (input.StartsWith("?")) { input = input.Substring(1); } ServiceRequest serviceRequest = new ServiceRequest(name.ServiceName(), name.FolderName(), input) { OnlineResource = _mapServiceManager.Options.OnlineResource + "/MapRequest/" + guid + "/" + name, OutputUrl = _mapServiceManager.Options.OutputUrl, Identity = identity }; #endregion IServiceRequestInterpreter interpreter = _mapServiceManager.GetInterpreter(new Guid(guid)); #region Queue & Wait IServiceRequestContext context = await ServiceRequestContext.TryCreate( _mapServiceManager.Instance, interpreter, serviceRequest); await _mapServiceManager.TaskQueue.AwaitRequest(interpreter.Request, context); #endregion string ret = serviceRequest.ResponseAsString; return(Result(ret, "text/xml")); } catch (MapServerException mse) { return(WriteError(mse.Message)); } catch (UnauthorizedAccessException) { return(WriteUnauthorized()); } }
public string ServiceRequest2(string OnlineResource, string service, string request, string InterpreterGUID, string usr, string pwd) { //string clientAddress = CallContext.GetData("ClientAddress").ToString(); try { #if (DEBUG) Logger.LogDebug("Start SendRequest"); #endif Identity id = Identity.FromFormattedString(usr); id.HashedPassword = pwd; if (IMS.acl != null && !IMS.acl.HasAccess(id, pwd, service)) { throw new UnauthorizedAccessException(); //return "ERROR: Not Authorized!"; } if (service == "catalog" && IMS.acl != null) { IMS.acl.ReloadXmlDocument(); } if (service == "catalog" && request == "get_used_servers") { StringBuilder sb = new StringBuilder(); sb.Append("<servers>"); foreach (DataRow server in MapServer.GDIServers.Rows) { sb.Append("<server uri='" + (string)server["Server"] + "' port='" + (int)server["Port"] + "' />"); } sb.Append("</servers>"); return(sb.ToString()); } if (service == "catalog" && request == "get_instance_info") { StringBuilder sb = new StringBuilder(); MapServer mapServer = IMS.mapServer; sb.Append("<instance_info>"); if (mapServer != null) { sb.Append("<output url='" + mapServer.OutputUrl + "' />"); } sb.Append("</instance_info>"); return(sb.ToString()); } Guid guid = new Guid(InterpreterGUID); IServiceRequestInterpreter interperter = null; foreach (IServiceRequestInterpreter i in IMS._interpreters) { if (PlugInManager.PlugInID(i) == guid) { interperter = i; break; } } if (interperter == null) { return("FATAL ERROR: Unknown request interpreger..."); } // User berechtigungen überprüfen ServiceRequest serviceRequest = new ServiceRequest(service, request); serviceRequest.OnlineResource = OnlineResource; //serviceRequest.UserName = usr; serviceRequest.Identity = id; IServiceRequestContext context = new ServiceRequestContext( IMS.mapServer, interperter, serviceRequest); //ManualResetEvent resetEvent = new ManualResetEvent(false); //IMS.threadQueue.AddQueuedThread(interperter.Request, context, resetEvent); //resetEvent.WaitOne(); IMS.threadQueue.AddQueuedThreadSync(interperter.Request, context); return(serviceRequest.Response); #if (DEBUG) Logger.LogDebug("SendRequest Finished"); #endif } catch (Exception ex) { //System.Diagnostics.Process.GetCurrentProcess().Kill(); return("FATAL ERROR: " + ex.Message); } }
public ServiceRequestBusiness(ServiceRequestContext serviceRequestContext) { this._serviceRequestContext = serviceRequestContext; }