Package com.sun.syndication.feed.synd

Examples of com.sun.syndication.feed.synd.SyndFeedImpl


          catch (Exception e) {} // do nothign will use now as pub date
        }       
        tmpList.add((SyndEntry) synd);

        if (null != extraUrl.fullText) {
          SyndFeedImpl fullTextContainer = new SyndFeedImpl();
          fullTextContainer.setDescription(extraUrl.fullText);
          synd.setSource(fullTextContainer);
        }
      }
    }
   
View Full Code Here


private static final Logger logger = Logger.getLogger(RssOutput.class);
 
  public String getDocs(ResponsePojo rp) {
    // Create the feed using Rome
    SyndFeed feed = new SyndFeedImpl(); // create the feed
    String feedType = "rss_2.0";
 
    // Setup a list of feeds
    @SuppressWarnings("unchecked")
    List<BasicDBObject> docs = (List<BasicDBObject>) rp.getData();
   
    PropertiesManager props = new PropertiesManager();
   
    // Set the title of the feed
    feed.setTitle( "Infinit.e Knowledge Discovery RSS Feed" );
    feed.setDescription( "Infinit.e Search Results RSS Feed" );
    feed.setLanguage( "en-us" );
    feed.setPublishedDate( new Date( System.currentTimeMillis() ) );
    feed.setFeedType( feedType ); // set the type of your feed
    String urlRoot = props.getUrlRoot();
    if (null != urlRoot) {
      feed.setLink(urlRoot.replace("/api/", ""));
    }
    else { // feed.link needs to be specified, otherwise RSS feed will fail:
      feed.setLink("http://www.ikanow.com/#SET_YOUR_URL_ROOT");
    }
   
    // Establish the list to contain the feeds
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
   
    // loop through the result set
    for ( BasicDBObject fdbo : docs)
    {
      SyndEntry entry = new SyndEntryImpl(); // create a feed entry

      String title = fdbo.getString(DocumentPojo.title_);
      if ( title != null ) {
        entry.setTitle( title );
      }
      Date pubDate = (Date) fdbo.get(DocumentPojo.publishedDate_);
      if ( pubDate != null )
        entry.setPublishedDate( pubDate );
     
      String url = fdbo.getString(DocumentPojo.displayUrl_);
      if (null == url) {
        url = fdbo.getString(DocumentPojo.url_);
        if ((null != url) && !url.startsWith("http")) {
          url = null;
        }
      }//TESTED
      else if (!url.startsWith("http:") && !url.startsWith("https:")) {
        if (null != urlRoot) {
          Object sourceKeyObj = fdbo.get(DocumentPojo.sourceKey_);
          String sourceKey = null;
          try {
            if (sourceKeyObj instanceof String) {
              sourceKey = (String) sourceKey;
            }//(should never happen)
            else if (sourceKeyObj instanceof Collection) {
              @SuppressWarnings("rawtypes")
              Collection sourceKeyCollection = ((Collection)sourceKeyObj);
              sourceKey = (String) sourceKeyCollection.iterator().next();
            }//TESTED
            else if (sourceKeyObj instanceof String[]) {
              sourceKey = ((String[])sourceKeyObj)[0];             
            }//(should never happen)
           
            if (url.startsWith("/")) {
              url = urlRoot + "knowledge/document/file/get/" + sourceKey + url;
            }
            else {
              url = urlRoot + "knowledge/document/file/get/" + sourceKey + "/" + url;           
            }
          }
          catch (Exception e) {} // carry on...
        }//TESTED
        else {
          url = null;
        }
      }//TESTED
      if ((null == url) && (null != urlRoot)) {
        url = urlRoot + "knowledge/document/get/" + fdbo.getObjectId(DocumentPojo._id_).toString() + "?returnRawData=false";
      }//TESTED
      if (null != url) {
        entry.setLink( url );
      }
     
      String description = fdbo.getString(DocumentPojo.description_);
      if ( description != null ) {
        // Create the content for the entry
        SyndContent content = new SyndContentImpl(); // create the content of your entry
        content.setType( "text/plain" );
        content.setValue( description );
        entry.setDescription( content );
      }
      entries.add( entry );
    }//(end loop over entries)
   
    feed.setEntries( entries ); // you can add multiple entries in your feed
   
    SyndFeedOutput output = new SyndFeedOutput();
    String rss = null;
       
    try {
View Full Code Here

    private void createFeed(List<HistoricalEvent> historicalEvents,
                            String feedType,
                            File outputDirectory,
                            String classifier)
    {
        SyndFeed feed = new SyndFeedImpl();
        feed.setFeedType(feedType);
        feed.setTitle("Play! Modules");
        feed.setLink("http://modules.playframework.org");
        feed.setUri("http://modules.playframework.org");
        feed.setPublishedDate(new Date());
        feed.setDescription("The Play! Framework's module repository feed");

        List<SyndEntry> entries = new ArrayList<SyndEntry>(historicalEvents.size());
        for (HistoricalEvent historicalEvent : historicalEvents)
        {
            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle(historicalEvent.category);
            entry.setAuthor("Play framework modules");
            entry.setPublishedDate(historicalEvent.creationDate);
            // todo this will be the url of the module
            entry.setLink("http://modules.playframework.org");
            entry.setUri("mpo-he-" + historicalEvent.id);
            SyndContent description = new SyndContentImpl();
            description.setType("text/plain");
            description.setValue(historicalEvent.message);
            entry.setDescription(description);
            entries.add(entry);
        }

        feed.setEntries(entries);

        Writer writer = null;
        try
        {
            File outputFile = new File(outputDirectory,
View Full Code Here

   * @throws FeedException
   *             if the feed could not be parsed
   *
   */
  public SyndFeed build(File file) throws FileNotFoundException, IOException, IllegalArgumentException, FeedException {
    return new SyndFeedImpl(_feedInput.build(file), preserveWireFeed);
  }
View Full Code Here

   * @throws FeedException
   *             if the feed could not be parsed
   *
   */
  public SyndFeed build(Reader reader) throws IllegalArgumentException, FeedException {
    return new SyndFeedImpl(_feedInput.build(reader), preserveWireFeed);
  }
View Full Code Here

   * @throws FeedException
   *             if the feed could not be parsed
   *
   */
  public SyndFeed build(InputSource is) throws IllegalArgumentException, FeedException {
    return new SyndFeedImpl(_feedInput.build(is), preserveWireFeed);
  }
View Full Code Here

   * @throws FeedException
   *             if the feed could not be parsed
   *
   */
  public SyndFeed build(org.w3c.dom.Document document) throws IllegalArgumentException, FeedException {
    return new SyndFeedImpl(_feedInput.build(document), preserveWireFeed);
  }
View Full Code Here

   * @throws FeedException
   *             if the feed could not be parsed
   *
   */
  public SyndFeed build(Document document) throws IllegalArgumentException, FeedException {
    return new SyndFeedImpl(_feedInput.build(document), preserveWireFeed);
  }
View Full Code Here

   
    return resourceResponse;
  }
 
  public static SyndFeed getFeed() {
    SyndFeed feed = new SyndFeedImpl();
   
    feed.setFeedType("rss_2.0");
        feed.setTitle("My test with RSS");
        feed.setLink("http://mycompanysite.com/rss");
        feed.setDescription("Don't mind. It's just a test.");   
       
    return feed;
  }
View Full Code Here

     * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers.
     * @throws FeedException if the feed could not be parsed
     *
     */
    public SyndFeed build(File file) throws FileNotFoundException,IOException,IllegalArgumentException,FeedException {
        return new SyndFeedImpl(_feedInput.build(file), preserveWireFeed);
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.synd.SyndFeedImpl

Copyright © 2018 www.massapicom. 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.