KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmfClientComponents > ManagedObjectClientComposition > logNewRecordSegImpl


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

28
29 package ist.coach.coachEmfClientComponents.ManagedObjectClientComposition;
30
31 import ist.coach.coachEmfClientComponents.gui.GuiMaster;
32 import java.text.DateFormat JavaDoc;
33 import ist.coach.coachEmfCommon.Utils;
34 import ist.coach.coachEmfServices.EmfBasicLog.LogSeverity;
35 import ist.coach.coachEmfClientComponents.gui.GuiMessages;
36 /**
37  * This is the CIDL-based implementation of the
38  * OMG IDL3 CIDL:coach.ist/coachEmfClientComponents/ManagedObjectClientComposition/ManagedObjectClientHome_impl/ManagedObjectClient_impl/logNewRecordSeg:1.0 segment type.
39  *
40  * @author OpenCCM CIF_Jimpl Compiler.
41  */

42 public class logNewRecordSegImpl
43      extends ist.coach.coachEmfClientComponents.ManagedObjectClientComposition.logNewRecordSeg
44 {
45     // ==================================================================
46
//
47
// Internal states.
48
//
49
// ==================================================================
50

51     // ==================================================================
52
//
53
// Constructors.
54
//
55
// ==================================================================
56

57     public logNewRecordSegImpl()
58     {
59
60     }
61
62     // ==================================================================
63
//
64
// Methods.
65
//
66
// ==================================================================
67

68     /**
69      * Implementation of the ::coachEmfServicesComponents::CCM_LogNewRecordConsumer::push operation.
70      */

71     public void
72     push(ist.coach.coachEmfServicesComponents.LogNewRecord event)
73     {
74
75         //System.err.println("---->LogNewRecord received: ");
76
//System.err.println("Source Object Name = " + Utils.name2string(event.source));
77
//System.err.println("Source Object Type = " + event.sourceClass);
78
//System.err.println("logRecordId = " + String.valueOf(
79
// event.logRecordId));
80
//System.err.println("Time = " + String.valueOf(event.eventTime.time));
81

82         java.util.Date JavaDoc event_date = new java.util.Date JavaDoc(event.eventTime.time);
83         String JavaDoc event_type_str = GuiMessages.info_log;
84         String JavaDoc event_type = GuiMaster.INFO_LOG;
85
86         switch(event.severity.value()) {
87           case LogSeverity._Error :
88                     event_type_str = GuiMessages.error_log;
89                     event_type = GuiMaster.ERROR_LOG;
90                     break;
91           case LogSeverity._FatalError :
92                     event_type_str = GuiMessages.fatal_error_log;
93                     event_type = GuiMaster.FATAL_LOG;
94                     break;
95           case LogSeverity._Warning :
96                 event_type_str = GuiMessages.warning_log;
97                 event_type = GuiMaster.WARNING_LOG;
98                 break;
99         };
100       ManagedObjectClientImpl main_segment = (ManagedObjectClientImpl) get_main_segment();
101             // if user has unsubscribed from log events of this type
102
if (! main_segment.subscribed_log_events.contains(event_type))
103           return;
104
105         DateFormat JavaDoc df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);
106         String JavaDoc time_str = df.format(event_date);
107
108
109         main_segment.ui_client.print(time_str,
110                 event_type_str,
111                 Utils.name2string(event.source),
112                 event.sourceClass,
113                 String.valueOf(event.logRecordId),
114                 event.info
115                 );
116     }
117
118 }
119
Popular Tags