-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up DAP4 code plus minor mods to other -- non-dap4 -- code #1133
Clean up DAP4 code plus minor mods to other -- non-dap4 -- code #1133
Conversation
This PR make major changes to the DAP4 code. It also makes some small but necessary changes to non-DAP4 code, the of which will be described in some detail below. ## DAP4 Changes * Biggest change is to merge all of the dap submodules (dap4:d4core, dap4:d4cdm, etc) into just one single "dap4" module. * Get rid of the old DAP4 CDMXXX types and instead use the standard netcdf-java Array types; this has some consequences with respect to what kind of sequence objects can be handled. * Reduce the set of DAP4 tests to be similar to those used by netcdf-c. * Convert tests to JUNIT-4 parameterized tests. * Remove all tests that use server mocking -- we will use a real server instead. * Enable inclusion of dap4 in fatJars and ncIdv. * Switch compile action in dap4 build.gradle to implementation in anticipation of a gradle version upgrade. * Aggregate all DAP4 constants into DapConstants.java. * Move selected NetCDF-4 related constants from Attribute.java to CDM.java * Get the HttpServices interceptor mechanism to work again; this is for debugging * Remove unused code * Move some DAP4 only code from UnitTestCommon.java to DapTestCommon.java * Begin the conversion to the new checksum mode capability. * Remove the now unused Bison-based DMR parser. * Remove the Odometer code as no longer used. ## Non-DAP4 related Changes * Remove extraneous code from TestCDF5Reading.java * Clean up UnitTestCommon.java * Allow zero-length dimensions, but also ignore any variables that have a zero length dimension. * Change NetcdfFiles warning from mentioning H5iop to H5iospNew. * Modify DatasetUrl to properly detect things like ".drm.xml" as of type ServiceType.DAP4. ## TODO * Search and destroy unused imports ## PR Checklist <!-- This will become an interactive checklist once the PR is opened --> - [X] Link to any issues that the PR addresses - [ ] Add labels - [ ] Open as a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) until ready for review - [X] Make sure GitHub tests pass - [X] Mark PR as "Ready for Review"
Got my fingers crossed that this deals with #985 enough that I can make first contact with a DAP4 server. |
netcdf-java/dap4 was modified as follows: * Remove some old, unused code. * A number of classes were renamed to more accurately reflect their semantics. Specifically: - *DataCursor* -> *D4Array* - *DataIndex* -> *D4Index* * Some refactoring of code was done: - Added *ArrayScheme* - Deleted *CEConstraintIF*
I'm working on a NASA project that uses the netcdf-java library to retrieve data from a dataset served by the Earthdata OPeNDAP/Hyrax service. In order to do so, we need to pass along the Earthdata Login bearer token in the HTTP Authorization header. From what I can tell so far, this isn't possible at the moment. I'm looking to add support for this and submit a PR when I noticed this PR. So I'm wondering if you could provide me some direction on adding support for this (if indeed it's not possible to add the bearer token HTTP header in the current release). Since this PR does a major re-org of the DAP4 code, it seems like I should base my PR on the changes here, and wait until this PR is merged before submitting mine. More importantly, I'm looking for some help in determining how to add support for this use case. I'm not very familiar with the codebase yet, so I'm still working to figure that out. From an API point-of-view, specifically, i.e., how should a user of the API configure their token to be available when making HTTP requests for DAP4 datasets? If this makes sense as a separate issue & discussion & PR I will open an issue and we can have the conversation there. If it makes sense to integrate this into this PR we can keep it here. Just let me know what you would prefer. Thank you! |
Can you describe what HTTP headers are sent and what is their form for including the bearer token? |
Yes, the Earthdata Login (EDL) token (which is generated via a call to an EDL endpoint) is a JWT token, and once obtained, can be passed in the HTTP 'Authorization' header in the following format (where 'ABCD1234WXYZ0987' is the token value obtained from EDL): Authorization: Bearer ABCD1234WXYZ0987 E.g., in a curl command it would be passed as: --header 'authorization: Bearer ABCD1234WXYZ0987' |
Do you have an idea how the API user would provide this using the Java API? I'm new to the lib & codebase, so still trying to tie things together. For example, if in my client code I'm getting some data using the URL: My understanding is I would do: ucar.nc2.NetcdfFile.open("dap4:https://opendap.uat.earthdata.nasa.gov/collections/C1241426907-NSIDC_CUAT/granules/ATL08_20200103074826_01160605_005_01.h5?dap4.ce=/gt3l_land_segments_latitude") So the question is where would I provide the token to be used when the underlying HttpDSP class issues the request to the server? Would I precede this NetcdfFile.open() call by providing something in the httpservices package with the token, so that the HttpDSP could use it if available? |
Sorry, I misread your message -- thought it was about the c library. |
No problem. The
followed by
If so, then I believe I can confine this change to the |
Httpservices is our attempt to isolate the http functionality we need. |
Excellent. I'll open a separate issue and PR. Thanks! |
Disabling because there is no way to fix the errors this causes on Jenkins. |
## Description of Changes WARNING: The merging of this PR needs to be synchronized with the following netcdf-java PR: Unidata/netcdf-java#1211 So after both PRs are reviewed and approved, both need to be merged one right after the other. This PR make major changes to the DAP4 code. It also makes some small but necessary changes to non-DAP4 code, which will be described below. ### DAP4 Change Overview * Cleanup the D4TS server -- D4TS standing for Dap4 Test Server -- so that it properly operates in the remotetest.unidata.ucar.edu test server. * Remove all DAP4 tests; they all depended on using MockServlet, which basically does not work. The assumption is that we will test dap4 support in the process of testing DAP4 support in netcdf-java and netcdf-c. * The DAP4 service in TDS is left disabled until everything has been successfully merged. * Update gradle files to reflect the flattening of the netcdf-java/dap4 module from PR Unidata/netcdf-java#1133. #### DAP4 Specific Changes * Remove all DSP types and replace with the *CDMWrap* class. * Move the Odometer classes from *netcdf-java* to *tds* since they are only used in that repo. * Remove the attempt to replace netcdf-c JNA system. Now relies only on CDM API. * Remove the synthetic test case generator and all supporting classes. * Remove the dap4/d4tests directory since there are no longer any tests. * Change the gradle "compile" action to the "implementation" to conform to the upcoming gradle version 7 (this change is only partially completed). * Move the various D4TS support files into the WEB-INF directory so the from() actions are no longer needed. * Create a new set of .nc files to be used for testing clients. These files come from and are consistent with those expected by netcdf-c. * Create a new D4TS server web page template (the so-called "FrontPage"). * Created DSR template files to support per-dataset creation of DSRs. * Rebuilt the handling of the *getResourcePath* function to make it dependent on the specific DAP4 Servlet/Controller (i.e. under d4ts vs under thredds). * Added an abstract *getWebContentRoot* function to *DapController* so that each servlet can provide specific locations for the template files. * When a zero-size dimension is encountered, now suppress that dimension and any variable that used it. Ideally this should be an error, but we have encountered too many instances in the wild, so it is better to suppress rather than cause an error. * A number of classes were renamed to more accurately reflect their semantics. Specifically: - *CDMCursor* -> *CDMData* * Convert DSP LRU cache to only cache the NetcdfFile instances. * Remove some now unused classes: - *URLMap* - *URLMapDefault* * *Dap4Controller* was modified to enable DAP4 as a service. * Properly handle checksums in the DMR and DAP. ### Non-DAP4 Specific Changes * Modify CatalogViewContextParser to map a request for file using the DAP4 service: change from *.dmr.xml* to *.dsr.html*. This may change again in the future if we try to emulate the DAP2 .ascii format. * Re-enable the Dap4Controller * Enable the DAP4 service in various test catalogs. * The changes to the intercept code in netcdf-java required changes to some tds tests; specificially *TestFormBuilder* (also converted to JUNIT4 parameterized test format). * Some constants and static utility functions were moved into the CDM class. Currently, this only affects one file outside of DAP4, namely the opendap file NcDAS.java. * Change occurrences of "static protected|public" to "protected|public static". ## PR Checklist <!-- This will become an interactive checklist once the PR is opened --> - [X] Link to any issues that the PR addresses - [ ] Add labels - [X] Open as a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) until ready for review - [X] Make sure GitHub tests pass - [X] Mark PR as "Ready for Review"
* ## Cleanup the DAP4 support in the tds repository ## Description of Changes WARNING: The merging of this PR needs to be synchronized with the following netcdf-java PR: Unidata/netcdf-java#1211 So after both PRs are reviewed and approved, both need to be merged one right after the other. This PR make major changes to the DAP4 code. It also makes some small but necessary changes to non-DAP4 code, which will be described below. ### DAP4 Change Overview * Cleanup the D4TS server -- D4TS standing for Dap4 Test Server -- so that it properly operates in the remotetest.unidata.ucar.edu test server. * Remove all DAP4 tests; they all depended on using MockServlet, which basically does not work. The assumption is that we will test dap4 support in the process of testing DAP4 support in netcdf-java and netcdf-c. * The DAP4 service in TDS is left disabled until everything has been successfully merged. * Update gradle files to reflect the flattening of the netcdf-java/dap4 module from PR Unidata/netcdf-java#1133. #### DAP4 Specific Changes * Remove all DSP types and replace with the *CDMWrap* class. * Move the Odometer classes from *netcdf-java* to *tds* since they are only used in that repo. * Remove the attempt to replace netcdf-c JNA system. Now relies only on CDM API. * Remove the synthetic test case generator and all supporting classes. * Remove the dap4/d4tests directory since there are no longer any tests. * Change the gradle "compile" action to the "implementation" to conform to the upcoming gradle version 7 (this change is only partially completed). * Move the various D4TS support files into the WEB-INF directory so the from() actions are no longer needed. * Create a new set of .nc files to be used for testing clients. These files come from and are consistent with those expected by netcdf-c. * Create a new D4TS server web page template (the so-called "FrontPage"). * Created DSR template files to support per-dataset creation of DSRs. * Rebuilt the handling of the *getResourcePath* function to make it dependent on the specific DAP4 Servlet/Controller (i.e. under d4ts vs under thredds). * Added an abstract *getWebContentRoot* function to *DapController* so that each servlet can provide specific locations for the template files. * When a zero-size dimension is encountered, now suppress that dimension and any variable that used it. Ideally this should be an error, but we have encountered too many instances in the wild, so it is better to suppress rather than cause an error. * A number of classes were renamed to more accurately reflect their semantics. Specifically: - *CDMCursor* -> *CDMData* * Convert DSP LRU cache to only cache the NetcdfFile instances. * Remove some now unused classes: - *URLMap* - *URLMapDefault* * *Dap4Controller* was modified to enable DAP4 as a service. * Properly handle checksums in the DMR and DAP. ### Non-DAP4 Specific Changes * Modify CatalogViewContextParser to map a request for file using the DAP4 service: change from *.dmr.xml* to *.dsr.html*. This may change again in the future if we try to emulate the DAP2 .ascii format. * Re-enable the Dap4Controller * Enable the DAP4 service in various test catalogs. * The changes to the intercept code in netcdf-java required changes to some tds tests; specificially *TestFormBuilder* (also converted to JUNIT4 parameterized test format). * Some constants and static utility functions were moved into the CDM class. Currently, this only affects one file outside of DAP4, namely the opendap file NcDAS.java. * Change occurrences of "static protected|public" to "protected|public static". ## PR Checklist <!-- This will become an interactive checklist once the PR is opened --> - [X] Link to any issues that the PR addresses - [ ] Add labels - [X] Open as a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) until ready for review - [X] Make sure GitHub tests pass - [X] Mark PR as "Ready for Review" * Upgrade to latest master --------- Co-authored-by: haileyajohnson <[email protected]>
Description of Changes
This PR make major changes to the DAP4 code. It also makes some small but necessary changes to non-DAP4 code, which will be described below.
This PR depends upon PR #1091, and should not be merged before #1091.
DAP4 Changes
Note: This PR Assumes that PR #1091 has been merged.
Non-DAP4 related Changes
TODO
Addendum: Additional Commit Changes
netcdf-java/dap4 was modified as follows:
PR Checklist