Clover Coverage Report - Kuali Student 1.2.1-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Nov 2 2011 04:03:58 EST
../../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
23   89   8   3.83
2   61   0.35   6
6     1.33  
1    
 
  ServerPropertiesRpcGwtServlet       Line # 35 23 0% 8 31 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
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")
 
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   
 
41  0 toggle public Map<String, String> getProperties() {
42  0 return properties;
43    }
44   
 
45  0 toggle public void setProperties(Map<String, String> properties) {
46  0 this.properties = properties;
47    }
48   
 
49  0 toggle @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   
 
60  0 toggle @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   
 
69  0 toggle @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   
 
76  0 toggle @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    }