Clover coverage report - JFox Service-Oriented Application Framework - 1.0-RC2 Coverage timestamp: 星期四 十二月 15 2005 11:58:01 CST FRAMES NO FRAMES |
file stats: | LOC: | 103 |  | Methods: | 3
| NCLOC: | 34 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
ServiceLoaderPlugIn.java | 0% | 0% | 0% | 0% |

1 |  |
     /**
2 |  |
      * @(#)ServiceLoaderPlugIn.java
3 |  |
      *
4 |  |
      * JFoxSOAF, Service-Oriented Application Framework
5 |  |
      *
6 |  |
      * Copyright(c) JFoxSOAF Team
7 |  |
      *
8 |  |
      * Licensed under the GNU LGPL, Version 2.1 (the "License");
9 |  |
      * you may not use this file except in compliance with the License.
10 |  |
      * You may obtain a copy of the License at
11 |  |
      *
12 |  |
      * http://www.gnu.org/copyleft/lesser.html
13 |  |
      *
14 |  |
      * Unless required by applicable law or agreed to in writing, software
15 |  |
      * distributed under the License is distributed on an "AS IS" BASIS,
16 |  |
      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 |  |
      * See the License for the specific language governing permissions and
18 |  |
      * limitations under the License.
19 |  |
      *
20 |  |
      * For more information, please visit:
21 |  |
      * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22 |  |
      * http://www.huihoo.org/jfox/jfoxsoaf
23 |  |
      */
24 |  |
25 |  |
     package org.huihoo.jfox.soaf.services.useraccess.struts;
26 |  |
27 |  |
     import java.io.InputStream;
28 |  |
29 |  |
     import javax.servlet.ServletException;
30 |  |
31 |  |
     import org.apache.commons.logging.Log;
32 |  |
     import org.apache.commons.logging.LogFactory;
33 |  |
     import org.apache.struts.action.ActionServlet;
34 |  |
     import org.apache.struts.action.PlugIn;
35 |  |
     import org.apache.struts.config.ModuleConfig;
36 |  |
     import org.huihoo.jfox.soaf.container.ServiceLoader;
37 |  |
     import org.huihoo.jfox.soaf.exception.ServiceConfigurationException;
38 |  |
39 |  |
     /**
40 |  |
      * <p>
41 |  |
      * Struts service loader plugin
42 |  |
      * </p>
43 |  |
      *
44 |  |
      * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
45 |  |
      * @version $Revision: 1.0 $ $Date: 2005/07/31 14:42:12 $
46 |  |
      * @version Revision: 1.0
47 |  |
      */
48 |  |
49 |  |
     public class ServiceLoaderPlugIn implements PlugIn {
50 |  |
51 |  |
         private ServiceLoader serviceLoader = ServiceLoader.getInstance();
52 |  |
53 |  |
         /**
54 |  |
          * Logging output for this plug in instance.
55 |  |
          */
56 |  |
         private Log log = LogFactory.getLog(this.getClass());
57 |  |
58 |  |
         /**
59 |  |
          * The web application resource path of our persistent database storage
60 |  |
          * file.
61 |  |
          */
62 |  |
         private String pathname = "/WEB-INF/jfoxsoaf-config.xml";
63 |  |
64 |  |
         /**
65 |  |
          * Destroy service config.
66 |  |
          *
67 |  |
          * @see org.apache.struts.action.PlugIn#destroy()
68 |  |
          */
69 | 0 |
         public void destroy() {
70 |  |
         }
71 |  |
72 |  |
         /**
73 |  |
          * Initialize the service config resources for this module.
74 |  |
          *
75 |  |
          * @see org.apache.struts.action.PlugIn#init(org.apache.struts.action.ActionServlet,
76 |  |
          *      org.apache.struts.config.ModuleConfig)
77 |  |
          */
78 | 0 |
         public void init(ActionServlet actionServlet, ModuleConfig moduleConfig)
79 |  |
                 throws ServletException {
80 | 0 |
             if (log.isInfoEnabled()) {
81 | 0 |
                 log.info("Loading service config from '" + pathname + "'");
82 |  |
             }
83 |  |
84 | 0 |
             try {
85 | 0 |
                 initServiceConfig(actionServlet);
86 |  |
             } catch (ServiceConfigurationException e) {
87 | 0 |
                 log.error("Service configuration initialization failed", e);
88 | 0 |
                 e.printStackTrace();
89 |  |
             }
90 |  |
91 |  |
         }
92 |  |
93 |  |
         /**
94 |  |
          * @param actionServlet
95 |  |
          */
96 | 0 |
         private void initServiceConfig(ActionServlet actionServlet)
97 |  |
                 throws ServiceConfigurationException {
98 | 0 |
             InputStream is = actionServlet.getServletContext().getResourceAsStream(
99 |  |
                     pathname);
100 | 0 |
             serviceLoader.initService(is);
101 |  |
         }
102 |  |
103 |  |
     }