Coverage Report - org.seasar.cubby.plugin.AbstractPlugin
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractPlugin
67%
10/15
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.plugin;
 17  
 
 18  
 import java.util.LinkedHashSet;
 19  
 import java.util.Set;
 20  
 
 21  
 import javax.servlet.ServletContext;
 22  
 
 23  
 import org.seasar.cubby.action.ActionResult;
 24  
 import org.seasar.cubby.spi.Provider;
 25  
 
 26  
 /**
 27  
  * プラグインの抽象的な実装です。
 28  
  * 
 29  
  * @author baba
 30  
  */
 31  137
 public abstract class AbstractPlugin implements Plugin {
 32  
 
 33  
         /** プラグインがサポートするサービスのセット。 */
 34  137
         private final Set<Class<? extends Provider>> supportedServices = new LinkedHashSet<Class<? extends Provider>>();
 35  
 
 36  
         /**
 37  
          * プラグインがサポートするサービスを追加します。
 38  
          * 
 39  
          * @param service
 40  
          *            サービス
 41  
          */
 42  
         protected void support(final Class<? extends Provider> service) {
 43  1
                 supportedServices.add(service);
 44  1
         }
 45  
 
 46  
         /**
 47  
          * このプラグインが指定されたサービスをサポートするかを示します。
 48  
          * 
 49  
          * @param service
 50  
          *            サービス
 51  
          * @return このプラグインが指定されたサービスをサポートする場合は <code>true</code>、そうでない場合は
 52  
          *         <code>false</code>
 53  
          */
 54  
         protected boolean isSupport(final Class<? extends Provider> service) {
 55  0
                 return supportedServices.contains(service);
 56  
         }
 57  
 
 58  
         /**
 59  
          * {@inheritDoc}
 60  
          */
 61  
         public void initialize(final ServletContext servletContext) {
 62  0
         }
 63  
 
 64  
         /**
 65  
          * {@inheritDoc}
 66  
          */
 67  
         public Set<Class<? extends Provider>> getSupportedServices() {
 68  1
                 return supportedServices;
 69  
         }
 70  
 
 71  
         /**
 72  
          * {@inheritDoc}
 73  
          */
 74  
         public <S extends Provider> S getProvider(final Class<S> service) {
 75  0
                 return null;
 76  
         }
 77  
 
 78  
         /**
 79  
          * {@inheritDoc}
 80  
          */
 81  
         public void ready() {
 82  0
         }
 83  
 
 84  
         /**
 85  
          * {@inheritDoc}
 86  
          */
 87  
         public void destroy() {
 88  0
         }
 89  
 
 90  
         /**
 91  
          * {@inheritDoc}
 92  
          */
 93  
         public void invokeRequestProcessing(
 94  
                         final RequestProcessingInvocation invocation) throws Exception {
 95  1
                 invocation.proceed();
 96  1
         }
 97  
 
 98  
         /**
 99  
          * {@inheritDoc}
 100  
          */
 101  
         public ActionResult invokeAction(final ActionInvocation invocation)
 102  
                         throws Exception {
 103  1
                 return invocation.proceed();
 104  
         }
 105  
 
 106  
         /**
 107  
          * {@inheritDoc}
 108  
          */
 109  
         public void invokeActionResult(final ActionResultInvocation invocation)
 110  
                         throws Exception {
 111  1
                 invocation.proceed();
 112  1
         }
 113  
 
 114  
 }