Example #1
0
        public static bool Run()
        {
            var getCapabilities = SoapRequest.GetSoapContentByAction(SoapActions.GetCapabilities);

            var responseContent = SoapRequest.Send(SoapActions.GetCapabilities, getCapabilities);

            if (responseContent.Descendants(XmlNamespaces.Soap + XmlElements.Fault.LocalName).Any())
            {
                SwapGeosynkchronizationVersion();

                getCapabilities = SoapRequest.GetSoapContentByAction(SoapActions.GetCapabilities);

                responseContent = SoapRequest.Send(SoapActions.GetCapabilities, getCapabilities);
            }

            if (Provider.ConfigFile == null)
            {
                Provider.ConfigFile = responseContent.Descendants(XmlNamespaces.Ows + XmlElements.Title.LocalName)
                                      .First().Value
                                      .Replace(" ", "_") + ".xml";
            }

            var datasetsList = GetDatasets(responseContent);

            Provider.Save(datasetsList);

            Console.WriteLine("Saved " + datasetsList.Count + " datasets to " + Provider.ConfigFile);

            return(true);
        }
        public static void Run()
        {
            var getChangelogStatus = SoapRequest.GetSoapContentByAction(SoapActions.GetChangelogStatus);

            getChangelogStatus.Descendants(Provider.GeosynchronizationNamespace + XmlAttributes.ChangelogId.LocalName)
            .First().Value =
                Dataset.OrderedChangelogId;

            var queryCounter = 1;

            while (true)
            {
                var returnValue = GetChangelogStatusResponseValue(getChangelogStatus);

                Console.WriteLine("Query " + queryCounter + ": changelog with ID " + Dataset.OrderedChangelogId +
                                  " is " + returnValue);

                switch (returnValue)
                {
                case "queued":
                case "working":
                    Task.Delay(Config.StatusQueryDelay * queryCounter++).Wait();
                    continue;

                case "finished":
                    return;

                default:
                    throw new Exception("Status for changelog with ID " + Dataset.OrderedChangelogId + ": " +
                                        returnValue);
                }
            }
        }
Example #3
0
        private static XDocument CreateGetPrecisionDocument()
        {
            var getPrecisionDocument = SoapRequest.GetSoapContentByAction(SoapActions.GetPrecision);

            getPrecisionDocument.Descendants(Provider.GeosynchronizationNamespace + XmlAttributes.DatasetId.LocalName).First()
            .Value = Dataset.Id;

            return(getPrecisionDocument);
        }
        public static string Run()
        {
            var getDatasetVersion = SoapRequest.GetSoapContentByAction(SoapActions.GetDatasetVersion);

            getDatasetVersion.Descendants(Provider.GeosynchronizationNamespace + XmlAttributes.DatasetId.LocalName).First()
            .Value = Dataset.Id;

            return(SoapRequest.Send(SoapActions.GetDatasetVersion, getDatasetVersion)
                   .Descendants(Provider.GeosynchronizationNamespace + XmlElements.Return.LocalName).First().Value.Trim());
        }
Example #5
0
        public static bool Run()
        {
            var xDocument = SoapRequest.GetSoapContentByAction(SoapActions.GetLastIndex);

            xDocument.Descendants(Provider.GeosynchronizationNamespace + XmlAttributes.DatasetId.LocalName).First()
            .Value = Dataset.Id;

            Dataset.SetProviderLastIndex(GetLastIndexFromProvider(xDocument));

            return(Dataset.ProviderLastIndex > Dataset.SubscriberLastIndex);
        }
Example #6
0
        public static string Run()
        {
            var getChangelog = SoapRequest.GetSoapContentByAction(SoapActions.GetChangelog);

            getChangelog.Descendants(Provider.GeosynchronizationNamespace + XmlAttributes.ChangelogId.LocalName).First()
            .Value =
                Dataset.OrderedChangelogId;

            var responseContent = SoapRequest.Send(SoapActions.GetChangelog, getChangelog);

            var returnValue = responseContent
                              .Descendants(Provider.GeosynchronizationNamespace + XmlElements.DownloadUri.LocalName).First().Value;

            return(returnValue);
        }
Example #7
0
        public static void Run()
        {
            if (Dataset.OrderedChangelogId != Dataset.EmptyValue)
            {
                return;
            }

            var responseContent =
                SoapRequest.Send(SoapActions.OrderChangelog,
                                 SetOrderVariables(SoapRequest.GetSoapContentByAction(SoapActions.OrderChangelog)));

            Dataset.OrderedChangelogId =
                responseContent
                .Descendants(Provider.GeosynchronizationNamespace + XmlAttributes.ChangelogId.LocalName).First()
                .Value;

            Provider.ConfigFileXml.Descendants(XmlElements.Dataset)
            .First(d => d.Attribute(XmlAttributes.DatasetId)?.Value == Dataset.Id)
            .Descendants(XmlElements.AbortedChangelog).First().Attribute(XmlAttributes.ChangelogId)
            .Value =
                Dataset.OrderedChangelogId;

            Provider.Save();
        }
 private static System.Xml.Linq.XDocument GetResponseContent(System.Xml.Linq.XDocument getChangelogStatus)
 {
     return(SoapRequest.Send(SoapActions.GetChangelogStatus, getChangelogStatus));
 }
Example #9
0
 private static XElement GetReturnValue()
 {
     return(SoapRequest.Send(SoapActions.GetPrecision, CreateGetPrecisionDocument())
            .Descendants(Provider.GeosynchronizationNamespace + XmlElements.Return.LocalName).First());
 }
Example #10
0
 private static XDocument GetResponseContent()
 {
     return(SoapRequest.Send(SoapActions.OrderChangelog2,
                             SetOrderVariables(SoapRequest.GetSoapContentByAction(SoapActions.OrderChangelog2))));
 }
Example #11
0
 private static long GetLastIndexFromProvider(System.Xml.Linq.XDocument xDocument)
 {
     return(Convert.ToInt64(SoapRequest.Send(SoapActions.GetLastIndex, xDocument)
                            .Descendants(Provider.GeosynchronizationNamespace + XmlElements.Return.LocalName).First().Value));
 }