Changeset 1250
- Timestamp:
- 04/27/11 13:27:18 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r1244 r1250 54 54 @Context 55 55 private HttpServletRequest request; 56 57 56 private final static Logger LOG = LoggerFactory.getLogger(ComponentRegistryRestService.class); 58 59 57 public static final String DATA_FORM_FIELD = "data"; 60 58 public static final String NAME_FORM_FIELD = "name"; … … 92 90 @GET 93 91 @Path("/components") 94 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})92 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 95 93 public List<ComponentDescription> getRegisteredComponents(@QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 96 94 long start = System.currentTimeMillis(); … … 103 101 @GET 104 102 @Path("/profiles") 105 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})103 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 106 104 public List<ProfileDescription> getRegisteredProfiles(@QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { 107 105 long start = System.currentTimeMillis(); … … 114 112 @GET 115 113 @Path("/components/{componentId}") 116 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})114 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 117 115 public CMDComponentSpec getRegisteredComponent(@PathParam("componentId") String componentId, 118 116 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { … … 123 121 @GET 124 122 @Path("/components/{componentId}/{rawType}") 125 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML})123 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) 126 124 public Response getRegisteredComponentRawType(@PathParam("componentId") final String componentId, @PathParam("rawType") String rawType) { 127 125 LOG.info("Component with id: " + componentId + " and rawType:" + rawType + " is requested."); … … 136 134 if ("xml".equalsIgnoreCase(rawType)) { 137 135 result = new StreamingOutput() { 136 138 137 public void write(OutputStream output) throws IOException, WebApplicationException { 139 138 registry.getMDComponentAsXml(componentId, output); … … 142 141 } else if ("xsd".equalsIgnoreCase(rawType)) { 143 142 result = new StreamingOutput() { 143 144 144 public void write(OutputStream output) throws IOException, WebApplicationException { 145 145 registry.getMDComponentAsXsd(componentId, output); … … 172 172 @GET 173 173 @Path("/profiles/{profileId}") 174 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})174 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 175 175 public CMDComponentSpec getRegisteredProfile(@PathParam("profileId") String profileId, 176 176 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) { … … 203 203 public Response publishRegisteredProfile(@PathParam("profileId") String profileId, @FormDataParam(DATA_FORM_FIELD) InputStream input, 204 204 @FormDataParam(NAME_FORM_FIELD) String name, @FormDataParam(DESCRIPTION_FORM_FIELD) String description, 205 @FormDataParam( DOMAIN_FORM_FIELD) String domainName) {205 @FormDataParam(GROUP_FORM_FIELD) String group, @FormDataParam(DOMAIN_FORM_FIELD) String domainName) { 206 206 Principal principal = checkAndGetUserPrincipal(); 207 207 ProfileDescription desc = getRegistry(true).getProfileDescription(profileId); 208 208 if (desc != null) { 209 updateDescription(desc, name, description, domainName, null);209 updateDescription(desc, name, description, domainName, group); 210 210 return register(input, desc, getUserCredentials(principal), true, new PublishAction(principal)); 211 211 } else { … … 221 221 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace, @FormDataParam(DATA_FORM_FIELD) InputStream input, 222 222 @FormDataParam(NAME_FORM_FIELD) String name, @FormDataParam(DESCRIPTION_FORM_FIELD) String description, 223 @FormDataParam( DOMAIN_FORM_FIELD) String domainName) {223 @FormDataParam(GROUP_FORM_FIELD) String group, @FormDataParam(DOMAIN_FORM_FIELD) String domainName) { 224 224 Principal principal = checkAndGetUserPrincipal(); 225 225 UserCredentials userCredentials = getUserCredentials(principal); 226 226 ProfileDescription desc = getRegistry(userspace).getProfileDescription(profileId); 227 227 if (desc != null) { 228 updateDescription(desc, name, description, domainName, null);228 updateDescription(desc, name, description, domainName, group); 229 229 return register(input, desc, userCredentials, userspace, new UpdateAction()); 230 230 } else { … … 344 344 @GET 345 345 @Path("/profiles/{profileId}/{rawType}") 346 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML})346 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) 347 347 public Response getRegisteredProfileRawType(@PathParam("profileId") final String profileId, @PathParam("rawType") String rawType) { 348 348 LOG.info("Profile with id: " + profileId + " and rawType:" + rawType + " is requested."); … … 358 358 if ("xml".equalsIgnoreCase(rawType)) { 359 359 result = new StreamingOutput() { 360 360 361 public void write(OutputStream output) throws IOException, WebApplicationException { 361 362 registry.getMDProfileAsXml(profileId, output); … … 364 365 } else if ("xsd".equalsIgnoreCase(rawType)) { 365 366 result = new StreamingOutput() { 367 366 368 public void write(OutputStream output) throws IOException, WebApplicationException { 367 369 registry.getMDProfileAsXsd(profileId, output); … … 391 393 @POST 392 394 @Path("/profiles") 393 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})395 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 394 396 @Consumes("multipart/form-data") 395 397 public Response registerProfile(@FormDataParam(DATA_FORM_FIELD) InputStream input, @FormDataParam(NAME_FORM_FIELD) String name, … … 411 413 @POST 412 414 @Path("/components") 413 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})415 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 414 416 @Consumes("multipart/form-data") 415 417 public Response registerComponent(@FormDataParam(DATA_FORM_FIELD) InputStream input, @FormDataParam(NAME_FORM_FIELD) String name, … … 431 433 @GET 432 434 @Path("/pingSession") 433 @Produces( { MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})435 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 434 436 public Response pingSession() { 435 437 boolean stillActive = false;
Note: See TracChangeset
for help on using the changeset viewer.