Exemplo n.º 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);
        }
Exemplo n.º 2
0
        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);
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 8
0
 private static System.Xml.Linq.XDocument GetResponseContent(System.Xml.Linq.XDocument getChangelogStatus)
 {
     return(SoapRequest.Send(SoapActions.GetChangelogStatus, getChangelogStatus));
 }
Exemplo n.º 9
0
 private static XElement GetReturnValue()
 {
     return(SoapRequest.Send(SoapActions.GetPrecision, CreateGetPrecisionDocument())
            .Descendants(Provider.GeosynchronizationNamespace + XmlElements.Return.LocalName).First());
 }
Exemplo n.º 10
0
 private static XDocument GetResponseContent()
 {
     return(SoapRequest.Send(SoapActions.OrderChangelog2,
                             SetOrderVariables(SoapRequest.GetSoapContentByAction(SoapActions.OrderChangelog2))));
 }
Exemplo n.º 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));
 }