View Javadoc

1   package org.apache.turbine.pipeline;
2   
3   
4   /*
5    * Copyright 2001-2004 The Apache Software Foundation.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License")
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  
21  import java.io.IOException;
22  
23  import org.apache.turbine.Turbine;
24  import org.apache.turbine.TurbineConstants;
25  import org.apache.turbine.modules.ActionLoader;
26  import org.apache.turbine.modules.actions.AccessController;
27  import org.apache.turbine.util.RunData;
28  import org.apache.turbine.util.TurbineException;
29  
30  /***
31   * Implements the action portion of the "Turbine classic" processing
32   * pipeline (from the Turbine 2.x series).
33   *
34   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
35   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
36   * @version $Id: DefaultACLCreationValve.java 222043 2004-12-06 17:47:33Z painter $
37   */
38  public class DefaultACLCreationValve
39      extends AbstractValve
40      implements TurbineConstants
41  {
42      protected AccessController accessController = null;
43  
44      /***
45       * Here we can setup objects that are thread safe and can be
46       * reused. We setup the session validator and the access
47       * controller.
48       */
49      public DefaultACLCreationValve()
50          throws Exception
51      {
52  
53      }
54  
55      /***
56       * @see org.apache.turbine.Valve#invoke(RunData, ValveContext)
57       */
58      public void invoke(PipelineData pipelineData, ValveContext context)
59          throws IOException, TurbineException
60      {
61          try
62          { 
63              // Put the Access Control List into the RunData object, so
64              // it is easily available to modules.  It is also placed
65              // into the session for serialization.  Modules can null
66              // out the ACL to force it to be rebuilt based on more
67              // information.
68              ActionLoader.getInstance().exec(
69                      pipelineData, Turbine.getConfiguration().getString(ACTION_ACCESS_CONTROLLER_KEY,
70                              ACTION_ACCESS_CONTROLLER_DEFAULT));
71          }
72          catch (Exception e)
73          {
74              throw new TurbineException(e);
75          }
76  
77          // Pass control to the next Valve in the Pipeline
78          context.invokeNext(pipelineData);
79      }
80  }