View Javadoc
1   package org.apache.turbine.modules;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.turbine.Turbine;
23  import org.apache.turbine.pipeline.PipelineData;
24  
25  /**
26   * The purpose of this class is to allow one to load and execute
27   * Action modules.
28   *
29   * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
30   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
31   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
32   * @version $Id$
33   */
34  public class ActionLoader
35      extends GenericLoader<Action>
36  {
37      /** The single instance of this class. */
38      private static ActionLoaderder.html#ActionLoader">ActionLoader instance = new ActionLoader();
39  
40      /**
41       * These ctor's are private to force clients to use getInstance()
42       * to access this class.
43       */
44      private ActionLoader()
45      {
46          super(Action.class,
47                  () -> Turbine.getConfiguration().getInt(Action.CACHE_SIZE_KEY,
48                          Action.CACHE_SIZE_DEFAULT));
49      }
50  
51      /**
52       * Attempts to load and execute the external action.
53       *
54       * @param pipelineData Turbine information.
55       * @param name Name of object that will execute the action.
56       * @throws Exception a generic exception.
57       */
58      @Override
59      public void exec(PipelineData pipelineData, String name)
60      		throws Exception
61      {
62          getAssembler(name).perform(pipelineData);
63      }
64  
65      /**
66       * The method through which this class is accessed.
67       *
68       * @return The single instance of this class.
69       */
70      public static ActionLoader getInstance()
71      {
72          return instance;
73      }
74  }