-
Notifications
You must be signed in to change notification settings - Fork 13
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
IRSA-6468: Support for Packager Script of URLs (Euclid, SphereX, Rubin, etc.) #1690
Conversation
import static edu.caltech.ipac.util.FileUtil.getUniqueFileNameForGroup; | ||
|
||
@SearchProcessorImpl(id = "PackagerScript") | ||
public class PackagerScript extends FileGroupsProcessor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class implementation is not right. If it's a generic, reusable script generator, then it should not have any ObsCore logic. If it's an ObsCore data packager, then it is named wrong and there is already an ObsCorePackager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution should be divided into two parts:
- Verify that the script generator functions as intended.
- Modify the UI and server code to support a "create download script" option as an alternative to the existing "package download" data feature.
I thought that this PR was suppose to address the first part. In any case, the implementation is not what I expected.
5bf920a
to
b499a06
Compare
File tmpFile = File.createTempFile("obscorepackager-", ".download", ServerContext.getTempWorkDir()); | ||
FileInfo tmpFileInfo = URLDownload.getDataToFile(url, tmpFile); | ||
String contentType = tmpFileInfo.getAttribute(HttpResultInfo.CONTENT_TYPE); | ||
|
||
//todo: replace tmpFile code above with this, or else remove this commented out code | ||
//HttpResultInfo r= URLDownload.getDataFromURL(new URL(access_url), null, null, null); | ||
//String contentType = r.getContentType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- based on our discussion, I had thought about removing the tmpFile code, as we could just use
access_format
to get theextension
, but I realized that theelse
case (~line 103) is actually triggered whenaccess_format
isnull
. So I have left this code and the commented out line here for now, but we can discuss it.
b499a06
to
80b64e8
Compare
Since the PR description is a bit detailed, here's a short summary of today's final changes:
Follow the testing instructions above and in the IFE PR, but a quick summary for testing as well:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Minor cleanup then you're good to go.
public static final String PRODUCTS = "productTypes"; | ||
public static final String SCRIPT = "scriptType"; | ||
public static final String ACCESS_URL = "access_url"; | ||
public static final String ACCESS_FORMAT = "access_format"; | ||
public static final String SEMANTICS = "semantics"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These constants should not be here.
private static String makeDownloadUrl(File f, String suggestedName) { | ||
String fileStr = ServerContext.replaceWithPrefix(f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to copy/paste this function here. Change PackagingWorker.makeDownloadUrl accessor to public or package protected(remove private) then use it instead.
src/firefly/js/ui/DownloadDialog.jsx
Outdated
showFileLocation=true, showTitle=true, | ||
downloadButtonText='Prepare Download', downloadType='package', ...props}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could derive downloadButtonText
and similarly buttonText
from downloadType
to avoid redundancy. However, I'm open to whichever approach you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did this for downloadButtonText
based on your suggestion, left buttonText
as is, since it's passed to the DownloadButton
component (as opposed to DownloadOptionPanel
)
d246852
to
949d4fe
Compare
@@ -155,15 +156,12 @@ public static List<FileInfo> parseDatalink(URL url, String prepend_file_name, St | |||
ext_file_name = makeDataLinkFolder ? prepend_file_name + "/" + ext_file_name : ext_file_name; | |||
} | |||
|
|||
if (products != null) { | |||
// Check if products exist and contains sem | |||
if (products != null) { // Check if products exist and contains sem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// Extract the last part of the path | ||
String path = url.getPath(); | ||
if (path != null && !path.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use StringUtils.isEmpty
26c985b
to
a831bbc
Compare
Ticket: IRSA-6468
DownloadSciptWorker
based on our existingPackagingWorker
with changes to write out the URLs to a script made available for download (instead of zipped files of products)curl
,wget
or plain list of urls)DownloadScript.java
to support better filename generation from the given URLDownloadButton
andDownloadOptionPanel
components to accept the download button text (instead ofPrepare Download
)DownloadOptionPanel
andPackageRequest
(inSearchServicesJson.js
) now accept a new parameter:downloadType
. This determines whether we use our traditional packager or the new download script.ObsCorePackagaer.java
Testing:
Image
search (previouslyExplore Regions
)Generate Download Script
All data
curl
orwget
) to ensure the download works (you can only keep 2-3 URLs in the file to test this)m81
or anything elsePrepare Download
, ensure this behavior is the same as before asObsCorePackaager.java
has also been modified