Commit 9355f4e6 authored by Mat's avatar Mat

Merge branch 'feature/doc' into develop

parents fe0c2a08 8f84b28e
......@@ -88,6 +88,11 @@
<artifactId>poi-ooxml</artifactId>
<version>3.15-beta1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
</dependencies>
<build>
<plugins>
......@@ -108,4 +113,4 @@
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
</project>
......@@ -78,15 +78,17 @@ public class TextExtractPar implements Serializable {
public static int maxTupleSize = 0;
public static int threshold = 100;
// lookup stores a plaintext inverted index of the dataset, i.e., the
// association between the keyword and documents that contain the keyword
/**
* lookup stores a plaintext inverted index of the dataset, i.e., the
* association between the keyword and documents that contain the keyword
*/
Multimap<String, String> lookup1 = ArrayListMultimap.create();
public static Multimap<String, String> lp1 = ArrayListMultimap.create();
// lookup2 stores the document identifier (title) and the keywords contained
// in this document
/**
* lookup2 stores the document identifier (title) and the keywords contained
* in this document
*/
Multimap<String, String> lookup2 = ArrayListMultimap.create();
public static Multimap<String, String> lp2 = ArrayListMultimap.create();
......
......@@ -77,11 +77,13 @@ public class TextProc {
}
}
/*
/**
* This method gets all files from a directory. These files, will be
* processed later on to get all the keywords and create an inverted index
* structure
* @param directoryName
* @param files
*/
public static void listf(String directoryName, ArrayList<File> files) {
File directory = new File(directoryName);
......
......@@ -2,13 +2,19 @@ package searchitect.common.view;
import javax.xml.bind.annotation.XmlRootElement;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* UserAuthRequest - json object used to pass credentials for authentication
*
*/
@XmlRootElement
@ApiModel(value="User credentials")
public class UserAuthRequest {
@ApiModelProperty(value = "The username")
private String username;
@ApiModelProperty(value = "The password")
private String password;
public UserAuthRequest(String username, String password) {
......
......@@ -3,6 +3,10 @@ package searchitect.controller;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import searchitect.util.UrlBuilderService;
import java.security.Principal;
......@@ -42,17 +46,36 @@ public class CheckController {
}
@ApiOperation(value = "Checks if a SE backend is online")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "A welcome message from the backend."),
@ApiResponse(code = 403, message = ""),
@ApiResponse(code = 404, message = ""),
})
@RequestMapping(value="/checkbackend/{b_id}", method = RequestMethod.GET)
public String checkSebackend(@PathVariable ("b_id") String backendName) {
public String checkSebackend(
@ApiParam(value="Name of the backend to check")
@PathVariable ("b_id")
String backendName
) {
String url = urlBuilder.getTargetUrl(backendName, "", "", "");
String response = restTemplate.getForObject(url, String.class);
return response;
}
@ApiOperation(value = "Checks if a SE backend is online for an authenticated user")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "A welcome message from the backend."),
@ApiResponse(code = 403, message = ""),
@ApiResponse(code = 404, message = ""),
})
@RequestMapping(value = "/checkauthbackend/{b_id}", method = RequestMethod.GET)
public ResponseEntity<String> checkAuthenticated(@AuthenticationPrincipal Principal principal, @PathVariable ("b_id") String backendName) {
public ResponseEntity<String> checkAuthenticated(
@AuthenticationPrincipal Principal principal,
@ApiParam(value="Name of the backend to check")
@PathVariable ("b_id")
String backendName) {
String url = urlBuilder.getTargetUrl(backendName, "", "", "");
String response = restTemplate.getForObject(url, String.class);
String name = principal.getName();
......
......@@ -24,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import searchitect.model.UserEDB;
import searchitect.common.exception.SearchitectException;
import searchitect.model.UserAccount;
......@@ -32,6 +35,7 @@ import searchitect.service.UserAccountRepository;
import searchitect.util.UrlBuilderService;
@RestController
@Api(tags = {"Manage SE repositories on the available backends"})
public class RepositoryController {
private final EDBRepository eDBRepository;
......@@ -95,9 +99,15 @@ public class RepositoryController {
* @param backendName
* @return
*/
@ApiOperation(value = "Create a new repository in a backend")
@RequestMapping(value = "/backend/{b_id}/repository", method = RequestMethod.POST)
public ResponseEntity<String> forwardSetup(@AuthenticationPrincipal Principal principal,
@RequestBody String postData, @PathVariable("b_id") String backendName) {
@ApiParam(value="Data to forward to the backend")
@RequestBody
String postData,
@PathVariable("b_id")
String backendName
) {
try {
String targetUrl = this.urlBuilder.getTargetUrl(backendName, "repository", "", "");
String response = postResponseStringFromBackend(postData, targetUrl);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment