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 26 import org.apache.turbine.Turbine; 27 import org.apache.turbine.TurbineConstants; 28 import org.apache.turbine.modules.Action; 29 import org.apache.turbine.modules.ActionLoader; 30 import org.apache.turbine.services.assemblerbroker.TurbineAssemblerBroker; 31 import org.apache.turbine.util.TurbineException; 32 33 /** 34 * Implements the action portion of the "Turbine classic" processing 35 * pipeline (from the Turbine 2.x series). 36 * 37 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> 38 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 39 * @version $Id: DefaultACLCreationValve.java 758254 2009-03-25 13:41:02Z tv $ 40 */ 41 public class DefaultACLCreationValve 42 extends AbstractValve 43 { 44 private ActionLoader actionLoader; 45 46 /** 47 * Here we can setup objects that are thread safe and can be 48 * reused. We setup the session validator and the access 49 * controller. 50 */ 51 public DefaultACLCreationValve() 52 throws Exception 53 { 54 // empty constructor 55 } 56 57 /** 58 * Initialize this valve for use in a pipeline. 59 * 60 * @see org.apache.turbine.pipeline.AbstractValve#initialize() 61 */ 62 public void initialize() throws Exception 63 { 64 super.initialize(); 65 66 this.actionLoader = (ActionLoader)TurbineAssemblerBroker.getLoader(Action.NAME); 67 } 68 69 /** 70 * @see org.apache.turbine.Valve#invoke(RunData, ValveContext) 71 */ 72 public void invoke(PipelineData pipelineData, ValveContext context) 73 throws IOException, TurbineException 74 { 75 try 76 { 77 // Put the Access Control List into the RunData object, so 78 // it is easily available to modules. It is also placed 79 // into the session for serialization. Modules can null 80 // out the ACL to force it to be rebuilt based on more 81 // information. 82 actionLoader.exec( 83 pipelineData, Turbine.getConfiguration().getString( 84 TurbineConstants.ACTION_ACCESS_CONTROLLER_KEY, 85 TurbineConstants.ACTION_ACCESS_CONTROLLER_DEFAULT)); 86 } 87 catch (Exception e) 88 { 89 throw new TurbineException(e); 90 } 91 92 // Pass control to the next Valve in the Pipeline 93 context.invokeNext(pipelineData); 94 } 95 }