1 /*
2 * Copyright 2011 FatWire Corporation. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.fatwire.gst.foundation.controller.action.support;
17
18 import org.apache.commons.lang.StringUtils;
19
20 import COM.FutureTense.Interfaces.ICS;
21
22 import com.fatwire.gst.foundation.controller.action.Action;
23 import com.fatwire.gst.foundation.controller.action.Injector;
24 import com.fatwire.gst.foundation.controller.action.RenderPage;
25
26 /**
27 * ActionLocator that always returns a {@link RenderPage} action as long as the name parameter is blank.
28 *
29 * @author Dolf Dijkstra
30 *
31 */
32 public final class RenderPageActionLocator extends AbstractActionLocator {
33 public RenderPageActionLocator(Injector injector) {
34 super(injector);
35 }
36
37 @Override
38 protected Action doFindAction(ICS ics, String name) {
39 if (StringUtils.isNotBlank(name))
40 throw new IllegalArgumentException(
41 "The "
42 + getClass().getName()
43 + " was called with a named Action. This is not intended as this means that a Action should have been found by a previous ActionLocator.");
44 return new RenderPage();
45 }
46 }