KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > itut_q816Components > FactoryFinderProviderComposition > adminSegImpl


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.itut_q816Components.FactoryFinderProviderComposition;
30
31 import intt.itu.itut_x780.UIDType;
32 import intt.itu.itut_x780.ApplicationError;
33 import intt.itu.itut_q816.FactoryInfoType;
34
35 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
36 /**
37  * This is the CIDL-based implementation of the
38  * OMG IDL3 CIDL:coach.ist/itut_q816Components/FactoryFinderProviderComposition/FactoryFinderProviderHome_impl/FactoryFinderProvider_impl/adminSeg:1.0 segment type.
39  *
40  * @author OpenCCM CIF_Jimpl Compiler.
41  */

42 public class adminSegImpl
43      extends ist.coach.itut_q816Components.FactoryFinderProviderComposition.adminSeg
44 {
45     // ==================================================================
46
//
47
// Internal states.
48
//
49
// ==================================================================
50

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

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

67     /**
68      * Implementation of the ::itut_q816::FactoryFinderComponent::register operation.
69      */

70     public void
71     register(String JavaDoc factoryClass, intt.itu.itut_x780.ManagedObjectFactory factoryRef)
72     throws intt.itu.itut_x780.ApplicationError
73     {
74         //
75
// DONE : implement
76
//
77
if (factoryClass == null || factoryClass.length() == 0) {
78             ApplicationErrorInfoTypeImpl error_code =
79                     new ApplicationErrorInfoTypeImpl();
80             error_code.error = new UIDType(
81                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
82                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
83             error_code.details = new String JavaDoc("Factory class name is not specified!");
84
85             throw new ApplicationError(error_code);
86         }
87         if (factoryRef == null) {
88              ApplicationErrorInfoTypeImpl error_code =
89                     new ApplicationErrorInfoTypeImpl();
90             error_code.error = new UIDType(
91                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
92                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
93             error_code.details = new String JavaDoc("Factory reference is not provided!");
94
95             throw new ApplicationError(error_code);
96         }
97
98         FactoryInfoType factory_info = new FactoryInfoType(factoryClass, factoryRef);
99         synchronized(FactoryFinderProviderImpl.factories) {
100           FactoryFinderProviderImpl.factories.put(factoryClass, factory_info);
101         }
102     }
103
104     /**
105      * Implementation of the ::itut_q816::FactoryFinderComponent::unregister operation.
106      */

107     public void
108     unregister(String JavaDoc factoryClass, intt.itu.itut_x780.ManagedObjectFactory factoryRef)
109     throws intt.itu.itut_q816.FactoryNotFound,
110
111            intt.itu.itut_x780.ApplicationError
112     {
113         //
114
// DONE : implement
115
//
116

117         if (! FactoryFinderProviderImpl.factories.containsKey(factoryClass))
118             throw new intt.itu.itut_q816.FactoryNotFound(factoryClass +
119                 " has not been registered");
120         synchronized(FactoryFinderProviderImpl.factories) {
121           FactoryFinderProviderImpl.factories.remove(factoryClass);
122        }
123     }
124
125 }
126
Popular Tags