Examples of SyndFeedInfo


Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

        Date lastUpdated = new Date();
        try {
            feedURL = new URL(sub.getFeedURL());
            log.debug("Get feed from cache "+sub.getFeedURL());
            feed = feedFetcher.retrieveFeed(feedURL);
            SyndFeedInfo feedInfo = feedInfoCache.getFeedInfo(feedURL);
            if (feedInfo.getLastModified() != null) {
                long lastUpdatedLong =
                        ((Long)feedInfo.getLastModified()).longValue();
                if (lastUpdatedLong != 0) {
                    lastUpdated = new Date(lastUpdatedLong);
                }
            }
            Thread.sleep(100); // be nice
View Full Code Here

Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

      FeedInfo feedInfo = null;

      FeedIndex findex = null;
      Transaction tx = null;
      boolean status = false;
      SyndFeedInfo fi = null;
     
      PersistenceManager pm = PMF.getTxnPm();
      PersistenceManager pm2 = PMF.getNonTxnPm();

      try {
View Full Code Here

Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

    logger.info("in UpdateFeed: " + urlstring);
    try {

      this.dateChecked = new Date();
      SyndFeedInfo fi = feedFetcher.retrieveFeedInfo(new URL(this.urlstring), this);
      // if non-null was returned, update the feed contents.
      // null indicates either that the feed did not need updating, or that there was an error fetching it.
      if (fi != null) {
        this.feedInfo = fi;
        this.eTag = fi.getETag();
        setLastModified(fi.getLastModified());
        StreamItem.buildItems(this, pm);
        this.dateUpdated = new Date();
        JDOHelper.makeDirty(this, "feedInfo");
        logger.info("updating feed " + urlstring + " at " + dateUpdated);
      }
View Full Code Here

Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

    if (!(connection instanceof HttpURLConnection)) {      
      throw new IllegalArgumentException(feedUrl.toExternalForm() + " is not a valid HTTP Url");
    }
    HttpURLConnection httpConnection = (HttpURLConnection)connection;  

    SyndFeedInfo syndFeedInfo = null;
    if (dtsFeedInfo != null) {
      setRequestHeaders(connection, dtsFeedInfo.getLastModified(), dtsFeedInfo.getETag());
    }
    else {
      setRequestHeaders(connection, null, null);
    }
    httpConnection.connect();
    try {
      fireEvent(FetcherEvent.EVENT_TYPE_FEED_POLLED, connection);

      if (dtsFeedInfo == null) {
        // this is a feed that hasn't been retrieved
        syndFeedInfo = new SyndFeedInfo();
        try {
          resetFeedInfo(feedUrl, syndFeedInfo, httpConnection);
        }
        catch (java.lang.IllegalArgumentException e) {
          logger.warning("Got exception " + e.getMessage());
          logger.warning("If " + feedUrl + " was a correctly formed Twitter feed, this error is likely due to having the max number of requests for the current hour exceeded");
          throw e;
        }
      }
      else {
        // check the response code
        int responseCode = httpConnection.getResponseCode();
        if (responseCode != HttpURLConnection.HTTP_NOT_MODIFIED) {
          logger.fine("*****the feed " + feedUrl + " needs retrieving");
          syndFeedInfo = new SyndFeedInfo();
          resetFeedInfo(feedUrl, syndFeedInfo, httpConnection);
        }
        else {
          logger.fine("the feed " + feedUrl + " does not need retrieving");
          // the feed does not need retrieving
View Full Code Here

Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

    {
        this.cachePath = cachePath;
    }
    public SyndFeedInfo getFeedInfo(URL url)
    {
        SyndFeedInfo info = null;
        String fileName = cachePath + File.separator + "feed_" + url.hashCode();
        FileInputStream fis;
        try
        {
            fis = new FileInputStream(fileName);
View Full Code Here

Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

        Date lastUpdated = new Date();
        try {
            feedURL = new URL(sub.getFeedURL());
            log.debug("Get feed from cache "+sub.getFeedURL());
            feed = feedFetcher.retrieveFeed(feedURL);
            SyndFeedInfo feedInfo = feedInfoCache.getFeedInfo(feedURL);
            if (feedInfo.getLastModified() != null) {
                long lastUpdatedLong =
                        ((Long)feedInfo.getLastModified()).longValue();
                if (lastUpdatedLong != 0) {
                    lastUpdated = new Date(lastUpdatedLong);
                }
            }
            Thread.sleep(100); // be nice
View Full Code Here

Examples of com.sun.syndication.fetcher.impl.SyndFeedInfo

    }

    public void testCache() throws Exception 
    {
        URL url = new URL("http://cnn.com");
        SyndFeedInfo info = new SyndFeedInfo();
        info.setUrl(url);
       
        String buildDir = System.getProperty("ro.build");
        assertNotNull("ro.build not null", buildDir);
        assertTrue("ro.build not zero length", buildDir.trim().length() > 0);
        if (!buildDir.startsWith("/")) buildDir = "..";
        File file = new File(buildDir);
       
        assertTrue("buildDir exists", file.exists());
        assertTrue("buildDir is directory", file.isDirectory());       
       
        DiskFeedInfoCache cache =
            new DiskFeedInfoCache(buildDir + "/tests/planet-cache");
        cache.setFeedInfo(info.getUrl(), info);
       
        SyndFeedInfo info2 = cache.getFeedInfo(url);
        assertNotNull(info2);
        assertEquals(url, info2.getUrl());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.