KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > transports > http > HTTPServerTransportInstrumentation


1 package org.objectweb.celtix.bus.transports.http;
2
3 import org.objectweb.celtix.bus.management.TransportInstrumentation;
4 import org.objectweb.celtix.bus.management.counters.TransportServerCounters;
5 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute;
6 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource;
7 import org.objectweb.celtix.management.Instrumentation;
8 import org.objectweb.celtix.transports.http.configuration.HTTPServerPolicy;
9
10 @ManagedResource(componentName = "HTTPServerTransport",
11                  description = "The Celtix bus HTTP Server Transport component ",
12                  currencyTimeLimit = 15, persistPolicy = "OnUpdate")
13 public class HTTPServerTransportInstrumentation
14     extends TransportInstrumentation
15     implements Instrumentation {
16     private static final String JavaDoc INSTRUMENTED_NAME = "Bus.Service.Port.HTTPServerTransport";
17     
18     JettyHTTPServerTransport httpServerTransport;
19     HTTPServerPolicy policy;
20     TransportServerCounters counters;
21   
22     //EndpointReference eprf;
23

24     public HTTPServerTransportInstrumentation(JettyHTTPServerTransport hsTransport) {
25         super(hsTransport.bus);
26         httpServerTransport = hsTransport;
27         // servicename, portname, transport type
28
serviceName = findServiceName(httpServerTransport.reference);
29         portName = findPortName(httpServerTransport.reference);
30         /*HTTPServerTransport:
31             org.objectweb.celtix.instrumentation:type=Bus.Service.Port.HTTPServerTransport,
32             Bus=celtix,Bus.Service={http://objectweb.org/hello_world}SOAPService",Bus.Port=SoapPort,
33             name=HTTPServerTransport"*/

34         objectName = getPortObjectName() + ",name=HTTPServerTransport";
35         counters = hsTransport.counters;
36     }
37     
38    
39     @ManagedAttribute(description = "Get the Service name",
40                       persistPolicy = "OnUpdate")
41     public String JavaDoc getServiceName() {
42         return serviceName;
43     }
44     
45     @ManagedAttribute(description = "Get the port name",
46                       persistPolicy = "OnUpdate")
47     public String JavaDoc getPortName() {
48         return portName;
49     }
50     
51     @ManagedAttribute(description = "The http server url",
52                       persistPolicy = "OnUpdate")
53     //define the basic management operation for the instrumentation
54
public String JavaDoc getUrl() {
55         return httpServerTransport.url;
56     }
57     
58     @ManagedAttribute(description = "The http server request error",
59                       persistPolicy = "OnUpdate")
60     public int getTotalError() {
61         return counters.getTotalError().getValue();
62     }
63     
64     @ManagedAttribute(description = "The http server total request counter",
65                       persistPolicy = "OnUpdate")
66     public int getRequestTotal() {
67         return counters.getRequestTotal().getValue();
68     }
69     
70     @ManagedAttribute(description = "The http server one way request counter",
71                       persistPolicy = "OnUpdate")
72     public int getRequestOneWay() {
73         return counters.getRequestOneWay().getValue();
74     }
75     
76     // return the policy object ......
77
public HTTPServerPolicy getHTTPServerPolicy() {
78         return httpServerTransport.policy;
79     }
80   
81     public Object JavaDoc getComponent() {
82         return httpServerTransport;
83     }
84
85     public String JavaDoc getInstrumentationName() {
86         return INSTRUMENTED_NAME;
87     }
88
89     public String JavaDoc getUniqueInstrumentationName() {
90         return objectName;
91     }
92    
93     
94 }
95
Popular Tags