KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > corba > trace > PI > TraceSI


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2003 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Offroy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.corba.trace.PI;
28
29 /* MONOLOG import */
30 import org.objectweb.util.monolog.api.BasicLevel;
31 import org.objectweb.util.monolog.api.Logger;
32
33 /**
34  * The Server side interceptor used to log CORBA Server activity
35  * @author <a HREF="mailto:offroy@lifl.fr">offroy@lifl.fr;</a>
36  */

37 public class TraceSI extends org.omg.CORBA.LocalObject JavaDoc
38     implements org.omg.PortableInterceptor.ServerRequestInterceptor JavaDoc {
39
40     protected Logger logger_;
41
42     /**
43      * Level of logging for Server side Interceptor
44      */

45     private short logLevelServer;
46     /* TODO change static def of ServerLevelLog */
47
48     /**
49      * used to get CORBA call information (server side)
50      */

51     protected ServerRequestInfoReader srir_;
52
53     /**
54      * Constructor
55      */

56     public TraceSI(int trace_slot, org.omg.PortableInterceptor.ORBInitInfo JavaDoc info) {
57         /* MONOLOG logger initialization */
58         logger_ = MonologLogger.loggerSI;
59         logLevelServer = 1;
60         this.srir_ = new ServerRequestInfoReader(logLevelServer);
61
62          if (MonologLogger.enableTrace)
63             logger_.log(BasicLevel.DEBUG, "Init Trace Interceptor CORBA Server Side");
64     }
65
66     /**********************************************************************
67      * Public Method
68      **********************************************************************/

69     /**
70      * Called when the server receive a request from a client (before receive_request)
71      * @param ri the server request
72      */

73     public void receive_request_service_contexts(org.omg.PortableInterceptor.ServerRequestInfo JavaDoc ri){
74          if (MonologLogger.enableTrace)
75             logger_.log(BasicLevel.INFO, srir_.displayServerRequestInfoMonolog(ri));
76     }
77
78     /**
79      * Called when the server receive a request from a client (after receive_request_service_context)
80      * @param ri the server request
81      */

82     public void receive_request(org.omg.PortableInterceptor.ServerRequestInfo JavaDoc ri) {
83          if (MonologLogger.enableTrace)
84             logger_.log(BasicLevel.INFO, srir_.displayServerRequestInfoMonolog(ri));
85     }
86
87     /**
88      * Called when the server send a reply to a client
89      * @param ri the server request
90      */

91     public void send_reply(org.omg.PortableInterceptor.ServerRequestInfo JavaDoc ri) {
92          if (MonologLogger.enableTrace)
93             logger_.log(BasicLevel.INFO, srir_.displayServerRequestInfoMonolog(ri));
94     }
95
96     /**
97      * Called when the server send an exception to a client
98      * @param ri the server request
99      */

100     public void send_exception(org.omg.PortableInterceptor.ServerRequestInfo JavaDoc ri) {
101          if (MonologLogger.enableTrace)
102            logger_.log(BasicLevel.ERROR, srir_.displayServerRequestInfoMonolog(ri,false));
103     }
104
105     /**
106      * Called when the server send a message to a client
107      * which is not a reply and not an exception
108      * @param ri the server request
109      */

110     public void send_other(org.omg.PortableInterceptor.ServerRequestInfo JavaDoc ri) {
111          if (MonologLogger.enableTrace)
112             logger_.log(BasicLevel.INFO, srir_.displayServerRequestInfoMonolog(ri));
113     }
114
115     /**
116      * return the name of the Logging Server Interceptor
117      */

118     public java.lang.String JavaDoc name() {
119         return "LoggingServerInterceptor";
120     }
121
122     /**
123      * Destroy the interceptor.
124      */

125     public void destroy() {
126     }
127 }
128
Popular Tags