1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.controller.action.support;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24
25 import COM.FutureTense.Interfaces.ICS;
26
27 import com.fatwire.gst.foundation.controller.action.Action;
28
29
30
31
32
33
34
35
36
37
38
39 public class MapActionLocator extends BaseActionLocator {
40
41 protected static final Log LOG = LogFactory.getLog(MapActionLocator.class.getPackage().getName());
42 private Map<String, Action> commandActionMap = new HashMap<String, Action>();
43
44 public MapActionLocator() {
45 super();
46 }
47
48 public void setActionMap(final Map<String, Action> map) {
49 LOG.debug("Configured action mapping with " + (map == null ? 0 : map.size() + " entries."));
50 this.commandActionMap = map;
51 }
52
53 @Override
54 protected Action doFindAction(ICS ics, String name) {
55 Action action;
56 action = commandActionMap.get(name);
57 if (action != null) {
58 injectDependencies(ics, action);
59 }
60 return action;
61
62 }
63
64 }