https://bugs.eclipse.org/bugs/show_bug.cgi?id=241630
diff --git a/source/COPYRIGHT b/source/COPYRIGHT
index b54cb14..b94bbe8 100644
--- a/source/COPYRIGHT
+++ b/source/COPYRIGHT
@@ -1,5 +1,5 @@
 
-Copyright (c) 2006 Logica and others
+Copyright (c) 2006 Logica, 2008 IBM, and others
  
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v1.0
@@ -8,4 +8,4 @@
 
 Contributors:
 * Onno van der Straaten:: initial implementation
-
+* Ricardo Balduino:: additions for feed generation (practices and UMA types)
diff --git a/source/app/controllers/rss_controller.rb b/source/app/controllers/rss_controller.rb
index 96dc3ed..f7e416e 100644
--- a/source/app/controllers/rss_controller.rb
+++ b/source/app/controllers/rss_controller.rb
@@ -1,5 +1,6 @@
 #--######################################################################
 # Copyright (c) 2006 Logica
+# Copyright (c) 2008 IBM
 # 
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
@@ -9,14 +10,15 @@
 # Contributors:
 # 
 # Onno van der Straaten:: initial implementation
+# Ricardo Balduino:: added actions to handle Practice feed and UMA Types feed
 #++######################################################################
-# {Copyright (c) 2006 Logica}[link:files/COPYRIGHT.html]
+# {Copyright (c) 2006 Logica, 2008 IBM}[link:files/COPYRIGHT.html]
 
 class RssController < ApplicationController
 
   session :off # stateless RSS requests
   
-  caches_page :list 
+  caches_page :list
   
   def list
     @cadmin = User.find_central_admin
@@ -33,4 +35,39 @@
     headers['Content-Type'] = 'application/rss+xml'
     render :layout => false
   end
-end
\ No newline at end of file
+  
+  # author: RB
+  def practice_feed # processes the request for a practice feed
+    @wiki = Wiki.find_by_folder(params[:site_folder]) # gets the wiki site folder that is part of the requesting url
+    if (@wiki == nil) 
+        render :action => 'error', :status => 404         
+    else
+      @practice_name = params[:practice_name] # gets the practice name that is part of the requestin url
+      @wikiId = Wiki.find(@wiki.id) # finds the wiki site with the given id
+      # queries for the practice page in this particular wiki site
+      @practice = WikiPage.find(:first, :conditions => ['uma_name=? and site_id=?', @practice_name, @wiki.id])
+      
+      if (@practice == nil)
+        render :action => 'error', :status => 404
+      end  
+    end
+  end
+
+  # author: RB
+  def any_uma_type_feed # processes the request for any uma element feed
+    @wiki = Wiki.find_by_folder(params[:site_folder]) # gets the wiki site folder that is part of the requesting url
+    @umaType = params[:uma_type] # gets the uma type that is part of the requesting url
+    if (@wiki == nil) 
+        render :action => 'error', :status => 404         
+    else
+      @wikiId = Wiki.find(@wiki.id) # finds the wiki site with the given id
+      # queries for all the elements of given uma type in this particular wiki site
+      @umaElements = WikiPage.find(:all, :conditions => ['uma_type=? and site_id=?', @umaType, @wiki.id])
+    
+      if (@umaElements.size == 0)
+        render :action => 'error', :status => 404
+      end  
+    end
+  end  
+end
+
diff --git a/source/app/models/page.rb b/source/app/models/page.rb
index 126b004..a493e3c 100644
--- a/source/app/models/page.rb
+++ b/source/app/models/page.rb
@@ -2,6 +2,7 @@
 # * {EPF Wiki Data model}[link:files/doc/DATAMODEL.html]
 #--######################################################################
 # Copyright (c) 2006 Logica
+# Copyright (c) 2008 IBM
 # 
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
@@ -11,8 +12,9 @@
 # Contributors:
 # 
 # Onno van der Straaten:: initial implementation
+# Ricardo Balduino:: tweaked method that returns brief description of UMA elements (overviewTable)
 #++######################################################################
-# {Copyright (c) 2006 Logica}[link:files/COPYRIGHT.html]
+# {Copyright (c) 2006 Logica, 2008 IBM.}[link:files/COPYRIGHT.html]
 
 class Page < ActiveRecord::Base
   
