1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.universAAL.ri.gateway.eimanager.impl.exporting;
22
23 import java.io.IOException;
24
25 import org.universAAL.middleware.container.ModuleContext;
26 import org.universAAL.middleware.rdf.Resource;
27 import org.universAAL.middleware.ui.UICaller;
28 import org.universAAL.middleware.ui.UIHandlerProfile;
29 import org.universAAL.middleware.ui.UIRequest;
30 import org.universAAL.middleware.ui.UIResponse;
31 import org.universAAL.ri.gateway.eimanager.impl.ProxyBusMember;
32
33 public class ProxyUICaller extends ProxyBusMember {
34
35 private ProxiedUICaller caller;
36 private String modalityRegex;
37 private UIHandlerProfile[] handlerProfiles;
38
39 public ProxyUICaller(ExportedProxyManager manager, String targetId,
40 ModuleContext mc, String modalityRegex,
41 UIHandlerProfile[] handlerProfiles) {
42 super(manager, targetId,"", mc);
43 this.modalityRegex = modalityRegex;
44 this.handlerProfiles = handlerProfiles;
45 caller = new ProxiedUICaller(mc);
46 }
47
48 public void invoke(UIRequest req) {
49 caller.sendUIRequest(req);
50 }
51
52 public void removeProxy() {
53 caller.close();
54 }
55
56 class ProxiedUICaller extends UICaller {
57
58 protected ProxiedUICaller(ModuleContext context) {
59 super(context);
60 }
61
62 public void communicationChannelBroken() {
63 }
64
65 public void dialogAborted(String dialogID, Resource data) {
66 }
67
68 public void handleUIResponse(UIResponse input) {
69 try {
70 ((ExportedProxyManager) getManager()).handleUIResponse(
71 targetId, input);
72 } catch (IOException e) {
73
74 e.printStackTrace();
75 }
76 }
77 }
78
79 public String getId() {
80 return caller.getMyID();
81 }
82
83 public String getModalityRegex() {
84 return modalityRegex;
85 }
86
87 public void setModalityRegex(String modalityRegex) {
88 this.modalityRegex = modalityRegex;
89 }
90
91 public UIHandlerProfile[] getHandlerProfiles() {
92 return handlerProfiles;
93 }
94
95 public void setHandlerProfiles(UIHandlerProfile[] handlerProfiles) {
96 this.handlerProfiles = handlerProfiles;
97 }
98 }