oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ross Laidlaw (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OODT-449) Create a default GeoRSS configuration file for the fmprod web application
Date Wed, 09 May 2012 05:45:42 GMT

    [ 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}
<namespace prefix="geo" uri="http://www.w3.org/2003/01/geo/wgs84_pos#" />
<namespace prefix="georss" uri="http://www.georss.org/georss" />
<namespace prefix="gml" uri="http://www.opengis.net/gml" />
{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<RSSNamespace> namespaces;
{code}


* added assignment to the constructor:

{code}
this.namespaces = new Vector<RSSNamespace>();
{code}


* added getter and setter methods for the namespaces instance variable:

{code}
public List<RSSNamespace> getNamespaces() { return namespaces; }
public void setNamespaces(List<RSSNamespace> 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}
<rss xmlns:cas="http://oodt.jpl.nasa.gov/1.0/cas" 
     xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" 
     xmlns:georss="http://www.georss.org/georss" 
     xmlns:gml="http://www.opengis.net/gml" version="2.0">
{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

        

Mime
View raw message