KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmfServicesComponents > BasicLogProviderComposition > BasicLogProviderHomeImpl


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.coachEmfServicesComponents.BasicLogProviderComposition;
30
31 import ist.coach.coachEmfCommon.LogAttributeValueChangeFactory;
32 import ist.coach.coachEmfCommon.LogThresholdAlarmFactory;
33 import ist.coach.coachEmfCommon.NamePrimaryKeyFactory;
34 import ist.coach.coachEmfCommon.LogNewRecordFactory;
35
36 import ist.coach.coachEmfServicesComponents.BasicLogProvider;
37 //import ist.coach.coachEmfServicesComponents.BasicLogProviderHelper;
38
//import ist.coach.coachEmfServicesComponents.BasicLogHomeHelper;
39

40 import ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.*;
41
42 import java.util.Vector JavaDoc;
43 import java.util.Enumeration JavaDoc;
44 /**
45  * This is the CIDL-based implementation of
46  * OMG IDL3 IDL:coach.ist/coachEmfServicesComponents/BasicLogProviderHome:1.0 home type.
47  *
48  * This class inherits from the generated home executor skeleton class
49  * defined by OMG CIDL ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.BasicLogProviderSimpleHome_impl
50  *
51  * @author OpenCCM CIF_Jimpl Compiler.
52  */

53 public class BasicLogProviderHomeImpl
54      extends ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.BasicLogProviderSimpleHome_impl
55 {
56     // ==================================================================
57
//
58
// Internal states.
59
//
60
// ==================================================================
61
private Vector JavaDoc allExistingLogs_;
62
63
64     // ==================================================================
65
//
66
// Constructors.
67
//
68

69     // ==================================================================
70

71     public BasicLogProviderHomeImpl()
72     {
73         allExistingLogs_ = new Vector JavaDoc();
74     }
75
76     // ==================================================================
77
//
78
// Methods.
79
//
80
// ==================================================================
81

82     /**
83      * Method for the org.objectweb.ccm.runtime.cif.api.SegmentHome interface.
84      *
85      * Create an executor segment from its identifier.
86      *
87      * @param segid - The executor segment identifier.
88      *
89      * @return - The executor segment created.
90      */

91     public org.omg.Components.ExecutorSegmentBase
92     create_executor_segment(int segid)
93     {
94
95
96         switch (segid)
97         {
98             case ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.basicLogSegImpl._segment_id_value :
99
100                 return new ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.basicLogSegImpl();
101             default :
102                 ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.BasicLogProviderImpl new_logProvider =
103                 new ist.coach.coachEmfServicesComponents.BasicLogProviderComposition.BasicLogProviderImpl();
104
105                 return new_logProvider;
106         }
107     }
108 /****
109     public org.omg.Components.EnterpriseComponent
110     create() {
111       System.err.println("BasicLogProviderHome> custom create called!!!");
112       BasicLogProviderImpl new_log_provider = (BasicLogProviderImpl) super.create();
113       allExistingLogs_.add(new_log_provider);
114       System.err.println("BasicLogProviderHome> custom create returns!!!");
115       return (org.omg.Components.EnterpriseComponent) new_log_provider;
116     }
117 ****/

118     /**
119      * This method is called by the OpenCCM Component Server
120      * to create a home instance.
121      *
122      * @return - The created home.
123      */

124     public static org.omg.Components.HomeExecutorBase
125     create_home()
126     {
127
128         BasicLogProviderHomeImpl home = new BasicLogProviderHomeImpl();
129         return home;
130     }
131
132
133     /**
134      * Implementation of the ::coachEmfServices::EmfBasicLog::LogMgr::list_logs operation.
135      */

136     public ist.coach.coachEmfServices.EmfBasicLog.BasicLog[]
137     list_logs()
138     {
139         //
140
// DONE : Implement
141
//
142
ist.coach.coachEmfServices.EmfBasicLog.BasicLog[] logs_list =
143               new ist.coach.coachEmfServices.EmfBasicLog.BasicLog[allExistingLogs_.size()];
144
145         for(int i = 0; i < logs_list.length; i++)
146           logs_list[i] = ((BasicLogProvider) allExistingLogs_.elementAt(i)).provide_i_BasicLog();
147           //allExistingLogs_.copyInto(logs_list);
148

149         return logs_list;
150     }
151
152
153     /**
154      * Implementation of the ::coachEmfServices::EmfBasicLog::LogMgr::list_logs_by_id operation.
155      */

156     public int[]
157     list_logs_by_id()
158     {
159         //
160
// DONE : Implement
161
//
162
int[] logs_by_id = new int[allExistingLogs_.size()];
163         int i = 0;
164         for (Enumeration JavaDoc e = allExistingLogs_.elements() ; e.hasMoreElements() &&
165                 i < logs_by_id.length ; i++) {
166             logs_by_id[i] = ((BasicLogProvider) e.nextElement()).logId();
167
168         }
169
170         return logs_by_id;
171     }
172
173
174     // Executed once at the loading of this class
175
// by the OpenCCM Component Server.
176
static {
177
178         LogAttributeValueChangeFactory.register();
179         LogThresholdAlarmFactory.register();
180         NamePrimaryKeyFactory.register();
181         LogNewRecordFactory.register();
182
183     }
184
185 }
186
Popular Tags