Examples of RSSItem


Examples of com.xmultra.processor.rss.RssItem

        Iterator iter = sortedItems.listIterator();

        int itemCount = 0;

        while (iter.hasNext() && itemCount < this.maxItems) {
            RssItem item = (RssItem)iter.next();

            // Skip items that are too old.
            if (item.getPubDate().compareTo(this.minimumPubDate) < 0) {
                continue;
            }

            items += item.getText();
            itemCount++;
        }

        RssItemSet itemSet = new RssItemSet(items, itemCount);
View Full Code Here

Examples of com.xmultra.processor.rss.RssItem

        // Iterate over unduplicated items and retrieve their text.
        Iterator iter = dedupedItems.keySet().iterator();

        while ( iter.hasNext() ) {
            String key = (String)iter.next();
            RssItem item = (RssItem)(dedupedItems.get( key ));
            items += item.getText();
        }

        return items;
    }
View Full Code Here

Examples of com.xmultra.processor.rss.RssItem

            if (connection == null) {
                connection = this.dataSource.getConnection();
            }

            RssItem item = (RssItem)entry.getValue();

            // Strip tags before passing guid to stored function.
            String guid = strings.strip( "</?guid[^>]*>", item.getGuid() );

            // Strip tags and escape apostrophes before passing title to stored function.
            String title = strings.strip( "</?title>", item.getTitle() );
            title = strings.substitute("'", "''", title);

            // Escape dollar signs in title before using in substitution.
            title = title.replace("\\$", "\\\\$");

            // Fill in placeholder parameters from stored function node in config file.
            boolean deepCopy = true;
            Node functionNode = this.dbFunctionNode.cloneNode(deepCopy);
            NodeList functionParameters = ((Element)functionNode).getElementsByTagName(DBXmlConfig.DB_PARAM);

            for (int i = 0; i < functionParameters.getLength(); i++) {
                // Each parameter node contains a text node whose value is the actual parameter value.
                Node parameter = functionParameters.item(i);
                String parameterValue = parameter.getFirstChild().getNodeValue();
                parameterValue = parameterValue.replace(XmultraConfig.RSS_ITEM_GUID_SYMBOL, guid);
                parameterValue = parameterValue.replace(XmultraConfig.RSS_ITEM_TITLE_SYMBOL, title);
                parameter.getFirstChild().setNodeValue(parameterValue);
            }

            String fileName = (String)dataSource.callStoredFunction(connection, functionNode);
            String fileContents = "";

            if (fileName != null) {
                fileContents = fileUtils.readFile( fileUtils.addRoot(fileName) );
            }

            if ( !fileContents.equals("") ) {

                RssItem fullTextItem = null;

                try {
                    boolean keepCDataSections = true;
                    fullTextItem = new RssItem(fileContents, keepCDataSections);
                    String fullText = fullTextItem.getContentEncoded();
                    item.setContentEncoded(fullText, updateText);

                    // Retrieve byline and credit line from full-text item if necessary,
                    // as when a Daylife feed is being processed.
                    String itemCreator = item.getCreator();

                    if ( itemCreator == null || itemCreator.equals("") ) {
                        String fullTextItemCreator = fullTextItem.getCreator();

                        if ( fullTextItemCreator != null && !fullTextItemCreator.equals("") ) {
                            item.setCreator(fullTextItemCreator, updateText);
                        }
                    }
View Full Code Here

Examples of com.xmultra.processor.rss.RssItem

    private boolean itemHasFullText(Map.Entry entry,
                                    Map<String,RssItem> previousItems,
                                    Map<String,RssItem> previousSourceItems) {

        String title = (String)entry.getKey();
        RssItem newItem = (RssItem)entry.getValue();

        Date newPubDate = newItem.getPubDate();

        boolean hasFullText = false;
        boolean updateText = true;

        // Check to see if we had this item last time we generated this feed.
        if ( previousItems.containsKey(title) ) {

            // This item was in the previous output.
            RssItem previousItem = previousItems.get(title);

            // Check to see if we also had this item in the previous source.
            if (previousSourceItems.containsKey(title) ) {

                // This item also was in the previous source.
                RssItem previousSourceItem = previousSourceItems.get(title);
                Date previousSourcePubDate = previousSourceItem.getPubDate();
               
                // Test the previous source date against the new source date.
                if ( newPubDate.equals(previousSourcePubDate) ) {
                    // Source dates match, so new source item is not an update and we
                    // can use the previous output's full text and, if necessary, dc:creator.
View Full Code Here

Examples of net.rim.device.api.io.parser.rss.model.RSSItem

    private void displayRSSTree(final Message message) {
        final int parentNode = 0;
        int childNode;
        RSSChannel channel;
        RSSItem item;
        Vector items;

        _treeField.deleteAll();

        final Object obj = message.getObjectPayload();

        if (obj instanceof RSSChannel) {
            channel = (RSSChannel) obj;

            items = channel.getRSSItems();

            for (int i = 0; i < items.size(); ++i) {
                item = (RSSItem) items.elementAt(i);
                final String key = item.getTitle();
                final String val = item.getDescription();
                childNode = _treeField.addChildNode(parentNode, key);
                _treeField.addChildNode(childNode, val);
            }
        }
    }
View Full Code Here

Examples of net.rim.device.api.io.parser.rss.model.RSSItem

    private void displayRSSTree(final Message message) {
        final int parentNode = 0;
        int childNode;
        RSSChannel channel;
        RSSItem item;
        Vector items;

        _treeField.deleteAll();

        final Object obj = message.getObjectPayload();

        if (obj instanceof RSSChannel) {
            channel = (RSSChannel) obj;

            items = channel.getRSSItems();

            for (int i = 0; i < items.size(); ++i) {
                item = (RSSItem) items.elementAt(i);
                final String key = item.getTitle();
                final String val = item.getDescription();
                childNode = _treeField.addChildNode(parentNode, key);
                _treeField.addChildNode(childNode, val);
            }
        }
    }
View Full Code Here

Examples of org.apache.nutch.parse.rss.structs.RSSItem

                }

                // now get the descriptions of all the underlying RSS Items and
                // then index them too
                for (int j = 0; j < r.getItems().size(); j++) {
                    RSSItem theRSSItem = (RSSItem) r.getItems().get(j);
                    indexText.append(theRSSItem.getDescription());
                    indexText.append(" ");

                    String whichLink = null;

                    if (theRSSItem.getPermalink() != null)
                        whichLink = theRSSItem.getPermalink();
                    else
                        whichLink = theRSSItem.getLink();

                    if (whichLink != null) {
                        try {
          if (theRSSItem.getDescription()!=null) {
        theOutlinks.add(new Outlink(whichLink, theRSSItem.getDescription(), getConf()));
          } else {
        theOutlinks.add(new Outlink(whichLink, "", getConf()));
          }
                        } catch (MalformedURLException e) {
                            if (LOG.isWarnEnabled()) {
View Full Code Here

Examples of org.apache.nutch.parse.rss.structs.RSSItem

            String description, String permalink) throws FeedParserException {

        //System.out.println("Found a new published article: " + permalink);
        if (fCurrentChannel != null) { //should never be null
            fCurrentChannel.getItems().add(
                    new RSSItem(title, link, description, permalink));
        }

    }
View Full Code Here

Examples of org.apache.nutch.parse.rss.structs.RSSItem

                }

                // now get the descriptions of all the underlying RSS Items and
                // then index them too
                for (int j = 0; j < r.getItems().size(); j++) {
                    RSSItem theRSSItem = (RSSItem) r.getItems().get(j);
                    indexText.append(theRSSItem.getDescription());
                    indexText.append(" ");

                    String whichLink = null;

                    if (theRSSItem.getPermalink() != null)
                        whichLink = theRSSItem.getPermalink();
                    else
                        whichLink = theRSSItem.getLink();

                    if (whichLink != null) {
                        try {
          if (theRSSItem.getDescription()!=null) {
        theOutlinks.add(new Outlink(whichLink, theRSSItem.getDescription()));
          } else {
        theOutlinks.add(new Outlink(whichLink, ""));
          }
                        } catch (MalformedURLException e) {
                            if (LOG.isWarnEnabled()) {
View Full Code Here

Examples of org.apache.nutch.parse.rss.structs.RSSItem

            String description, String permalink) throws FeedParserException {

        //System.out.println("Found a new published article: " + permalink);
        if (fCurrentChannel != null) { //should never be null
            fCurrentChannel.getItems().add(
                    new RSSItem(title, link, description, permalink));
        }

    }
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.