/// <summary> /// Main method that gathers data /// </summary> /// <param name="context">iDroneContext</param> public override void GetData(object context) { try { BaseContext cont = context as BaseContext; Context = cont; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { //do work WriteToUsageLogFile("MarketShareBuilder.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started MarketShareBuilder calls"); GetBuilders(); WriteToUsageLogFile("MarketShareBuilder.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed MarketShareBuilder calls"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); GC.Collect(); } catch (Exception e) { ExceptionExtensions.LogError(e, "Drone.SmallBusinessTracking.Components.MarketShareBuilder.GetData()"); } }
/// <summary> /// Main method that gathers data /// </summary> /// <param name="context">iDroneContext</param> public override void GetData(object context) { try { BaseContext cont = context as BaseContext; Context = cont; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName) && (int)DateTime.Today.DayOfWeek == (int)Enum.Parse(typeof(DayOfWeek), XMLUtility.GetTextFromAccountNode(Xml, ProcessorName + "/interval"), true) || Utility.FileExists("Crunchbase_AllCompanies.txt")) //if this file exists, it means the service failed and is restarting. { //do work WriteToUsageLogFile("Crunchbase.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started Crunchbase calls"); GetAllCompanies(); WriteToUsageLogFile("Crunchbase.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed Crunchbase calls"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "Drone.SmallBusinessTracking.Components.Crunchbase.GetData()"); } }
public override void GetData(object context) { try { BaseContext cont = context as BaseContext; Context = cont; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { GetFanDemographics(); GetPageInfoForAllCompetitors(); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "FacebookFanInfo.GetData()"); } }
/// <summary> /// Main method that gathers data /// </summary> /// <param name="context">iDroneContext</param> public override void GetData(object context) { try { BaseContext cont = context as BaseContext; Context = cont; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode("dnshost", cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, "dnshost")) { //do work WriteToUsageLogFile("DNSHost.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started DNSHost calls"); GetAllDNSHosts(); WriteToUsageLogFile("DNSHost.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed DNSHost calls"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "Drone.MarketShare.Components.DNSHost.GetData()"); } }
public override void GetData(object context) { try { BaseContext cont = context as BaseContext; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { WriteToUsageLogFile("FacebookInsight.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started GetInsightInfo"); string accountId = XMLUtility.GetTextFromAccountNode(Xml, "id"); string accessToken = XMLUtility.GetTextFromAccountNode(Xml, "accesstoken"); FBIO = new Graph().GetInsightInfo(accountId, accessToken); WriteToUsageLogFile("FacebookInsight.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed GetInsightInfo"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "FacebookInsight.GetData()"); } }
public override void GetData(object context) { try { BaseContext cont = context as BaseContext; Context = cont; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { WriteToUsageLogFile("YouTube.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started GetChannelData"); GetSquatterData(); GetChannelData(); WriteToUsageLogFile("YouTube.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed GetChannelData"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "YouTube.GetData()"); } }
/// <summary> /// Main method that gathers data /// </summary> /// <param name="context">iDroneContext</param> public override void GetData(object context) { try { BaseContext cont = context as BaseContext; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { //do work WriteToUsageLogFile("TwitterTrend.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started GetTwitterTrendsAllPlaces"); TwitterDataComponent _dataComponent = DroneDataComponent as TwitterDataComponent; _dataComponent.TrendRootList = GetTwitterTrendsAllPlaces(); //DroneDataSource.Process(_dataComponent); //add via webapi call if this is needed again WriteToUsageLogFile("TwitterTrend.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed GetTwitterTrendsAllPlaces"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "Drone.Twitter.Components.TwitterTrend.GetData()"); } }
public void TwitterUtility_IsComponentEnabled() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); bool enabledProperty = XMLUtility.IsComponentEnabled(t.Xml, "twittertrend"); Assert.IsFalse(enabledProperty); }
/// <summary> /// Main method that gathers data /// </summary> /// <param name="context">iDroneContext</param> public override void GetData(object context) { try { BaseContext cont = context as BaseContext; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); DateTime tempNextRun = cont.NextRun; SetNextRunIntervalByNode(ProcessorName, cont); if (XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { WriteToUsageLogFile("TwitterFollower.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started GetTwitterFollowers"); //wait 5 min for other twitter processes to finish so we don't get rate limited Thread.Sleep(300000); //do work TwitterDataComponent _dataComponent = DroneDataComponent as TwitterDataComponent; UserManager um = new UserManager(); OAuthTokens oat = Utility.GetOAuthToken(Xml); _dataComponent.TwitterUserList = um.GetAllFollowers(oat); DroneDataSource.Process(_dataComponent); WriteToUsageLogFile("TwitterFollower.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed GetTwitterFollowers"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "Drone.Twitter.Components.TwitterFollower.GetData()"); } }
/// <summary> /// Get all tweets with "GoDaddy" in them. /// 100 per page, up to 15 pages if we loop and make seperate calls for each page /// </summary> internal Dictionary <int, List <Status> > GetAllMentionsByQuery(TwitterContext cont) { Dictionary <int, List <Status> > allTwitterMentions = new Dictionary <int, List <Status> >(); if (XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { int countPerPage; int pageCount; TwitterDataSource data = new TwitterDataSource(); TweetManager tm = new TweetManager(); XMLUtility.GetPageResultCounts(Xml, ProcessorName, out countPerPage, out pageCount, 100, 3); List <Keyword> queries = data.GetTweetQueries(); bool useSinceId = XMLUtility.UseSinceId(Xml, ProcessorName); //create backup of current keys in case of failure at db level lock (cont) cont.prevRunLatestTweetIDs = cont.LatestTweetIDs.ToDictionary(entry => entry.Key, entry => entry.Value); foreach (Keyword item in queries) { try { long sinceId = 0; if (useSinceId) { //get the last recorded id for this query and use it if (!Object.Equals(cont, null)) { lock (cont) { if (cont.LatestTweetIDs.ContainsKey(item.KeywordId)) { cont.LatestTweetIDs.TryGetValue(item.KeywordId, out sinceId); } } } } //call the mention object in the API wrapper TwitterDataComponent _dataComponent = DroneDataComponent as TwitterDataComponent; KeywordStatus ks = new KeywordStatus(); ks.KeywordId = item.KeywordId; ks.StatusList = tm.GetTweetsByQuery(countPerPage, item.KeywordValue + (sinceId > 0 ? "&since_id=" + sinceId : string.Empty), Utility.GetOAuthToken(Xml)); allTwitterMentions.Add(ks.KeywordId, ks.StatusList); _dataComponent.KeywordStatus = ks; DroneDataSource.Process(_dataComponent); //if there was a failure saving to the db, reset the since id to gather and try again if (_dataComponent.SaveFailure) { lock (cont) cont.LatestTweetIDs = cont.prevRunLatestTweetIDs.ToDictionary(entry => entry.Key, entry => entry.Value); } //get the last id for this query and store it if (!Object.Equals(cont, null) && allTwitterMentions.ContainsKey(item.KeywordId) && allTwitterMentions[item.KeywordId].Count > 0) { long latestID; long.TryParse(allTwitterMentions[item.KeywordId][0].id.ToString(), out latestID); lock (cont) { if (cont.LatestTweetIDs.ContainsKey(item.KeywordId)) { cont.LatestTweetIDs[item.KeywordId] = latestID; } else { cont.LatestTweetIDs.Add(item.KeywordId, latestID); } } } } catch (Exception e) { ExceptionExtensions.LogError(e, "Twitter.GetAllMentionsByQuery()", "Keyword name: " + item.KeywordName); } } } return(allTwitterMentions); }
/// <summary> /// Main method that gathers data /// </summary> /// <param name="context">iDroneContext</param> public override void GetData(object context) { try { BaseContext cont = context as BaseContext; if (!Object.Equals(cont, null)) { SetContextStatus("processing", cont); DateTime tempNextRun = cont.NextRun; SetNextRunIntervalByNode(ProcessorName, cont); if (DateTime.Compare(tempNextRun, DateTime.MinValue) != 0 && XMLUtility.IsEnabled(Xml) && XMLUtility.IsComponentEnabled(Xml, ProcessorName)) { WriteToUsageLogFile("TwitterUser.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Started GetTwitterUsers Competitors"); //do work TwitterDataComponent _dataComponent = DroneDataComponent as TwitterDataComponent; _dataComponent.TwitterUserList = GetTwitterUsers(); DroneDataSource.Process(_dataComponent); WriteToUsageLogFile("TwitterUser.GetData | Thread:" + Thread.CurrentThread.ManagedThreadId.ToString(), "Completed GetTwitterUsers Competitors"); } SetContextStatus("waiting", cont); } RaiseProcessingCompletedEvent(new EventArgs()); } catch (Exception e) { ExceptionExtensions.LogError(e, "Drone.Twitter.Components.TwitterUser.GetData()"); } }