| 1 |  |  | 
            
  
    | 2 |  |  | 
            
  
    | 3 |  |  | 
            
  
    | 4 |  |  | 
            
  
    | 5 |  |  | 
            
  
    | 6 |  |  | 
            
  
    | 7 |  |  | 
            
  
    | 8 |  |  | 
            
  
    | 9 |  |  | 
            
  
    | 10 |  |  | 
            
  
    | 11 |  |  | 
            
  
    | 12 |  |  | 
            
  
    | 13 |  |  | 
            
  
    | 14 |  |  | 
            
  
    | 15 |  |  | 
            
  
    | 16 |  | package org.kuali.student.common.ui.server.gwt; | 
            
  
    | 17 |  |  | 
            
  
    | 18 |  | import java.io.IOException; | 
            
  
    | 19 |  | import java.util.HashMap; | 
            
  
    | 20 |  | import java.util.LinkedHashMap; | 
            
  
    | 21 |  | import java.util.List; | 
            
  
    | 22 |  | import java.util.Map; | 
            
  
    | 23 |  |  | 
            
  
    | 24 |  | import javax.servlet.ServletConfig; | 
            
  
    | 25 |  | import javax.servlet.ServletException; | 
            
  
    | 26 |  |  | 
            
  
    | 27 |  | import org.apache.log4j.Logger; | 
            
  
    | 28 |  | import org.kuali.rice.core.config.ConfigContext; | 
            
  
    | 29 |  | import org.kuali.student.common.ui.client.service.ServerPropertiesRpcService; | 
            
  
    | 30 |  | import org.kuali.student.common.util.ManifestInspector; | 
            
  
    | 31 |  |  | 
            
  
    | 32 |  | import com.google.gwt.user.server.rpc.RemoteServiceServlet; | 
            
  
    | 33 |  |  | 
            
  
    | 34 |  | @SuppressWarnings("serial") | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 31 (31) | Complexity: 8 | Complexity Density: 0.35 |  | 
  
  
    | 35 |  | public class ServerPropertiesRpcGwtServlet extends RemoteServiceServlet implements ServerPropertiesRpcService { | 
            
  
    | 36 |  |  | 
            
  
    | 37 |  | final Logger logger = Logger.getLogger(ServerPropertiesRpcGwtServlet.class); | 
            
  
    | 38 |  |  | 
            
  
    | 39 |  | Map<String, String> properties = new HashMap<String, String>(); | 
            
  
    | 40 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 41 | 0 |  public Map<String, String> getProperties() {... | 
            
  
    | 42 | 0 | return properties; | 
            
  
    | 43 |  | } | 
            
  
    | 44 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 45 | 0 |  public void setProperties(Map<String, String> properties) {... | 
            
  
    | 46 | 0 | this.properties = properties; | 
            
  
    | 47 |  | } | 
            
  
    | 48 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 8 (8) | Complexity: 2 | Complexity Density: 0.33 |  | 
  
  
    | 49 | 0 |  @Override... | 
            
  
    | 50 |  | public String get(String property) { | 
            
  
    | 51 | 0 | String value = properties.get(property); | 
            
  
    | 52 | 0 | logger.info("Getting property: " + property + " with value: " + value); | 
            
  
    | 53 | 0 | if (null == value) { | 
            
  
    | 54 | 0 | value = ConfigContext.getCurrentContextConfig().getProperty(property); | 
            
  
    | 55 | 0 | logger.info("Property not found, looking in Context: " + property + " with value: " + value); | 
            
  
    | 56 |  | } | 
            
  
    | 57 | 0 | return value; | 
            
  
    | 58 |  | } | 
            
  
    | 59 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 4 (4) | Complexity: 1 | Complexity Density: 0.25 |  | 
  
  
    | 60 | 0 |  @Override... | 
            
  
    | 61 |  | public Map<String, String> get(List<String> properties) { | 
            
  
    | 62 | 0 | Map<String, String> map = new LinkedHashMap<String, String>(); | 
            
  
    | 63 | 0 | for (String property : properties) { | 
            
  
    | 64 | 0 | map.put(property, get(property)); | 
            
  
    | 65 |  | } | 
            
  
    | 66 | 0 | return map; | 
            
  
    | 67 |  | } | 
            
  
    | 68 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 3 (3) | Complexity: 1 | Complexity Density: 0.33 |  | 
  
  
    | 69 | 0 |  @Override... | 
            
  
    | 70 |  | public String getContextPath(){ | 
            
  
    | 71 | 0 | String contextPath = this.getThreadLocalRequest().getContextPath(); | 
            
  
    | 72 | 0 | logger.info("Returning servlet path of [" + contextPath + "]"); | 
            
  
    | 73 | 0 | return contextPath; | 
            
  
    | 74 |  | } | 
            
  
    | 75 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 8 (8) | Complexity: 2 | Complexity Density: 0.25 |  | 
  
  
    | 76 | 0 |  @Override... | 
            
  
    | 77 |  | public void init(ServletConfig config) throws ServletException { | 
            
  
    | 78 | 0 | super.init(config); | 
            
  
    | 79 | 0 | try { | 
            
  
    | 80 | 0 | logger.info("Obtaining build information from " + ManifestInspector.MANIFEST_LOCATION); | 
            
  
    | 81 | 0 | ManifestInspector inspector = new ManifestInspector(); | 
            
  
    | 82 | 0 | String buildInfo = inspector.getBuildInformationString(getServletConfig().getServletContext()); | 
            
  
    | 83 | 0 | logger.info("Build information: " + buildInfo); | 
            
  
    | 84 | 0 | properties.put("ks.application.version", buildInfo); | 
            
  
    | 85 |  | } catch (IOException e) { | 
            
  
    | 86 | 0 | throw new ServletException(e); | 
            
  
    | 87 |  | } | 
            
  
    | 88 |  | } | 
            
  
    | 89 |  | } |