Coverage Report - org.seasar.cubby.servlet.CubbyServlet
 
Classes in this File Line Coverage Branch Coverage Complexity
CubbyServlet
82%
9/11
N/A
0
 
 1  
 /*
 2  
  * Copyright 2004-2009 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.cubby.servlet;
 17  
 
 18  
 import java.io.IOException;
 19  
 
 20  
 import javax.servlet.GenericServlet;
 21  
 import javax.servlet.ServletConfig;
 22  
 import javax.servlet.ServletContextEvent;
 23  
 import javax.servlet.ServletException;
 24  
 import javax.servlet.ServletRequest;
 25  
 import javax.servlet.ServletResponse;
 26  
 
 27  
 import org.seasar.cubby.internal.plugin.PluginManager;
 28  
 import org.seasar.cubby.plugin.PluginRegistry;
 29  
 
 30  
 /**
 31  
  * プラグインの初期化などを行う <code>Servlet</code> です。
 32  
  * 
 33  
  * @author baba
 34  
  */
 35  
 public class CubbyServlet extends GenericServlet {
 36  
 
 37  
         /** シリアルバージョン UID。 */
 38  
         private static final long serialVersionUID = 1L;
 39  
 
 40  
         /** プラグインマネージャ。 */
 41  
         private PluginManager pluginManager;
 42  
 
 43  
         /**
 44  
          * サーブレットをインスタンス化します。
 45  
          */
 46  
         public CubbyServlet() {
 47  1
                 super();
 48  1
                 this.pluginManager = buildPluginManager();
 49  1
         }
 50  
 
 51  
         /**
 52  
          * {@inheritDoc}
 53  
          * <p>
 54  
          * プラグインの初期化とレジストリへの登録を行います。
 55  
          * </p>
 56  
          */
 57  
         @Override
 58  
         public void init(final ServletConfig config) throws ServletException {
 59  1
                 super.init(config);
 60  1
                 pluginManager.init(config.getServletContext());
 61  1
         }
 62  
 
 63  
         /**
 64  
          * {@inheritDoc}
 65  
          * <p>
 66  
          * プラグインの破棄を行います。
 67  
          * </p>
 68  
          * 
 69  
          * @see Plugins#destroy(ServletContextEvent)
 70  
          */
 71  
         @Override
 72  
         public void destroy() {
 73  1
                 super.destroy();
 74  1
                 pluginManager.destroy();
 75  1
         }
 76  
 
 77  
         /**
 78  
          * {@inheritDoc}
 79  
          */
 80  
         @Override
 81  
         public void service(final ServletRequest req, final ServletResponse res)
 82  
                         throws ServletException, IOException {
 83  
                 // do nothing
 84  0
         }
 85  
 
 86  
         /**
 87  
          * プラグインマネージャを構築します。
 88  
          * 
 89  
          * @return プラグインマネージャ
 90  
          */
 91  
         protected PluginManager buildPluginManager() {
 92  0
                 return new PluginManager(PluginRegistry.getInstance());
 93  
         }
 94  
 
 95  
 }