KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > monitor > CallFlowMonitor


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /*
25  */

26
27 package com.sun.appserv.management.monitor;
28
29 import java.util.List JavaDoc;
30 import java.util.Map JavaDoc;
31
32 import com.sun.appserv.management.base.XTypes;
33
34 /**
35  * Provides CallFlow Monitoring information as well as enables/disables
36  * CallFlow Monitoring.
37  */

38 public interface CallFlowMonitor extends Monitoring
39 {
40     /** The j2eeType as returned by
41      * {@link com.sun.appserv.management.base.AMX#getJ2EEType}.
42      */

43     public static final String JavaDoc J2EE_TYPE = XTypes.CALL_FLOW_MONITOR;
44         
45     /**
46      * Key accessing a container-generated Unique ID used by
47      * {@link #queryCallStackForRequest} and {@link #queryPieInformation}
48      */

49     public static final String JavaDoc REQUEST_ID_KEY = "RequestID";
50     /**
51      * TimeStamp obtained from {@link java.lang.System#nanoTime}
52      */

53     public static final String JavaDoc TIME_STAMP_KEY = "TimeStamp";
54     
55     /*
56      * TimeStamp of Request Start obtained from {@link java.lang.System#currentTimeMillis}
57      */

58     public static final String JavaDoc TIME_STAMP_MILLIS_KEY = "TimeStampMillis";
59     
60     /**
61      * The type of the Incoming request. An incoming request is the container
62      * that the request came into the Appserver.
63      * Container types are the following types
64      * <ul>
65      * <li>{@link #REMOTE_ASYNC_MESSAGE} </li>
66      * <li>{@link #REMOTE_EJB}</li>
67      * <li>{@link #REMOTE_WEB}</li>
68      * <li>{@link #REMOTE_WEB_SERVICE}</li>
69      * <li>{@link #TIMER_EJB}</li>
70      * </ul>
71      */

72     public static final String JavaDoc REQUEST_TYPE_KEY = "RequestType";
73
74     /**
75      * Remote Aysnchronous Message Request Type. Typically incoming {@link #MESSAGE_DRIVEN_BEAN} Calls
76      */

77     public static final String JavaDoc REMOTE_ASYNC_MESSAGE = "REMOTE_ASYNC_MESSAGE";
78
79     /**
80      * Remote EJB Request Type
81      */

82     public static final String JavaDoc REMOTE_EJB = "REMOTE_EJB";
83     
84     /**
85      * Remote Web Request Type
86      */

87     public static final String JavaDoc REMOTE_WEB = "REMOTE_WEB";
88     
89     /**
90      * Remote Web Service Request Type
91      */

92     public static final String JavaDoc REMOTE_WEB_SERVICE = "REMOTE_WEB_SERVICE";
93     
94     /**
95      * Timer EJB Request Type
96      */

97     public static final String JavaDoc TIMER_EJB = "TIMER_EJB";
98     
99     
100     /**
101      * The type of the component where the call is in.
102      * Container types are the following types
103      * <ul>
104      * <li>{@link #BEAN_MANAGED_PERSISTENCE}</li>
105      * <li>{@link #CONTAINER_MANAGED_PERSISTENCE}</li>
106      * <li>{@link #MESSAGE_DRIVEN_BEAN}</li>
107      * <li>{@link #SERVLET}</li>
108      * <li>{@link #SERVLET_FILTER}</li>
109      * <li>{@link #STATEFUL_SESSION_BEAN}</li>
110      * <li>{@link #STATELESS_SESSION_BEAN}</li>
111      * </ul>
112      */

113     public static final String JavaDoc COMPONENT_TYPE_KEY = "ComponentType";
114
115     /**
116      * Servlet Component Type
117      */

118     public static final String JavaDoc SERVLET= "SERVLET";
119
120     /**
121      * Servlet Filter Component Type
122      */

123     public static final String JavaDoc SERVLET_FILTER = "SERVLET_FILTER";
124
125     /**
126      * Stateless Session Bean Component Type
127      */

128     public static final String JavaDoc STATELESS_SESSION_BEAN = "STATELESS_SESSION_BEAN";
129
130     /**
131      * Stateful Session Bean Component Type
132      */

133     public static final String JavaDoc STATEFUL_SESSION_BEAN = "STATEFUL_SESSION_BEAN";
134
135     /**
136      * Bean Managed Persistence Component Type
137      */

138     public static final String JavaDoc BEAN_MANAGED_PERSISTENCE = "BEAN_MANAGED_PERSISTENCE";
139
140     /**
141      * Container Managed Persistence Component Type
142      */

143     public static final String JavaDoc CONTAINER_MANAGED_PERSISTENCE = "CONTAINER_MANAGED_PERSISTENCE";
144
145     /**
146      * Message Driven Bean Component Type
147      */

148     public static final String JavaDoc MESSAGE_DRIVEN_BEAN = "MESSAGE_DRIVEN_BEAN";
149
150     /**
151      * The type of the container where the call originated
152      */

153     public static final String JavaDoc CONTAINER_TYPE_KEY = "ContainerType";
154     
155     /**
156      * Web Container
157      */

158      public static final String JavaDoc WEB_CONTAINER = "WEB_CONTAINER";
159      
160     /**
161      * EJB Container
162      */

163      public static final String JavaDoc EJB_CONTAINER = "EJB_CONTAINER";
164      
165      /**
166       * ORB Container
167       */

168      public static final String JavaDoc ORB = "ORB_CONTAINER";
169
170      /**
171       * WEB Application Container
172       */

173      public static final String JavaDoc WEB_APPLICATION = "WEB_APPLICATION";
174
175      /**
176       * EJB Application Container
177       */

178      public static final String JavaDoc EJB_APPLICATION = "EJB_APPLICATION";
179      
180     /**
181      * OTHER Container, containers that are not monitored for callflow
182      */

183     public static final String JavaDoc OTHER = "OTHER";
184     
185     /**
186      * Username of the Caller making a request.
187      */

188     public static final String JavaDoc USER_KEY = "User";
189     /**
190      * Status of the request.
191      */

192     public static final String JavaDoc STATUS_KEY = "Status";
193     /**
194      * The client host from where the request came in.
195      */

196     public static final String JavaDoc CLIENT_HOST_KEY = "ClientHost";
197     /**
198      * Name of the method invoked to service a request.
199      */

200     public static final String JavaDoc METHOD_NAME_KEY = "MethodName";
201     /**
202      * Name of component invoked to service a request.
203      */

204     public static final String JavaDoc COMPONENT_NAME_KEY = "ComponentName";
205
206     /**
207      * Name of the module invoked to service a request.
208      */

209     public static final String JavaDoc MODULE_NAME_KEY = "ModuleName";
210     /**
211      * Name of application invoked to service a request.
212      */

213     public static final String JavaDoc APPLICATION_NAME_KEY = "ApplicationName";
214     /**
215      * Response time for a particular request.
216      */

217     public static final String JavaDoc RESPONSE_TIME_KEY = "ResponseTime";
218
219     /**
220      * Thread ID used for a particular request.
221      */

222     public static final String JavaDoc THREAD_ID_KEY = "ThreadID";
223     /**
224      * Transaction ID for a particular request
225      */

226     public static final String JavaDoc TRANSACTION_ID_KEY = "TransactionID";
227     /**
228      * Exception (if any) for the request. String reprsentation of
229      * {@link java.lang.Throwable}
230      */

231     public static final String JavaDoc EXCEPTION_KEY = "Exception";
232     /**
233      * This is the key for the row type returned by the
234      * {@link #queryCallStackForRequest} method.
235      * There are four types of rows returned each signifying the RequestStart,
236      * MethodStart, MethodEnd and RequestEnd information.
237      * The values of the CallStackRowType are as follows
238      * <ul>
239      * <li> {@link #CALL_STACK_REQUEST_START} </li>
240      * <li> {@link #CALL_STACK_REQUEST_END} </li>
241      * <li> {@link #CALL_STACK_METHOD_START} </li>
242      * <li> {@link #CALL_STACK_METHOD_END} </li>
243      * </ul>
244      */

245     public static final String JavaDoc CALL_STACK_ROW_TYPE_KEY = "CallStackRowType";
246     
247     /**
248      * Value of type of a row returned by {@link #queryCallStackForRequest} method.
249      * Keyed by {@link #CALL_STACK_ROW_TYPE_KEY}
250      * This represents information pertaining to start of a incoming request
251      * in the container.
252      */

253     public static final String JavaDoc CALL_STACK_REQUEST_START = "RequestStart";
254     
255     /**
256      * Value of type of a row returned by {@link #queryCallStackForRequest} method.
257      * Keyed by {@link #CALL_STACK_ROW_TYPE_KEY}
258      * This represents information pertaining to end of a incoming request
259      * in the container.
260      */

261     public static final String JavaDoc CALL_STACK_REQUEST_END = "RequestEnd";
262
263     /**
264      * Value of type of a row returned by {@link #queryCallStackForRequest} method.
265      * Keyed by {@link #CALL_STACK_ROW_TYPE_KEY}
266      * This represents information pertaining to start of a method for a
267      * incoming request in the container.
268      */

269     public static final String JavaDoc CALL_STACK_METHOD_START = "MethodStart";
270     
271     /**
272      * Value of type of a row returned by {@link #queryCallStackForRequest} method.
273      * Keyed by {@link #CALL_STACK_ROW_TYPE_KEY}
274      * This represents information pertaining to method end of a incoming request
275      * in the container.
276      */

277     public static final String JavaDoc CALL_STACK_METHOD_END = "MethodEnd";
278     
279     /**
280      * Used in {@link #queryPieInformation}. Denotes the time spent by a
281      * particular request in the EJB Container
282      */

283     public static final String JavaDoc EJB_CONTAINER_TYPE = "EJBContainer";
284
285     /**
286      * Used in {@link #queryPieInformation}. Denotes the time spent by a
287      * particular request in the Web Container
288      */

289     public static final String JavaDoc WEB_CONTAINER_TYPE = "WebContainer";
290
291     /**
292      * Used in {@link #queryPieInformation}. Denotes the time spent by a
293      * particular request in the ORB layer in EJB Container.
294      */

295     public static final String JavaDoc ORB_LAYER_EJB_CONTAINER_TYPE = "ORBLayerInEJBContainer";
296
297     /**
298      * Used in {@link #queryPieInformation}. Denotes the time spent by a
299      * particular request in a users EJB application code. This time is different
300      * from the time spent in the EJB or ORB Container code.
301      */

302     public static final String JavaDoc EJB_APPLICATION_TYPE = "EJBApplication";
303
304     /**
305      * Used in {@link #queryPieInformation}. Denotes the time spent by a
306      * particular request in a users Web Application code. This time is different
307      * from the time spent in the Web Container code.
308      */

309     public static final String JavaDoc WEB_APPLICATION_TYPE = "WebApplication";
310
311     /**
312      * Used in {@link #queryPieInformation}. Denotes the time spent by a
313      * particular request in the connector layer.
314      */

315     public static final String JavaDoc CONNECTOR_CONTAINER_TYPE = "Connector";
316     /**
317      * @return true if the callflow tracking is on, false otherwise
318      */

319     public boolean getEnabled();
320     
321     
322     /**
323      * Turns CallFlow On or Off
324      * @param enabled true to enable call flow tracking
325      */

326     public void setEnabled(boolean enabled);
327     
328     /**
329      * Deletes all the data that was collected during the last callflow run
330      * from the database
331      */

332     public void clearData();
333     
334     /**
335      * Delete a list of request ids.
336      * @param requestId an array of request ids. Request IDs are obtained using
337      * the {@link #REQUEST_ID_KEY} from {@link #queryRequestInformation}
338      */

339     public boolean deleteRequestIDs (String JavaDoc[] requestId);
340     /**
341      * Gets information for requests.
342      * Each row in the list is a Map of key=value
343      * pairs, each key and value is a @link java.lang.String respectively.
344      * The keys are of the type
345      * <ul>
346      * <li>{@link #REQUEST_ID_KEY}</li>
347      * <li>{@link #TIME_STAMP_MILLIS_KEY}</li>
348      * <li>{@link #REQUEST_TYPE_KEY}. There are 5 types</li>
349      * <ul>
350      * <li>{@link #REMOTE_ASYNC_MESSAGE} </li>
351      * <li>{@link #REMOTE_EJB}</li>
352      * <li>{@link #REMOTE_WEB}</li>
353      * <li>{@link #REMOTE_WEB_SERVICE}</li>
354      * <li>{@link #TIMER_EJB}</li>
355      * </ul>
356      * <li>{@link #USER_KEY}</li>
357      * <li>{@link #STATUS_KEY}</li>
358      * <li>{@link #CLIENT_HOST_KEY}</li>
359      * <li>{@link #METHOD_NAME_KEY}</li>
360      * <li>{@link #APPLICATION_NAME_KEY}</li>
361      * <li>{@link #RESPONSE_TIME_KEY}</li>
362      * </ul>
363      * @return List<Map<String, String>>, a list of Maps each encapsulating
364      * all information represented by the keys
365      */

366     public List JavaDoc<Map JavaDoc<String JavaDoc, String JavaDoc>> queryRequestInformation();
367     
368     /**
369      * Returns CallStackInformation for a particular RequestID. This list is
370      * sorted on time to return a logical flow of calls through various containers
371      * for a particular requestID. Each row in the list is a Map of key=value
372      * pairs, each key and value is a @link java.lang.String respectively.
373      * The keys are of the type
374      * <ul>
375      * <li> </li>
376      * <li>{@link #REQUEST_ID_KEY}</li>
377      * <li>{@link #TIME_STAMP_KEY}</li>
378      * <li>{@link #TIME_STAMP_MILLIS_KEY}</li>
379      * <li>{@link #REQUEST_TYPE_KEY}. This represents the Container where the call
380      * origniated in and is only available for
381      * {@link #CALL_STACK_ROW_TYPE_KEY} of the types
382      * <ul>
383      * <li>{@link #CALL_STACK_REQUEST_START}</li>
384      * </ul>
385      * <pre>
386      * There are 5 values for the {@link #REQUEST_TYPE_KEY}
387      * <ul>
388      * <li>{@link #REMOTE_ASYNC_MESSAGE} </li>
389      * <li>{@link #REMOTE_EJB}</li>
390      * <li>{@link #REMOTE_WEB}</li>
391      * <li>{@link #REMOTE_WEB_SERVICE}</li>
392      * <li>{@link #TIMER_EJB}</li>
393      * </ul>
394      * </li>
395      * <li>{@link #USER_KEY}</li>
396      * <li>{@link #STATUS_KEY}</li>
397      * <li>{@link #METHOD_NAME_KEY}</li>
398      * <li>{@link #APPLICATION_NAME_KEY}</li>
399      * <li>{@link #THREAD_ID_KEY}</li>
400      * <li>{@link #TRANSACTION_ID_KEY}</li>
401      * <li>{@link #RESPONSE_TIME_KEY}</li>
402      * <li>{@link #EXCEPTION_KEY}</li>
403      * <li>{@link #CONTAINER_TYPE_KEY}. This represents the container where the
404      * call is and is only available for
405      * {@link #CALL_STACK_ROW_TYPE_KEY} of the types
406      * <ul>
407      * <li>{@link #CALL_STACK_METHOD_START}</li>
408      * <li>{@link #CALL_STACK_METHOD_END}</li>
409      * </ul>
410      * There are 7 valid values for {@link #CONTAINER_TYPE_KEY}
411      * <ul>
412      * <li>{@link #BEAN_MANAGED_PERSISTENCE}</li>
413      * <li>{@link #CONTAINER_MANAGED_PERSISTENCE}</li>
414      * <li>{@link #MESSAGE_DRIVEN_BEAN}</li>
415      * <li>{@link #SERVLET}</li>
416      * <li>{@link #SERVLET_FILTER}</li>
417      * <li>{@link #STATEFUL_SESSION_BEAN}</li>
418      * <li>{@link #STATELESS_SESSION_BEAN}</li>
419      * </ul>
420      * </li>
421      * </ul>
422      * @param requestID obtained on calling #getRequestInformation
423      * @return List<Map<String, String>>, a list of Maps each encapsulating
424      * all information represented by the keys
425      */

426     public List JavaDoc<Map JavaDoc<String JavaDoc, String JavaDoc>> queryCallStackForRequest(String JavaDoc requestID);
427        
428     /**
429      * Returns the "PIE" information for a requestID. The "PIE" is a simple
430      * Map<String, String> with key=value pairs indicating the time spent
431      * for each call in a particular container/
432      * The keys are of the types
433      * <li>{@link #CONTAINER_TYPE_KEY} . There are four types</li>
434      * <ul>
435      * <li>{@link #EJB_CONTAINER_TYPE} </li>
436      * <li>{@link #WEB_CONTAINER_TYPE}</li>
437      * <li>{@link #ORB} </li>
438      * <li>{@link #CONNECTOR_CONTAINER_TYPE}</li>
439      * </ul>
440      * The values for the keys are String representation of time spent in each
441      * container. Time is obtained using
442      * {@link java.lang.System#currentTimeMillis}
443      * @param requestID ID of the request whose PIE information is to
444      * be obtained.
445      * @return Map<String, String>
446      */

447     public Map JavaDoc<String JavaDoc, String JavaDoc> queryPieInformation (String JavaDoc requestID);
448    
449     /**
450      * Gets the at-source IP filter set up on this particular Server Instance.
451      * An At-source filter, filters the Call Flow Data at Data Collection Time.
452      * of the type of filter and value is a String value.
453      * @return String the string representation of the IP filter set for this
454      * instance.
455      */

456     public String JavaDoc getCallerIPFilter();
457     
458     /**
459      * Sets the at-source IP filter for this particular Server Instance.
460      * @param filter The ip address to filter on.
461      */

462     public void setCallerIPFilter(String JavaDoc filter);
463     
464     /**
465      * Gets the at-source Principal filter for this particular Server Instance.
466      * @return String The Principal Name that is filtered for.
467      */

468     public String JavaDoc getCallerPrincipalFilter();
469     
470     /**
471      * Sets the at-source Principal filter for this particular Server Instance.
472      * @param filter The Principal Name to filter on.
473      */

474     public void setCallerPrincipalFilter (String JavaDoc filter);
475     
476     /**
477      * Returns a list of all request types
478      * <ul>
479      * <li>{@link #REMOTE_ASYNC_MESSAGE} </li>
480      * <li>{@link #REMOTE_EJB}</li>
481      * <li>{@link #REMOTE_WEB}</li>
482      * <li>{@link #REMOTE_WEB_SERVICE}</li>
483      * <li>{@link #TIMER_EJB}</li>
484      * </ul>
485      *
486      */

487     public String JavaDoc[] queryRequestTypeKeys ();
488     
489     /**
490      * Returns a list of component types
491      * <li>{@link #BEAN_MANAGED_PERSISTENCE}</li>
492      * <li>{@link #CONTAINER_MANAGED_PERSISTENCE}</li>
493      * <li>{@link #MESSAGE_DRIVEN_BEAN}</li>
494      * <li>{@link #SERVLET}</li>
495      * <li>{@link #SERVLET_FILTER}</li>
496      * <li>{@link #STATEFUL_SESSION_BEAN}</li>
497      * <li>{@link #STATELESS_SESSION_BEAN}</li>
498      */

499     public String JavaDoc[] queryComponentTypeKeys ();
500     
501     /**
502      * Returns a list of Container types
503      * <li>{@link #WEB_CONTAINER}</li>
504      * <li>{@link #EJB_CONTAINER}</li>
505      * <li>{@link #ORB}</li>
506      * <li>{@link #WEB_APPLICATION}</li>
507      * <li>{@link #EJB_APPLICATION}</li>
508      * <li>{@link #OTHER}</li>
509      */

510     public String JavaDoc[] queryContainerTypeOrApplicationTypeKeys ();
511 }
512
Popular Tags