Return-Path: X-Original-To: apmail-oodt-commits-archive@www.apache.org Delivered-To: apmail-oodt-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7B6AEC6ED for ; Wed, 9 May 2012 05:46:06 +0000 (UTC) Received: (qmail 47601 invoked by uid 500); 9 May 2012 05:46:06 -0000 Delivered-To: apmail-oodt-commits-archive@oodt.apache.org Received: (qmail 47573 invoked by uid 500); 9 May 2012 05:46:05 -0000 Mailing-List: contact commits-help@oodt.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@oodt.apache.org Delivered-To: mailing list commits@oodt.apache.org Received: (qmail 47356 invoked by uid 99); 9 May 2012 05:46:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 05:46:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 05:46:02 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2C6A543B3D7 for ; Wed, 9 May 2012 05:45:42 +0000 (UTC) Date: Wed, 9 May 2012 05:45:42 +0000 (UTC) From: "Ross Laidlaw (JIRA)" To: commits@oodt.apache.org Message-ID: <615774207.42711.1336542342296.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1289984480.3564.1335546769209.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (OODT-449) Create a default GeoRSS configuration file for the fmprod web application MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OODT-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13271120#comment-13271120 ] Ross Laidlaw commented on OODT-449: ----------------------------------- I've been experimenting with some ideas to implement Paul's suggestion for namespaces. I have a solution that appears to be working. Here are the steps I took: 1) Added Paul's namespace tags to the georss-config.xml file, as follows: {code} {code} 2) Created a new RSSNamespace class, which is very similar to the RSSTag class: {code} package org.apache.oodt.cas.product.rss; public class RSSNamespace { private String prefix; private String uri; public RSSNamespace() { } public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix;} public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } } {code} 3) Modified the RSSConfig class to add a list to store namespaces: * added new instance variable namespaces: {code} private List namespaces; {code} * added assignment to the constructor: {code} this.namespaces = new Vector(); {code} * added getter and setter methods for the namespaces instance variable: {code} public List getNamespaces() { return namespaces; } public void setNamespaces(List namespaces) { this.namespaces = namespaces; } {code} 4) Added new constants to the RSSConfigReaderMetKeys interface: {code} public static final String NAMESPACE_TAG = "namespace"; public static final String NAMESPACE_ATTR_PREFIX = "prefix"; public static final String NAMESPACE_ATTR_URI = "uri"; {code} 5) Updated the RSSConfigReader class to read in the namespace tags: * added readNamespaces() method to RSSConfigReader {code} protected static void readNamespaces(Element root, RSSConfig conf) { NodeList namespaceList = root.getElementsByTagName(NAMESPACE_TAG); if (namespaceList != null && namespaceList.getLength() > 0) { for (int i = 0; i < namespaceList.getLength(); i++) { Element namespaceElem = (Element) namespaceList.item(i); RSSNamespace namespace = new RSSNamespace(); namespace.setPrefix(namespaceElem.getAttribute(NAMESPACE_ATTR_PREFIX)); namespace.setUri(namespaceElem.getAttribute(NAMESPACE_ATTR_URI)); conf.getNamespaces().add(namespace); } } } {code} * added call to readNamespaces before the call to readTags in the readConfig method {code} public static RSSConfig readConfig(File file) throws FileNotFoundException { ... readNamespaces(rootElem, conf); readTags(rootElem, conf); ... } {code} 6) Updated the doIt() method in the RSSProductServlet class to process the list of namespace tags and add any namespaces to the rss tag of the output: {code} public void doIt(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { ... if (products != null && products.size() > 0) { ... try { ... Element rss = XMLUtils.addNode(doc, doc, "rss"); XMLUtils.addAttribute(doc, rss, "version", "2.0"); XMLUtils.addAttribute(doc, rss, "xmlns:cas", (String) NS_MAP.get("cas")); for (RSSNamespace namespace : this.conf.getNamespaces()) { XMLUtils.addAttribute(doc, rss, "xmlns:" + namespace.getPrefix(), namespace.getUri()); } ... } } } {code} 7) Tested the output: The results showed that the namespaces defined in georss-config.xml are now being added to the 'rss' tag of the output, as follows: {code} {code} > Create a default GeoRSS configuration file for the fmprod web application > ------------------------------------------------------------------------- > > Key: OODT-449 > URL: https://issues.apache.org/jira/browse/OODT-449 > Project: OODT > Issue Type: Sub-task > Components: file manager > Reporter: Ross Laidlaw > Labels: gsoc2012 > Fix For: 0.5 > > > Create a default GeoRSS configuration file for the fmprod web application of the File Manager component. > The GeoRSS configuration file will contain all of the information from the default RSS configuration file. In addition, it will also contain definitions for latitude and longitude GeoRSS XML tags. > Name the file 'georss-config.xml' and add the file to http://svn.apache.org/repos/asf/oodt/trunk/webapp/fmprod/src/main/resources -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira