1 package org.apache.turbine.pipeline; 2 3 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 */ 22 23 24 import java.io.IOException; 25 import java.io.Writer; 26 27 import org.apache.turbine.util.RunData; 28 import org.apache.turbine.util.TurbineException; 29 30 /** 31 * <code>Valve</code> implementation use for testing purposes. 32 * 33 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> 34 * @version $Id: SimpleValve.java 615328 2008-01-25 20:25:05Z tv $ 35 */ 36 class SimpleValve 37 extends AbstractValve 38 { 39 private String value; 40 41 private Writer writer; 42 43 /** 44 * The value for the associated <code>Writer</code> to write. 45 */ 46 public void setValue(String value) 47 { 48 this.value = value; 49 } 50 51 protected void setWriter(Writer writer) 52 { 53 this.writer = writer; 54 } 55 56 /** 57 * @see org.apache.turbine.Valve#invoke(RunData, ValveContext) 58 */ 59 public void invoke(PipelineData data, ValveContext context) 60 throws IOException, TurbineException 61 { 62 // Perform our actions 63 writer.write(value); 64 65 // Pass control to the next Valve in the Pipeline 66 context.invokeNext(data); 67 } 68 }