private static void AddIMGOffering(Terradue.ServiceModel.Ogc.Eop21.EarthObservationType eo, IOpenSearchResultItem item) { Terradue.ServiceModel.Ogc.Eop21.BrowseInformationPropertyType[] bi = null; if (eo.result != null && eo.result.Eop21EarthObservationResult.browse != null) { bi = eo.result.Eop21EarthObservationResult.browse; } if (bi != null) { foreach (var browse in bi) { if (browse.BrowseInformation.type != "img") { continue; } OwcOffering offering = new OwcOffering(); offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/img"; offering.Contents = new OwcContent[1]; offering.Contents[0] = new OwcContent(); offering.Contents[0].Url = new Uri(browse.BrowseInformation.fileName.ServiceReference.href); item.ElementExtensions.Add(offering, new XmlSerializer(typeof(OwcOffering))); } } }
private static List <WpsServiceOverview> GetWpsServiceOverview(IfyContext context, OwcOffering offering, string appUid, string appTitle, string appIcon) { List <WpsServiceOverview> wpsOverviews = new List <WpsServiceOverview>(); if (offering != null) { if (offering.Operations != null) { foreach (var ops in offering.Operations) { if (ops.Code == "ListProcess") { var href = ops.Href; //replace usernames in apps try { var user = UserTep.FromId(context, context.UserId); href = href.Replace("${USERNAME}", user.Username); href = href.Replace("${T2USERNAME}", user.TerradueCloudUsername); href = href.Replace("${T2APIKEY}", user.GetSessionApiKey()); } catch (Exception e) { context.LogError(context, e.Message); } var uri = new Uri(href.Replace("file://", context.BaseUrl)); var nvc = HttpUtility.ParseQueryString(uri.Query); nvc.Set("count", "100"); Terradue.OpenSearch.Engine.OpenSearchEngine ose = MasterCatalogue.OpenSearchEngine; var responseType = ose.GetExtensionByExtensionName("atom").GetTransformType(); EntityList <WpsProcessOffering> wpsProcesses = new EntityList <WpsProcessOffering>(context); wpsProcesses.SetFilter("Available", "true"); wpsProcesses.OpenSearchEngine = ose; wpsProcesses.Identifier = string.Format("servicewps-{0}", context.Username); CloudWpsFactory wpsOneProcesses = new CloudWpsFactory(context); wpsOneProcesses.OpenSearchEngine = ose; wpsProcesses.Identifier = "service/wps"; var entities = new List <IOpenSearchable> { wpsProcesses, wpsOneProcesses }; var settings = MasterCatalogue.OpenSearchFactorySettings; MultiGenericOpenSearchable multiOSE = new MultiGenericOpenSearchable(entities, settings); IOpenSearchResultCollection osr = ose.Query(multiOSE, nvc, responseType); OpenSearchFactory.ReplaceOpenSearchDescriptionLinks(wpsProcesses, osr); foreach (var itemWps in osr.Items) { string uid = ""; var identifiers = itemWps.ElementExtensions.ReadElementExtensions <string>("identifier", "http://purl.org/dc/elements/1.1/"); if (identifiers.Count > 0) { uid = identifiers[0]; } string description = ""; if (itemWps.Content is TextSyndicationContent) { var content = itemWps.Content as TextSyndicationContent; description = content.Text; } string version = ""; var versions = itemWps.ElementExtensions.ReadElementExtensions <string>("version", "https://www.terradue.com/"); if (versions.Count > 0) { version = versions[0]; } string publisher = ""; var publishers = itemWps.ElementExtensions.ReadElementExtensions <string>("publisher", "http://purl.org/dc/elements/1.1/"); if (publishers.Count > 0) { publisher = publishers[0]; } var serviceUrl = new UriBuilder(context.GetConfigValue("BaseUrl")); serviceUrl.Path = "/t2api/service/wps/search"; serviceUrl.Query = "id=" + uid; var url = new UriBuilder(context.GetConfigValue("BaseUrl")); url.Path = "t2api/share"; url.Query = "url=" + HttpUtility.UrlEncode(serviceUrl.Uri.AbsoluteUri) + "&id=" + appUid; var icon = itemWps.Links.FirstOrDefault(l => l.RelationshipType == "icon"); //entry.Links.Add(new SyndicationLink(new Uri(this.IconUrl), "icon", null, null, 0)); wpsOverviews.Add(new WpsServiceOverview { Identifier = uid, App = new AppOverview { Icon = appIcon ?? "", Title = appTitle, Uid = appUid }, Name = itemWps.Title != null ? itemWps.Title.Text : uid, Description = description, Version = version, Provider = publisher, Url = url.Uri.AbsoluteUri, Icon = icon != null ? icon.Uri.AbsoluteUri : "" }); } } } } } return(wpsOverviews); }
private static List <CollectionOverview> GetDataCollectionOverview(IfyContext context, OwcOffering offering, string appUid, string appTitle, string appIcon) { List <CollectionOverview> collectionOverviews = new List <CollectionOverview>(); if (offering != null) { if (offering.Operations != null) { foreach (var ops in offering.Operations) { if (ops.Any == null || ops.Any[0] == null || ops.Any[0].InnerText == null) { continue; } if (ops.Code == "ListSeries") { EntityList <Collection> collections = new EntityList <Collection>(context); Terradue.OpenSearch.Engine.OpenSearchEngine ose = MasterCatalogue.OpenSearchEngine; var uri = new Uri(ops.Href); var nvc = HttpUtility.ParseQueryString(uri.Query); var resultColl = ose.Query(collections, nvc); foreach (var itemColl in resultColl.Items) { var itemCollIdTrim = itemColl.Identifier.Trim().Replace(" ", ""); var any = ops.Any[0].InnerText.Trim(); var anytrim = any.Replace(" ", "").Replace("*", itemCollIdTrim); any = any.Replace("*", itemColl.Identifier); var url = new UriBuilder(context.GetConfigValue("BaseUrl")); url.Path = "/geobrowser/"; url.Query = "id=" + appUid + "#!context=" + System.Web.HttpUtility.UrlEncode(anytrim); if (any != string.Empty) { collectionOverviews.Add(new CollectionOverview { Name = any, App = new AppOverview { Icon = appIcon ?? "", Title = appTitle, Uid = appUid }, Url = url.Uri.AbsoluteUri }); } } } else { var any = ops.Any[0].InnerText.Trim(); var anytrim = any.Replace(" ", ""); var url = new UriBuilder(context.GetConfigValue("BaseUrl")); url.Path = "/geobrowser/"; url.Query = "id=" + appUid + "#!context=" + System.Web.HttpUtility.UrlEncode(anytrim); if (any != string.Empty) { collectionOverviews.Add(new CollectionOverview { Name = any, App = new AppOverview { Icon = appIcon ?? "", Title = appTitle, Uid = appUid }, Url = url.Uri.AbsoluteUri }); } } } } } return(collectionOverviews); }
public void Serialize() { OwsContextAtomFeed feed = new OwsContextAtomFeed(); // display OwcDisplay display = new OwcDisplay() { PixelWidth = 800, PixelHeight = 600, MmPerPixel = 100 }; var displayAny = new System.Collections.Generic.List <XmlElement>(); display.Any = displayAny.ToArray(); feed.Display = display; // date DateTimeInterval interval = new DateTimeInterval(); interval.StartDate = DateTime.Parse("2010-05-30T05:54:34+02"); interval.EndDate = DateTime.Parse("2010-05-31T20:20:20.000Z"); feed.Date = interval; // georss GeoRssWhere georss = (GeoRssWhere)GeoRssHelper.Deserialize(XmlReader.Create(new StringReader("<georss:where xmlns:georss=\"http://www.georss.org/georss\">\n<gml:Polygon xmlns:gml=\"http://www.opengis.net/gml\">\n<gml:exterior>\n<gml:LinearRing>\n<gml:posList>45 -2 45 8 55 8 55 -2 45 -2</gml:posList>\n</gml:LinearRing>\n</gml:exterior>\n</gml:Polygon>\n</georss:where>"))); feed.Where = georss; /// entries List <OwsContextAtomEntry> items = new List <OwsContextAtomEntry>(); OwsContextAtomEntry item = new OwsContextAtomEntry(); List <OwcOffering> offerings = new List <OwcOffering>(); OwcOffering offering = new OwcOffering(); List <XmlElement> offeringAny = new List <XmlElement>(); offering.Any = offeringAny.ToArray(); List <OwcOperation> ops = new List <OwcOperation>(); ops.Add(new OwcOperation("GetCapabilities", new Uri("http://ows.genesi-dec.eu/geoserver/385d7d71-650a-414b-b8c7-739e2c0b5e76/wms?SERVICE=WMS&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilitiesVERSION=1.3.0&REQUEST=GetCapabilities"))); ops.Add(new OwcOperation("GetCapabilities2", new Uri("http://ows.genesi-dec.eu/geoserver/385d7d71-650a-414b-b8c7-739e2c0b5e76/wms?SERVICE=WMS&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilitiesVERSION=1.3.0&REQUEST=GetCapabilities"))); offering.Operations = ops.ToArray(); offerings.Add(offering); item.Offerings = offerings; items.Add(item); feed.Items = items; MemoryStream stream = new MemoryStream(); SerializeToStream(feed, stream); stream.Seek(0, SeekOrigin.Begin); SerializeToStream(feed, Console.Out); XDocument doc = XDocument.Load(stream); Assert.NotNull(doc.Element(XName.Get("feed", OwcNamespaces.Atom))); Assert.NotNull(doc.Element(XName.Get("feed", OwcNamespaces.Atom)).Element(XName.Get("display", OwcNamespaces.Owc))); Assert.AreEqual("2010-05-30T03:54:34.0000000Z/2010-05-31T20:20:20.0000000Z", doc.Element(XName.Get("feed", OwcNamespaces.Atom)).Element(XName.Get("date", OwcNamespaces.Dc)).Value); }
public void SerializeWithAny() { OwsContextAtomFeed feed = new OwsContextAtomFeed(); OwsContextAtomEntry entry = new OwsContextAtomEntry(); var items = new List <OwsContextAtomEntry>(); items.Add(entry); var offering = new OwcOffering(); List <OwcOperation> operations = new List <OwcOperation>(); Uri executeUri = new Uri("http://localhost/wps?"); Terradue.ServiceModel.Ogc.Owc.AtomEncoding.OwcOperation operation = new OwcOperation { Method = "POST", Code = "Execute", RequestUrl = executeUri }; List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >(); Parameters.Add(new KeyValuePair <string, string>("manu", "test")); Execute execute = new Execute(); execute.Identifier = new CodeType { Value = "id" }; execute.DataInputs = new List <InputType>(); foreach (var param in Parameters) { InputType input = new InputType(); input.Identifier = new CodeType { Value = param.Key }; input.Data = new DataType { Item = new LiteralDataType { Value = param.Value } }; execute.DataInputs.Add(input); } MemoryStream ms = new MemoryStream(); XmlWriter writer = XmlWriter.Create(ms); new System.Xml.Serialization.XmlSerializer(typeof(Execute)).Serialize(writer, execute); writer.Flush(); ms.Seek(0, SeekOrigin.Begin); XmlDocument doc = new XmlDocument(); doc.Load(ms); XmlElement any = (XmlElement)doc.DocumentElement.CloneNode(true); operation.Request = new OwcContent(); ((OwcContent)operation.Request).Any = any; operations.Add(operation); offering.Operations = operations.ToArray(); entry.Offerings = new List <OwcOffering> { offering }; entry.Categories.Add(new SyndicationCategory("WpsOffering")); entry.Summary = new TextSyndicationContent("summary"); entry.ElementExtensions.Add("identifier", "http://purl.org/dc/elements/1.1/", "id"); feed.Items = items; SerializeToStream(feed, Console.Out); }
//--------------------------------------------------------------------------------------------------------------------- public override AtomItem ToAtomItem(NameValueCollection parameters) { string providerUrl = null; string identifier = null; log.Debug("WpsProcessOffering - ToAtomItem"); if (this.ProviderId == 0 || this.Provider.Proxy) { providerUrl = context.BaseUrl + "/wps/WebProcessingService"; identifier = this.Identifier; } else { identifier = this.RemoteIdentifier; if (this.Provider.BaseUrl.Contains("request=")) { providerUrl = this.Provider.BaseUrl.Substring(0, this.Provider.BaseUrl.IndexOf("?")); } else { providerUrl = this.Provider.BaseUrl; } } var status = this.DoesGrantPermissionsToAll() ? "public" : (IsRestricted() ? "restricted" : "private"); if (identifier == null) { identifier = ""; } string name = (this.Name != null ? this.Name : identifier); string description = this.Description; string text = (this.TextContent != null ? this.TextContent : ""); if (!IsSearchable(parameters)) { return(null); } var capurl = providerUrl + "?service=WPS&request=GetCapabilities"; log.Debug("capabilities = " + capurl); Uri capabilitiesUri = new Uri(capurl); AtomItem atomEntry = null; var entityType = EntityType.GetEntityType(typeof(WpsProcessOffering)); Uri id = null; var idurl = context.BaseUrl; if (this.ProviderId == 0) { idurl = context.BaseUrl + "/" + entityType.Keyword + "/search?wpsUrl=" + HttpUtility.UrlEncode(this.Provider.BaseUrl) + "&pId=" + this.RemoteIdentifier; } else { idurl = context.BaseUrl + "/" + entityType.Keyword + "/search?id=" + this.Identifier; } log.Debug("id url = " + idurl); id = new Uri(idurl); try{ atomEntry = new AtomItem(name, description, capabilitiesUri, id.ToString(), DateTime.UtcNow); } catch (Exception) { atomEntry = new AtomItem(); } log.Debug("Adding owscontext"); OwsContextAtomEntry entry = new OwsContextAtomEntry(atomEntry); var offering = new OwcOffering(); List <OwcOperation> operations = new List <OwcOperation>(); var describeurl = providerUrl + "?service=WPS" + "&request=DescribeProcess" + "&version=" + this.Provider.WPSVersion + "&identifier=" + identifier; log.Debug("describeprocess url = " + describeurl); Uri describeUri = new Uri(describeurl); var executeurl = providerUrl + "?service=WPS" + "&request=Execute" + "&version=" + this.Provider.WPSVersion + "&identifier=" + identifier; log.Debug("execute url = " + executeurl); Uri executeUri = new Uri(executeurl); operations.Add(new OwcOperation { Method = "GET", Code = "GetCapabilities", Href = capabilitiesUri.AbsoluteUri }); operations.Add(new OwcOperation { Method = "GET", Code = "DescribeProcess", Href = describeUri.AbsoluteUri }); operations.Add(new OwcOperation { Method = "POST", Code = "Execute", Href = executeUri.AbsoluteUri }); offering.Operations = operations.ToArray(); entry.Offerings = new List <OwcOffering> { offering }; if (string.IsNullOrEmpty(this.provider.Description)) { entry.Publisher = (this.Provider != null ? this.Provider.Name : "Unknown"); } else { entry.Publisher = this.Provider.Name + " (" + this.Provider.Description + ")"; } if (this.Provider != null) { entry.ElementExtensions.Add("providerId", "https://www.terradue.com/", this.Provider.Identifier); } //categories if (this.Available) { entry.Categories.Add(new SyndicationCategory("available")); } if (this.Commercial) { entry.Categories.Add(new SyndicationCategory("commercial")); } if (this.Provider.Id == 0) { entry.Categories.Add(new SyndicationCategory("Discovered")); } if (this.Provider.IsSandbox) { entry.Categories.Add(new SyndicationCategory("sandbox")); } entry.Categories.Add(new SyndicationCategory("visibility", null, status)); entry.Categories.Add(new SyndicationCategory("WpsOffering")); foreach (var tag in GetTagsAsList()) { entry.Categories.Add(new SyndicationCategory("tag", "", tag)); } if (this.Commercial) { var contact = ExtractProviderContact(this.Provider.Contact); if (!string.IsNullOrEmpty(contact)) { entry.Categories.Add(new SyndicationCategory("contact", null, contact)); } } if (this.Quotable) { entry.Categories.Add(new SyndicationCategory("quotable")); } entry.ElementExtensions.Add("identifier", "http://purl.org/dc/elements/1.1/", this.Identifier); if (!string.IsNullOrEmpty(this.RemoteIdentifier)) { entry.ElementExtensions.Add("remote_identifier", "http://purl.org/dc/elements/1.1/", this.RemoteIdentifier); } if (!string.IsNullOrEmpty(this.Version)) { entry.ElementExtensions.Add("version", "https://www.terradue.com/", this.Version); } if (this.Domain != null) { entry.ElementExtensions.Add("domain", "https://www.terradue.com/", this.Domain.Identifier); } if (!string.IsNullOrEmpty(this.Geometry)) { entry.ElementExtensions.Add("spatial", "http://purl.org/dc/terms/", this.Geometry); } entry.Links.Add(new SyndicationLink(id, "self", name, "application/atom+xml", 0)); if (!string.IsNullOrEmpty(this.IconUrl)) { log.Debug("icon link = " + IconUrl); entry.Links.Add(new SyndicationLink(new Uri(this.IconUrl), "icon", null, null, 0)); } if (!string.IsNullOrEmpty(this.Geometry)) { entry.ElementExtensions.Add("box", "http://www.georss.org/georss", this.Geometry); } return(new AtomItem(entry)); }
private static void AddIMGOffering(Terradue.ServiceModel.Ogc.Eop21.EarthObservationType eo, IOpenSearchResultItem item) { Terradue.ServiceModel.Ogc.Eop21.BrowseInformationPropertyType[] bi = null; if (eo.result != null && eo.result.Eop21EarthObservationResult.browse != null) { bi = eo.result.Eop21EarthObservationResult.browse; } if (bi != null) { foreach (var browse in bi) { if (browse.BrowseInformation.type != "img") continue; OwcOffering offering = new OwcOffering(); offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/img"; offering.Contents = new OwcContent[1]; offering.Contents[0] = new OwcContent(); offering.Contents[0].Url = new Uri(browse.BrowseInformation.fileName.ServiceReference.href); item.ElementExtensions.Add(offering, new XmlSerializer(typeof(OwcOffering))); } } }
private AtomFeed CreateFeedForRDF(XmlNode any, string identifier, string baseurl) { OwsContextAtomFeed feed = new OwsContextAtomFeed(); List <OwsContextAtomEntry> entries = new List <OwsContextAtomEntry> (); XmlDocument doc = new XmlDocument(); doc.LoadXml(any.OuterXml); XmlNamespaceManager xmlns = new XmlNamespaceManager(doc.NameTable); xmlns.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); xmlns.AddNamespace("dclite4g", "http://xmlns.com/2008/dclite4g#"); xmlns.AddNamespace("dc", "http://purl.org/dc/elements/1.1/"); xmlns.AddNamespace("dct", "http://purl.org/dc/terms/"); var onlineResource = doc.SelectNodes("rdf:RDF/dclite4g:DataSet/dclite4g:onlineResource", xmlns); var createddate = doc.SelectSingleNode("rdf:RDF/dclite4g:DataSet/dct:created", xmlns).InnerText; var modifieddate = doc.SelectSingleNode("rdf:RDF/dclite4g:DataSet/dct:modified", xmlns).InnerText; feed.Title = new Terradue.ServiceModel.Syndication.TextSyndicationContent(doc.SelectSingleNode("rdf:RDF/dclite4g:DataSet/dc:title", xmlns).InnerText); feed.Description = new Terradue.ServiceModel.Syndication.TextSyndicationContent(doc.SelectSingleNode("rdf:RDF/dclite4g:DataSet/dc:subject", xmlns).InnerText); feed.Date = new DateTimeInterval { StartDate = Convert.ToDateTime(modifieddate), EndDate = Convert.ToDateTime(modifieddate) }; for (int i = 0; i < onlineResource.Count; i++) { string id = onlineResource [i].ChildNodes [0].Attributes.GetNamedItem("rdf:about").InnerText; Uri remoteUri = new Uri(id); OwsContextAtomEntry entry = new OwsContextAtomEntry(); entry.Id = remoteUri.AbsoluteUri; entry.Title = new Terradue.ServiceModel.Syndication.TextSyndicationContent(remoteUri.AbsoluteUri); entry.PublishDate = new DateTimeOffset(Convert.ToDateTime(modifieddate)); entry.LastUpdatedTime = new DateTimeOffset(Convert.ToDateTime(modifieddate)); entry.Date = new DateTimeInterval { StartDate = Convert.ToDateTime(modifieddate), EndDate = Convert.ToDateTime(modifieddate) }; entry.ElementExtensions.Add("identifier", OwcNamespaces.Dc, identifier); entry.Links.Add(Terradue.ServiceModel.Syndication.SyndicationLink.CreateMediaEnclosureLink(remoteUri, "application/octet-stream", 0)); List <OwcOffering> offerings = new List <OwcOffering> (); OwcOffering offering = new OwcOffering(); OwcContent content = new OwcContent(); content.Url = remoteUri;; string extension = remoteUri.AbsoluteUri.Substring(remoteUri.AbsoluteUri.LastIndexOf(".") + 1); switch (extension.ToLower()) { case "gif": content.Type = "image/gif"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/gif"; break; case "gtiff": content.Type = "image/tiff"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/geotiff"; break; case "jpeg": content.Type = "image/jpg"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/jpg"; break; case "png": content.Type = "image/png"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/png"; break; default: content.Type = "application/octet-stream"; offering.Code = null; break; } List <OwcContent> contents = new List <OwcContent> (); contents.Add(content); offering.Contents = contents.ToArray(); offerings.Add(offering); entry.Offerings = offerings; entries.Add(entry); } feed.Items = entries; AtomFeed atomfeed = new AtomFeed(feed); atomfeed.Title = feed.Title; atomfeed.Description = feed.Description; var urib = new UriBuilder(baseurl); urib.Path += "/proxy/wps/" + identifier + "/description"; atomfeed.Links.Add(new Terradue.ServiceModel.Syndication.SyndicationLink(urib.Uri, "search", "OpenSearch Description link", "application/opensearchdescription+xml", 0)); return(atomfeed); }
private AtomFeed CreateFeedForMetalink(XmlNode any, string identifier, string baseurl, IfyContext context) { OwsContextAtomFeed feed = new OwsContextAtomFeed(); List <OwsContextAtomEntry> entries = new List <OwsContextAtomEntry> (); XmlDocument doc = new XmlDocument(); doc.LoadXml(any.OuterXml); XmlNamespaceManager xmlns = new XmlNamespaceManager(doc.NameTable); xmlns.AddNamespace("ml", "http://www.metalinker.org"); var onlineResource = doc.SelectNodes("ml:metalink/ml:files/ml:file/ml:resources/ml:url", xmlns); var createddate = doc.SelectSingleNode("ml:metalink/ml:files/ml:file/ml:releasedate", xmlns).InnerText; var self = baseurl + "/proxy/wps/" + identifier + "/search"; var search = baseurl + "/proxy/wps/" + identifier + "/description"; feed.Id = self; feed.Title = new Terradue.ServiceModel.Syndication.TextSyndicationContent("Wps job results"); feed.Date = new DateTimeInterval { StartDate = Convert.ToDateTime(createddate), EndDate = Convert.ToDateTime(createddate) }; foreach (XmlNode node in onlineResource) { string url = node.InnerText; context.LogDebug(this, "Url = " + url); Uri remoteUri = new Uri(url); OwsContextAtomEntry entry = new OwsContextAtomEntry(); //link is an OWS context, we add it as is Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter(); if (url.Contains(".atom")) { NetworkCredential credentials = null; var uri = new UriBuilder(url); if (!string.IsNullOrEmpty(uri.UserName) && !string.IsNullOrEmpty(uri.Password)) { credentials = new NetworkCredential(uri.UserName, uri.Password); } HttpWebRequest atomRequest = WpsProvider.CreateWebRequest(url, credentials, context.Username); atomRequest.Accept = "*/*"; atomRequest.UserAgent = "Terradue TEP"; try { using (var atomResponse = (HttpWebResponse)atomRequest.GetResponse()) { using (var atomResponseStream = new MemoryStream()) { using (var stream = atomResponse.GetResponseStream()) stream.CopyTo(atomResponseStream); atomResponseStream.Seek(0, SeekOrigin.Begin); var sr = XmlReader.Create(atomResponseStream); atomFormatter.ReadFrom(sr); sr.Close(); } } } catch (Exception e) { context.LogError(this, e.Message, e); throw e; } return(new AtomFeed(atomFormatter.Feed)); } //we build the OWS context entry.Id = node.InnerText.Contains("/") ? node.InnerText.Substring(node.InnerText.LastIndexOf("/") + 1) : node.InnerText; entry.Title = new Terradue.ServiceModel.Syndication.TextSyndicationContent(remoteUri.AbsoluteUri); entry.PublishDate = new DateTimeOffset(Convert.ToDateTime(createddate)); entry.LastUpdatedTime = new DateTimeOffset(Convert.ToDateTime(createddate)); entry.Date = new DateTimeInterval { StartDate = Convert.ToDateTime(createddate), EndDate = Convert.ToDateTime(createddate) }; entry.ElementExtensions.Add("identifier", OwcNamespaces.Dc, entry.Id); entry.Links.Add(Terradue.ServiceModel.Syndication.SyndicationLink.CreateMediaEnclosureLink(remoteUri, "application/octet-stream", 0)); List <OwcOffering> offerings = new List <OwcOffering> (); OwcOffering offering = new OwcOffering(); OwcContent content = new OwcContent(); content.Url = remoteUri; string extension = remoteUri.AbsoluteUri.Substring(remoteUri.AbsoluteUri.LastIndexOf(".") + 1); switch (extension.ToLower()) { case "gif": content.Type = "image/gif"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/gif"; break; case "gtiff": content.Type = "image/tiff"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/geotiff"; break; case "jpeg": content.Type = "image/jpg"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/jpg"; break; case "png": content.Type = "image/png"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/png"; break; case "tgz": content.Type = "application/tar+gzip"; offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/tgz"; break; default: content.Type = "application/octet-stream"; offering.Code = ""; break; } List <OwcContent> contents = new List <OwcContent> (); contents.Add(content); offering.Contents = contents.ToArray(); offerings.Add(offering); entry.Offerings = offerings; entries.Add(entry); } feed.Items = entries; AtomFeed atomfeed = new AtomFeed(feed); atomfeed.Title = feed.Title; atomfeed.Description = feed.Description; var urib = new UriBuilder(baseurl); urib.Path += "/proxy/wps/" + identifier + "/description"; atomfeed.Links.Add(new Terradue.ServiceModel.Syndication.SyndicationLink(urib.Uri, "search", "OpenSearch Description link", "application/opensearchdescription+xml", 0)); return(atomfeed); }