About the viewers
John Caron
caron at unidata.ucar.edu
Wed Jan 31 15:08:09 MST 2007
Hi Roger:
I dont understand what is wrong with your class, but i get same results with it. But when I recompile, it works ok.
if I dissamble your class, I see:
public class saidinViewer.Start extends java.lang.Object{
public saidinViewer.Start();
public boolean isViewable(thredds.catalog.InvDatasetImpl);
public java.lang.String getViewerLinkHtml(thredds.catalog.InvDatasetImpl, javax.servlet.http.HttpServletRequest);
}
but when i recompile your source, i get:
public class saidinViewer.Start extends java.lang.Object implements thredds.servlet.Viewer{
public saidinViewer.Start();
public boolean isViewable(thredds.catalog.InvDatasetImpl);
public java.lang.String getViewerLinkHtml(thredds.catalog.InvDatasetImpl, javax.servlet.http.HttpServletRequest);
}
So im guuessing you just need to recompile the source correctly.
However, placing this code into tomcat/shared/lib does not work, i think due to classloading issues. For now, you will have to put it directly into webapps/thredds/WEB-INF/lib or classes. I will see if I can figure out a way around that.
Thanks for bringing this to my attention. My testing failed to see this problem.
John
Roger Olivella wrote:
> John,
>
> I'm having some problems in registering our viewer. First of all, I've
> created a class that implements the Viewer interface (see attached file
> Start.java). Then I've zipped this file into a JAR file (attached
> saidin-viewer.jar) and put it into /usr/local/tomcat/shared/lib.
> Finally, I've restarted Tomcat. Unfortunately, something goes wrong
> because at, for example,
>
> http://ers.cmima.csic.es/thredds/catalog.html?cmd=subset&catalog=http://ers.cmima.csic.es/thredds/catalog/ers/2002/02-Feb/02/catalog.xml&dataset=ers/2002/02-Feb/02/20020202.1342.n16.nc.bz2
>
>
> it doesn't appear our viewer. I've looked at threddsServlet.log and
> found an error:
>
> 2007-01-31T10:14:21.607 +0100 [ 607][ 1] ERROR -
> thredds.servlet.ViewServlet - Attempt to load class saidinViewer.Start
> does not implementthredds.servlet.Viewer
>
>
> What I'm doing wrong?
>
> Thank you for your help.
>
> Roger
>
>
>
> J ohn Caron wrote:
>
>> Youre welcome, let me know how it goes. we will have the code
>> available over an svn web server soon also.
>>
>> Roger Olivella wrote:
>>
>>> John,
>>>
>>> I've downloaded the JAR. Now I'm going to install it.
>>>
>>> Thank you very much.
>>>
>>> Roger
>>>
>>> John Caron wrote:
>>>
>>>> source is at
>>>> ftp://ftp.unidata.ucar.edu/pub/thredds/tmp/threddsSrc-2.2.18.02.jar
>>>>
>>>> sorry that took so long.
>>>>
>>>> please let me know when you have downloaded so i can remove it.
>>>>
>>>>
>>>>
>>>> Roger Olivella wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> We are working on installing and configuring a Thredds server at
>>>>> http://ers.cmima.csic.es/thredds. We have two questions about the
>>>>> viewers:
>>>>>
>>>>> 1.
>>>>>
>>>>> When a user clicks on “Integrated Data Viewer (IDV) (webstart)”
>>>>> (for example at
>>>>>
>>>>> http://ers.cmima.csic.es/thredds/catalog.html?cmd=subset&catalog=http://ers.cmima.csic.es/thredds/catalog/ers/2001/08/25/catalog.xml&dataset=ers/2001/08/25/20010825.1343.n16.nc.bz2
>>>>>
>>>>>
>>>>> <http://ers.cmima.csic.es/thredds/catalog.html?cmd=subset&catalog=http://ers.cmima.csic.es/thredds/catalog/ers/2001/08/25/catalog.xml&dataset=ers/2001/08/25/20010825.1343.n16.nc.bz2>),
>>>>>
>>>>> webstart loads IDV but it doesn't load directly the
>>>>> 20010825.1343.n16.nc.bz2 file. Are we missing something?
>>>>>
>>>>> 2.
>>>>>
>>>>> We are trying to add another external viewer. According to
>>>>>
>>>>> http://www.unidata.ucar.edu/projects/THREDDS/tech/tutorial/Viewers.html,
>>>>>
>>>>> fisrt of all we have to implement the Viewer interface. The
>>>>> question is: where is this interface? At the documentation it
>>>>> can
>>>>> be read that “Your class must implement the
>>>>> *thredds.servlet.Viewer* interface” but where can we find
>>>>> “thredds.servlet” package?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Roger Olivella-Pujol
>>>>> Institute of Marine Sciences (CMIMA-CSIC)
>>>>> Barcelona, Catalonia (Spain)
>>>>> (+34) 932 309 500 voice
>>>>> http://saidin.cmima.csic.es <http://saidin.cmima.csic.es/>
>>>>>
>>>>
>>
>
> ------------------------------------------------------------------------
>
> package saidinViewer;
>
> import thredds.catalog.*;
> import javax.servlet.http.HttpServletRequest;
> import java.net.*;
> import thredds.servlet.Viewer;
>
>
> public class Start implements Viewer {
>
> public boolean isViewable( InvDatasetImpl ds) {
> InvAccess access = ds.getAccess(ServiceType.DODS);
> if (access == null) access = ds.getAccess(ServiceType.OPENDAP);
> if (access == null) return false;
>
> return (ds.getDataType() == DataType.GRID);
> }
>
> public String getViewerLinkHtml( InvDatasetImpl ds, HttpServletRequest req) {
> InvAccess access = ds.getAccess(ServiceType.DODS);
> if (access == null) access = ds.getAccess(ServiceType.OPENDAP);
>
> URI dataURI = access.getStandardUri();
> try {
> URI base = new URI( req.getRequestURI().toString());
> dataURI = base.resolve( dataURI);
> } catch (URISyntaxException e) {
> e.printStackTrace();
> System.out.println("Resolve URL with "+req.getRequestURI());
> }
>
> //return "<a href='/thredds/view/idv.jnlp?url="+dataURI.toString()+"'>IDV</a>";
> return "<a href='http://ers.cmima.csic.es/saidin?img="+dataURI.toString()+"'>SAIDIN</a>";
> }
> }
More information about the Thredds
mailing list