Changeset 2563
- Timestamp:
- 02/11/13 10:33:01 (11 years ago)
- Location:
- ComponentRegistry/trunk/ComponentRegistry/src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r2561 r2563 145 145 long start = System.currentTimeMillis(); 146 146 List<ComponentDescription> components = getRegistry(getStatus(userspace)).getComponentDescriptions(); 147 LOG. info("Releasing {} registered components into the world ({} millisecs)", components.size(), (System.currentTimeMillis() - start));147 LOG.debug("Releasing {} registered components into the world ({} millisecs)", components.size(), (System.currentTimeMillis() - start)); 148 148 return components; 149 149 } … … 163 163 } 164 164 165 LOG. info("Releasing {} registered profiles into the world ({} millisecs)", profiles.size(), (System.currentTimeMillis() - start));165 LOG.debug("Releasing {} registered profiles into the world ({} millisecs)", profiles.size(), (System.currentTimeMillis() - start)); 166 166 return profiles; 167 167 } … … 172 172 public Response getRegisteredComponent(@PathParam("componentId") String componentId, 173 173 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 174 LOG. info("Component with id: {} is requested.", componentId);174 LOG.debug("Component with id: {} is requested.", componentId); 175 175 CMDComponentSpec mdComponent = getRegistry(getStatus(userspace)).getMDComponent(componentId); 176 176 if (mdComponent == null) { … … 185 185 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) 186 186 public Response getRegisteredComponentRawType(@PathParam("componentId") final String componentId, @PathParam("rawType") String rawType) { 187 LOG. info("Component with id: {} and rawType: {} is requested.", componentId, rawType);187 LOG.debug("Component with id: {} and rawType: {} is requested.", componentId, rawType); 188 188 StreamingOutput result = null; 189 189 try { … … 256 256 public Response getRegisteredProfile(@PathParam("profileId") String profileId, 257 257 @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 258 LOG. info("Profile with id {} is requested.", profileId);258 LOG.debug("Profile with id {} is requested.", profileId); 259 259 CMDComponentSpec mdProfile = getRegistry(getStatus(userspace)).getMDProfile(profileId); 260 260 if (mdProfile == null) { … … 275 275 List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId); 276 276 277 LOG. info("Found {} components and {} profiles that use component {} ({} millisecs)",277 LOG.debug("Found {} components and {} profiles that use component {} ({} millisecs)", 278 278 components.size(), profiles.size(), componentId, (System.currentTimeMillis() - start)); 279 279 … … 297 297 final Principal principal = security.getUserPrincipal(); 298 298 List<Comment> comments = getRegistry(getStatus(userspace)).getCommentsInProfile(profileId, principal); 299 LOG. info("Releasing {} registered comments in profile into the world ({} millisecs)", comments.size(), (System.currentTimeMillis() - start));299 LOG.debug("Releasing {} registered comments in profile into the world ({} millisecs)", comments.size(), (System.currentTimeMillis() - start)); 300 300 return comments; 301 301 } … … 308 308 final Principal principal = security.getUserPrincipal(); 309 309 List<Comment> comments = getRegistry(getStatus(userspace)).getCommentsInComponent(componentId, principal); 310 LOG. info("Releasing {} registered comments in Component into the world ({} millisecs)", comments.size(), (System.currentTimeMillis() - start));310 LOG.debug("Releasing {} registered comments in Component into the world ({} millisecs)", comments.size(), (System.currentTimeMillis() - start)); 311 311 return comments; 312 312 } … … 316 316 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 317 317 public Comment getSpecifiedCommentFromProfile(@PathParam("profileId") String profileId, @PathParam("commentId") String commentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 318 LOG. info("Comments of profile with id {} are requested.", commentId);318 LOG.debug("Comments of profile with id {} are requested.", commentId); 319 319 final Principal principal = security.getUserPrincipal(); 320 320 return getRegistry(getStatus(userspace)).getSpecifiedCommentInProfile(profileId, commentId, principal); … … 325 325 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) 326 326 public Comment getSpecifiedCommentFromComponent(@PathParam("componentId") String componentId, @PathParam("commentId") String commentId, @QueryParam(USERSPACE_PARAM) @DefaultValue("false") boolean userspace) throws ComponentRegistryException { 327 LOG. info("Comments of component with id {} are requested.", commentId);327 LOG.debug("Comments of component with id {} are requested.", commentId); 328 328 final Principal principal = security.getUserPrincipal(); 329 329 return getRegistry(getStatus(userspace)).getSpecifiedCommentInComponent(componentId, commentId, principal); … … 513 513 Principal principal = checkAndGetUserPrincipal(); 514 514 ComponentRegistry registry = getRegistry(getStatus(userspace)); 515 LOG. info("Component with id {} set for deletion.", componentId);515 LOG.debug("Component with id {} set for deletion.", componentId); 516 516 registry.deleteMDComponent(componentId, principal, false); 517 517 } catch (DeleteFailedException e) { … … 540 540 try { 541 541 Principal principal = checkAndGetUserPrincipal(); 542 LOG. info("Profile with id: {} set for deletion.", profileId);542 LOG.debug("Profile with id: {} set for deletion.", profileId); 543 543 getRegistry(getStatus(userspace)).deleteMDProfile(profileId, principal); 544 544 } catch (DeleteFailedException e) { … … 570 570 final Comment comment = registry.getSpecifiedCommentInProfile(profileId, commentId, principal); 571 571 if (comment != null && profileId.equals(comment.getProfileDescriptionId())) { 572 LOG. info("Comment with id: {} set for deletion.", commentId);572 LOG.debug("Comment with id: {} set for deletion.", commentId); 573 573 registry.deleteComment(commentId, principal); 574 574 } else { … … 603 603 final Comment comment = registry.getSpecifiedCommentInComponent(componentId, commentId, principal); 604 604 if (comment != null && componentId.equals(comment.getComponentDescriptionId())) { 605 LOG. info("Comment with id: {} set for deletion.", commentId);605 LOG.debug("Comment with id: {} set for deletion.", commentId); 606 606 registry.deleteComment(commentId, principal); 607 607 } else { … … 631 631 @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML}) 632 632 public Response getRegisteredProfileRawType(@PathParam("profileId") final String profileId, @PathParam("rawType") String rawType) { 633 LOG. info("Profile with id {} and rawType {} is requested.", profileId, rawType);633 LOG.debug("Profile with id {} and rawType {} is requested.", profileId, rawType); 634 634 StreamingOutput result = null; 635 635 try { … … 711 711 desc.setGroupName(group); 712 712 desc.setDomainName(domainName); 713 LOG. info("Trying to register Profile: {}", desc);713 LOG.debug("Trying to register Profile: {}", desc); 714 714 return register(input, desc, userCredentials, userspace, new NewAction()); 715 715 } catch (UserUnauthorizedException ex) { … … 735 735 desc.setGroupName(group); 736 736 desc.setDomainName(domainName); 737 LOG. info("Trying to register Component: {}", desc);737 LOG.debug("Trying to register Component: {}", desc); 738 738 return register(input, desc, userCredentials, userspace, new NewAction()); 739 739 } catch (UserUnauthorizedException ex) { … … 758 758 ComponentDescription description = registry.getComponentDescription(componentId); 759 759 if (description != null) { 760 LOG. info("Trying to register comment to {}", componentId);760 LOG.debug("Trying to register comment to {}", componentId); 761 761 return registerComment(input, registry, userspace, description, principal, userCredentials); 762 762 } else { … … 785 785 ProfileDescription description = registry.getProfileDescription(profileId); 786 786 if (description != null) { 787 LOG. info("Trying to register comment to {}", profileId);787 LOG.debug("Trying to register comment to {}", profileId); 788 788 return registerComment(input, registry, userspace, description, principal, userCredentials); 789 789 } else { … … 803 803 Principal userPrincipal = security.getUserPrincipal(); 804 804 if (LOG.isInfoEnabled()) { 805 LOG. info("ping by <{}>", (userPrincipal == null ? "unauthorized user" : userPrincipal.getName()));805 LOG.debug("ping by <{}>", (userPrincipal == null ? "unauthorized user" : userPrincipal.getName())); 806 806 } 807 807 if (request != null) { … … 848 848 } 849 849 } else { 850 LOG. info("Registration failed with validation errors: {}", Arrays.toString(response.getErrors().toArray()));850 LOG.warn("Registration failed with validation errors: {}", Arrays.toString(response.getErrors().toArray())); 851 851 response.setRegistered(false); 852 852 } 853 LOG.info("Registered new {} {}", desc.isProfile() ? "profile" : "component", desc); 853 854 response.setIsProfile(desc.isProfile()); 854 855 return Response.ok(response).build(); … … 906 907 } else { 907 908 response.setRegistered(false); 908 response.addError("Unable to register at this moment. Internal server error."); 909 response.addError("Unable to post at this moment. Internal server error."); 910 } 911 if (com.getComponentDescriptionId() != null) { 912 LOG.info("Posted new comment on component {}", com.getComponentDescriptionId()); 913 } else { 914 LOG.info("Posted new comment on profile {}", com.getProfileDescriptionId()); 909 915 } 910 916 } else { 911 LOG. info("Registrationfailed with validation errors: {}", Arrays.toString(response.getErrors().toArray()));917 LOG.warn("Posting of comment failed with validation errors: {}", Arrays.toString(response.getErrors().toArray())); 912 918 response.setRegistered(false); 913 919 } … … 938 944 } 939 945 940 private Comment createNewComment() {941 Comment com = Comment.createANewComment();942 return com;943 }944 945 946 private String createXlink(String id) { 946 947 URI uri = uriInfo.getRequestUriBuilder().path(id).build(); … … 1025 1026 final RssCreatorDescriptions instance = new RssCreatorDescriptions(userspace, getApplicationBaseURI(), "components", Integer.parseInt(limit), components, AbstractDescription.COMPARE_ON_DATE); 1026 1027 final Rss rss = instance.getRss(); 1027 LOG. info("Releasing RSS of {} most recently registered components", limit);1028 LOG.debug("Releasing RSS of {} most recently registered components", limit); 1028 1029 return rss; 1029 1030 } … … 1044 1045 final RssCreatorDescriptions instance = new RssCreatorDescriptions(userspace, getApplicationBaseURI(), "profiles", Integer.parseInt(limit), profiles, AbstractDescription.COMPARE_ON_DATE); 1045 1046 final Rss rss = instance.getRss(); 1046 LOG. info("Releasing RSS of {} most recently registered profiles", limit);1047 LOG.debug("Releasing RSS of {} most recently registered profiles", limit); 1047 1048 return rss; 1048 1049 } … … 1068 1069 final RssCreatorComments instance = new RssCreatorComments(userspace, getApplicationBaseURI(), Integer.parseInt(limit), profileId, profileName, "profile", comments, Comment.COMPARE_ON_DATE); 1069 1070 final Rss rss = instance.getRss(); 1070 LOG. info("Releasing RSS of {} most recent post on profile {}", limit, profileId);1071 LOG.debug("Releasing RSS of {} most recent post on profile {}", limit, profileId); 1071 1072 return rss; 1072 1073 } … … 1092 1093 final RssCreatorComments instance = new RssCreatorComments(userspace, getApplicationBaseURI(), Integer.parseInt(limit), componentId, componentName, "component", comments, Comment.COMPARE_ON_DATE); 1093 1094 final Rss rss = instance.getRss(); 1094 LOG. info("Releasing RSS of {} most recent post on component {}", limit, componentId);1095 LOG.debug("Releasing RSS of {} most recent post on component {}", limit, componentId); 1095 1096 return rss; 1096 1097 } -
ComponentRegistry/trunk/ComponentRegistry/src/main/resources/log4j.properties
r2562 r2563 10 10 log4j.rootLogger=WARN,ROOT 11 11 12 log4j.logger.clarin.cmdi.componentregistry=WARN 13 log4j.logger.clarin.cmdi.componentregistry.rest=WARN 12 log4j.logger.clarin.cmdi.componentregistry.rest=INFO 14 13 log4j.logger.clarin.cmdi.componentregistry.impl.database=WARN 15 14 log4j.logger.clarin.cmdi.componentregistry.servlet.IsocatServlet=WARN
Note: See TracChangeset
for help on using the changeset viewer.