View Javadoc
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.TurbineConstants;
27  import org.apache.turbine.annotation.TurbineConfiguration;
28  import org.apache.turbine.annotation.TurbineLoader;
29  import org.apache.turbine.modules.Action;
30  import org.apache.turbine.modules.ActionLoader;
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$
40   */
41  public class DefaultACLCreationValve
42      implements Valve
43  {
44      /** Injected loader instance */
45      @TurbineLoader( Action.class )
46      private ActionLoader actionLoader;
47  
48      @TurbineConfiguration( TurbineConstants.ACTION_ACCESS_CONTROLLER_KEY )
49      private String actionAccessController = TurbineConstants.ACTION_ACCESS_CONTROLLER_DEFAULT;
50  
51      /**
52       * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext)
53       */
54      @Override
55      public void invoke(PipelineData pipelineData, ValveContext context)
56          throws IOException, TurbineException
57      {
58          try
59          {
60              // Put the Access Control List into the RunData object, so
61              // it is easily available to modules.  It is also placed
62              // into the session for serialization.  Modules can null
63              // out the ACL to force it to be rebuilt based on more
64              // information.
65              actionLoader.exec(pipelineData, actionAccessController);
66          }
67          catch (Exception e)
68          {
69              throw new TurbineException(e);
70          }
71  
72          // Pass control to the next Valve in the Pipeline
73          context.invokeNext(pipelineData);
74      }
75  }