KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > Containers > Plugins > TraceControllerHome


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2001-2002 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): Mathieu Vadet.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.Containers.Plugins;
28
29 /**
30  * This interface ??????.
31  *
32  * @author <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
33  *
34  * @version 0.3
35  */

36
37 public class TraceControllerHome
38        extends org.omg.CORBA.LocalObject JavaDoc
39        implements org.objectweb.openccm.Containers.SystemHome
40 {
41     // ==================================================================
42
//
43
// Internal state.
44
//
45
// ==================================================================
46

47     /**
48      **
49      **/

50     protected org.objectweb.ccm.util.Table singletons_;
51
52     // ==================================================================
53
//
54
// Constructor.
55
//
56
// ==================================================================
57

58     /**
59      ** The constructor.
60      **
61      **/

62     protected
63     TraceControllerHome()
64     {
65         singletons_ = new org.objectweb.ccm.util.Table();
66     }
67
68     // ==================================================================
69
//
70
// Internal methods.
71
//
72
// ==================================================================
73

74     // ==================================================================
75
//
76
// Public methods for the SystemHome interface.
77
//
78
// ==================================================================
79

80     //
81
// IDL:goal.lifl.fr/OpenCCM/Containers/SystemHome/create:1.0
82
//
83
/**
84      **
85      **/

86     public org.objectweb.openccm.Containers.SystemComponent
87     create_component(org.objectweb.openccm.Containers.PropertySet config)
88     throws org.objectweb.openccm.Containers.CreationFailed
89     {
90         boolean is_singleton = true;
91         java.lang.String JavaDoc name = null;
92         try
93         {
94             name = config.get_as_string("singleton").value();
95         }
96         catch(org.objectweb.openccm.Containers.UnknownProperty ex)
97         {
98             java.lang.String JavaDoc msg =
99                 "exception in class org.objectweb.openccm.Containers.Plugins.TraceControllerHome\n"+
100                 " operation : configure\n"+
101                 " message : "+ex.getMessage();
102             // throw new org.objectweb.openccm.Containers.CreationFailed(msg);
103
is_singleton = false;
104         }
105         catch(org.objectweb.openccm.Containers.BadPropertyKind ex)
106         {
107             java.lang.String JavaDoc msg =
108                 "exception in class org.objectweb.openccm.Containers.Plugins.TraceControllerHome\n"+
109                 " operation : configure\n"+
110                 " message : "+ex.getMessage();
111             // throw new org.objectweb.openccm.Containers.CreationFailed(msg);
112
is_singleton = false;
113         }
114
115         if (!is_singleton)
116             return new TraceController();
117
118         TraceController trace = (TraceController)singletons_.get(name);
119         if (trace!=null)
120             return trace;
121
122         trace = new TraceController();
123         singletons_.put(name, trace);
124         return trace;
125     }
126
127     // ==================================================================
128
//
129
// Public methods for the SystemComponent interface.
130
//
131
// ==================================================================
132

133     // ==================================================================
134
//
135
// Public methods for the Configuration interface.
136
//
137
// ==================================================================
138

139     //
140
// IDL:goal.lifl.fr/OpenCCM/Containers/Configuration/configure:1.0
141
//
142
/**
143      **
144      **/

145     public void
146     configure(org.objectweb.openccm.Containers.PropertySet config)
147     throws org.objectweb.openccm.Containers.ConfigurationFailed
148     {
149     }
150
151     // ==================================================================
152
//
153
// Public static methods.
154
//
155
// ==================================================================
156

157     /**
158      ** Callback - no parameters
159      **/

160     public static TraceControllerHome
161     create()
162     {
163         return new TraceControllerHome();
164     }
165
166     // ==================================================================
167
//
168
// Public methods.
169
//
170
// ==================================================================
171
}
172
Popular Tags