01: package org.objectweb.celtix.bus.transports.http;
02:
03: import org.objectweb.celtix.bus.management.TransportInstrumentation;
04: import org.objectweb.celtix.bus.management.counters.TransportServerCounters;
05: import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute;
06: import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource;
07: import org.objectweb.celtix.management.Instrumentation;
08: import org.objectweb.celtix.transports.http.configuration.HTTPServerPolicy;
09:
10: @ManagedResource(componentName="HTTPServerTransport",description="The Celtix bus HTTP Server Transport component ",currencyTimeLimit=15,persistPolicy="OnUpdate")
11: public class HTTPServerTransportInstrumentation extends
12: TransportInstrumentation implements Instrumentation {
13: private static final String INSTRUMENTED_NAME = "Bus.Service.Port.HTTPServerTransport";
14:
15: JettyHTTPServerTransport httpServerTransport;
16: HTTPServerPolicy policy;
17: TransportServerCounters counters;
18:
19: //EndpointReference eprf;
20:
21: public HTTPServerTransportInstrumentation(
22: JettyHTTPServerTransport hsTransport) {
23: super (hsTransport.bus);
24: httpServerTransport = hsTransport;
25: // servicename, portname, transport type
26: serviceName = findServiceName(httpServerTransport.reference);
27: portName = findPortName(httpServerTransport.reference);
28: /*HTTPServerTransport:
29: org.objectweb.celtix.instrumentation:type=Bus.Service.Port.HTTPServerTransport,
30: Bus=celtix,Bus.Service={http://objectweb.org/hello_world}SOAPService",Bus.Port=SoapPort,
31: name=HTTPServerTransport"*/
32: objectName = getPortObjectName() + ",name=HTTPServerTransport";
33: counters = hsTransport.counters;
34: }
35:
36: @ManagedAttribute(description="Get the Service name",persistPolicy="OnUpdate")
37: public String getServiceName() {
38: return serviceName;
39: }
40:
41: @ManagedAttribute(description="Get the port name",persistPolicy="OnUpdate")
42: public String getPortName() {
43: return portName;
44: }
45:
46: @ManagedAttribute(description="The http server url",persistPolicy="OnUpdate")
47: //define the basic management operation for the instrumentation
48: public String getUrl() {
49: return httpServerTransport.url;
50: }
51:
52: @ManagedAttribute(description="The http server request error",persistPolicy="OnUpdate")
53: public int getTotalError() {
54: return counters.getTotalError().getValue();
55: }
56:
57: @ManagedAttribute(description="The http server total request counter",persistPolicy="OnUpdate")
58: public int getRequestTotal() {
59: return counters.getRequestTotal().getValue();
60: }
61:
62: @ManagedAttribute(description="The http server one way request counter",persistPolicy="OnUpdate")
63: public int getRequestOneWay() {
64: return counters.getRequestOneWay().getValue();
65: }
66:
67: // return the policy object ......
68: public HTTPServerPolicy getHTTPServerPolicy() {
69: return httpServerTransport.policy;
70: }
71:
72: public Object getComponent() {
73: return httpServerTransport;
74: }
75:
76: public String getInstrumentationName() {
77: return INSTRUMENTED_NAME;
78: }
79:
80: public String getUniqueInstrumentationName() {
81: return objectName;
82: }
83:
84: }
|