Changeset 6044
- Timestamp:
- 02/24/15 18:53:22 (9 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java
r6038 r6044 29 29 import eu.dasish.annotation.schema.ObjectFactory; 30 30 import eu.dasish.annotation.schema.Access; 31 import eu.dasish.annotation.schema.AnnotationInfo; 31 32 import eu.dasish.annotation.schema.PermissionList; 32 33 import eu.dasish.annotation.schema.ReferenceList; … … 59 60 60 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 outputsthe declared output type62 * A REST class for GETting, POSTing, PUTting and DELETing annotations or their substructures (child elements). 63 * Every REST method in the case of successful completion produces the object of the declared output type 63 64 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise. 64 65 * @author olhsha … … 72 73 final private String[] admissibleMatchModes = {"exact", "starts_with", "ends_with", "contains"}; 73 74 74 /** 75 * 76 * @param httpServletResponse a {@link HttpServletResponse} object, setting us used in unit tests. 77 */ 78 public void setHttpServletResponse(HttpServletResponse httpServletResponse) { 79 this.httpServletResponse = httpServletResponse; 80 } 81 82 /** 83 * 84 * @param httpServletRequest a {@link HttpServletRequest} object, setting is used in the unit tests. 75 76 /** 77 * 78 * @param httpServletRequest a {@link HttpServletRequest} object; set explicitely in the unit tests. 85 79 */ 86 80 public void setHttpServletRequest(HttpServletRequest httpServletRequest) { … … 90 84 /** 91 85 * 92 * @param providers a {@link Providers} object, to be set to "this" object and to be used to force93 * validation of the input/output xml files w.r.t. the dasish schema.86 * @param providers a {@link Providers} object, used by JAXB, also 87 * to validate input and output xml files w.r.t. the dasish schema. 94 88 */ 95 89 public void setProviders(Providers providers) { … … 103 97 /** 104 98 * 105 * @param externalIdentifier the string representing theUUID of an annotation.99 * @param externalIdentifier the UUID of an annotation. 106 100 * @return the xml-element representing the annotation with "externalIdentifier" built up 107 101 * from the "annotation" table and the corresponding junction tables. 108 * @throws IOException if sending theerror fails.102 * @throws IOException if sending an error fails. 109 103 */ 110 104 @GET … … 141 135 * 142 136 * @param externalIdentifier the string representing the UUID of an annotation. 143 * @return the xml element representing the list of h-references of the annotation with "externalIdentifier".144 * @throws IOException if sending theerror fails.137 * @return the xml element representing the list of h-references of the targets of the annotation with "externalIdentifier". 138 * @throws IOException if sending an error fails. 145 139 */ 146 140 @GET … … 177 171 * 178 172 * @param link the link representing one of the target sources of the annotation. 179 * @param matchMode the relation of the actual target-source link to "link" parameter: "exact", "starts_with", "ends_with", "contains"173 * @param matchMode the relation of the actual target-source link to the "link" parameter: "exact", "starts_with", "ends_ith", "contains". 180 174 * @param text the text fragment that must be present in the annotation body. 181 175 * @param access the access mode of the logged in user to the requested annotations. … … 186 180 * @return the xml-element representing the list of {@link AnnotationInfo} objects representing 187 181 * the annotations satisfying the requirements defined by the parameters. 188 * @throws IOException if sending theerror fails.182 * @throws IOException if sending an error fails. 189 183 */ 190 184 @GET … … 238 232 239 233 /** 240 * 241 * @param n # of requested annotations (to which logged in principal has "read" access. 242 * @return the external UUIDs of some n annotations to which the logged in principal has "read" access, 243 * if the principal has "admin" or "developer" type of account. 244 * @throws IOException if sending the error fails. 234 * The request can be sent by principals with "developer" or "admin" account. 235 * @param n # of threads. 236 * @return a message reporting test success. 237 * @throws IOException if sending an error fails. 245 238 * @throws NotInDataBaseException if getting annotation fails. 246 239 */ … … 288 281 * @return the xml-element representing the list of permissions, i.e. pairs (principalId, accessMode), 289 282 * built upon the table "annotations_principals_accesses". 290 * @throws IOException if sending theerror fails.283 * @throws IOException if sending an error fails. 291 284 */ 292 285 @GET … … 323 316 * 324 317 * @param externalIdentifier the external UUID of the annotation to be deleted. 325 * @return the message if the annotation is deleted or not.326 * @throws IOException if sending theerror fails.318 * @return the message telling if the annotation is deleted or not. 319 * @throws IOException if sending an error fails. 327 320 */ 328 321 @DELETE … … 356 349 /** 357 350 * 358 * @param annotation an {@link Annotation} object ,351 * @param annotation an {@link Annotation} object. 359 352 * @return the {@link ResponseBody} element that contains the xml element representing 360 * the fresh annotation (with its generated by the method external UUID), and the list353 * the fresh annotation (with its freshly generated by the back-end external UUID), and the list 361 354 * of action-elements representing the actions the client should care for, 362 355 * e.g. add a cached representation for a certain target. 363 * @throws IOException if sending theerror fails.356 * @throws IOException if sending an error fails. 364 357 */ 365 358 @POST … … 401 394 * 402 395 * @param externalId the external UUID of the annotation to be updated. 403 * @param annotation the {@link Annotation} object that representthe new annotation that should replace the annotation with "externalId".396 * @param annotation the {@link Annotation} object representing the new annotation that should replace the annotation with "externalId". 404 397 * @return the {@link ResponseBody} element that contains the xml element representing 405 398 * the updated annotation, and the list of action-elements representing the actions the client should care for, 406 399 * e.g. add a cached representation for a certain target. 407 * @throws IOException if sending theerror fails.400 * @throws IOException if sending an error fails. 408 401 */ 409 402 @PUT … … 459 452 * @return the {@link ResponseBody} element that contains the xml element representing 460 453 * the updated annotation, and the list of action-elements representing the actions the client should care for. 461 * @throws IOException if sending theerror fails.454 * @throws IOException if sending an error fails. 462 455 */ 463 456 @PUT … … 500 493 * 501 494 * @param externalIdentifier the external UUID of the annotation whose headline is to be updated. 502 * @param newHeadline the string representing thenew headline.495 * @param newHeadline a new headline. 503 496 * @return the {@link ResponseBody} element that contains the xml element representing 504 497 * the updated annotation, and the list of action-elements representing the actions the client should care for. 505 * @throws IOException if sending theerror fails.498 * @throws IOException if sending an error fails. 506 499 */ 507 500 @PUT … … 546 539 * @param annotationHeadline the annotation's headline. 547 540 * @param access the new value for the public attribute of the annotation. 548 * @return the message if the database has been updated and how many rows have been updated;541 * @return the message telling if the database has been updated and how many rows have been updated; 549 542 * if "annotationDatabaseId" == null or empty then all the annotations with "annotationHeadline" 550 * must be updated ,551 * @throws IOException if sending theerror fails.543 * must be updated. 544 * @throws IOException if sending an error fails. 552 545 */ 553 546 @POST … … 615 608 * @param annotationExternalId the external UUID of an annotation. 616 609 * @param principalExternalId the external UUID of a principal whose access mode to the annotation must be updated. 617 * @param access the access mode that should assigned to the principal.610 * @param access the access mode that should be assigned to the principal. 618 611 * @return the message about the amount of updated rows. 619 * @throws IOException if sending theerror fails.612 * @throws IOException if sending an error fails. 620 613 */ 621 614 @PUT … … 637 630 638 631 /** 639 * One of 3 principal-related parameters must be non-null and non-empty; one of 2 annotation 632 * One of 3 principal-related parameters must be non-null and non-empty; one of 2 annotation-related parameters must be non-null and non-empty. 640 633 * @param remoteID the remote ID of the principal whose access mode to the annotation (see below) must be updated. 641 634 * @param fullName the full name of the principal whose access mode to the annotation must be updated. … … 645 638 * @param access the new access mode. 646 639 * @return the message explaining how many rows have been updated. 647 * @throws IOException if sending error messagefails.640 * @throws IOException if sending an error fails. 648 641 */ 649 642 @POST … … 738 731 * the updated annotation, and the list of action-elements representing the actions the client should care for, 739 732 * e.g. add the e-mail of a certain principal. 740 * @throws IOException if sending theerror fails.733 * @throws IOException if sending an error fails. 741 734 */ 742 735 @PUT … … 781 774 * @param annotationId the external UUID of the annotation. 782 775 * @param principalId the external UUID of a principal whose access mode must be deleted. 783 * @return the amount of updated/removed rows in the database.784 * @throws IOException if sending theerror fails.776 * @return the amount of removed rows in the database. 777 * @throws IOException if sending an error fails. 785 778 */ 786 779 @DELETE -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AutheticationResource.java
r6038 r6044 35 35 36 36 /** 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 outputsthe declared output type37 * A REST class for GETting a logged in principal, log-in and log-out. 38 * Every REST method in the case of successful completion produces the object of the declared output type 39 39 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise. 40 40 * @author olhsha … … 47 47 /** 48 48 * 49 * @return the {@link Principal} object representing the current logged- on principal.50 * @throws IOException if sending theerror fails.49 * @return the {@link Principal} object representing the current logged-in principal. 50 * @throws IOException if sending an error fails. 51 51 */ 52 52 @GET … … 84 84 /** 85 85 * 86 * @throws IOException if sending redirectfails.86 * @throws IOException if sending the redirect to logout page fails. 87 87 */ 88 88 @GET -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/CachedRepresentationResource.java
r6038 r6044 52 52 53 53 /** 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 outputsthe declared output type54 * A REST class for GETting, POSTing and PUTting cached representations. 55 * DELETing cached representation is provided by {@link TargetRsource} class. 56 * Every REST method in the case of successful completion produces an object of the declared output type 57 57 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise. 58 58 * @author olhsha … … 63 63 public class CachedRepresentationResource extends ResourceResource { 64 64 65 /** 66 * 67 * @param request a {@link HttpServletRequest} object representing request; the set parameter is used in unit tests. 68 */ 69 public void setHttpRequest(HttpServletRequest request) { 70 this.httpServletRequest = request; 71 } 72 73 /** 74 * 75 * @param externalId the external UUID of a cached representations. 76 * @return a {@link CachedRepresentationInfo} representing the metadata for the cached representation with the "externalId". 77 * @throws IOException if sending the error fails. 65 66 /** 67 * 68 * @param externalId the external UUID of a cached representation. 69 * @return a {@link CachedRepresentationInfo} object representing the metadata for the cached representation with the "externalId". 70 * @throws IOException if sending an error fails. 78 71 */ 79 72 @GET … … 112 105 * @param externalId the external UUID of a cached representation. 113 106 * @return the image-blob if the cached-representation's blob is an image file. 114 * @throws IOException if logging theerror fails (should be changed to sending httpResponse error message).107 * @throws IOException if logging an error fails (should be changed to sending httpResponse error message). 115 108 */ 116 109 @GET … … 150 143 * @param externalId the external UUID of a cached representation. 151 144 * @return the cached-representation's blob. 152 * @throws IOException is sending theerror fails.145 * @throws IOException is sending an error fails. 153 146 */ 154 147 @GET … … 180 173 /** 181 174 * 182 * @param cachedIdentifier the external uuidof a cached representation.183 * @param multiPart a {@link MultiPart} object containing two parts: a {@link CachedRepresentationInfo} object for the cached-representation's metadata, and its blob.184 * @return a message about how many rows in "cached_representation" table have been update ; "1" if updated, and "0" otherwisee.185 * @throws IOException if sending theerror fails.175 * @param cachedIdentifier the external UUID of a cached representation. 176 * @param multiPart a {@link MultiPart} object containing two parts: a {@link CachedRepresentationInfo} object for the cached-representation's metadata, and its blob. 177 * @return a message about how many rows in "cached_representation" table have been updated; "1" if updated, and "0" otherwisee. 178 * @throws IOException if sending an error fails. 186 179 */ 187 180 @PUT … … 263 256 /** 264 257 * 265 * @param cachedInfo a {@link CachedRepresentationInfo} representing the new metadata.266 * @return a message about how many rows in "cached_representation" table ,"1" if updated, "0" otherwise.267 * @throws IOException if sending theerror fails.258 * @param cachedInfo a {@link CachedRepresentationInfo} object representing the new metadata. 259 * @return a message about how many rows in "cached_representation" table have been updated: "1" if updated, "0" otherwise. 260 * @throws IOException if sending an error fails. 268 261 */ 269 262 @PUT -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/DebugResource.java
r6038 r6044 44 44 45 45 /** 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 outputsthe declared output type48 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise ;49 * The class is used only by "admin" and "developer" principals; these account types are set in "principal" table.46 * A 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 produces the object of the declared output type 48 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise. 49 * The class is used only by "admin" and "developer" principals; these account types are set in the "principal" table. 50 50 * @author olhsha 51 51 */ … … 69 69 /** 70 70 * 71 * @return An {@link AnnotationInfoList}-element containing the list of {@link AnnotationInfo} objects of ALL the annotations,71 * @return An {@link AnnotationInfoList}-element containing the list of {@link AnnotationInfo} elements of ALL the annotations, 72 72 * with the latest (youngest) annotation on the top. 73 * @throws IOException if sending theerror fails.73 * @throws IOException if sending an error fails. 74 74 */ 75 75 @GET … … 98 98 * @param n # of strings. 99 99 * @return the latest n strings of the dasish database log file. 100 * @throws IOException if sending theerror fails.100 * @throws IOException if sending an error fails. 101 101 */ 102 102 @GET … … 135 135 * @param n # of strings 136 136 * @return the last n strings of the dasish server logger (non-SQL-request logs). 137 * @throws IOException if sending theerror fails.137 * @throws IOException if sending an error fails. 138 138 */ 139 139 @GET … … 158 158 /** 159 159 * 160 * @param principalId the external UUID of a principal whose account type must be updated ,160 * @param principalId the external UUID of a principal whose account type must be updated. 161 161 * @param account the new account type (admin, developer, user). 162 * @return a message if the account has been updated or not.163 * @throws IOException if sending theerror fails.162 * @return a message telling if the account has been updated or not. 163 * @throws IOException if sending an error fails. 164 164 */ 165 165 @PUT … … 194 194 * @param oldExternalId the old external UUID of the resource. 195 195 * @param newExternalId the new UUID of the resource 196 * @return the message if the "newExternalIdentifier" has replaced the "oldExternalIdentifier" or not,197 * @throws IOException is sending theerror fails.196 * @return a message telling if the "newExternalIdentifier" has replaced the "oldExternalIdentifier" or not. 197 * @throws IOException is sending an error fails. 198 198 */ 199 199 @PUT -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/GetThread.java
r6018 r6044 22 22 23 23 /** 24 * A helper class used by an "admin" or a "dedeloper" in "stress testing" method AnnotationResource.getAnnotationsMultithread(..) 24 * A helper class used by an "admin" or a "dedeloper" in "stress testing" method AnnotationResource.getAnnotationsMultithread(..). Check {@link AnnotationResource} class. 25 25 * @author olhsha 26 26 */ -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/JaxbUnmarshallerFactory.java
r6018 r6044 29 29 30 30 /** 31 * Implemented to deserialise xml-elements into java objects, used to validate XML data.31 * Implemented to deserialise xml-elements into java objects, used by JAXB, also to validate input XML files. 32 32 * @author olhsha 33 33 */ -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/NotebookResource.java
r6038 r6044 47 47 48 48 /** 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 outputsthe declared output type49 * A REST interface for GETting, POSTing, PUTting and DELETing notebooks or their substructures (child elements). 50 * Every REST method in the case of successful completion produces the object of the declared output type 51 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.nl52 * @author olhsha@mpi.nl 53 53 */ 54 54 @Component … … 65 65 * @return the {@link NotebookInfoList} element containing the list of {@link NotebookInfo} elements 66 66 * of all the notebooks to which the in-logged principal has "access" access. 67 * @throws IOException if sending theerror fails.67 * @throws IOException if sending an error fails. 68 68 */ 69 69 @GET … … 87 87 * 88 88 * @return the {@link ReferenceList} element containing the list of h-references of all the notebooks owned by the in-logged principal. 89 * @throws IOException if sending theerror fails.89 * @throws IOException if sending an error fails. 90 90 */ 91 91 @GET … … 105 105 * 106 106 * @param externalIdentifier the external UUID identifier of a notebook. 107 * @param accessMode the access mode on which principals must be filtered ,107 * @param accessMode the access mode on which principals must be filtered; 108 108 * can be "none", "read", "write", "all". 109 109 * @return a {@link ReferenceList} element representing the list of h-references of the 110 * principal that have access "accessMode"111 * @throws IOException if sending theerror fails.110 * principals that have access "accessMode". 111 * @throws IOException if sending an error fails. 112 112 */ 113 113 @GET … … 140 140 * 141 141 * @param externalIdentifier the external UUID identifier of a notebook. 142 * @return a {@link Notebook} element built up on the whole information143 * ( "notebook" table and the corresponding junction tables) for the notebook with "externalIdentifier".144 * @throws IOException if sending theerror fails.142 * @return a {@link Notebook} element representing the notebook with "externalIdentifier"; built up on the whole information 143 * (the "notebook" table and the corresponding junction tables) for the notebook with "externalIdentifier". 144 * @throws IOException if sending an error fails. 145 145 */ 146 146 … … 174 174 /** 175 175 * 176 * @param externalIdentifier the external UUID identifierof a notebook.177 * @param maximumAnnotations the maximum amount of annotations from this notebook to output 176 * @param externalIdentifier the external UUID of a notebook. 177 * @param maximumAnnotations the maximum amount of annotations from this notebook to output; 178 178 * if the amount of annotations in the notebook is more than (startAnnotations-1) + maximumAnnotations, 179 * then exactly maximumAnnotations will be output, otherwise the amount of annotations of 180 * output is limited by "# of annotations in the notebook" - startAnnotation 179 * then exactly maximumAnnotations will be output, otherwise the amount of annotations is limited by "# of annotations in the notebook" - (startAnnotation-1) 181 180 * @param startAnnotations the index of the first annotation, min value is "1". 182 181 * @param orderBy the field in the table "notebook" on which annotations must be ordered. 183 182 * @param desc if true then the annotations in the list must be ordered in descending order, otherwise in ascending order. 184 * @return a {@link ReferenceList} element representing the list of (maximum) maximumAnnotations185 * @throws IOException if sending theerror fails.183 * @return a {@link ReferenceList} element representing the list of annotations filtered according to the parameters. 184 * @throws IOException if sending an error fails. 186 185 */ 187 186 @GET … … 222 221 * @param notebookInfo the fresh {@link NotebookInfo} object. 223 222 * @return a {@link ResponseBody} element containing the just updated {@link Notebook} element 224 * and the list of actions , which are not yet specified for the notebooks.225 * @throws IOException if sending theerror fails.223 * and the list of actions (which are not yet specified for the notebooks). 224 * @throws IOException if sending an error fails. 226 225 */ 227 226 @PUT … … 229 228 @Produces(MediaType.APPLICATION_XML) 230 229 @Path("{notebookid: " + BackendConstants.regExpIdentifier + "}") 231 public JAXBElement<ResponseBody> updateNotebookInfo(@PathParam("notebookid") String externalIdentifier, NotebookInfo notebookInfo) throws IOException , HTTPException{230 public JAXBElement<ResponseBody> updateNotebookInfo(@PathParam("notebookid") String externalIdentifier, NotebookInfo notebookInfo) throws IOException{ 232 231 Number remotePrincipalID = this.getPrincipalID(); 233 232 if (remotePrincipalID == null) { -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/PrincipalResource.java
r6038 r6044 53 53 54 54 /** 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 outputsthe declared output type55 * A REST class for GETting, POSTing, PUTting and DELETing principals or their substructures (child elements). 56 * Every REST method in the case of successful completion produces an object of the declared output type 57 57 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise. 58 58 * @author olhsha … … 65 65 int shaStrength = 512; 66 66 67 68 /** 69 * 70 * @param request a {@link HttpServletRequest} object; set object is used in unit tests. 71 */ 72 public void setHttpRequest(HttpServletRequest request) { 73 this.httpServletRequest = request; 74 } 75 67 76 68 public PrincipalResource() { 77 69 } … … 81 73 * @param externalIdentifier the external UUID of a principal. 82 74 * @return the {@link Principal} element representing the principal object with the "externalIdentifier". 83 * @throws IOException is sending theerror fails.75 * @throws IOException is sending an error fails. 84 76 */ 85 77 @GET … … 113 105 /** 114 106 * 115 * @return a message containing the f ill name and the e-mail of the admin.116 * @throws IOException if sending the error in the call of "this.getPrincipalID()".107 * @return a message containing the full name and the e-mail of the admin. 108 * @throws IOException if sending an error in the call of "this.getPrincipalID()" fails. 117 109 */ 118 110 @GET … … 130 122 /** 131 123 * 132 * @param email a string representingthe e-mail of a principal.124 * @param email the e-mail of a principal. 133 125 * @return a {@link Principal} representing the principal with the "email", 134 126 * if such a principal is found; otherwise "SC_NOT_FOUND" error is sent. 135 * @throws IOException if sending theerror fails.127 * @throws IOException if sending an error fails. 136 128 */ 137 129 @GET … … 168 160 * @return a {@link CurrentPrincipalInfo} element containing "true" if the principal 169 161 * with externalIdentifier is logged-in in this session; 170 * with ethe current implementation does not make that much sense for me,162 * with the current implementation does not make that much sense for me, 171 163 * because the logged-in user knows his/her externalIDdentifier and knows that the other UUIDs 172 * will be "not logged in", and therefore "false" is expected ,173 * @throws IOException if sending theerror fails.164 * will be "not logged in", and therefore "false" is expected. 165 * @throws IOException if sending an error fails. 174 166 */ 175 167 @GET … … 261 253 * @param remoteId the remote id of the principal to be registered. 262 254 * @param password the password selected by the principal to be registered. 263 * @param email anemail of the principal to be registered.264 * @return a @Link Principal} element representing the just registered principal.265 * @throws IOException if sending theerror fails.255 * @param email the email of the principal to be registered. 256 * @return a {@link Principal} element representing the just registered principal. 257 * @throws IOException if sending an error fails. 266 258 */ 267 259 @POST … … 310 302 /** 311 303 * 312 * @param name the name of the principal to be registered 304 * @param name the name of the principal to be registered. 313 305 * @param remoteId the remote shibboleth id. 314 306 * @param email the email. 315 * @return a @Link Principal} element representing the just registered principal.316 * @throws IOException if sending theerror fails.307 * @return a {@link Principal} element representing the just registered principal. 308 * @throws IOException if sending an error fails. 317 309 */ 318 310 @POST … … 353 345 354 346 /** 355 * It is of a goodconvenience method limiting proliferation of user profiles, however347 * It is a convenience method limiting proliferation of user profiles, however 356 348 * the method is currently not used till security issues will be discussed with the LAT 357 349 * system administrators. … … 359 351 * @param password a shibboleth password which will be set as a basic-authentication password. 360 352 * @return a message about amount of records; which must be 2 if everything goes well: 361 * 1 record for the principal, another for the authorities table362 * @throws IOException if sending theerror fails.353 * 1 record for the "principal" table, 1is for the "authorities" tabl. 354 * @throws IOException if sending an error fails. 363 355 */ 364 356 @POST … … 381 373 * 382 374 * @param principal a {@link Principal} object representing new information (name, e-mail) about the principal 383 * with the eternal UUID given in the object ,384 * @return a @Link Principal} element representing the just updated principal.385 * @throws IOException if sending theerror message fails.375 * with the eternal UUID given in the object. 376 * @return a {@link Principal} element representing the just updated principal. 377 * @throws IOException if sending an error message fails. 386 378 */ 387 379 @PUT … … 418 410 * 419 411 * @param name a new full name. 420 * @param email a new email 421 * @return a @Link Principal} element representing the just updated principal.422 * @throws IOException if sending theerror fails.412 * @param email a new email. 413 * @return a {@link Principal} element representing the just updated principal. 414 * @throws IOException if sending an error fails. 423 415 * @throws NotInDataBaseException if the in-logged principal is not found in the database 424 * or update dfails.416 * or update fails. 425 417 */ 426 418 @POST -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ProjectInfoResource.java
r6038 r6044 41 41 * 42 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.s43 * @throws IOException if getting a principal or sending an error fails. 44 44 */ 45 45 @GET -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/RequestWrappers.java
r6038 r6044 33 33 34 34 /** 35 * Different requests for different resources stillhave some steps in common and therefore36 * can be wrapped in a class whose higher-order methods perform sthe common steps and then call35 * Different requests for different resources have some steps in common and therefore 36 * can be wrapped in a class whose higher-order methods perform the common steps and then call 37 37 * the methods performing the specific part; the specific-part object is passed as a parameter. 38 38 * @author olhsha … … 48 48 /** 49 49 * Set the instance of a specific REST class. 50 * @param resourceResource 50 * @param resourceResource a {@link ResourceResource} object representing one of the rest resource classes of this package. 51 51 */ 52 52 public RequestWrappers(ResourceResource resourceResource) { … … 59 59 * @param resource a type of resource: "annotation", "principal", "cached representation", "notebook", "target". 60 60 * @param action a string naming the action that should have been performed. 61 * @return 61 * @return a string representing a tuned error message. 62 62 */ 63 63 public String FORBIDDEN_RESOURCE_ACTION(String identifier, String resource, String action) { … … 70 70 * @param dbRequestor the object that will be performing the specific part of the request ("continuation"). 71 71 * @return the requested resource. 72 * @throws IOException if sending error messagefails in the called methods.72 * @throws IOException if sending an error fails in the called methods. 73 73 * @throws NotInDataBaseException if thrown by the specific part of the request. 74 74 * @throws ForbiddenException if the action is forbidden for the inlogged user. … … 87 87 * @param params list of parameters that will be used by a specific part of the request (in "the continuation"). 88 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".89 * @param resource a {@link Resource} object, representing the type of a resource: "annotation", "principal", "cached representation", "notebook", "target". 90 90 * @param action an {@link Access} object representing the type ("mightiness") of the action. 91 91 * @param externalId the external UUID of the resource. 92 92 * @return the resource. 93 * @throws IOException if sending error messagefails in the called methods.93 * @throws IOException if sending an error fails in the called methods. 94 94 * @throws NotInDataBaseException if thrown by the specific part of the request. 95 95 * @throws ForbiddenException if the action is forbidden for the inlogged user. … … 120 120 * @param dbRequestor the object that will be performing the specific part of the request ("continuation"). 121 121 * @return a {@link Principal} element. 122 * @throws IOException if sending error messagefails in the called methods.122 * @throws IOException if sending an error fails in the called methods. 123 123 * @throws NotInDataBaseException if thrown by the specific part of the request. 124 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)125 * (can be sthrown if the request is to add or update a principal). 126 126 */ 127 127 public JAXBElement<Principal> wrapAddPrincipalRequest(Map params, ILambdaPrincipal<Map, Principal> dbRequestor) throws IOException, NotInDataBaseException, PrincipalExists { -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ResourceResource.java
r6038 r6044 34 34 35 35 /** 36 * This class is a super-class of any [SpecificPart]Resource of this RESTpackage and contains the methods37 * and field common for each of them.36 * This class is a super-class of any [SpecificPart]Resource class of this package and contains the methods 37 * and fields common for each of them. 38 38 * @author olhsha 39 39 */ … … 60 60 * @return the internal database id of the logged in principal if the authentication went well, 61 61 * otherwise sends a corresponding error message. 62 * @throws IOException if sending theerror fails.62 * @throws IOException if sending an error fails. 63 63 */ 64 64 public Number getPrincipalID() throws IOException { … … 101 101 102 102 103 104 protected void ADMIN_RIGHTS_EXPECTED() throws IOException{103 104 protected void ADMIN_RIGHTS_EXPECTED(){ 105 105 loggerServer.debug("The request can be performed only by the principal with the admin rights."); 106 106 } 107 107 108 protected void INVALID_ACCESS_MODE(String accessMode) throws IOException{108 protected void INVALID_ACCESS_MODE(String accessMode) { 109 109 loggerServer.debug(accessMode + " is an invalid access value, which must be either owner, or read, or write."); 110 110 } 111 111 112 /** 113 * 114 * @return concatenation of the context-path and servlet-path. 115 */ 112 116 protected String getRelativeServiceURI(){ 113 117 return httpServletRequest.getContextPath()+httpServletRequest.getServletPath(); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/TargetResource.java
r6038 r6044 36 36 import java.util.Map; 37 37 import java.util.UUID; 38 import javax.servlet.http.HttpServletRequest;39 38 import javax.servlet.http.HttpServletResponse; 40 39 import javax.ws.rs.Consumes; … … 49 48 import javax.xml.bind.JAXBElement; 50 49 import javax.xml.parsers.ParserConfigurationException; 51 import javax.xml.ws.http.HTTPException;52 50 import org.springframework.stereotype.Component; 53 51 import org.springframework.transaction.annotation.Transactional; 54 52 55 53 /** 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 outputsthe declared output type54 * A REST class for GETting, POSTing, PUTting and DELETing targets or their substructures (child elements). 55 * Every REST method in the case of successful completion produces the object of the declared output type 58 56 * (a JAXB-element or a message string) or sends a HTTP-error with the corresponding diagnostics otherwise. 59 60 57 * @author olhsha 61 58 */ … … 66 63 public class TargetResource extends ResourceResource { 67 64 68 /**69 * Sets {@link HttpServletRequest} object, to be used in unit tests.70 * @param request a @link HttpServletRequest} object to be set.71 */72 public void setHttpRequest(HttpServletRequest request) {73 this.httpServletRequest = request;74 }75 76 65 public TargetResource() { 77 66 } … … 79 68 /** 80 69 * 81 * @param externalIdentifier the external UUId of thetarget.70 * @param externalIdentifier the external UUId of a target. 82 71 * @return a {@link Target} element representing a target object with "externalIdentifier". 83 72 * @throws IOException if sending an error fails. … … 117 106 * 118 107 * @param externalIdentifier the external UUID of a target. 119 * @return a {@link ReferenceList} element representing the list of h e-references of the targets that120 * refer to the same link .121 * @throws IOException if sending theerror fails.108 * @return a {@link ReferenceList} element representing the list of h-references of the targets that 109 * refer to the same link as the target with "externalIdentifier". 110 * @throws IOException if sending an error fails. 122 111 */ 123 112 @GET … … 157 146 * @param fragmentDescriptor a string representing the location of the target within the cached-representation's content. 158 147 * @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.148 * {@link CachedRepresentationInfo} element} and a blob for a cached representation content. 160 149 * @return a {@link CachedRepresentationInfo} element containing the metadata of the just added cached representation; 161 150 * the difference with the input metadata is that a persistent external UUID is assigned, and the last-updated 162 151 * attribute is changed. 163 * @throws IOException if sending theerror fails.152 * @throws IOException if sending an error fails. 164 153 */ 165 154 @POST … … 215 204 * @param cachedIdentifier the external UUID of a cached representation. 216 205 * @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.206 * @return a message about the # of updated rows; should be "1 row is updated" in a case of success. 218 207 * @throws IOException if sending an error fails. 219 208 */ … … 251 240 * @return a message reporting how deletion went; in the case of success it tells 252 241 * how many pairing (target, cached) have been deleted. 253 * @throws IOException if sending theerror fails.242 * @throws IOException if sending an error fails. 254 243 */ 255 244 @DELETE
Note: See TracChangeset
for help on using the changeset viewer.