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.commons.configuration.Configuration;
    27  import org.apache.turbine.TurbineConstants;
    28  import org.apache.turbine.annotation.TurbineConfiguration;
    29  import org.apache.turbine.annotation.TurbineLoader;
    30  import org.apache.turbine.modules.Action;
    31  import org.apache.turbine.modules.ActionLoader;
    32  import org.apache.turbine.util.TurbineException;
    33
    34  /**
    35   * Implements the action portion of the "Turbine classic" processing
    36   * pipeline (from the Turbine 2.x series).
    37   *
    38   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    39   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
    40   * @version $Id: DefaultACLCreationValve.java 1706239 2015-10-01 13:18:35Z tv $
    41   */
    42  public class DefaultACLCreationValve
    43      extends AbstractValve
    44  {
    45      /** Injected loader instance */
    46      @TurbineLoader( Action.class )
    47      private ActionLoader actionLoader;
    48
    49      /** Injected configuration instance */
    50      @TurbineConfiguration
    51      private Configuration config;
    52
    53      /**
    54       * @see org.apache.turbine.pipeline.Valve#invoke(PipelineData, ValveContext)
    55       */
    56      @Override
    57      public void invoke(PipelineData pipelineData, ValveContext context)
    58          throws IOException, TurbineException
    59      {
    60          try
    61          {
    62              // Put the Access Control List into the RunData object, so
    63              // it is easily available to modules.  It is also placed
    64              // into the session for serialization.  Modules can null
    65              // out the ACL to force it to be rebuilt based on more
    66              // information.
    67              actionLoader.exec(
    68                      pipelineData, config.getString(
    69                              TurbineConstants.ACTION_ACCESS_CONTROLLER_KEY,
    70                              TurbineConstants.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  }