Beispiel #1
0
        public static Feed AddFeed(Feed feed)
        {
            if (feed.Name == null)
                throw new Exception("Must give the feed a name");

            if (feed.Id == Guid.Empty)
                feed.Id = Guid.NewGuid();

            if (feed.RequestInterval == 0)
                feed.RequestInterval = 60;

               if(feed.Document == null)
               feed.ReLoad();

            ObjectStore os = new ObjectStore();
            os.UniqueId = feed.Id;
            os.Name = "Feed: " + feed.Name;
            os.Data = ObjectManager.ConvertToString(feed);
            os.ContentType = "feed/xml";
            os.Type = typeof (Feed).FullName;
            os.Save();

            ZCache.RemoveCache("Feed-Objects");

            return feed;
        }
Beispiel #2
0
        public static Feed GetFeed(string url, bool throwExceptionOnError)
        {
            Dictionary<Guid, Feed> feeds = GetFeeds();
            foreach (Feed feed in feeds.Values)
                if (Util.AreEqualIgnoreCase(feed.Url, url))
                    return feed;

            Log.Warn("Feed", "Feed with name: {0} was requested but not found. It was added to the queue.", url);

            Feed newFeed = new Feed();
            newFeed.Url = url;
            newFeed.Id = Guid.NewGuid();
            newFeed.RequestInterval =60;
            newFeed.ReLoad(throwExceptionOnError);
            if (newFeed.Document != null)
                newFeed.Name = "Feed: " + newFeed.Document.Channel.Title;
            else
                newFeed.Name = "Feed:" + url;

            AddFeed(newFeed);

            return newFeed;
        }
Beispiel #3
0
        private static void UpdateFeed(Feed feed, bool resetCache)
        {
            ObjectStore os = ObjectStore.FetchByColumn(ObjectStore.Columns.UniqueId,feed.Id);
            os.Data = ObjectManager.ConvertToString(feed);
            os.Version++;
            os.Save();

            if(resetCache)
                ZCache.RemoveCache("Feed-Objects");
        }
Beispiel #4
0
 public static void UpdateFeed(Feed feed)
 {
     UpdateFeed(feed,true);
 }
Beispiel #5
0
 public static void UpdateFeed(Feed feed)
 {
     UpdateFeed(feed, true);
 }