@@ -122,8 +124,9 @@
   
   def overview_table
     match = /class="overviewTable".*?>(.*?)<\/table>/m.match(self.html)
+    match1 = /td.*?>(.*?)<\/td>/m.match(match[1]) # returns only the text
     if match
-      result = '<table border="0" cellspacing="0" cellpadding="0">'+match[1]+'</table>'
+      result = match1[1]
     else
       result = ""
     end
diff --git a/source/app/views/rss/any_uma_type_feed.rxml b/source/app/views/rss/any_uma_type_feed.rxml
new file mode 100644
index 0000000..cb03e9e
--- /dev/null
+++ b/source/app/views/rss/any_uma_type_feed.rxml
@@ -0,0 +1,66 @@
+#--######################################################################
+# Copyright (c) 2008 IBM
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# 
+# Ricardo Balduino:: Initial implementation, based on design discussions with Onno van der Straaten
+#++######################################################################
+# {Copyright (c) 2008 IBM}[link:files/COPYRIGHT.html]
+
+records = (@umaElements).uniq
+imageSrc = ""
+imageSrcTag = ""
+
+
+xml.instruct!
+  #xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
+  xml.rss "version" => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do
+  
+  scope = @wiki.title + " Wiki" if @wiki
+  scope = ENV['EPFWIKI_APP_NAME'] unless @wiki
+  
+  xml.channel do
+    xml.title "#{scope}"
+    if @wiki
+      xml.link @wiki.url(true) 
+      xml.atom:link, :href => "http://#{ENV['EPFWIKI_HOST']}/rss/#{@wiki.folder}/#{@umaType}", :rel => 'self', :type => 'application/rss+xml'      
+    end
+    xml.pubDate CGI.rfc1123_date(Time.now.gmtime) 
+    xml.description h("All #{@umaType} elements in '#{scope}'")
+    records.sort_by{|record| [record.presentation_name]}.each do |record| # can sort on more columns but we have the baseline_updated_on column
+      xml.item do
+        logger.debug("RSS item for #{record.class.to_s} with ID #{record.id}")
+        wiki_page = record
+
+        # extracts the image for each item
+        match1 = /<td width="50"><img src="(.*?)"/m.match(wiki_page.html)
+        if match1
+          imageSrc = match1[1]
+          imageSrc = imageSrc.gsub("../", '')
+          imageSrc = imageSrc.gsub("./", '')
+          imageSrc = "http://" + ENV['EPFWIKI_HOST'] + "/" + "#{ENV['EPFWIKI_WIKIS_FOLDER']}/" + wiki_page.site.folder + "/" + imageSrc # uses this to show an image by the channel title
+          imageSrcTag = '<img src="'+imageSrc+'" width="16" height="16" />' # uses this to show an image by the brief description
+        end      
+       
+        xml.guid "WikiPage#{wiki_page.id.to_s}", :isPermaLink => false
+        xml.title "#{wiki_page.presentation_name}"
+        xml.link wiki_page.url(true)
+        xml.description imageSrcTag+" "+wiki_page.overview_table
+        xml.pubDate CGI.rfc1123_date(Time.now.gmtime)
+        #xml.dc_creator h(wiki_page.user.name) # this is raising an exception -> user is nil
+      end
+    end
+   
+    # shows the image with link on the channel section
+    xml.image do
+      xml.url imageSrc
+      xml.link @wiki.url(true)
+      xml.title @wiki.title
+    end  
+  end
+end
diff --git a/source/app/views/rss/error.rhtml b/source/app/views/rss/error.rhtml
new file mode 100644
index 0000000..7b84c51
--- /dev/null
+++ b/source/app/views/rss/error.rhtml
@@ -0,0 +1,37 @@
+<!--
+#--######################################################################
+# Copyright (c) 2008 IBM
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# 
+# Ricardo Balduino:: Initial implementation
+#++######################################################################
+# {Copyright (c) 2008 IBM}[link:files/COPYRIGHT.html]
+-->
+
+<% @heading = "Application Error" %>
+<% @overview = "An application error occurred while processing your request. " %>
+
+
+<head>
+	<h1>Application Error</h1>
+</head>
+<body>
+<div class="sectionHeading">
+	<%= "Error " + "'" + ENV['EPFWIKI_APP_NAME'] + "'" %>
+</div>
+<div class="sectionContent">
+    <table cellpadding="0" cellspacing="0" border="0" class="sectionTable">
+        <tr valign="top">
+            <td scope="row" class="sectionTableCell">
+            	<p>An application error occurred while processing your request.</p>
+        	</td>
+        </tr>
+    </table>
+</div>
+</body>
\ No newline at end of file
diff --git a/source/app/views/rss/practice_feed.rxml b/source/app/views/rss/practice_feed.rxml
new file mode 100644
index 0000000..590d8a2
--- /dev/null
+++ b/source/app/views/rss/practice_feed.rxml
@@ -0,0 +1,102 @@
+#--######################################################################
+# Copyright (c) 2008 IBM
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# 
+# Ricardo Balduino:: Initial implementation, based on design discussions with Onno van der Straaten
+#++######################################################################
+# {Copyright (c) 2008 IBM}[link:files/COPYRIGHT.html]
+
+record = (@practice)
+
+xml.instruct!
+  #xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
+  xml.rss "version" => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do
+  
+  scope = @practice.presentation_name + " Practice" if @practice
+  scope = ENV['EPFWIKI_APP_NAME'] unless @wiki
+  
+  wiki_page = record
+
+  xml.channel do
+    xml.title "#{scope}" 
+    if @wiki
+      xml.link wiki_page.url(true) 
+      xml.atom:link, :href => "http://#{ENV['EPFWIKI_HOST']}/rss/#{@wiki.folder}/practice/#{@practice_name}", :rel => 'self', :type => 'application/rss+xml'      
+    end
+    
+    xml.pubDate CGI.rfc1123_date(Time.now.gmtime) 
+    
+    xml.image do
+      xml.url "http://" + ENV['EPFWIKI_HOST'] + "/" + "#{ENV['EPFWIKI_WIKIS_FOLDER']}/" + wiki_page.site.folder + "/" + "images/practice.gif"
+      xml.link wiki_page.url(true)
+      xml.title @practice.presentation_name
+    end
+    
+    # xml.description h("Practice #{wiki_page.presentation_name} in '#{@wiki.title}' Wiki") # use this and remove the line below in case the practice itself is added as first item in the feed, see commented section below 
+    xml.description wiki_page.overview_table # Gets the brief description from the element page
+
+    # The first entry could be the practice itself, but is it redundant with the channel information above.
+    #xml.item do
+    #  xml.guid "WikiPage#{wiki_page.id.to_s}", :isPermaLink => false
+    #  xml.title "#{wiki_page.presentation_name}"
+    #  xml.link wiki_page.url(true)
+    #  xml.description wiki_page.overview_table # Gets the brief description from the element page
+    #  xml.pubDate CGI.rfc1123_date(Time.now.gmtime)
+      #xml.dc_creator h(wiki_page.user.name) # this is raising an exception -> user is nil
+    #end
+    
+    # crawls the practice page and finds all the elements the practice relates to
+    match = /class="sectionTableHeading"(.*?)<\/td>/m.match(wiki_page.html) #finds first sectionTableHeading (Relationships table)
+    if match
+      sectionTableHeading = '<th class="sectionTableHeading"'+match[1]+'</td>'
+      more_nodes = true
+      while (more_nodes) do
+        # finds the image that is included by the brief description of the element
+        match1 = /img src="(.*?)"/m.match(sectionTableHeading)
+        if match1
+          imageTag = '<img src="'+match1[1]+'"'+' height="16" width="16">'
+          imageSrc = match1[1]
+          imageSrc = imageSrc.gsub("../", '')
+          imageSrc = imageSrc.gsub("./", '')
+          imageSrc = "http://" + ENV['EPFWIKI_HOST'] + "/" + "#{ENV['EPFWIKI_WIKIS_FOLDER']}/" + wiki_page.site.folder + "/" + imageSrc
+          sectionTableHeading = sectionTableHeading.sub(imageTag, '') # removes the img section from the sectionTableHeading, so next time next image will be returned
+          imageSrc = '<img src="'+imageSrc+'" width="16" height="16" />' # this is added by the brief description later
+        end
+        
+        match2 = /a (.*?)<\/a>/m.match(sectionTableHeading) #finds first <a href...</a> section in the sectionTableHeading block returned
+        if match2
+          xml.item do
+            aSection = '<a '+match2[1]+'</a>'
+            match3 = /"\>(.*?)<\/a>/m.match(aSection) # returns the text in the <a></a> section
+            title = match3[1]
+            xml.title title
+            match4 = /href="(.*?)"/m.match(aSection) # returns the relative path in the href attribute
+            if match4
+              aHref = match4[1]
+              # extracts the "./../../../" and adds the full url of the wiki site to the relative path
+              aHref = aHref.gsub("../", '')
+              aHref = aHref.gsub("./", '')
+              relPath = aHref # but the relative path is preserved for the purposes of using it on the wiki page query below
+              aHref = "http://" + ENV['EPFWIKI_HOST'] + "/" + "#{ENV['EPFWIKI_WIKIS_FOLDER']}/" + wiki_page.site.folder + "/" + aHref
+              xml.link aHref
+            end
+            page = WikiPage.find (:first, :conditions => ['rel_path=?', relPath]) # finds the page that is pointed by this relative path
+            xml.description imageSrc+" "+page.overview_table # returns the brief description of the element represented by this page, but first adds the relate image
+            xml.guid "WikiPage#{page.id.to_s}", :isPermaLink => false
+            xml.pubDate CGI.rfc1123_date(Time.now.gmtime)
+            
+            sectionTableHeading = sectionTableHeading.gsub(aSection, '') # removes the used <a>...</a> section from the whole, so this block repeats for the next <a>..</a> section found
+          end      
+        else
+          more_nodes = false
+        end
+      end
+    end # ends crawler
+  end
+end
diff --git a/source/config/routes.rb b/source/config/routes.rb
index 307b571..d6bf086 100644
--- a/source/config/routes.rb
+++ b/source/config/routes.rb
@@ -1,3 +1,19 @@
+#--######################################################################
+# Copyright (c) 2006 Logica
+# Copyright (c) 2008 IBM
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# 
+# Onno van der Straaten:: initial implementation
+# Ricardo Balduino:: added mappings to handle Practice feed and UMA Types feed
+#++######################################################################
+# {Copyright (c) 2006 Logica, 2008 IBM}[link:files/COPYRIGHT.html]
+
 ActionController::Routing::Routes.draw do |map|
   # The priority is based upon order of creation: first created -> highest priority.
   
