Changeset 6038 for DASISH


Ignore:
Timestamp:
02/24/15 10:37:58 (9 years ago)
Author:
olhsha@mpi.nl
Message:

Javadoc annotations are completed.

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java

    r6024 r6038  
    5959
    6060/**
    61  *
     61 * REST class for GETting, POSTing, PUTting and DELETing annotations or their substructures (child elements);
     62 * Every REST method in the case of successful completion of its action outputs the declared output type
     63 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise.
    6264 * @author olhsha
    6365 */
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AutheticationResource.java

    r6013 r6038  
    3535
    3636/**
    37  *
     37 * REST class for GETting a logged in principal, log-in and log-out;
     38 * Every REST method in the case of successful completion of its action outputs the declared output type
     39 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise.
    3840 * @author olhsha
    3941 */
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/CachedRepresentationResource.java

    r6014 r6038  
    5252
    5353/**
    54  *
     54 * REST class for GETting, POSTing and PUTting cached representations;
     55 * DELETing cached representation is provided by TargetRsource class;
     56 * Every REST method in the case of successful completion of its action outputs the declared output type
     57 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise.
    5558 * @author olhsha
    5659 */
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/DebugResource.java

    r6015 r6038  
    4444
    4545/**
     46 * REST class for GETting information useful for debugging the back-end or a front-end;
     47 * Every REST method in the case of successful completion of its action outputs the declared output type
     48 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise;
    4649 * The class is used only by "admin" and "developer" principals; these account types are set in "principal" table.
    4750 * @author olhsha
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/NotebookResource.java

    r6021 r6038  
    4747
    4848/**
    49  * Created on : Jun 11, 2013, 5:10:55 PM
    50  *
    51  * @author Peter Withers <peter.withers@mpi.nl>
     49 * REST interface for GETting, POSTing, PUTting and DELETing notebooks or their substructures (child elements);
     50 * Every REST method in the case of successful completion of its action outputs the declared output type
     51 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise.
     52 * @author Peter Withers <peter.withers@mpi.nl>, olhsha@mpi.nl
    5253 */
    5354@Component
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/PrincipalResource.java

    r6024 r6038  
    5353
    5454/**
    55  *
    56  * @author olhsha
     55 * REST class for GETting, POSTing, PUTting and DELETing principals or their substructures (child elements);
     56 * Every REST method in the case of successful completion of its action outputs the declared output type
     57 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise.
     58* @author olhsha
    5759 */
    5860@Component
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ProjectInfoResource.java

    r6021 r6038  
    3030
    3131/**
    32  *
     32 * A help REST class so far containing only one method outputting the backend-version number.
    3333 * @author olhsha
    3434 */
     
    3838public class ProjectInfoResource extends ResourceResource{
    3939   
     40    /**
     41     *
     42     * @return a message string containing the number of the version of the backend.
     43     * @throws IOException if getting a principal or sending the error fails.s
     44     */
    4045    @GET
    4146    @Produces(MediaType.TEXT_PLAIN)
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/RequestWrappers.java

    r5850 r6038  
    3333
    3434/**
    35  *
     35 * Different requests for different resources still have some steps in common and therefore
     36 * can be wrapped in a class whose higher-order methods performs the common steps and then call
     37 * the methods performing the specific part; the specific-part object is passed as a parameter.
    3638 * @author olhsha
    3739 */
     
    4446    private String _resourceType = "resourceType";
    4547
     48    /**
     49     * Set the instance of a specific REST class.
     50     * @param resourceResource
     51     */
    4652    public RequestWrappers(ResourceResource resourceResource) {
    4753        this.resourceResource = resourceResource;
    4854    }
    4955
     56    /**
     57     *
     58     * @param identifier the external UUID of the resource over which the action should have been performed.
     59     * @param resource a type of resource: "annotation", "principal", "cached representation", "notebook", "target".
     60     * @param action a string naming the action that should have been performed.
     61     * @return
     62     */
    5063    public String FORBIDDEN_RESOURCE_ACTION(String identifier, String resource, String action) {
    5164        return " The logged-in principal cannot perform action that falls under access mode'" + action + "', with the " + resource + " with the identifier " + identifier;
    5265    }
    5366
     67    /**
     68     * This is the simplest wrapper which checks if there is a logged-in principal.
     69     * @param params list of parameters that will be used by a specific part of the request (in "the continuation").
     70     * @param dbRequestor the object that will be performing the specific part of the request ("continuation").
     71     * @return the requested resource.
     72     * @throws IOException if sending error message fails in the called methods.
     73     * @throws NotInDataBaseException if thrown by the specific part of the request.
     74     * @throws ForbiddenException if the action is forbidden for the inlogged user.
     75     */
    5476    public T wrapRequestResource(Map params, ILambda<Map, T> dbRequestor) throws IOException, NotInDataBaseException, ForbiddenException {
    5577        Number remotePrincipalID = resourceResource.getPrincipalID();
     
    6183    }
    6284
     85    /**
     86     *
     87     * @param params list of parameters that will be used by a specific part of the request (in "the continuation").
     88     * @param dbRequestor the object that will be performing the specific part of the request ("continuation").
     89     * @param resource a {@link Resource} object, representing the type of a resource  "annotation", "principal", "cached representation", "notebook", "target".
     90     * @param action an {@link Access} object representing the type ("mightiness")  of the action.
     91     * @param externalId the external UUID of the resource.
     92     * @return the resource.
     93     * @throws IOException if sending error message fails in the called methods.
     94     * @throws NotInDataBaseException if thrown by the specific part of the request.
     95     * @throws ForbiddenException if the action is forbidden for the inlogged user.
     96     */
    6397    public T wrapRequestResource(Map params, ILambda<Map, T> dbRequestor, Resource resource, Access action, String externalId) throws IOException, ForbiddenException, NotInDataBaseException {
    6498        Number principalID = resourceResource.getPrincipalID();
     
    80114   
    81115   
    82 
     116    /**
     117     * The method is used for uniformity to treat principal-specific requests as others;
     118     * in the future the common part can be added if necessary.
     119     * @param params list of parameters that will be used by a specific part of the request (in "the continuation").
     120     * @param dbRequestor the object that will be performing the specific part of the request ("continuation").
     121     * @return a {@link Principal} element.
     122     * @throws IOException if sending error message fails in the called methods.
     123     * @throws NotInDataBaseException if thrown by the specific part of the request.
     124     * @throws PrincipalExists if a principal with the given e-mail or name is already exist in the database
     125     * (thrown if the request is to add or update a principal)
     126     */
    83127    public JAXBElement<Principal> wrapAddPrincipalRequest(Map params, ILambdaPrincipal<Map, Principal> dbRequestor) throws IOException, NotInDataBaseException, PrincipalExists {
    84128        return new ObjectFactory().createPrincipal(dbRequestor.apply(params));
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceJaxbMarshallerProvider.java

    r4603 r6038  
    2626
    2727/**
    28  *
     28 * Manages serialisation of java object into xml elements.
    2929 * @author olhsha
    3030 */
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceJaxbUnmarshallerProvider.java

    r5174 r6038  
    2727
    2828/**
    29  *
     29 * Manages deserialisation of xml elements into java objects according to the dasish schema;
     30 * also validates according to this schema; the schema and other settings are done in {@link JaxbUnmarshallerFactory}.
    3031 * @author olhsha
    3132 */
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceResource.java

    r5468 r6038  
    3434
    3535/**
    36  *
     36 * This class is a super-class of any [SpecificPart]Resource of this REST package and contains the methods
     37 * and field common for each of them.
    3738 * @author olhsha
    3839 */
     
    5556    protected String[] admissibleAccess = {"read", "write", "owner"};
    5657
     58    /**
     59     *
     60     * @return the internal database id of the logged in principal if the authentication went well,
     61     * otherwise sends a corresponding error message.
     62     * @throws IOException  if sending the error fails.
     63     */
    5764    public Number getPrincipalID() throws IOException {
    5865       
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/TargetResource.java

    r5836 r6038  
    5454
    5555/**
    56  *
     56 * REST class for GETting, POSTing, PUTting and DELETing targets or their substructures (child elements);
     57 * Every REST method in the case of successful completion of its action outputs the declared output type
     58 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise.
     59
    5760 * @author olhsha
    5861 */
    59 /**
    60  *
    61  * @author olhsha
    62  */
     62
    6363@Component
    6464@Path("/targets")
     
    6666public class TargetResource extends ResourceResource {
    6767
     68    /**
     69     * Sets {@link HttpServletRequest} object, to be used in unit tests.
     70     * @param request  a @link HttpServletRequest} object to be set.
     71     */
    6872    public void setHttpRequest(HttpServletRequest request) {
    6973        this.httpServletRequest = request;
     
    7377    }
    7478
    75     // TODOD both unit tests
     79    /**
     80     *
     81     * @param externalIdentifier the external UUId of the target.
     82     * @return a {@link Target} element representing a target object with "externalIdentifier".
     83     * @throws IOException if sending an error fails.
     84     */
    7685    @GET
    7786    @Produces(MediaType.TEXT_XML)
     
    105114    }
    106115
    107     /////////////////////////////////////////////////
     116    /**
     117     *
     118     * @param externalIdentifier the external UUID of a target.
     119     * @return a {@link ReferenceList} element representing the list of he-references of the targets that
     120     * refer to the same link.
     121     * @throws IOException if sending the error fails.
     122     */
    108123    @GET
    109124    @Produces(MediaType.TEXT_XML)
    110125    @Path("{targetid: " + BackendConstants.regExpIdentifier + "}/versions")
    111126    @Transactional(readOnly = true)
    112     public JAXBElement<ReferenceList> getSiblingTargets(@PathParam("targetid") String externalIdentifier) throws HTTPException, IOException {
     127    public JAXBElement<ReferenceList> getSiblingTargets(@PathParam("targetid") String externalIdentifier) throws IOException {
    113128        Map params = new HashMap();
    114129        try {
     
    137152    }
    138153
    139     ////////////////////////////////////////////////
     154    /**
     155     *
     156     * @param targetIdentifier the external UUID of a target.
     157     * @param fragmentDescriptor a string representing the location of the target within the cached-representation's content.
     158     * @param multiPart a {@link MultiPart} object representing two-part request body, containing the cached representation metadata
     159     * ({@link CachedRepresentationInfo} element} and a blob for a cached representation content.
     160     * @return a {@link CachedRepresentationInfo} element containing the metadata of the just added cached representation;
     161     * the difference with the input metadata is that a persistent external UUID is assigned, and the last-updated
     162     * attribute is changed.
     163     * @throws IOException  if sending the error fails.
     164     */
    140165    @POST
    141166    @Consumes("multipart/mixed")
     
    185210    }
    186211
    187     ////////////////////////////////////////////////
     212    /**
     213     *
     214     * @param targetIdentifier the external UUID of a target.
     215     * @param cachedIdentifier the external UUID of a cached representation.
     216     * @param fragmentDescriptor the new fragment descriptor locating the target within the cached representation.
     217     * @return a message about the updated; should be "1 row is updated" in a case of success.
     218     * @throws IOException if sending an error fails.
     219     */
    188220    @PUT
    189221    @Produces(MediaType.APPLICATION_XML)
     
    213245    }
    214246
     247    /**
     248     *
     249     * @param targetExternalIdentifier the external UUID of a target.
     250     * @param cachedExternalIdentifier the external UUID of a chaced representation.
     251     * @return a message reporting how deletion went; in the case of success it tells
     252     * how many pairing (target, cached) have been deleted.
     253     * @throws IOException if sending the error fails.
     254     */
    215255    @DELETE
    216256    @Path("{targetid: " + BackendConstants.regExpIdentifier + "}/cached/{cachedid: " + BackendConstants.regExpIdentifier + "}")
    217257    public String deleteCachedForTarget(@PathParam("targetid") String targetExternalIdentifier,
    218             @PathParam("cachedid") String cachedExternalIdentifier) throws HTTPException, IOException {
     258            @PathParam("cachedid") String cachedExternalIdentifier) throws IOException {
    219259        Number remotePrincipalID = this.getPrincipalID();
    220260        if (remotePrincipalID == null) {
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/WelcomeResource.java

    r5385 r6038  
    2222import javax.ws.rs.Path;
    2323import javax.ws.rs.Produces;
    24 import javax.ws.rs.core.Context;
    2524import javax.ws.rs.core.MediaType;
    26 import javax.ws.rs.core.UriInfo;
    2725import org.springframework.stereotype.Component;
    2826
    2927/**
    30  *
     28 * The class contains so far 1 method, outputting a welcome string.
    3129 * @author olhsha
    3230 */
     
    3533public class WelcomeResource extends ResourceResource{
    3634   
     35    /**
     36     *
     37     * @return the welcome-string for the logged-in principal, or the "null-principal".
     38     */
    3739    @GET
    3840    @Produces(MediaType.TEXT_HTML)
Note: See TracChangeset for help on using the changeset viewer.