Skip to content

Commit

Permalink
Merge pull request #478 from AuScope/AUS-4238
Browse files Browse the repository at this point in the history
AUS 4238: Remove unused APIs
  • Loading branch information
stuartwoodman authored Oct 18, 2024
2 parents a72f6aa + d9f0b75 commit 44d90d5
Show file tree
Hide file tree
Showing 43 changed files with 36 additions and 4,668 deletions.
66 changes: 30 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>

Expand Down Expand Up @@ -253,14 +253,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</exclusions>
</dependency>
<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Expand All @@ -273,13 +273,13 @@
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand All @@ -295,7 +295,7 @@
<artifactId>Saxon-HE</artifactId>
<version>9.9.1-8</version>
</dependency>
<dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<scope>test</scope>
Expand All @@ -306,24 +306,24 @@
<version>2.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.12.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
</dependency>
<dependency>
<groupId>edu.ucar</groupId>
<artifactId>netcdf4</artifactId>
<version>5.3.3</version>
<optional>false</optional>
</dependency>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
Expand All @@ -335,26 +335,20 @@
<version>4.10.0</version>
<type>pom</type>
</dependency>
<dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>0.23.0</version>
</dependency>
<dependency>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-apache-v2</artifactId>
<version>1.43.2</version>
</dependency>
<dependency>
</dependency>
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo</artifactId>
<version>5.5.0</version>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<artifactId>minlog</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package org.auscope.portal.core.server.controllers;

import java.net.URISyntaxException;
import java.util.List;

import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.auscope.portal.core.server.http.HttpServiceCaller;
import org.auscope.portal.core.services.CSWService;
import org.auscope.portal.core.services.csw.CSWServiceItem;
Expand Down Expand Up @@ -53,61 +50,6 @@ private DateTime stringToDateTime(String dateString, boolean endOfDay) {
endOfDay ? 999 : 0); // millisOfSecond
}

/**
* use for testing a csw connection
*
* @param cswServiceUrl
* @return
* @throws Exception
* @throws URISyntaxException
*/
@RequestMapping("/testCSWConnection.do")
public ModelAndView testConnection(
@RequestParam(value = "cswServiceUrl", required = true) String cswServiceUrl) throws Exception {
try {
HttpGet method = new HttpGet(cswServiceUrl);
URIBuilder builder = new URIBuilder(cswServiceUrl);
// test request=GetCapabilities&service=CSW&acceptVersions=2.0.2&acceptFormats=application%2Fxml
builder.addParameter("request", "GetCapabilities");
builder.addParameter("service", "CSW");
builder.addParameter("acceptVersions", "2.0.2");
builder.addParameter("acceptFormats", "application/xml");
method.setURI(builder.build());
this.serviceCaller.getMethodResponseAsString(method);

return generateJSONResponseMAV(true);
} catch (Exception e) {
throw e;
}

}

/**
* use for testing a csw connection
*
* @param cswServiceUrl
* @return
* @throws Exception
* @throws URISyntaxException
*/
@RequestMapping("/testServiceGetCap.do")
public ModelAndView testServiceGetCap(
@RequestParam(value = "serviceUrl", required = true) String serviceUrl) throws Exception {
try {
HttpGet method = new HttpGet(serviceUrl);
URIBuilder builder = new URIBuilder(serviceUrl);
// test request=GetCapabilities&service=CSW&acceptVersions=2.0.2&acceptFormats=application%2Fxml
builder.addParameter("request", "GetCapabilities");
method.setURI(builder.build());
this.serviceCaller.getMethodResponseAsString(method);

return generateJSONResponseMAV(true);
} catch (Exception e) {
throw e;
}

}

/**
* Requests CSW records from the cswServiceUrl provided. The results will be filtered by the CQL Text and the filter options. Records will be returned from
* the starting point (where 1 is the first record, not 0) and the number of records retrieved will not exceed maxRecords.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -85,69 +83,6 @@ public DownloadController(HttpServiceCaller serviceCaller, ServiceConfiguration
this.serviceConfiguration = serviceConfiguration;
}

@RequestMapping("/getGmlDownload.do")
public void getGmlDownload(
@RequestParam("email") final String email,
HttpServletResponse response) throws Exception {
DownloadTracker downloadTracker = DownloadTracker.getTracker(email);
Progression progress = downloadTracker.getProgress();
if (progress == Progression.COMPLETED) {
response.setContentType("application/zip");

boolean csvSign = false;
ZipFile downloadZip = null;
try {
downloadZip = new ZipFile(downloadTracker.getFileHandle().getAbsolutePath());
Enumeration<? extends ZipEntry> zipEntries = downloadZip.entries();
while (zipEntries.hasMoreElements()) {
String fileName = ((ZipEntry) zipEntries.nextElement()).getName();
if (fileName.contains("csv"))
{
csvSign = true;
break;
}
}
} finally {
if (downloadZip != null) {
downloadZip.close();
}
}
if (csvSign == false)
response.setHeader("Content-Disposition",
"inline; filename=GMLDownload.zip;");
else
response.setHeader("Content-Disposition",
"inline; filename=CSVDownload.zip;");
FileIOUtil.writeInputToOutputStream(downloadTracker.getFile(), response.getOutputStream(), 1024, true);
}

}

@RequestMapping("/checkGMLDownloadStatus.do")
public void checkGMLDownloadStatus(
@RequestParam("email") final String email,
HttpServletResponse response,
HttpServletRequest request) throws Exception {

DownloadTracker downloadTracker = DownloadTracker.getTracker(email);
Progression progress = downloadTracker.getProgress();
String htmlResponse = "";
response.setContentType("text/html");

if (progress == Progression.INPROGRESS) {
htmlResponse = "<html><p>Download currently still in progress</p></html>";
} else if (progress == Progression.NOT_STARTED) {
htmlResponse = "<html><p>No download request found..</p></html>";
} else if (progress == Progression.COMPLETED) {
htmlResponse = "<html><p>Your download has successfully completed.</p><p><a href='getGmlDownload.do?email="
+ email + "'>Click on this link to download</a></p></html>";
} else {
htmlResponse = "<html><p>A serious error has occurred, please contact our Administrator on [email protected]</p></html>";
}

response.getOutputStream().write(htmlResponse.getBytes());
}

/**
* Given a list of URls, this function will collate the responses into a zip file and send the response back to the browser. if no email is provided, a zip
* is written to the response output If email address is provided, a html response is returned to the user informing his request has been processed and to
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 44d90d5

Please sign in to comment.