001 package org.apache.turbine.pipeline; 002 003 import java.util.HashMap; 004 import java.util.Map; 005 006 007 /* 008 * Licensed to the Apache Software Foundation (ASF) under one 009 * or more contributor license agreements. See the NOTICE file 010 * distributed with this work for additional information 011 * regarding copyright ownership. The ASF licenses this file 012 * to you under the Apache License, Version 2.0 (the 013 * "License"); you may not use this file except in compliance 014 * with the License. You may obtain a copy of the License at 015 * 016 * http://www.apache.org/licenses/LICENSE-2.0 017 * 018 * Unless required by applicable law or agreed to in writing, 019 * software distributed under the License is distributed on an 020 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 021 * KIND, either express or implied. See the License for the 022 * specific language governing permissions and limitations 023 * under the License. 024 */ 025 026 027 /** 028 * <p>A <b>PipelineData</b> is a holder for data being passed from one 029 * Valve to the next. 030 * The detailed contract for a Valve is included in the description of 031 * the <code>invoke()</code> method below.</p> 032 * 033 * <b>HISTORICAL NOTE</b>: The "PipelineData" name was assigned to this 034 * holder as it functions similarily to the RunData object, but without 035 * the additional methods 036 * 037 * @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh</a> 038 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 039 */ 040 public class DefaultPipelineData implements PipelineData 041 { 042 private final Map<Class<?>, Map<?, ?>> map = new HashMap<Class<?>, Map<?, ?>>(); 043 044 public void put(Class<?> key, Map<?, ?> value) 045 { 046 map.put(key, value); 047 } 048 049 public Map<?, ?> get(Class key) 050 { 051 return map.get(key); 052 } 053 054 public Object get(Class<?> key, Object innerKey) 055 { 056 Map<?, ?> innerMap = get(key); 057 if (innerMap == null) 058 { 059 return null; 060 } 061 return innerMap.get(innerKey); 062 } 063 064 065 }