Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SimpleTargetListener.java
Go to the documentation of this file.
1 
2 package vmi1;
3 
4 import vmi1.*;
5 
6 import java.util.Map;
7 import java.util.HashMap;
8 import org.apache.axis2.engine.MessageReceiver;
9 import javax.jws.WebService;
10 import javax.jws.WebMethod;
11 import javax.jws.soap.SOAPBinding;
12 import javax.xml.namespace.QName;
13 
14 import org.apache.axis2.description.WSDL2Constants;
15 
16 /*
17  * NB: make sure getTargetNamespace and getServiceName return the same
18  * values as the annotation!!!
19  */
20 @WebService(name = "targetListener",
21  serviceName="targetListener",
22  targetNamespace = "http://anathema.flux.utah.edu/schema/vmi/1")
23 
24 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
25  use = SOAPBinding.Use.LITERAL,
26  parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
27 
28 public class SimpleTargetListener extends TargetListenerSkeleton
29  implements SimpleService {
30 
31  protected static final String tns =
32  "http://anathema.flux.utah.edu/schema/vmi/1";
33  protected static final String sns =
34  "http://anathema.flux.utah.edu/schema/vmi/1";
35  protected static final String snsPrefix = "vmi1";
36  protected static Map<String,MessageReceiver> messageReceiverClassMap = null;
37  protected static final String schemaResourcePath =
38  "targetListener.wsdl";
39  protected static Map<String,QName> typeMapping = null;
40  protected static Map<String,String> methodClassNameMapping = null;
41  protected static Map<String,QName> dynamicTypeMapping = null;
42 
43  @WebMethod(exclude = true)
44  public Map<String,MessageReceiver> getMessageReceiverClassMap() {
45  if (SimpleTargetListener.messageReceiverClassMap == null) {
46  SimpleTargetListener.messageReceiverClassMap =
47  new HashMap<String,MessageReceiver>();
48 
49  SimpleTargetListener.messageReceiverClassMap.
50  put(WSDL2Constants.MEP_URI_IN_OUT, //"vmi1.SimpleTargetListener",
51  new vmi1.TargetListenerMessageReceiverInOut());
52  }
53  return SimpleTargetListener.messageReceiverClassMap;
54  }
55 
56  @WebMethod(exclude = true)
57  public String getTargetNamespace() {
58  return SimpleTargetListener.tns;
59  }
60 
61  @WebMethod(exclude = true)
62  public String getSchemaNamespace() {
63  return SimpleTargetListener.sns;
64  }
65 
66  @WebMethod(exclude = true)
67  public String getSchemaNamespacePrefix() {
68  return SimpleTargetListener.snsPrefix;
69  }
70 
71  @WebMethod(exclude = true)
72  public String getSchemaResourcePath() {
73  return SimpleTargetListener.schemaResourcePath;
74  }
75 
76  @WebMethod(exclude = true)
77  public Map<String,QName> getStaticTypeMapping() {
78  if (SimpleTargetListener.typeMapping == null) {
79  SimpleTargetListener.typeMapping = new HashMap<String,QName>();
80 
81  //String jType = snsPrefix + "." + "probeEvent";
82  /*
83  String jType = "targetEventNotification";
84  QName qn = new QName(sns,"TargetEventNotification");
85  SimpleTargetListener.typeMapping.put(jType,qn);
86 
87  String jType = "probeEventNotification";
88  QName qn = new QName(sns,"ProbeEventNotification");
89  SimpleTargetListener.typeMapping.put(jType,qn);
90 
91  jType = snsPrefix + "." + "actionEventNotification";
92  qn = new QName(sns,"ActionEventNotification");
93  SimpleTargetListener.typeMapping.put(jType,qn);
94  */
95  }
96  return typeMapping;
97  }
98 
99  @WebMethod(exclude = true)
100  public Map<String,String> getMethodClassNameMapping() {
101  if (SimpleTargetListener.methodClassNameMapping == null) {
102  SimpleTargetListener.methodClassNameMapping =
103  new HashMap<String,String>();
104 
105  SimpleTargetListener.methodClassNameMapping
106  .put("targetEventNotification","vmi.TargetEventNotification");
107  SimpleTargetListener.methodClassNameMapping
108  .put("probeEventNotification","vmi.ProbeEventNotification");
109  SimpleTargetListener.methodClassNameMapping
110  .put("actionEventNotification","vmi.ActionEventNotification");
111  }
112  return methodClassNameMapping;
113  }
114 
115  @WebMethod(exclude = true)
116  public Map<String,QName> getDynamicTypeMapping() {
117  if (SimpleTargetListener.dynamicTypeMapping == null) {
118  SimpleTargetListener.dynamicTypeMapping =
119  new HashMap<String,QName>();
120 
121  SimpleTargetListener.dynamicTypeMapping
122  .put("targetEventNotification",
123  new QName(SimpleTargetListener.sns,"TargetEventNotification"));
124  SimpleTargetListener.dynamicTypeMapping
125  .put("probeEventNotification",
126  new QName(SimpleTargetListener.sns,"ProbeEventNotification"));
127  SimpleTargetListener.dynamicTypeMapping
128  .put("actionEventNotification",
129  new QName(SimpleTargetListener.sns,"ActionEventNotification"));
130  }
131  return dynamicTypeMapping;
132  }
133 
134  @WebMethod(exclude = true)
135  public boolean isRootService() {
136  return true;
137  }
138 
139  @WebMethod(exclude = true)
140  public String getServiceName() {
141  return "targetListener";
142  }
143 
144  @WebMethod(exclude = true)
145  public String getServicePath() {
146  return "/vmi1/targetListener";
147  }
148 
154  public vmi1.TargetEventNotificationResponse targetEventNotification
155  (vmi1.TargetEventNotification targetEventNotification) {
156  TargetEventT te = targetEventNotification.getTargetEvent();
157 
158  System.out.printf("TargetEvent(%s tid=%d thid=%d status=%s)\n"
159  + " msg: \"%s\"\n\n",
160  te.getTargetEventType(),te.getTid().getTargetIdT(),
161  te.getThid().getThreadIdT(),te.getTargetStatus(),
162  te.getEventMsg());
163 
164  vmi1.TargetEventNotificationResponse retval =
165  new vmi1.TargetEventNotificationResponse();
166  retval.setResult(vmi1.ResultT.success);
167  return retval;
168  }
169 
175  public vmi1.ProbeEventNotificationResponse probeEventNotification
176  (vmi1.ProbeEventNotification probeEventNotification) {
177  ProbeEventT pe = probeEventNotification.getProbeEvent();
178  ProbeT probe = pe.getProbe();
179  ThreadT thread = pe.getThread();
180  RegisterValueT[] rva = pe.getRegisterValues().getRegisterValue();
181 
182  System.out.printf("ProbeEvent(%s name=%s id=%d addr=0x%x,type=%s,"
183  + "style=%s,whence=%s,size=%s)\n",
184  pe.getProbeEventType(),probe.getName(),
185  probe.getPid().getProbeIdT(),
186  probe.getAddr().getADDR().longValue(),
187  probe.getType(),probe.getStyle(),probe.getWhence(),
188  probe.getPsize());
189 
190  System.out.printf(" thread: %d %s\n",
191  thread.getThid().getThreadIdT(),
192  thread.getThreadStatus());
193 
194  System.out.printf(" registers:\n");
195  for (int i = 0; i < rva.length; ++i) {
196  System.out.printf(" %7.7s 0x%x\n",
197  rva[i].getName(),rva[i].getValue().longValue());
198  }
199  System.out.println("");
200 
201  vmi1.ProbeEventNotificationResponse retval =
202  new vmi1.ProbeEventNotificationResponse();
203  retval.setResult(vmi1.ResultT.success);
204  return retval;
205  }
206 
212  public vmi1.ActionEventNotificationResponse actionEventNotification
213  (vmi1.ActionEventNotification actionEventNotification) {
214  System.out.println("ActionEventNotification " + actionEventNotification);
215  vmi1.ActionEventNotificationResponse retval =
216  new vmi1.ActionEventNotificationResponse();
217  retval.setResult(vmi1.ResultT.success);
218  return retval;
219  }
220 
221 }
static uint64_t unsigned int i
Definition: probe.h:308