generated from EGI-Federation/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from EGI-Federation/parser-esrf
Implemented ESRF parsing
- Loading branch information
Showing
17 changed files
with
530 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package parser.esrf; | ||
|
||
import io.smallrye.mutiny.Uni; | ||
import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; | ||
|
||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.jboss.resteasy.reactive.RestPath; | ||
import org.jboss.resteasy.reactive.RestQuery; | ||
import parser.esrf.model.*; | ||
|
||
import java.util.List; | ||
|
||
|
||
/*** | ||
* REST client for ESRF | ||
*/ | ||
@RegisterProvider(value = EsrfExceptionMapper.class) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public interface Esrf { | ||
|
||
@POST | ||
@Path("/session") | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
Uni<EsrfSession> getSessionAsync(EsrfCredentials credentials); | ||
|
||
@GET | ||
@Path("/doi/{authority}/{recordId}/datasets") | ||
Uni<List<EsrfDataSet>> getDataSetsAsync(@RestQuery("sessionId") String sessionId, | ||
@RestPath("authority") String authority, | ||
@RestPath("recordId") String recordId); | ||
|
||
@GET | ||
@Path("/catalogue/{sessionId}/dataset/id/{datasetId}/datafile") | ||
Uni<List<EsrfDataFile>> getDataFilesAsync(@RestPath("sessionId") String sessionId, | ||
@RestPath("datasetId") String datasetId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package parser.esrf; | ||
|
||
import javax.ws.rs.WebApplicationException; | ||
import javax.ws.rs.core.Response; | ||
|
||
|
||
/** | ||
* Exception class for ESRF API calls | ||
*/ | ||
public class EsrfException extends WebApplicationException { | ||
|
||
private String responseBody; | ||
|
||
public EsrfException() { | ||
super(); | ||
} | ||
|
||
/*** | ||
* Construct from a response | ||
* @param resp Response object | ||
* @param body Response body | ||
*/ | ||
public EsrfException(Response resp, String body) { | ||
super(resp); | ||
this.responseBody = body; | ||
} | ||
|
||
/*** | ||
* Get the response body | ||
* @return Body of the response | ||
*/ | ||
String responseBody() { return responseBody; } | ||
} |
Oops, something went wrong.