Hi anne:
change service base to whatever you want, eg
<service name="gridftpServer" serviceType="GridFTP" base="gridftp://server:port/"
/>
see:
http://www.unidata.ucar.edu/projects/THREDDS/tech/catalog/InvCatalogSpec11.html#constructingURLs
You should print out and read that whole spec, then things should be clearer.
Anne Wilson wrote:
Hi Ethan and John,
I just noticed that the access URLs I'm getting all start with http
regardless of the methods of access I've determined in my code. I've
copied some results from the http rendering below, and attached my code
that determines and sets the access methods. Am I doing something wrong?
If either of you are available to help me with this ASAP, that would be
especially great, although I know the timing is bad for both of you.
Thanks!
Anne
---------------------------------- from html rendering of catalog
Access:
1. HTTPServer:
http://lead2.unidata.ucar.edu:8080/thredds/fileServer/tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc
2. GridFTP:
http://lead2.unidata.ucar.edu:8080/thredds/gridftp/tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc
3. OPENDAP:
http://lead2.unidata.ucar.edu:8080/thredds/dodsC/tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc
4. WCS:
http://lead2.unidata.ucar.edu:8080/thredds/wcs/tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc
---------------------------------- the actual catalog
<?xml version="1.0" encoding="UTF-8"?>
<catalog
xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
xmlns:xlink="http://www.w3.org/1999/xlink" name="6AnneElizabethWilson"
version="1.0.1" expires="2006-10-12 21:40:28Z">
<service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/" />
<service name="HTTPServer" serviceType="HTTPServer"
base="/thredds/fileServer/" />
<service name="wcsServer" serviceType="WCS" base="/thredds/wcs/" />
<service name="gridftpServer" serviceType="GridFTP"
base="/thredds/gridftp/" />
<dataset name="exp3">
<dataset name="aaa">
<dataset name="Oct12">
<dataset name="NAM forecast Oct 12, 2006 1200Z"
ID="4568f130-5a3a-11db-a1f0-006008f5e03e"
urlPath="tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc">
<dataType>Grid</dataType>
<dataFormat>NetCDF</dataFormat>
<documentation>NAM forecast</documentation>
<access
urlPath="tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc"
serviceName="HTTPServer" dataFormat="NetCDF" />
<access
urlPath="tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc"
serviceName="gridftpServer" dataFormat="NetCDF" />
<access
urlPath="tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc"
serviceName="ncdods" dataFormat="NetCDF" />
<access
urlPath="tdr/6AnneElizabethWilson/exp3/aaa/Oct12/NAM_CONUS_80km_20061012_1200.nc"
serviceName="wcsServer" dataFormat="NetCDF" />
</dataset>
</dataset>
</dataset>
</dataset>
</catalog>
---------------------------------- my code
private void setAccessURLs(InvDatasetImpl dataset, String dataType) {
dataset.setUrlPath(tmp_access_urlPath);
// It can always be served via http
// InvAccessImpl httpAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, httpService);
// bug: httpService not being propagated
// TODO: when bug is fixed, use above
InvAccessImpl httpAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, "HTTPServer", null, null, 0.0);
dataset.addAccess(httpAccess);
logger.debug("dataset adding httpService");
// It can always be served via gridftp
InvAccessImpl gridftpAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, "gridftpServer", null, null, 0.0);
dataset.addAccess(gridftpAccess);
logger.debug("dataset adding gridftpService");
// Can it be served via opendap?
NetcdfFile ncd = null;
String filePath = tmp_fileAbsPath.getPath();
Boolean cdmOpenable = false;
try {
ncd = NetcdfDataset.openFile(filePath.toString(), null);
}
catch (Exception e) {
logger.error("Error in NetcdfDataset.openFile:", e);
}
if (ncd != null) {
logger.debug("Able to open " + filePath);
cdmOpenable = true;
// InvAccessImpl dodsAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, dodsService);
InvAccessImpl dodsAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, "ncdods", null, null, 0.0);
// InvAccessImpl dodsAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, "OPENDAP", null, null, 0.0);
dataset.addAccess(dodsAccess);
logger.debug("dataset adding dodsService");
try {
ncd.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else {
logger.debug("Can't open " + filePath);
}
// Can it be served via WCS?
// TODO: make this work!
// if (dataset.getDataType() == DataType.GRID) {
// if (dataset.getDataType().equals("Grid") & cdmOpenable) {
// if (dataset.getDataType().toString().equalsIgnoreCase("Grid") &
cdmOpenable) {
if (dataType.equalsIgnoreCase("Grid") & cdmOpenable) {
// public InvAccessImpl( InvDataset dataset, String urlPath,
InvService service) {
// InvAccessImpl wcsAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, wcsService);
InvAccessImpl wcsAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, "wcsServer", null, null, 0.0);
// InvAccessImpl wcsAccess = new InvAccessImpl(dataset,
tmp_access_urlPath, "WCS", null, null, 0.0);
dataset.addAccess(wcsAccess);
logger.debug("dataset adding ServiceName \"wcsServer\"");
}
else {
logger.debug("------------------------> NOT A GRID");
}
}