java . blogs - PowerPoint PPT Presentation

java blogs n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
java . blogs PowerPoint Presentation
Download Presentation
java . blogs

play fullscreen
1 / 81
java . blogs
158 Views
Download Presentation
ganya
Download Presentation

java . blogs

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. java.blogs “The movement, the site, the technology” Prepared by Mike Cannon-Brookes - June, 2003 mike@atlassian.com - http://www.atlassian.com

  2. Agenda • Blogging & Java • What is java.blogs? • Technology behind javablogs.com

  3. What is a weblog? • “News site” written by one person • Online, chronological journal • Personal list of thoughts, links etc • Newest entries at the top of the page • Usually has an RSS version • Hard to categorize, easier to show you an example

  4. Typical Blog Pieces Ugly Author Pic Silly Title Posts

  5. Posts Nav Search Blog Roll About

  6. Why read blogs? • Get a personal view point • Bloggers usually discuss latest content / ideas • In the Java world, often a good source of solutions and personal experience • Example: commons-logging & log4j • Comparison: best feature on Amazon? • book reviews!

  7. Why write a blog? • Everyone has their own reasons • A place for personal expression • Share your thoughts, wisdom • Feel part of a community • Rant / rave / vent / discuss • BileBlog perfect example

  8. RSS • Really Simple Syndication? • Rich Site Summary? • RSS is the “protocol” of the syndication world • An XML format representing a list of links • Used to syndicate weblogs in a machine readable format • It is a very simple format…

  9. RSS Example <rss> <channel> <title>rebelutionary</title> <link>http://blogs.atlassian.com/rebelutionary/</link> <description>Mike Cannon-Brookes on J2EE, Java, software development, bug tracking, Atlassian, JIRA and whatever comes to mind.</description> <item> <title>The BileBlog is painfully accurate</title> <link>http://blogs.atlassian.com/rebelutionary/archives/000166.html</link> <description>Let me start by saying …</description> </item> <item> <title>Two Weeks Left to TSS </title> <link>http://blogs.atlassian.com/rebelutionary/archives/000165.html</link> <description>Less than two weeks left until TSS Symposium... </description> </item> . . . </channel> </rss>

  10. Blog Syndication Blog 2 Blog 1 Blog 3 RSS(XML) HTML RSS(XML) HTML News Aggregator Reader

  11. News Aggregators • Software to aggregate news from your personal list of favourite sites. • Popular: • AmphetaDesk (Perl) • NetNewsWire (OSX) • NewsCrawler (Win) • NewsMonster (Moz) • java.blogs is a ‘web based’ news aggregator for the Java community.

  12. Blogging using Java • Lots of blog software written in Java • 3 biggest projects: • Roller, SnipSnap and Blojsom • Other projects include: • PersonalBlog, MiniBlog, CocoBlog etc.

  13. Tools: Roller • www.rollerweblogger.org • The most advanced Java-based blogging tool • Supports comments, templating, RSS, XML-RPC, multi-user. • Deploys on Servlet container & JDBC database • Technologies used: • Persistence: Hibernate or Castor • MVC: Struts • Views: Velocity

  14. Tools: SnipSnap • www.snipsnap.org • Innovative Java-based ‘Bliki’ (Blog + Wiki) • Features include a complex Wiki rendering engine, comments, search, RSS, XML-RPC • Standalone Jetty instance with McKoi DB • Technologies: • Views: JSP • Everything else hand rolled!

  15. Tools: Blojsom • blojsom.sf.net • Java port of Bloxsom (Perl-based tool) • Uses the file system for persistence • Supports comments, RSS, XML-RPC, referrer tracking, searching. • Runs on JDK 1.4 w/ Servlet 2.3 container. • Technologies: • Flexible view dispatcher: JSP, Velocity or Freemarker

  16. Tools: Wrap Up • If you’re looking to start a new blog, without software - try freeroller http://www.freeroller.net • No installation required • Completely web based • Good way to get blogging!

  17. Agenda • Blogging & Java • What is java.blogs? • Technology behind javablogs.com

  18. java.blogs Overview • www.javablogs.com • A web aggregator for Java focused weblogs • Currently aggregates: • Over 1.5 million words • Written in 18,000+ entries • Posted by 360+ bloggers

  19. Information Flows Blogs (Internet) Thoughts RSS Feeds Bloggers java.blogs Browse Website Email Aggregated RSS Readers

  20. java.blogs Features • Single ‘feed’ of all Java blog entries • Decentralized, uncontrolled, focused community • Each blog owner controls their own blog • Tracks “popular” entries • Popular entries show what the community reads • Text & date searchable content • eg find all entries about “AOP” this week • Daily email notifications • Keep up to date with most popular entries from within your email client

  21. java.blogs daily update

  22. How is it different? • It is a true community of equals • Find a wide range of views on any topic • eg Over 30 entries discussing the impact of java.net within 24 hours of launch. • There is no ‘agenda’ - just personal views • “Good entries” rise to the top • More news than you can ever want • Now averaging over 200 entries / day

  23. 350 authors 1000 users Users in total control This is good and bad! Content is personal 100% opinions Analogy: having a conversation with 350 developers Few authors 290,000 users Centralised editorial Quality assurance Content is controlled Opinions in comments Analogy: reading a newspaper or magazine java.blogs vs TSS

  24. java.net? • java.net contains Sun ‘by-invitation only’ weblogs • This is good for Javablogs.com! • Many new blogs to aggregate (java.net has RSS): • James Gosling, • Sam Ruby, • Mike Clark, etc • See http://weblogs.java.net/ for more information.

  25. Agenda • Blogging & Java • What is java.blogs? • Technology behind javablogs.com

  26. javablogs.com Components Mail (JavaMail & Velocity) Scheduling(Quartz & Atlassian Scheduler) java.blogs code (Java!) Persistence (OFBiz) Non-Web DB (Postgres) XML / SOAP (Electric XML & Glue) Presentation (SiteMesh, WebWork & JSP) Search & Indexing (Lucene) User Management (OSUser) Web MVC (WebWork)

  27. Component Tour Scheduling Persistence Security MVC Indexing Mail Presentation

  28. Component Tour: Scheduling Scheduling Persistence Security MVC Indexing Mail Presentation Components: Quartz & atlassian-scheduler

  29. Scheduling: Quartz • www.part.net/quartz.html • J2EE job scheduling system • Alternatives? • Threads, util.Timer, external cron • Operates around a job/trigger model • Built in period and cron triggers • Extremely flexible, friendly component • USE: scheduling RSS retrieval, sending daily email updates, any periodic task • atlassian-scheduler is a Quartz XML config…

  30. Scheduling: Atlassian Scheduler • Example: scheduler-config.xml <scheduler> <jobs> <job name="Updater" class="com...UpdateJob" /> <job name="DailyEmail" class="com...EmailJob" /> </jobs> <triggers> <trigger name="UpdaterTrigger" job="Updater"> <period>3m</period> <startDelay>3m</startDelay> </trigger> <trigger name=”MailTrigger" job="DailyEmail" type="cron"> <startDelay>1m</startDelay> <expression>00***?</expression> </trigger> </triggers> </scheduler>

  31. Component Tour: Persistence Scheduling Persistence Security MVC Indexing Mail Presentation Component: OFBiz Entity Engine

  32. Persistence: OFBiz EE • www.ofbiz.org - Open For Business project • “Different” persistence engine • Light wrapper around JDBC datasources • Proud to be relational! • Data entities are generic value objects • Entity, field, view and relation definitions are in XML • Use: all data persistence in Javablogs.

  33. Persistence: OFBiz EE • Retrieving all blogs: Collection blogs = ee.findAll(“Blog”); • Retrieving a specific blog entity: Map idField = UtilMisc.toMap(“id”, id); GenericValue blog = ee.findByPrimaryKey("Blog", idField); • Getting and setting a field value: GenericValue blog = retrieveBlog(); String url = blog.getString(“url”); blog.set(“url”, newUrl); blog.store();

  34. Persistence: OFBiz EE • Retrieving blog entries: Collection entries = blog.getRelated(“ChildEntry”); • Complex find operation: Map fields = UtilMisc.toMap(“author”, “bob”); List sortorders = UtilMisc.toList(“dateadded”); entries = ee.findByAnd(“Blog”, fields, sortorders);

  35. Persistence: OFBiz EE • Automatically creates and updates tables • Code talks to the logical model • Logical model + field mappings = physical db OFBiz EE javablogs code Logical Model entitymodel.xml Physical Database Field Mappings fieldtypes-oracle.xml

  36. Persistence: OFBiz EE • Sample entity from entitymodel.xml <entity entity-name= "BlogEntry" package-name= "" > <field name= "id" type= "numeric" col-name= ”entry_id" /> <field name= "blog" type= "numeric" /> <field name= "title" type= "long-varchar" /> <field name= "created" type= "date-time" /> ... <prim-key field= "id" /> <relation type= "one" title= "Parent" rel-entity-name= "Blog" > <key-map field-name= "blog" rel-field-name= "id" /> </ relation > </ entity >

  37. Persistence: OFBiz EE • Sample of fieldtypes-postgres.xml <fieldtypemodel> <field-type-def type= "date-time" sql-type= "TIMESTAMP" java-type= "java.sql.Timestamp" /> <field-type-def type= "short-varchar" sql-type= "VARCHAR(60)" java-type= "String" /> <field-type-def type= "very-long" sql-type= "TEXT" java-type= "String" /> <field-type-def type= "credit-card-number" sql-type= "VARCHAR(40)" java-type= "String"> <validate name= "isAnyCard"/> </ field-type-def>

  38. Component Tour: Indexing Scheduling Persistence Security MVC Indexing Mail Presentation Component: Jakarta Lucene

  39. Indexing: Lucene • jakarta.apache.org/lucene • Thefull-text index and search component • Highly scalable and efficient architecture • Why use full text searching? • No more SQL: LIKE ‘%foo%’ • Used for full text search of blog entries

  40. Component Tour: Security Scheduling Persistence Security MVC Indexing Mail Presentation Components: OSUser & atlassian-security

  41. User Management: OSUser • www.opensymphony.com/osuser • Server-agnostic user management API • Handles user, group and profile data • Why needed? • User data different to other data • Pluggable storage providers (ie LDAP) • Writing portable J2EE auth code very hard

  42. User Management: OSUser • Providers for storage: • EJB, JDBC, OFBiz, Hibernate, LDAP, XML files etc • Adapters for server integration • Weblogic, Orion, JBoss, Resin etc javablogs code providers adapters • Storage • users • groups • profiles Application Server OSUser

  43. User Management: OSUser • Retrieving a specific user and their groups: User user = userManager.getUser(“fred”); Collection groups = user.getGroups(); • Retrieving a user’s profile: PropertySet profile = user.getPropertySet(); String country = profile.getString(“user.address.country”); Date signedUp = profile.getDate(“user.signup”); Long logins = profile.getLong(“user.numlogins”); • Creating a new user in the administrators group: User newUser = userManager.createUser(“mike”); newUser.setEmail(“mike@atlassian.com”); newUser.addToGroup(userManager.getGroup(“administrators”));

  44. Security: atlassian-security • Security is worst part of Servlet spec • Not portable between servers • Very limited URL patterns • To perform effective security checks on a web application, need to roll your own framework. • atlassian-security is our solution to this • in process of being open sourced

  45. atlassian-security architecture Concepts Integration Points

  46. atlassian-security Services • Services allow you to check the roles required for any request • Two bundled services: • Path Service: looks at the request URL. Allows extremely flexible path lookups • /admin/*, **/admin/*, /admin/Setup* etc • WebWork Service: looks at the action being executed • Other examples could be IPService or KeyService.

  47. atlassian-security PathService • PathService is configured in a security-paths.xml file: <security-paths> <path name= "admin"> <url-pattern>/secure/admin/*</url-pattern> <role-name>administrators</role-name> </path> <path name= "user"> <url-pattern>/secure/*</url-pattern> <role-name>users, developers</role-name> </path> </security-paths>

  48. atlassian-security Interceptors • Problem: run code before / after security events • Events? login, logout, auth attempts etc. • Under the Servlet spec you can’t do this. • Solution: AOP-like interceptors • Example: used in java.blogs to store the date of last login, and number of logins

  49. Component Tour: MVC Scheduling Persistence Security MVC Indexing Mail Presentation Component: OpenSymphony WebWork