Re: BSF4REXX Event Listener



Hi Raetus,

java.lang.IllegalArgumentException: event set
'com.sun.syndication.fetcher.impl.HttpURLFeedFetcher@14693c7' unknown
for source type 'class
com.sun.syndication.fetcher.impl.HttpURLFeedFetcher'

This means that the introspection of the class 'com.sun.syndication.fetcher.impl.HttpURLFeedFetcher' did not yield information about events that class fires.

Are you sure that this class indeed does fire events at all? Could it be that the Java example is not working?

What does a "javap -public com.sun.syndication.fetcher.impl.HttpURLFeedFetcher" list?


Here is a quick transcription (which would cause the same error that you report):

------------ cut here --------------
/* cf. <news:comp.lang.rexx> posting of Raetus on 2008-06-18

Java source: <https://rome.dev.java.net/source/browse/rome/subprojects/fetcher/src/java/com/sun/syndication/fetcher/samples/FeedReader.java?view=markup>

*/


/* needs: - ROME, <https://rome.dev.java.net/> states as of 2008-06-05:

"ROME is an set of open source Java tools for parsing, generating and
publishing RSS and Atom feeds. The core ROME library depends only on the
JDOM XML parser and supports parsing, generating and converting all of the
popular RSS and Atom formats including RSS 0.90, RSS 0.91 Netscape, RSS
0.91 Userland, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3,
and Atom 1.0. You can parse to an RSS object model, an Atom object model
or an abstract SyndFeed model that can model either family of formats."

- JDOM, <http://jdom.org>

example:

testFeedReader http://ooonewsletter.blogspot.com/atom.xml
*/

parse arg url

test=bsf.import("com.sun.syndication.fetcher.FetcherListener", "FetcherListener")

feedUrl = .bsf~new("java.net.URL", url) -- create a Java URL object
feedUrlString= feedUrl~toString
feedInfoCache= bsf.loadClass("com.sun.syndication.fetcher.impl.HashMapFeedInfoCache")~getInstance
fetcher = .bsf~new("com.sun.syndication.fetcher.impl.HttpURLFeedFetcher", feedInfoCache)

fetcher~bsf.addEventListener("fetcher", "", "say 'a fetcher event occured'")
fetcher~bsf.addEventListener("fetcher", "unchanged", "say 'an ''unchanged'' fetcher event occured'")
fetcher~bsf.addEventListener("fetcher", "polled", "say 'a ''polled'' fetcher event occured'")
fetcher~bsf.addEventListener("fetcher", "retrieved", "say 'a ''retrieved'' fetcher event occured'")


..error~say("Retrieving feed" feedUrlString)
feed = fetcher~retrieveFeed(feedUrl)

..error~say(feedUrlString "retrieved")
..error~say(feedUrlString "has a title:" feed~getTitle "and contains" feed~getEntries~size -
"entries.")
..error~say("Polling" feedUrlString "again to test conditional get support.")
feed2 = fetcher~retrieveFeed(feedUrl)

do forever /* this is our event loop, processing event texts */
evText=bsf.pollEventText(10) /* get event text, timeout value 10/1000 secs */
say "evText:" pp(evText)
if evText=.nil then leave /* no event text, leave event loop */
end

..error~say('If a "Feed Unchanged" event fired then the server supports conditional gets.')
exit 0


::requires bsf.cls -- get Java support for ooRexx

------------ cut here --------------

Am a little bit in a hurry to get home, so I need to stop for the moment, but maybe you could look into that in the meantime?

---

Here is the beta of the latest drop of BSF4Rexx: <http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/old/2008/dist.20080618/>. Make sure that you de-install your current version before installing the new one (from the installation zip archive).

Please note that the reference cards (the PDF files) were updated as well.

HTH,

---rony

.



Relevant Pages

  • Re: BSF4REXX implementation of Java fragment
    ... publishing RSS and Atom feeds. ... You can parse to an RSS object model, ...
    (comp.lang.rexx)
  • [ANN] RSS Parser 0.1.7
    ... Atom support ... DublinCore module with RSS 2.0 support ... RSS::Maker.make can make Atom feed document. ...
    (comp.lang.ruby)
  • [ANN] feed-normalizer 1.5.0 Released
    ... An extensible Ruby wrapper for Atom and RSS parsers. ... Feed normalizer wraps various RSS and Atom parsers, ...
    (comp.lang.ruby)
  • Re: Entourage
    ... Entourage can't read RSS or Atom. ... There's also a free NetNewsWire Lite, which you should give a try, ...
    (microsoft.public.mac.office.entourage)