Examples of RSSFeed


Examples of org.eclipse.higgins.rsse.RssFeed

    final ID channelID = IDFactory.getDefault().createStringID("/reuters/worldNews/");
    // ID channelID = IDFactory.getDefault().createStringID("/feed.xml");
    final IMergeableChannel channel = channelContainer.createMergeableChannel(channelID, listener, new HashMap());
    if (channel instanceof FeedSharedObject) {
      // get remote feed (subscribed)
      final RssFeed remoteFeed = ((FeedSharedObject) channel).getFeed();
      // get local feed (published)
      final File feedFile = new File("feed.xml");
      RssFeed localFeed = RssFeed.load(feedFile);
      if (localFeed == null) {
        localFeed = new RssFeed(remoteFeed.getTitle(), remoteFeed.getLink(), remoteFeed.getDescription());
        localFeed.setVersion(RssVersion.RSS_2_0);
      }
      // merge remote feed with local one
      localFeed.merge(remoteFeed);
      // add a new item to feed
      localFeed.addItem(new RssItem("New Google Item", "This is a new item", "http://www.google.com"));
      // publish updated feed
      localFeed.save(feedFile);
      // print item titles
      final java.util.List items = localFeed.getItems();
      for (int i = 0; i < items.size(); i++) {
        System.out.println(" " + i + " " + ((RssItem) items.get(i)).getTitle());
      }
    }
    // remove the channel
View Full Code Here

