コード例 #1
0
        public IGeoserverRestResponse GetLayerInfoBy(string datastore, string workspace, string layername)
        {
            var uri = $@"workspaces/{workspace}/datastores/{datastore}/featuretypes/{layername}";
            var request = new ServiceRequest(uri);
            var response = restService.Get(request);

            var output = new GeoserverRestResponse
            {
                Data = response.Data,
                Code = response.StatusCode
            };

            if (response.StatusCode == HttpStatusCode.OK)
            {
                output.FeatureTypeRoot = JsonConvert.DeserializeObject<FeatureTypeRoot>(response.Data);
            }
            if (response.StatusCode == HttpStatusCode.NotFound)
            {
                output.IsMissingDataStore = response.Data.StartsWith("No such datastore");
                output.IsMissingWorkSpace = response.Data.StartsWith("No such workspace");
                output.IsMissingFeatureType = response.Data.StartsWith("No such feature type");
            }

            return output;
        }
コード例 #2
0
        public IGlobalSettingsRoot GetGlobalSettings()
        {
            const string uri = @"settings";

            var request = new ServiceRequest(uri);

            var response = restService.Get(request);

            var globalSettings = JsonConvert.DeserializeObject<GlobalSettingsRoot>(response.Data);

            return globalSettings;
        }
コード例 #3
0
        public IWorkspacesRoot GetAllWorkSpaces()
        {
            const string uri = @"workspaces";

            var request = new ServiceRequest(uri);

            var response = restService.Get(request);

            var workspacesRoot = JsonConvert.DeserializeObject<WorkspacesRoot>(response.Data);

            return workspacesRoot;
        }
コード例 #4
0
        public IGeoserverRestResponse GetServerStatus()
        {
            var request =new ServiceRequest("about/manifest");

            var response = restService.Get(request);

            var output = new GeoserverRestResponse
            {
                Data = response.Data,
                Code = response.StatusCode
            };
            return output;
        }
コード例 #5
0
        public IGeoserverRestResponse PutLayer(IFeatureTypeInfo layer)
        {
            var uri = $@"layers/{layer.Name}";
            var request = new ServiceRequest(uri);

            var layerRoot = LayerInfoTranslator.TranslateToRequestLayerRoot(layer);

            request.Body = JsonConvert.SerializeObject(layerRoot);

            var response = restService.Put(request);

            var output = new GeoserverRestResponse
            {
                Data = response.Data,
                Code = response.StatusCode
            };

            return output;
        }
コード例 #6
0
        public IGeoserverRestResponse PostLayer(IFeatureTypeInfo layer)
        {
            var uri = $@"workspaces/{layer.Workspace}/datastores/{layer.Datastore}/featuretypes";
            var request = new ServiceRequest(uri);

            var featureTypeRoot = LayerInfoTranslator.TranslateToRequestFeatureTypeRoot(layer);

            request.Body = JsonConvert.SerializeObject(featureTypeRoot);

            var response = restService.Post(request);

            var output = new GeoserverRestResponse
            {
                Data = response.Data,
                Code = response.StatusCode
            };

            return output;
        }