01: package org.objectweb.celtix.bus.transports.http;
02:
03: import org.objectweb.celtix.bus.configuration.security.AuthorizationPolicy;
04: import org.objectweb.celtix.bus.management.counters.TransportClientCounters;
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.HTTPClientPolicy;
09:
10: @ManagedResource(componentName="HTTPClientTransport",description="The Celtix bus HTTP client side transport componnet ",currencyTimeLimit=15,persistPolicy="OnUpdate")
11: public class HTTPClientTransportInstrumentation implements
12: Instrumentation {
13: private static final String INSTRUMENTATION_NAME = "Bus.Service.Port.HTTPClientTransport";
14:
15: private static int instanceNumber;
16:
17: HTTPClientTransport httpClientTransport;
18: String objectName;
19: TransportClientCounters counters;
20:
21: public HTTPClientTransportInstrumentation(
22: HTTPClientTransport hcTransport) {
23: httpClientTransport = hcTransport;
24: counters = hcTransport.counters;
25: objectName = "HTTPClientTransport" + instanceNumber;
26: instanceNumber++;
27: }
28:
29: public static void resetInstanceNumber() {
30: instanceNumber = 0;
31: }
32:
33: public HTTPClientPolicy getHTTPClientPolicy() {
34: return httpClientTransport.policy;
35: }
36:
37: public AuthorizationPolicy getAuthPolicy() {
38: return httpClientTransport.authPolicy;
39: }
40:
41: public AuthorizationPolicy getProxyAuthPolicy() {
42: return httpClientTransport.proxyAuthPolicy;
43: }
44:
45: @ManagedAttribute(description="The http request url",persistPolicy="OnUpdate")
46: public String getUrl() {
47: return httpClientTransport.url.toString();
48: }
49:
50: @ManagedAttribute(description="The http client invoke counter",persistPolicy="OnUpdate")
51: public int getInvoke() {
52: return counters.getInvoke().getValue();
53: }
54:
55: @ManagedAttribute(description="The http client invoke Async counter",persistPolicy="OnUpdate")
56: public int getInvokeAsync() {
57: return counters.getInvokeAsync().getValue();
58: }
59:
60: @ManagedAttribute(description="The http client one way invoke counter",persistPolicy="OnUpdate")
61: public int getInvokeOneWay() {
62: return counters.getInvokeOneWay().getValue();
63: }
64:
65: @ManagedAttribute(description="The http client error invoke counter",persistPolicy="OnUpdate")
66: public int getInvokeError() {
67: return counters.getInvokeError().getValue();
68: }
69:
70: public Object getComponent() {
71: return httpClientTransport;
72: }
73:
74: public String getInstrumentationName() {
75: return INSTRUMENTATION_NAME;
76: }
77:
78: public String getUniqueInstrumentationName() {
79: return objectName;
80: }
81: }
|