Skip to content

Commit 84535f7

Browse files
authored
FIREFLY-938: ZTF proprietary metadata is not returned in GUI (#1189)
* FIREFLY-938: ZTF proprietary metadata is not returned in GUI * remove unused code
1 parent 2fe5122 commit 84535f7

File tree

3 files changed

+12
-126
lines changed

3 files changed

+12
-126
lines changed

src/firefly/java/edu/caltech/ipac/astro/ibe/IBE.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import edu.caltech.ipac.astro.ibe.datasource.AtlasIbeDataSource;
77
import edu.caltech.ipac.firefly.data.FileInfo;
88
import edu.caltech.ipac.firefly.server.network.HttpServiceInput;
9+
import edu.caltech.ipac.firefly.server.network.HttpServices;
910
import edu.caltech.ipac.firefly.server.query.DataAccessException;
1011
import edu.caltech.ipac.firefly.server.query.URLFileInfoProcessor;
1112
import edu.caltech.ipac.table.DataGroup;
@@ -19,9 +20,7 @@
1920

2021
import java.io.File;
2122
import java.io.IOException;
22-
import java.net.MalformedURLException;
2323
import java.net.URL;
24-
import java.util.Collections;
2524
import java.util.Map;
2625

2726
import static edu.caltech.ipac.astro.ibe.BaseIbeDataSource.addUrlParam;
@@ -39,7 +38,6 @@ public class IBE {
3938
public static final String POS = "POS";
4039

4140
private IbeDataSource ibeDataSource;
42-
private IbeFileUploader fileUploader;
4341

4442

4543
public IBE(IbeDataSource ibeDataSource) {
@@ -50,10 +48,6 @@ public IbeDataSource getIbeDataSource() {
5048
return ibeDataSource;
5149
}
5250

53-
public void setFileUploader(IbeFileUploader fileUploader) {
54-
this.fileUploader = fileUploader;
55-
}
56-
5751
public void getMetaData(File results) throws IOException {
5852

5953
String url = ibeDataSource.getMetaDataUrl();
@@ -66,22 +60,17 @@ public void query(File results, IbeQueryParam param) throws IOException {
6660
}
6761

6862
public void multipleQueries(File results, File posFile, IbeQueryParam param) {
69-
if (fileUploader == null) {
70-
try {
71-
fileUploader = (IbeFileUploader) Class.forName("edu.caltech.ipac.firefly.server.query.ibe.IbeFileUploaderImpl").newInstance();
72-
} catch (Exception e) {
73-
throw new UnsupportedOperationException("You need an IbeFileUploader to do multiple queries search.");
74-
}
75-
}
76-
7763
String url = ibeDataSource.getSearchUrl();
7864

7965
Map<String, String> paramMap = ibeDataSource.getMulipleQueryParam(param);
8066
paramMap.remove(POS);
81-
try {
82-
fileUploader.post(results, POS, posFile, new URL(url), paramMap);
83-
} catch (MalformedURLException e) {
84-
throw new IllegalArgumentException("IBE URL is bad.");
67+
HttpServiceInput input = HttpServiceInput.createWithCredential(url);
68+
paramMap.forEach(input::setParam);
69+
input.setFile(POS, posFile);
70+
71+
HttpServices.Status status = HttpServices.postData(input, results);
72+
if (status.isError()) {
73+
throw new RuntimeException(String.format("IBE multi POS search failed with (%d) - %s", status.getStatusCode(), status.getErrMsg()));
8574
}
8675
}
8776

@@ -173,7 +162,10 @@ private FileInfo downloadViaUrl(URL url, Map<String, String> sourceParams, File
173162

174163
private void downloadViaUrlToFile(URL url, File results) throws IOException {
175164
try {
176-
URLDownload.getDataToFile(url, results, null, Collections.singletonMap("Accept", "text/plain"));
165+
HttpServiceInput addtlInfo = HttpServiceInput.createWithCredential(url.toString());
166+
addtlInfo.setHeader("Accept", "text/plain");
167+
168+
URLDownload.getDataToFile(url, results, addtlInfo.getCookies(), addtlInfo.getHeaders());
177169
} catch (FailedRequestException e) {
178170
throw new IOException(e.getUserMessage(), e);
179171
}

src/firefly/java/edu/caltech/ipac/astro/ibe/IbeFileUploader.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/firefly/java/edu/caltech/ipac/firefly/server/query/ibe/IbeFileUploaderImpl.java

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)