Coverage Report - org.seasar.cubby.plugin.AbstractPlugin
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractPlugin
87%
13/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  411
 public abstract class AbstractPlugin implements Plugin {
 32  
 
 33  
         /** プラグインがサポートするサービスのセット。 */
 34  411
         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  3
                 supportedServices.add(service);
 44  3
         }
 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  
                         throws Exception {
 63  3
         }
 64  
 
 65  
         /**
 66  
          * {@inheritDoc}
 67  
          */
 68  
         public Set<Class<? extends Provider>> getSupportedServices() {
 69  3
                 return supportedServices;
 70  
         }
 71  
 
 72  
         /**
 73  
          * {@inheritDoc}
 74  
          */
 75  
         public <S extends Provider> S getProvider(final Class<S> service) {
 76  0
                 return null;
 77  
         }
 78  
 
 79  
         /**
 80  
          * {@inheritDoc}
 81  
          */
 82  
         public void ready() throws Exception {
 83  3
         }
 84  
 
 85  
         /**
 86  
          * {@inheritDoc}
 87  
          */
 88  
         public void destroy() {
 89  3
         }
 90  
 
 91  
         /**
 92  
          * {@inheritDoc}
 93  
          */
 94  
         public void invokeRequestProcessing(
 95  
                         final RequestProcessingInvocation invocation) throws Exception {
 96  3
                 invocation.proceed();
 97  3
         }
 98  
 
 99  
         /**
 100  
          * {@inheritDoc}
 101  
          */
 102  
         public ActionResult invokeAction(final ActionInvocation invocation)
 103  
                         throws Exception {
 104  3
                 return invocation.proceed();
 105  
         }
 106  
 
 107  
         /**
 108  
          * {@inheritDoc}
 109  
          */
 110  
         public void invokeActionResult(final ActionResultInvocation invocation)
 111  
                         throws Exception {
 112  3
                 invocation.proceed();
 113  3
         }
 114  
 
 115  
 }