Пример #1
0
        /// <summary>
        /// Pokreze izvrsavanje bloka
        /// </summary>
        /// <param name="settings">Podesavanja webLoader-a</param>
        /// <param name="__syncMode">mod sinhronizacije</param>
        /// <returns>Referencu prema webResultBlock-u</returns>
        public webResultBlock executeBlock(webLoaderSettings settings, executionSyncMode __syncMode,
                                           webRequestBlockEvent __onFinished = null,
                                           webRequestBlockEvent __onAborted  = null,
                                           webRequestBlockEvent __onProgress = null)
        {
            __settings = settings;

            deploySettings(settings, __onFinished, __onAborted, __onProgress);

            if (__syncMode != executionSyncMode.unknown)
            {
                executeSyncMode = __syncMode;
            }
            output.Clear();


            if (executeSyncMode == executionSyncMode.synced)
            {
                startExecution(settings);
            }
            else
            {
                executeThread = new Thread(startExecution);
                executeThread.Start(settings);
            }

            return(output);
        }
Пример #2
0
        protected webResult _executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                            webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                            webRequestEvent __onRetry)
        {
            deploySettings(settings, __onExecutedOk, __onError, __onRetry);



            if (settings.doUseCache && webCacheSystem.hasCache(url))
            {
                status = webRequestEventType.executing;
                Thread lc = new Thread(loadCache);
                lc.Start();
                syncWaitingLoop(settings, __syncMode);
                if (status == webRequestEventType.executedOk)
                {
                    return(result);
                }
                else
                {
                }
                lc.Abort();
            }


            status = webRequestEventType.executing;
            executeBegin(settings);
            syncWaitingLoop(settings, __syncMode);

            if (doLogNewLoad)
            {
                aceLog.log("Load: " + url + " (" + status.toString() + ")");
            }
            return(result);
        }
        /// <summary>
        /// Izvrsavanje
        /// </summary>
        /// <param name="settings">Podesavanja loadera</param>
        /// <param name="__syncMode">Tip izvrsavanja</param>
        /// <param name="__onExecutedOk">kada je executedOk</param>
        /// <param name="__onError">za sve vrste gresaka</param>
        /// <param name="__onRetry">kada se desi retry</param>
        public override webResult executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                                 webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                                 webRequestEvent __onRetry)
        {
            url          = imbUrlOps.getStandardizedUrl(url, urlShema.http);
            settings.url = url;

            return(_executeRequest(settings, __syncMode, __onExecutedOk, __onError, __onRetry));
        }
Пример #4
0
        public List <webResultBlock> executeAllBlocks(executionSyncMode __syncMode)
        {
            List <webResultBlock> output = new List <webResultBlock>();

            foreach (webRequestBlock wRB in requestBlocks)
            {
                output.Add(wRB.executeBlock(settings, __syncMode, callRequestBlockFinished, callRequestBlockAborted,
                                            callExecutionProgress));
            }
            return(output);
        }
Пример #5
0
        /// <summary>
        /// Omogućava ad-hoc izvršavanje webRequest-a
        /// </summary>
        /// <param name="__url"></param>
        /// <param name="__syncMode"></param>
        /// <param name="__action"></param>
        /// <param name="__type"></param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraća dobijeni rezultat</returns>
        public webResult executeRequest(String __url, executionSyncMode __syncMode,
                                        webRequestActionType __action = webRequestActionType.openUrl,
                                        webRequestType __type         = webRequestType.unknown, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }
            webRequestBlock blck    = getCurrentBlock();
            webRequest      request = addNewRequest(__url, __action, __type);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
Пример #6
0
        /// <summary>
        /// Izvrsava jedan request
        /// </summary>
        /// <param name="request">Zahtev koji treba da se izvrsi</param>
        /// <param name="__syncMode">Rezim izvrsavanja</param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraca objekat sa rezultatom</returns>
        public webResult executeRequest(webRequest request, executionSyncMode __syncMode, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }

            webRequestBlock blck = getCurrentBlock();

            blck.Add(request);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
Пример #7
0
        /// <summary>
        /// Trenutni rezultat requesta
        /// </summary>
        protected void syncWaitingLoop(webLoaderSettings settings, executionSyncMode __syncMode)
        {
            DateTime start = DateTime.Now;

            if (__syncMode == executionSyncMode.synced)
            {
                while (isActive)
                {
                    Thread.Sleep(settings.tickDuration);

                    TimeSpan ts = DateTime.Now.Subtract(start);
                    if (ts.TotalMilliseconds > settings.timeout)
                    {
                        aceLog.saveAllLogs(true);
                        abortRequest(settings);
                    }

                    checkRequest(settings);
                }
            }
        }
Пример #8
0
 /// <summary>
 /// Izvrsavanje
 /// </summary>
 /// <param name="settings">Podesavanja loadera</param>
 /// <param name="__syncMode">Tip izvrsavanja</param>
 /// <param name="__onExecutedOk">kada je executedOk</param>
 /// <param name="__onError">za sve vrste gresaka</param>
 /// <param name="__onRetry">kada se desi retry</param>
 public override webResult executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                          webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                          webRequestEvent __onRetry)
 {
     return(_executeRequest(settings, __syncMode, __onExecutedOk, __onError, __onRetry));
 }
Пример #9
0
 public webResultBlock executeCurrentBlock(executionSyncMode __syncMode)
 {
     return(requestBlock.executeBlock(settings, __syncMode, callRequestBlockFinished, callRequestBlockAborted,
                                      callExecutionProgress));
 }
Пример #10
0
 public abstract webResult executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                          webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                          webRequestEvent __onRetry);