1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.fatwire.gst.foundation.controller.action.support;
17
18 import COM.FutureTense.Interfaces.ICS;
19
20 import com.fatwire.gst.foundation.controller.action.Action;
21 import com.fatwire.gst.foundation.controller.action.Injector;
22
23
24
25
26
27
28
29
30 public class SingleActionLocator extends AbstractActionLocator {
31
32 private Class<Action> actionClass;
33
34 public SingleActionLocator() {
35 super();
36 }
37
38 public SingleActionLocator(Injector injector, String actionClass) {
39 super(injector);
40 setActionClass(actionClass);
41 }
42
43 @Override
44 protected Action doFindAction(ICS ics, String name) {
45
46 try {
47 return actionClass.newInstance();
48 } catch (InstantiationException e) {
49 throw new RuntimeException(e);
50 } catch (IllegalAccessException e) {
51 throw new RuntimeException(e);
52 }
53 }
54
55 public Class<Action> getActionClass() {
56 return actionClass;
57 }
58
59 @SuppressWarnings("unchecked")
60 public void setActionClass(String actionClass) {
61 try {
62 this.actionClass = (Class<Action>) Thread.currentThread().getContextClassLoader().loadClass(actionClass);
63 this.actionClass.newInstance();
64
65 } catch (ClassNotFoundException e) {
66 throw new RuntimeException(e.getMessage());
67 } catch (InstantiationException e) {
68 throw new RuntimeException(e);
69 } catch (IllegalAccessException e) {
70 throw new RuntimeException(e);
71 }
72 }
73
74 }