Examples of org.gudy.azureus2.plugins.utils.xml.rss.RSSFeed

    singleton = this;
   
    init_sem.release();
   
    try{
      RSSFeed feed = plugin_interface.getUtilities().getRSSFeed(new URL("http://aelitis.com:7979/rss_feed.xml"));
     
      RSSChannel[]  channels = feed.getChannels();
     
      for (int i=0;i<channels.length;i++){
       
        RSSChannel  channel = channels[i];
       
View Full Code Here

Examples of org.gudy.azureus2.plugins.utils.xml.rss.RSSFeed

    }
   
    try {
      ByteArrayInputStream bais = new ByteArrayInputStream( page.getBytes("UTF-8"));
     
      RSSFeed rssFeed = StaticUtilities.getRSSFeed( bais );
     
      RSSChannel[] channels = rssFeed.getChannels();
     
      List results = new ArrayList();
     
      for ( int i=0; i<channels.length; i++ ){
       
        RSSChannel channel = channels[i];
       
        SimpleXMLParserDocumentNode[] channel_kids = channel.getNode().getChildren();
       
        int  auto_dl_state = AUTO_DL_SUPPORTED_YES;
       
        for ( int j=0; j<channel_kids.length; j++ ){

          SimpleXMLParserDocumentNode child = channel_kids[j];

          String  lc_full_child_name   = child.getFullName().toLowerCase();

          if ( lc_full_child_name.equals( "vuze:auto_dl_enabled" )){
           
            if ( !child.getValue().equalsIgnoreCase( "true" )){
             
              auto_dl_state = AUTO_DL_SUPPORTED_NO;
            }
          }
        }     
       
        setLocalLong( LD_AUTO_DL_SUPPORTED, auto_dl_state );
       
        RSSItem[] items = channel.getItems();

        for ( int j=0 ; j<items.length; j++ ){
         
          RSSItem item = items[j];
         
          WebResult result = new WebResult(this,getRootPage(),getBasePage(),getDateParser(),"");
         
          result.setPublishedDate(item.getPublicationDate());
         
          result.setNameFromHTML(item.getTitle());
         
          URL cdp_link = item.getLink();
         
          if ( cdp_link != null ){
         
            result.setCDPLink(cdp_link.toExternalForm());
          }
         
          String uid = item.getUID();
         
          if ( uid != null ){
           
            result.setUID( uid );
          }
         
          boolean got_seeds_peers = false;
         
          SimpleXMLParserDocumentNode node = item.getNode();
         
          if ( node != null ){
           
            SimpleXMLParserDocumentNode[] children = node.getChildren();
           
            boolean vuze_feed = false;
           
            for ( int k=0; k<children.length; k++ ){
                           
              SimpleXMLParserDocumentNode child = children[k];
             
              String  lc_full_child_name   = child.getFullName().toLowerCase();
             
              if ( lc_full_child_name.startsWith( "vuze:" )){
               
                vuze_feed = true;
               
                break;
              }
            }
           
            for ( int k=0; k<children.length; k++ ){
             
              SimpleXMLParserDocumentNode child = children[k];
             
              String  lc_child_name     = child.getName().toLowerCase();
              String  lc_full_child_name   = child.getFullName().toLowerCase();
             
              String  value = child.getValue();
             
              if (lc_child_name.equals( "enclosure" )){
               
                SimpleXMLParserDocumentAttribute typeAtt = child.getAttribute("type");
               
                if( typeAtt != null && typeAtt.getValue().equalsIgnoreCase( "application/x-bittorrent")) {
                 
                  SimpleXMLParserDocumentAttribute urlAtt = child.getAttribute("url");
                 
                  if( urlAtt != null ){
                   
                    result.setTorrentLink(urlAtt.getValue());
                  }
                 
                  SimpleXMLParserDocumentAttribute lengthAtt = child.getAttribute("length");
                 
                  if (lengthAtt != null){
                   
                    result.setSizeFromHTML(lengthAtt.getValue());
                  }
                }
              }else if(lc_child_name.equals( "category" )) {
                               
                result.setCategoryFromHTML( value );
               
              }else if(lc_child_name.equals( "comments" )){
               
                result.setCommentsFromHTML( value );
               
              }else if ( lc_child_name.equals( "link" ) || lc_child_name.equals( "guid" )) {
               
                String lc_value = value.toLowerCase();
                               
                try{
                  URL url = new URL(value);

                  if (   lc_value.endsWith( ".torrent" ) ||
                      lc_value.startsWith( "magnet:" ) ||
                      lc_value.startsWith( "bc:" ) ||
                      lc_value.startsWith( "bctp:" ) ||
                      lc_value.startsWith( "dht:" )){
                   
                   
                    result.setTorrentLink(value);
                   
                  }else if ( lc_child_name.equals( "link" ) && !vuze_feed ){
                 
                    long  test = getLocalLong( LD_LINK_IS_TORRENT, 0 );
                 
                    if ( test == 1 ){
                   
                      result.setTorrentLink( value );
                     
                    }else if ( test == 0 || SystemTime.getCurrentTime() - test > 60*1000 ){
                   
                      if ( linkIsToTorrent( url )){
                     
                        result.setTorrentLink(value);
                       
                        setLocalLong( LD_LINK_IS_TORRENT, 1 );
                       
                      }else{
                       
                        setLocalLong( LD_LINK_IS_TORRENT, SystemTime.getCurrentTime());
                      }
                    }
                  }
                }catch( Throwable e ){
                 
                    // see if this is an atom feed
                    //  <link rel="alternate" type="application/x-bittorrent" href="http://asdasd/
                 
                  SimpleXMLParserDocumentAttribute typeAtt = child.getAttribute( "type" );
                 
                  if ( typeAtt != null && typeAtt.getValue().equalsIgnoreCase("application/x-bittorrent")) {
                 
                    SimpleXMLParserDocumentAttribute hrefAtt = child.getAttribute( "href" );
                   
                    if ( hrefAtt != null ){
                     
                      String  href = hrefAtt.getValue().trim();
                     
                      try{
                       
                        result.setTorrentLink( new URL( href ).toExternalForm() );
                       
                      }catch( Throwable f ){
                       
                      }
                    }
                  }
                }
              }else if ( lc_child_name.equals( "content" ) && rssFeed.isAtomFeed()){
               
                SimpleXMLParserDocumentAttribute srcAtt = child.getAttribute( "src" );
               
                String  src = srcAtt==null?null:srcAtt.getValue();
                     
View Full Code Here

Examples of org.gudy.azureus2.plugins.utils.xml.rss.RSSFeed

        Map  args = new HashMap();
       
       
           
            try {
                RSSFeed feed = pluginInterface.getUtilities().getRSSFeed(new URL(rss_url));
                  RSSChannel[] channels = feed.getChannels();
             
                  for (int i = 0 ; i < channels.length ; i++)
                  {
                      final RSSChannel channel = channels[i];
                      View.display.asyncExec(new Runnable (){
View Full Code Here

Examples of org.olat.modules.webFeed.RSSFeed

  public MediaResource createFeedFile(OLATResourceable ores, Identity identity, Long courseId, String nodeId) {
    MediaResource media = null;
    Feed feed = readFeed(ores);

    if (feed != null) {
      SyndFeed rssFeed = new RSSFeed(feed, identity, courseId, nodeId);
      media = new SyndFeedMediaResource(rssFeed);
    }
    return media;
  }
View Full Code Here

Examples of org.rhq.enterprise.gui.legacy.portlet.RSSFeed

    private static final Log log = LogFactory.getLog(RSSAction.class.getName());

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        RSSFeed feed = getNewRSSFeed(request);
        ResourceManagerLocal manager = LookupUtil.getResourceManager();

        // Set title
        MessageResources res = getResources(request);
        feed.setTitle(res.getMessage("dash.home.ResourceHealth"));

        // Get the resources health
        WebUser user = getWebUser(request);
        if (user != null) {
            WebUserPreferences preferences = user.getWebPreferences();
            FavoriteResourcePortletPreferences favoriteResourcePreferences = preferences
                .getFavoriteResourcePortletPreferences();

            PageList<ResourceHealthComposite> results = manager.findResourceHealth(user.getSubject(),
                favoriteResourcePreferences.asArray(), PageControl.getUnlimitedInstance());

            if ((results != null) && (results.size() > 0)) {
                PageList<DisambiguationReport<ResourceHealthComposite>> list = DisambiguatedResourceListUtil.disambiguate(manager, results, ViewAction.RESOURCE_ID_EXTRACTOR);
               
                for (DisambiguationReport<ResourceHealthComposite> summary : list) {
                    String link = feed.getBaseUrl() + FunctionTagLibrary.getDefaultResourceTabURL() + "?id="
                        + summary.getOriginal().getId();

                    String availText = res.getMessage("dash.home.ResourceHealth.rss.item.availability", summary
                        .getOriginal().getAvailabilityType().toString());
                    String alertsText = res.getMessage("dash.home.ResourceHealth.rss.item.alerts", Long.valueOf(summary
                        .getOriginal().getAlerts()));
                    String typeText = res.getMessage("dash.home.ResourceHealth.rss.item.resourceType", summary
                        .getOriginal().getTypeName());
                    String parentsText = res.getMessage("dash.home.ResourceHealth.rss.item.resourceParents", getLineage(summary));
                   
                    long now = System.currentTimeMillis();

                    StringBuffer desc = new StringBuffer();
                    desc.append("<table><tr><td align=\"left\">").append(typeText).append("</td></tr>");

                    desc.append("<tr><td align=\"left\">").append(parentsText).append("</td></tr>");
                   
                    if (favoriteResourcePreferences.showAvailability) {
                        desc.append("<tr><td align=\"left\">").append(availText).append("</td></tr>");
                    }

                    if (favoriteResourcePreferences.showAlerts) {
                        desc.append("<tr><td align=\"left\">").append(alertsText).append("</td></tr>");
                    }

                    desc.append("</table>");

                    feed.addItem(summary.getOriginal().getName(), link, desc.toString(), now);
                }
            }

            request.setAttribute("rssFeed", feed);
View Full Code Here

Examples of org.rhq.enterprise.gui.legacy.portlet.RSSFeed

public class RSSAction extends BaseRSSAction {
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        RSSFeed feed = getNewRSSFeed(request);

        AlertManagerLocal alertManager = LookupUtil.getAlertManager();

        // Set title
        MessageResources res = getResources(request);
        feed.setTitle(res.getMessage("dash.home.CriticalAlerts"));

        // Get the alerts
        WebUser user = getWebUser(request);
        if (user != null) {

            AlertsPortletPreferences prefs = user.getWebPreferences().getAlertsPortletPreferences();

            PageControl pageControl = new PageControl(0, prefs.count);

            AlertCriteria criteria = new AlertCriteria();
            criteria.addFilterPriorities(AlertPriority.getByLegacyIndex(prefs.priority));
            criteria.addFilterStartTime(prefs.timeRange);
            criteria.addFilterResourceIds(("all".equals(prefs.displayAll) ? null : ArrayUtils.wrapInArray(prefs
                .asArray())));
            criteria.setPageControl(pageControl);

            PageList<Alert> alerts = alertManager.findAlertsByCriteria(user.getSubject(), criteria);

            if ((alerts != null) && (alerts.size() > 0)) {
                for (Alert alert : alerts) {
                    String link = feed.getBaseUrl() + "/alerts/Alerts.do?mode=viewAlert&id="
                        + alert.getAlertDefinition().getResource().getId() + "&a=" + alert.getId();

                    DateSpecifics specs = new DateSpecifics();
                    specs.setDateFormat(new SimpleDateFormat(res.getMessage(Constants.UNIT_FORMAT_PREFIX_KEY
                        + "epoch-millis")));

                    FormattedNumber fmtd = UnitsFormat.format(new UnitNumber(alert.getCtime(),
                        UnitsConstants.UNIT_DATE, ScaleConstants.SCALE_MILLI), request.getLocale(), specs);

                    feed.addItem(alert.getAlertDefinition().getResource().getName() + " "
                        + alert.getAlertDefinition().getName(), link, fmtd.toString(), alert.getCtime());
                }
            }

            request.setAttribute("rssFeed", feed);
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.