"...ending syndication feed confusion by supporting all of 'em. "
Content syndication with Project ROME by using ooRexx with BSF4ooRexx
LV-0902 - ao. Univ.Prof. Mag. Dr. Rony G. Flatscher Syndication
ROME
ooRexx
Martin Stoppacher Reg. No.:0650907
BSF4ooRexx
Programs
1
Agenda 1. 2. 2. 3.
Introduction Content Syndication Project ROME 2.1 2.2 3.1 3.2
4. 5. 6. 7. Syndication
API Java Programs
ooRexx
Introduction Examples
BSF4ooRexx ooRexx programs using BSF4ooRexx Demonstration Conclusion ROME
ooRexx
BSF4ooRexx
Programs
1. Introduction Content Syndication: - Specific type of XML - Distribution of information
Java:
- Platform independent programming language
Project ROME:
- Rss and atOm utilitiEs
- Syndication feed processing (JAVA API)
Open object Rexx: Syndication
ROME
ooRexx
- Interpreted programming language (extension: BSF4ooRexx) BSF4ooRexx
Programs
2. Content Syndication
Distribution of information
Information: summaries, recently added content ...
Advantages of web syndication
=> in the past B2B
- Millions of content providers, - No geographical barriers - Thousands of new distribution outlets - Eliminated entry barriers [BMcL02] Syndication
ROME
ooRexx
BSF4ooRexx
Programs
2. Content Syndication => Distribution through Syndication Feeds => Standardised XML Files => Different Standards (RSS, ATOM) and variants RSS 0.9, RSS 0.91, RSS 0.91, RSS 0.92, RSS 0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, Atom 1.0 Syndication
ROME
ooRexx
BSF4ooRexx
Programs
2. Content Syndication Structure of: RSS 2.0 | ATOM 0.3 ... ... Syndication
ROME
ooRexx
... ... BSF4ooRexx
Programs
3. Project ROME
Java, Application Programming Interface, API
Packages:
3
com.sun.syndication. feed.rss (1) feed.atom (2) feed.synd(3) Data-models: io module feed
1) The RSS data model (abstract) 2) The Atom data model (abstract) 3) A format independent data model Syndication
ROME
ooRexx
BSF4ooRexx
Programs
3. Project ROME PR Snippets
-
Java
SyndFeedInput input = newSyndFeedInput(); SyndFeed feed = input.build(newXmlReader(feedUrl)); System.out.println(feed); /* same result as feed.toString(); */ SyndFeedOutput output = newSyndFeedOutput(); output.output(feed, newPrintWriter(System.out)); feed.setFeedType(“outputType”)
;
Syndication
ROME
ooRexx
BSF4ooRexx
Programs
3. Project ROME
1
Syndication
ROME
ooRexx
BSF4ooRexx
st
Programs
4. Open Object Rexx
Classic Rexx is a procedural language
OoRexx is fully compatible with Classic Rexx
OoRexx is fully object oriented
Classical Rexx approach: feedback = check_in(book)
/* function */
Open Object Rexx approach: feedback = book~check_in Syndication
ROME
ooRexx
/* method */ BSF4ooRexx
Programs
4. Open Object Rexx OoRexx features:
Syndication
ROME
ooRexx
Object orientation Class libraries Method chaining English like statements Fewer rules Interpreted not compiled Type less variables Clear error messages BSF4ooRexx
Programs
4. Open Object Rexx
Directives: define classes, methods, routines, …
::class ::method
::requires
::routine
Create a class instance:
feedback=book~new([arguments])
/*instance*/
Usage of Class libraries: Array , Bag , Directory , List => Syndication
BSF.cls class library of BSF4ooRexx ROME
ooRexx
BSF4ooRexx
Programs
4. Open Object Rexx OoRexx code snippet: parse arginput value=.squared~new sqd=value~square(input) say'The original value is:'input say 'The squared value is:'sqd exit0 ::class squared ::method 'square' use argin return(in*in) [Fos05] Syndication
ROME
ooRexx
BSF4ooRexx
Programs
4. Open Object Rexx
2
Syndication
ROME
ooRexx
BSF4ooRexx
nd
Programs
5. BSF4ooRexx Bean Scripting Framework for ooRexx
Java support for ooRexx and vice versa
Based on Apache Jakarta BSF project (developed by IBM )
=> BSFManager
Features:
Syndication
=> BSFEngine (ooRexx specific)
BSF.cls
class library for the interfacing with Java preregistered objects BSF Registry ROME
ooRexx
BSF4ooRexx
Programs
5. BSF4ooRexx Example: MySQL DB connection: Java importjava.sql.*; publicclassmysql { publicstaticvoidmain(String[]args){
DriverManager.registerDriver( newcom.mysql.jdbc.Driver()); Connection conn = DriverManager.getConnection(url, url, pw); Statement stmt = conn.createStatement (); ResultSet rset = stmt.executeQuery("select NR, NAME from mytest"); rset.next()){ System.out.print(rset.getString("nr")); Syndication
ROME
ooRexx
BSF4ooRexx
Programs
5. BSF4ooRexx Example: MySQL DB connection: ooRexx mydrive=.bsf~new('com.mysql.jdbc.Driver') man=bsf.loadClass("java.sql.DriverManager") man~registerDriver(mydrive) conn=man~getConnection(url,uid,pw) stmt=conn~createStatement rset=stmt~executeQuery("select NR, NAME from mytest") rset~next rset~getString("nr") Syndication
ROME
ooRexx
BSF4ooRexx
Programs
5. BSF4ooRexx
3
Syndication
ROME
ooRexx
BSF4ooRexx
rd
Programs
6. Programs
Using BSF4ooRexx to create programs with ROME
Example programs:
Application areas: News distribution, Reports,
Feed reader (parser), writer, aggregator, creator, … Wikis, Blogs, Trading software,Search engines, ...
Syndication
ROME
ooRexx
BSF4ooRexx
Programs
6. Programs OoRexx Snippets using the PR API javaclass="FeedReader1" get=.bsf~new(javaClass) sayget~getfeed
Using a Java class Building an instance of a Java class
feedUrl=.bsf~new("java.net.URL",url) sayconnecting__||feedUrl~getAuthority() Parsing a Feed with Project ROME input=.bsf~new ("com.sun.syndication.io.SyndFeedInput") xmlr=.bsf~new ("com.sun.syndication.io.XmlReader”,feedUrl) feed=input~build(xmlr) Syndication
ROME
ooRexx
BSF4ooRexx
Programs
6. Programs Example of a FeedReader with a GUI Java AWT extension
Description retrieved from the Syndication Feed Syndication
ROME
ooRexx
BSF4ooRexx
Programs
6. Programs OoRexx Snippets using the PR API xmlr=.bsf~new ("org.xml.sax.InputSource",“/*URI String */”) feed~getUri() Different input sources feed~getAuthor() SyndFeed methods feed~getDescription() feed~getEncoding() Defines a Feed Type … (SyndFeed) feed~setFeedType("rss_2.0") sayfeed~getFeedType() Syndication
ROME
ooRexx
BSF4ooRexx
Programs
6. Programs Example output of PR methods ~getTitle() ~getURI() ~getAuthor()
Syndication
ROME
ooRexx
BSF4ooRexx
Programs
6. Programs OoRexx Snippets using the PR API sayoutput~outputString(feed,1) /* usage of pritty print(0 yes or 1 no) */ sayoutput~outputString(feed,1) WireFeedOutput, SyndFeedOutput writer=.bsf~new ("java.io.FileWriter",fileName) output=.bsf~new ("com.sun.syndication.io.SyndFeedOutput") output~output(feed,writer) Syndication
ROME
ooRexx
BSF4ooRexx
Programs
6. Programs Example of a graphical Feed Creator (JSwing)
Syndication
ROME
ooRexx
BSF4ooRexx
Programs
Demonstration
4
Syndication
ROME
ooRexx
BSF4ooRexx
th
Programs
Conclusion
PR => easy to use library for (Project ROME) syndication feed processing used for: News distribution, Reports, Wikis, Blogs, Trading software, Search engines, News collection, ...
OoRexx=> full usage of Java libraries via BSF4ooRexx - and therefore Project ROME
Feeds =>
Syndication
no more format confusion
“Code once run everywhere” ROME
ooRexx
BSF4ooRexx
Programs
Thank you
Syndication
ROME
ooRexx
BSF4ooRexx
Programs
References [ROME09]
Project ROME web resources; 2009; URL (2009-12-22) https://rome.dev.java.net/;
[ooR09]
About Open Object Rexx; Rexx Language Association; URL (2009-12-22) http://www.ooRexx.org/
[BSF4ooR]
BSF4ooRexx (Bean Scripting Framework for open object Rexx) 2009; URL (2009-12-22) http://wi.wu-wien.ac.at:8002/rgf/rexx/bsf4oorexx/current/
[Fos05]
REXX Programmer's Reference (Programmer to Programmer); Wrox; edition (März 2005); Author: Howard Fosdick; ISBN 0-13-780651-5;
[CoSh90]
The REXX Language: A Practical Approach to Programing; Prentice Hall PTR; 2nd edition (March 2, 1990); Author: M. F. Cowlishaw;
Syndication
ROME
2009;
ISBN-13: 978-0137806515; 1990;
ooRexx
BSF4ooRexx
Programs
References [Flat06]
Flatscher Rony G.: The Vienna Version of BSF4Rexx; “2006 International Rexx Symposium”, Austin, Texas; USA, April 2006; URL (2010-01-03) http://wi.wu.ac.at:8002/rgf/rexx/orx17/ 2006%5forx17%5fBSF%5fViennaEd%2epdf
[BMcL02]
Java und XML (Broschiert); O'Reilly/VVA; Edition (April 2002); Author: Brett McLaughlin; ISBN-13: 978-3897212800;
[Flat01]
Flatscher, Rony G.:Java Bean Scripting with Rexx; “12 International Rexx Symposium”, Raleigh, North Carolina; USA, April 30th – May 2nd , 2001; URL
Syndication
(2010-01-03) http://wi.wu.ac.at:8002/rgf/rexx/orx12/ JavaBeanScriptingWithRexx%5forx12%2epdf
ROME
ooRexx
BSF4ooRexx
Programs