Coverage Report - org.apache.turbine.pipeline.PipelineData
 
Classes in this File Line Coverage Branch Coverage Complexity
PipelineData
N/A
N/A
0
 
 1  
 package org.apache.turbine.pipeline;
 2  
 
 3  
 import java.util.Map;
 4  
 
 5  
 import org.apache.turbine.util.RunData;
 6  
 import org.apache.turbine.util.TurbineRuntimeException;
 7  
 
 8  
 
 9  
 /*
 10  
  * Licensed to the Apache Software Foundation (ASF) under one
 11  
  * or more contributor license agreements.  See the NOTICE file
 12  
  * distributed with this work for additional information
 13  
  * regarding copyright ownership.  The ASF licenses this file
 14  
  * to you under the Apache License, Version 2.0 (the
 15  
  * "License"); you may not use this file except in compliance
 16  
  * with the License.  You may obtain a copy of the License at
 17  
  *
 18  
  *   http://www.apache.org/licenses/LICENSE-2.0
 19  
  *
 20  
  * Unless required by applicable law or agreed to in writing,
 21  
  * software distributed under the License is distributed on an
 22  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 23  
  * KIND, either express or implied.  See the License for the
 24  
  * specific language governing permissions and limitations
 25  
  * under the License.
 26  
  */
 27  
 
 28  
 
 29  
 /**
 30  
  * <p>A <b>PipelineData</b> is a holder for data being passed from one
 31  
  * Valve to the next.
 32  
  * The detailed contract for a Valve is included in the description of
 33  
  * the <code>invoke()</code> method below.</p>
 34  
  *
 35  
  * <b>HISTORICAL NOTE</b>:  The "PipelineData" name was assigned to this
 36  
  * holder as it functions similarly to the RunData object, but without
 37  
  * the additional methods
 38  
  *
 39  
  * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a>
 40  
  * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
 41  
  */
 42  
 public interface PipelineData extends AutoCloseable
 43  
 {
 44  
     /**
 45  
      * Put a configured map of objects into the pipeline data object
 46  
      *
 47  
      * @param name the key class
 48  
      * @param value the value map
 49  
      */
 50  
     void put(Class<?> name, Map<Class<?>, ? super Object> value);
 51  
 
 52  
     /**
 53  
      * Get the configured map of objects for the given key
 54  
      *
 55  
      * @param name the key class
 56  
      * @return the value map or null if no such key exists
 57  
      */
 58  
     Map<Class<?>, ? super Object> get(Class<?> name);
 59  
 
 60  
     /**
 61  
      * Get a value from the configured map of objects for the given keys
 62  
      *
 63  
      * @param key the key class
 64  
      * @param innerKey the key into the value map
 65  
      *
 66  
      * @param <T> the type of the inner key
 67  
      *
 68  
      * @return the inner value or null if no such keys exist
 69  
      */
 70  
     <T> T get(Class<?> key, Class<T> innerKey);
 71  
 
 72  
     /**
 73  
      * Get RunData from PipelineData
 74  
      *
 75  
      * @return RunData extracted from PipelineData
 76  
      */
 77  
     default RunData getRunData()
 78  
     {
 79  
         if (!(this instanceof RunData))
 80  
         {
 81  
             throw new TurbineRuntimeException("Cannot cast to rundata from pipeline data.");
 82  
         }
 83  
         return (RunData) this;
 84  
     }
 85  
 }