@@ -28,6 +44,27 @@
   :month => /\d+/
   } 
 
+  # author:: RB
+  # A route for generating feed for a given practice from a given wiki site.
+  # http://myepfwiki/rss/[wiki folder]/practice/[practice_name]  
+  # for example "http://epf.eclipse.org/rss/EPF_Practices/practice/iterative_development" returns a feed with all elements of Iterative Development practice found in the EPF_Practices Wiki
+  map.connect "rss/:site_folder/practice/:practice_name",
+    :controller => 'rss',
+    :action => 'practice_feed',
+    :requirements => {:site_folder => /.*/,
+                      :practice_name => /.*/}
+
+  # author:: RB
+  # A route for generating feed for all elements of a given uma_type found in a given wiki site.
+  # http://myepfwiki/rss/[wiki folder]/[uma_type]  
+  # for example "http://epf.eclipse.org/rss/EPF_Practices/practice" returns a feed with all practices in the EPF Practices Wiki
+  map.connect "rss/:site_folder/:uma_type",
+    :controller => 'rss',
+    :action => 'any_uma_type_feed',
+    :requirements => {:site_folder => /.*/,
+                      :uma_type => /.*/}
+
+
 # TODO implement
 #  map.connect 'pages/list/:type',
 #    :controller => 'pages',
@@ -49,4 +86,6 @@
   # The following made sense for Apache, but not for LiteSpeed. 
   # BTW, LiteSpeed can be configured to use a custom error page
   map.connect '*path', :controller => 'other', :action => 'show404', :requirements => { :path => /.*/ }
+
+
 end