当前位置: 首页>>代码示例>>Java>>正文


Java SyndFeedImpl类代码示例

本文整理汇总了Java中com.sun.syndication.feed.synd.SyndFeedImpl的典型用法代码示例。如果您正苦于以下问题:Java SyndFeedImpl类的具体用法?Java SyndFeedImpl怎么用?Java SyndFeedImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SyndFeedImpl类属于com.sun.syndication.feed.synd包,在下文中一共展示了SyndFeedImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllBuildsFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 *
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getAllBuildsFeed(final int userID) {

  final List buildStatusList = org.parabuild.ci.security.SecurityManager.getInstance().getFeedBuildStatuses(userID);

  // traverse build statuses
  final List entries = new ArrayList(11);
  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  for (final Iterator i = buildStatusList.iterator(); i.hasNext();) {
    final int activeBuildID = ((BuildState)i.next()).getActiveBuildID();
    entries.addAll(getBuildEntries(cm, activeBuildID, urlGenerator));
  }

  // create feed and set collected entries
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Published Result Feed");
  feed.setLink(urlGenerator.makeBuildListURL());
  feed.setDescription("This feed provides information about published results at Parabuild server");
  feed.setEntries(entries);

  // return result
  return feed;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:PublishedResultFeedGenerator.java

示例2: getAllBuildsFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getAllBuildsFeed(final int userID) {

  final List buildStatusList = SecurityManager.getInstance().getFeedBuildStatuses(userID);

  // traverse build statuses
  final List entries = new ArrayList(1);
  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  for (final Iterator i = buildStatusList.iterator(); i.hasNext();) {
    final int activeBuildID = ((BuildState) i.next()).getActiveBuildID();
    entries.addAll(getBuildEntries(cm, activeBuildID, urlGenerator));
  }

  // create feed and set collected entries
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Feed");
  feed.setLink(urlGenerator.makeBuildListURL());
  feed.setDescription("This feed provides information about build statuses at Parabuild server");
  feed.setEntries(entries);

  // return result
  return feed;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:FeedGenerator.java

示例3: generateFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
public SyndFeed generateFeed( String title, String description, List<RssFeedEntry> dataEntries )
{
    if( dataEntries.size() ==  0 )
    {
        log.debug( "No updates found, feed not generated." );
        return null;
    }
    
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle( title );        
    feed.setDescription( description );
    feed.setLanguage( DEFAULT_LANGUAGE );
    feed.setPublishedDate( dataEntries.get( dataEntries.size() - 1 ).getPublishedDate() );
    feed.setFeedType( DEFAULT_FEEDTYPE );
    feed.setEntries( getEntries( dataEntries ) );

    log.debug( "Finished generating the feed \'{}\'.", title );
    
    return feed;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:21,代码来源:RssFeedGenerator.java

示例4: doGet

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("WildFly-Camel Test RSS Feed");
    feed.setLink("http://localhost:8080/rss-tests");
    feed.setDescription("Test RSS feed for the camel-rss component");

    List<SyndEntry> entries = new ArrayList<>();
    for (int i = 1; i <= 5; i++) {
        entries.add(createFeedEntry("Test entry: ", "Test content: ", i));
    }
    feed.setEntries(entries);

    SyndFeedOutput output = new SyndFeedOutput();
    try {
        output.output(feed, response.getWriter());
    } catch (FeedException e) {
        throw new IllegalStateException("Error generating RSS feed", e);
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:22,代码来源:RSSFeedServlet.java

示例5: testWireFeedSyndFeedConversion

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
public void testWireFeedSyndFeedConversion() throws Exception {
    SyndFeed sFeed1 = getCachedSyndFeed();
    WireFeed wFeed1 = sFeed1.createWireFeed();
    SyndFeed sFeed2 = new SyndFeedImpl(wFeed1);

    assertTrue(sFeed1.equals(sFeed2));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:FeedOpsTest.java

示例6: getBuildFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 *
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getBuildFeed(final int userID, final int activeBuildID) throws AccessForbiddenException, FeedNotFoundException {

  // validate that a build exists
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  final ActiveBuildConfig activeBuildConfig = cm.getActiveBuildConfig(activeBuildID);
  if (activeBuildConfig == null) {
    throw new FeedNotFoundException("Requested feed not found");
  }

  // validat build access
  if (!SystemConfigurationManagerFactory.getManager().isAnonymousAccessToProtectedFeedsIsEnabled()) {
    final SecurityManager securityManager = SecurityManager.getInstance();
    if (!securityManager.userCanViewBuild(userID, activeBuildID)) {
      throw new AccessForbiddenException("Access to this feed is forbidden");
    }
  }

  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final String buildName = activeBuildConfig.getBuildName();
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Feed for " + buildName);
  feed.setLink(urlGenerator.makeBuildStatusURL(activeBuildID));
  feed.setDescription("This feed provides information about statuses for " + buildName);
  feed.setEntries(getBuildEntries(cm, activeBuildID, urlGenerator));

  // return result
  return feed;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:PublishedResultFeedGenerator.java

示例7: getBuildFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getBuildFeed(final int userID, final int activeBuildID) throws AccessForbiddenException, FeedNotFoundException {

  // validate that a build exists
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  final ActiveBuildConfig activeBuildConfig = cm.getActiveBuildConfig(activeBuildID);
  if (activeBuildConfig == null) {
    throw new FeedNotFoundException("Requested feed not found");
  }

  // validat build access
  if (!SystemConfigurationManagerFactory.getManager().isAnonymousAccessToProtectedFeedsIsEnabled()) {
    final SecurityManager securityManager = SecurityManager.getInstance();
    if (!securityManager.userCanViewBuild(userID, activeBuildID)) {
      throw new AccessForbiddenException("Access to this feed is forbidden");
    }
  }

  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final String buildName = activeBuildConfig.getBuildName();
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Feed for " + buildName);
  feed.setLink(urlGenerator.makeBuildStatusURL(activeBuildID));
  feed.setDescription("This feed provides information about statuses for " + buildName);
  feed.setEntries(getBuildEntries(cm, activeBuildID, urlGenerator));

  // return result
  return feed;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:FeedGenerator.java

示例8: rssFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
@RequestMapping("/rss")
public void rssFeed(HttpServletResponse response) throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("atom_1.0");
    feed.setEntries(new LinkedList());

    podcastEpisodeService.allPodcasts().forEach(podcastEpisode -> {
        feed.getEntries().add(podcastEpisode.getSyndEntry());
    });

    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, response.getWriter());
}
 
开发者ID:DevWars,项目名称:devwars.tv,代码行数:14,代码来源:PodcastController.java

示例9: makeRSSFromRSSCorresponList

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * コレポンリストからRSSを生成する.
 * @param rssCorresponList コレポンリスト
 * @param baseURL BaseURL
 * @return RSS
 * @throws ServiceAbortException 設定値からRSSを出力する際に例外発生
 */
private String makeRSSFromRSSCorresponList(
    List<RSSCorrespon> rssCorresponList, String baseURL) throws ServiceAbortException {
    String resultRSS = null;

    SyndFeed feed = (SyndFeed) new SyndFeedImpl();
    feed.setFeedType(FEED_TYPE);
    feed.setTitle(RSS_TITLE);
    feed.setLink("");
    feed.setDescription("");
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    if (rssCorresponList != null) {
        for (RSSCorrespon c : rssCorresponList) {
            entries.add(makeEntryFromRSSCorrespon(c, baseURL));
        }
    }
    feed.setEntries(entries);

    try {
        SyndFeedOutput output = new SyndFeedOutput();
        resultRSS = output.outputString(feed);
    } catch (FeedException e) {
        // 設定された値から生成されるXMLが異常だった際に発生. 起こり得ない.
        ServiceAbortException sae =
            new ServiceAbortException("RSS outputString error");
        sae.initCause(e);
        throw sae;
    }
    return resultRSS;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:37,代码来源:RSSServiceImpl.java

示例10: call

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
@Override
public Map<String, String> call() throws Exception
{
    Map<String, String> map = new Hashtable<>(1);
    logger.debug("Started polling {}", rssURI);
    SyndFeed feed = consumer.receiveBody(rssURI, SyndFeedImpl.class);
    logger.debug("Finished polling {}.\nTitle: {}.\nDescription: {}", rssURI, feed.getTitle(), feed.getDescription());

    File folder=new File(path);
    if (!folder.exists())
        folder.mkdirs();
    if (folder.exists() && folder.isDirectory())
    {
        String file=folder.getPath() + "/" + fileName;
        OutputStream out = null;
        try {
            out = new FileOutputStream(file);
            out.write(RssConverter.feedToXml(feed).getBytes());
        } catch (IOException e)
        {
            logger.error(e.getMessage(), e);
            throw e;
        } finally {
            if (out != null)
                out.close();
        }
        logger.debug("Feed {} marshaled into file {}", rssURI, file);
        map.put(rssURI, file);
    }
    return map;
}
 
开发者ID:eurohlam,项目名称:rss2kindle,代码行数:32,代码来源:RssPollingTask.java

示例11: createFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * @param feedFile
 * @param seriesId
 * @param title
 * @param transcodingProfileId
 * @return
 */
public SyndFeed createFeed(File feedFile, String seriesId, String title,
    String transcodingProfileId) {
  final SyndFeed defaultFeed = new SyndFeedImpl();
  defaultFeed.setFeedType("rss_2.0");
  defaultFeed.setTitle(title);
  defaultFeed.setLink(this.applicationURL + PATH_SEPARATOR + transcodingProfileId
      + PATH_SEPARATOR + seriesId + feedFileExtension);
  defaultFeed.setDescription("Feed for the MythTV recordings of this program");

  File transformedFeedFile = null;
  try {
    final File feedDirectory = feedFile.getParentFile();
    if (!feedDirectory.exists()) {
      feedDirectory.mkdirs();
      LOGGER.info("Created feed directory: " + feedDirectory.getPath());
    }

    FileWriter writer = new FileWriter(feedFile);
    SyndFeedOutput output = new SyndFeedOutput();
    output.output(defaultFeed, writer);
    transformedFeedFile = this.generateTransformationFromFeed(feedFile, defaultFeed, seriesId);
    return defaultFeed;
  } catch (Exception e) {
    LOGGER.error("Error rendering feed", e);
    if (feedFile.canWrite()) {
      feedFile.delete();
    }

    if (transformedFeedFile != null && transformedFeedFile.canWrite()) {
      transformedFeedFile.delete();
    }
    return null;
  }
}
 
开发者ID:skidder,项目名称:mythpodcaster,代码行数:42,代码来源:FeedFileAccessorImpl.java

示例12: rss

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
public String rss() throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle("hiscores.shmup.com");
    feed.setFeedType("rss_2.0");
    feed.setDescription("hiscores.shmup.com");
    feed.setLink("http://hiscores.shmup.com");
    List entries = new ArrayList();
    feed.setEntries(entries);
    for (Score score : scores) {
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(score.getGameTitle());
        entry.setAuthor(score.player.name);
        entry.setLink("http://hiscores.shmup.com/score/" + score.id);
        SyndContentImpl content = new SyndContentImpl();
        content.setValue(score.tweet());
        entry.setDescription(content);
        entry.setPublishedDate(score.getCreatedAt());
        entry.setUpdatedDate(score.getCreatedAt());
        SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
        enclosure.setUrl(score.game.cover);
        enclosure.setType(score.game.getCoverType());
        entry.setEnclosures(Lists.newArrayList(enclosure));
        entries.add(entry);
    }
    Writer writer = new StringWriter();
    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, writer);
    writer.close();
    Controller.response().setContentType("application/rss+xml");
    return writer.toString();
}
 
开发者ID:jsmadja,项目名称:shmuphiscores,代码行数:32,代码来源:Timeline.java

示例13: RomeRssChannel

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
/**
 * Constructs an empty feed.
 */
public RomeRssChannel(TypedProperties props) {
    this(props, new SyndFeedImpl());

    // -- Init
    String rssFormat = props.getString(AppProperties.RSS_FORMAT_KEY, FORMAT_DEFAULT);
    setRssFormat(rssFormat);
}
 
开发者ID:cert-se,项目名称:megatron-java,代码行数:11,代码来源:RomeRssChannel.java

示例14: main

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
public static void main(String[] args) {
    boolean ok = false;
    if (args.length>=2) {
        try {
            String outputType = args[0];

            SyndFeed aggrFeed = new SyndFeedImpl();
            aggrFeed.setFeedType(outputType);

            aggrFeed.setTitle("Aggregated Feed");
            aggrFeed.setDescription("Anonymous Aggregated Feed");
            aggrFeed.setAuthor("anonymous");
            aggrFeed.setLink("http://www.anonymous.com");

            List entries = new ArrayList();
            aggrFeed.setEntries(entries);

            for (int i=1;i<args.length;i++) {
                URL feedUrl = new URL(args[i]);
                SyndFeedInput input = new SyndFeedInput();

                SyndFeed feed = input.build(new XmlReader(feedUrl));

                entries.addAll(feed.getEntries());
            }

            SyndFeedOutput output = new SyndFeedOutput();
            output.output(aggrFeed,new PrintWriter(System.out));

            ok = true;
        }
        catch (Exception ex) {
            System.out.println("ERROR: "+ex.getMessage());
        }
    }

    if (!ok) {
        System.out.println();
        System.out.println("FeedAggregator aggregates different feeds into a single one.");
        System.out.println("The first parameter must be the feed type for the aggregated feed.");
        System.out.println(" [valid values are: rss_0.9, rss_0.91, rss_0.92, rss_0.93, ]");
        System.out.println(" [                  rss_0.94, rss_1.0, rss_2.0 & atom_0.3  ]");
        System.out.println("The second to last parameters are the URLs of feeds to aggregate.");
        System.out.println();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:FeedAggregator.java

示例15: generateBlogRssFeed

import com.sun.syndication.feed.synd.SyndFeedImpl; //导入依赖的package包/类
public static Map<String, Object> generateBlogRssFeed(DispatchContext dctx, Map<String, ? extends Object> context) {
    GenericValue userLogin = (GenericValue) context.get("userLogin");
    String contentId = (String) context.get("blogContentId");
    String entryLink = (String) context.get("entryLink");
    String feedType = (String) context.get("feedType");
    Locale locale = (Locale) context.get("locale");

    // create the main link
    String mainLink = (String) context.get("mainLink");
    mainLink = mainLink + "?blogContentId=" + contentId;

    LocalDispatcher dispatcher = dctx.getDispatcher();
    Delegator delegator = dctx.getDelegator();

    // get the main blog content
    GenericValue content = null;
    try {
        content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }

    if (content == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                "ContentCannotGenerateBlogRssFeed", 
                UtilMisc.toMap("contentId", contentId), locale));
    }

    // create the feed
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType(feedType);
    feed.setLink(mainLink);

    feed.setTitle(content.getString("contentName"));
    feed.setDescription(content.getString("description"));
    feed.setEntries(generateEntryList(dispatcher, delegator, contentId, entryLink, locale, userLogin));

    Map<String, Object> resp = ServiceUtil.returnSuccess();
    resp.put("wireFeed", feed.createWireFeed());
    return resp;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:42,代码来源:BlogRssServices.java


注:本文中的com.sun.syndication.feed.synd.SyndFeedImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。