1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.util; |
2 |
> |
package uk.org.iscream.cms.server.componentmanager; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
|
import org.omg.CORBA.ORB; |
6 |
|
import org.omg.CosNaming.*; |
7 |
|
import org.omg.PortableServer.*; |
8 |
< |
import uk.ac.ukc.iscream.core.*; |
8 |
> |
import uk.org.iscream.cms.server.core.*; |
9 |
> |
import uk.org.iscream.cms.server.util.*; |
10 |
|
|
11 |
|
/** |
12 |
|
* This class returns references for global system objects. |
42 |
|
* |
43 |
|
* @return a reference to the ReferenceManager |
44 |
|
*/ |
45 |
< |
public static ReferenceManager getInstance() { |
45 |
> |
public synchronized static ReferenceManager getInstance() { |
46 |
|
if (_instance == null) { |
47 |
|
_instance = new ReferenceManager(); |
48 |
|
} |
81 |
|
dieWithError("\nCRITICAL:Invalid Name - when resolving reference to " + name + "!\n" + |
82 |
|
" Please check with your CORBA naming service provider."); |
83 |
|
} catch (org.omg.CosNaming.NamingContextPackage.NotFound e) { |
84 |
< |
dieWithError("\nCRITICAL:Not Found - when resolving reference to " + name + "!\n" + |
84 |
> |
recoverWithError("\nCRITICAL:Not Found - when resolving reference to " + name + "!\n" + |
85 |
|
" Please check that this component is running."); |
86 |
|
} |
87 |
|
return objRef; |
111 |
|
dieWithError("\nCRITICAL:Naming Service Cannot Proceed - when binding " + name + "!\n" + |
112 |
|
" Please check with your CORBA naming service provider."); |
113 |
|
} catch (org.omg.CosNaming.NamingContextPackage.NotFound e) { |
114 |
< |
dieWithError("\nCRITICAL:Naming Service Not Found - when binding " + name + "!\n" + |
114 |
> |
recoverWithError("\nCRITICAL:Naming Service Not Found - when binding " + name + "!\n" + |
115 |
|
" Please check with your CORBA naming service provider."); |
116 |
|
} catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e) { |
117 |
|
dieWithError("\nCRITICAL:Already Bound - when binding " + name + "!\n" + |
136 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
137 |
|
* method to provide clean logging (every class should have this). |
138 |
|
* |
139 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
139 |
> |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
140 |
|
* to format the toString() |
141 |
|
* |
142 |
|
* @return the name of this class and its CVS revision |
154 |
|
* If there are any CORBA errors this method is called with the |
155 |
|
* error message. |
156 |
|
* |
157 |
+ |
* The exception this throws is generic to CORBA communication |
158 |
+ |
* problems, this is a Runtime exception and is typically only |
159 |
+ |
* explicitly caught in the ComponentManager for the current VM |
160 |
+ |
* The ComponentManager can then decide what course of action to |
161 |
+ |
* take. |
162 |
+ |
* |
163 |
+ |
* Also, if it can, it will log the message with the logger. |
164 |
+ |
* |
165 |
+ |
* @param message the error message to die with |
166 |
+ |
*/ |
167 |
+ |
private void recoverWithError(String message) throws ComponentCORBAException { |
168 |
+ |
if (_logger != null) { |
169 |
+ |
_logger.write(toString(), Logger.WARNING, "component CORBA error - " + message); |
170 |
+ |
} |
171 |
+ |
throw new ComponentCORBAException(message); |
172 |
+ |
} |
173 |
+ |
|
174 |
+ |
|
175 |
+ |
/** |
176 |
+ |
* If there are any CORBA errors this method is called with the |
177 |
+ |
* error message. |
178 |
+ |
* |
179 |
|
* Currently this prints the error, on the local err stream. Will |
180 |
|
* print to the logger if one is available. |
181 |
|
* |
193 |
|
System.exit(1); |
194 |
|
} |
195 |
|
|
196 |
+ |
|
197 |
+ |
|
198 |
|
//---ACCESSOR/MUTATOR METHODS--- |
199 |
|
|
200 |
|
/** |
325 |
|
/** |
326 |
|
* A reference to the single instance of this class |
327 |
|
*/ |
328 |
< |
private static ReferenceManager _instance; |
328 |
> |
private static ReferenceManager _instance = null; |
329 |
|
} |