ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/ReferenceManager.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/ReferenceManager.java (file contents):
Revision 1.4 by ajm, Thu Nov 30 03:07:25 2000 UTC vs.
Revision 1.5 by ajm, Mon Dec 11 16:38:09 2000 UTC

# Line 79 | Line 79 | public class ReferenceManager {
79      private ReferenceManager(String[] args, String name) {
80          _orb = ORB.init(args, null);
81          _name = name;
82        getLogger().write(toString(), Logger.SYSINIT, "created");
82      }
83  
84   //---PUBLIC METHODS---
# Line 87 | Line 86 | public class ReferenceManager {
86      /**
87       * Obtains a CORBA reference through the naming service
88       * for the named object.
89 <     * This will throw a RuntimeException if there is an error
89 >     * This will throw a Error if there is an error
90       *
91       * @param name the name of the CORBA object to resolve
92       *
# Line 98 | Line 97 | public class ReferenceManager {
97          try {
98              objRef = getNS().resolve(getNS().to_name(name));
99          } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e) {
100 <            throw new RuntimeException("\nCRITICAL:Naming Service Cannot Proceed - when resolving reference to " + name + "!\n" +
101 <                                         "         Please check with your CORBA naming service provider.");
100 >            throw new Error("\nCRITICAL:Naming Service Cannot Proceed - when resolving reference to " + name + "!\n" +
101 >                              "         Please check with your CORBA naming service provider.");
102          } catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) {
103 <            throw new RuntimeException("\nCRITICAL:Invalid Name - when resolving reference to " + name + "!\n" +
104 <                                         "         Please check with your CORBA naming service provider.");
103 >            throw new Error("\nCRITICAL:Invalid Name - when resolving reference to " + name + "!\n" +
104 >                              "         Please check with your CORBA naming service provider.");
105          } catch (org.omg.CosNaming.NamingContextPackage.NotFound e) {
106 <            throw new RuntimeException("\nCRITICAL:Not Found - when resolving reference to " + name + "!\n" +
107 <                                         "         Please check that this component is running.");
106 >            throw new Error("\nCRITICAL:Not Found - when resolving reference to " + name + "!\n" +
107 >                              "         Please check that this component is running.");
108          }
109          return objRef;
110      }
# Line 113 | Line 112 | public class ReferenceManager {
112      /**
113       * Binds a given servant with the given name
114       * to the naming service.
115 <     * This will throw a RuntimeException if there is an error
115 >     * This will throw a Error if there is an error
116       *
117       * @param objRef a reverence to the servant object
118       * @param name the name to bind to the naming service with
# Line 122 | Line 121 | public class ReferenceManager {
121          try {
122              getNS().bind(getNS().to_name(name), getRootPOA().servant_to_reference(objRef));
123          } catch (org.omg.PortableServer.POAPackage.WrongPolicy e) {
124 <            throw new RuntimeException("\nCRITICAL:Wrong POA Policy - when binding " + name + "!\n" +
125 <                                         "         This indicates an error with your ORB.");
124 >            throw new Error("\nCRITICAL:Wrong POA Policy - when binding " + name + "!\n" +
125 >                              "         This indicates an error with your ORB.");
126          } catch (org.omg.PortableServer.POAPackage.ServantNotActive e) {
127 <            throw new RuntimeException("\nCRITICAL:ServantNotActive - when binding " + name + "!\n" +
128 <                                         "         This indicates an error with your ORB.");
127 >            throw new Error("\nCRITICAL:ServantNotActive - when binding " + name + "!\n" +
128 >                              "         This indicates an error with your ORB.");
129          } catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) {
130 <            throw new RuntimeException("\nCRITICAL:Invalid Name - when binding " + name + "!\n" +
131 <                                         "         Please check with your CORBA naming service provider.");
130 >            throw new Error("\nCRITICAL:Invalid Name - when binding " + name + "!\n" +
131 >                              "         Please check with your CORBA naming service provider.");
132          } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e) {
133 <            throw new RuntimeException("\nCRITICAL:Naming Service Cannot Proceed - when binding " + name + "!\n" +
134 <                                         "         Please check with your CORBA naming service provider.");
133 >            throw new Error("\nCRITICAL:Naming Service Cannot Proceed - when binding " + name + "!\n" +
134 >                              "         Please check with your CORBA naming service provider.");
135          } catch (org.omg.CosNaming.NamingContextPackage.NotFound e) {
136 <            throw new RuntimeException("\nCRITICAL:Naming Service Not Found - when binding " + name + "!\n" +
137 <                                         "         Please check with your CORBA naming service provider.");
136 >            throw new Error("\nCRITICAL:Naming Service Not Found - when binding " + name + "!\n" +
137 >                              "         Please check with your CORBA naming service provider.");
138          } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e) {
139 <            throw new RuntimeException("\nCRITICAL:Already Bound - when binding " + name + "!\n" +
140 <                                         "         Another component with this name is already running.");
139 >            throw new Error("\nCRITICAL:Already Bound - when binding " + name + "!\n" +
140 >                              "         Another component with this name is already running.");
141          }
142      }
143      
144      /**
145       * Activates the POA
146 <     * This will throw a RuntimeException if there is an error
146 >     * This will throw a Error if there is an error
147       */
148      public void activatePOA() {
149          try {
150              getRootPOA().the_POAManager().activate();
151          } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive e) {
152 <            throw new RuntimeException("\nCRITICAL:POA Set Inactive - when trying to activate POA!\n" +
153 <                                         "         This indicates an error with your ORB.");
152 >            throw new Error("\nCRITICAL:POA Set Inactive - when trying to activate POA!\n" +
153 >                              "         This indicates an error with your ORB.");
154          }
155      }
156      
# Line 180 | Line 179 | public class ReferenceManager {
179  
180      /**
181       * Returns a reference to the Root POA
182 <     * This will throw a RuntimeException if there is an error
182 >     * This will throw a Error if there is an error
183       *
184       * @return the reference this class holds
185       */
# Line 190 | Line 189 | public class ReferenceManager {
189              try {
190                  objRef = getORB().resolve_initial_references("RootPOA");
191              } catch (org.omg.CORBA.ORBPackage.InvalidName e) {
192 <                throw new RuntimeException("\nCRITICAL:Unable to resolve reference to the RootPOA!\n" +
193 <                                             "         This indicates an error with your ORB.");
192 >                throw new Error("\nCRITICAL:Unable to resolve reference to the RootPOA!\n" +
193 >                                  "         This indicates an error with your ORB.");
194              }
195              _rootPOA = POAHelper.narrow(objRef);
196          }
# Line 200 | Line 199 | public class ReferenceManager {
199      
200      /**
201       * Returns a reference to the Naming Service
202 <     * This will throw a RuntimeException if there is an error
202 >     * This will throw a Error if there is an error
203       *
204       * @return the reference this class holds
205       */
# Line 210 | Line 209 | public class ReferenceManager {
209              try {
210                  objRef = getORB().resolve_initial_references("NameService");
211              } catch (org.omg.CORBA.ORBPackage.InvalidName e) {
212 <                throw new RuntimeException("\nCRITICAL:Unable to resolve reference to the Naming Service!\n" +
213 <                                             "         Please check with your CORBA naming service provider.");
212 >                throw new Error("\nCRITICAL:Unable to resolve reference to the Naming Service!\n" +
213 >                                  "         Please check with your CORBA naming service provider.");
214              }
215              _ns = NamingContextExtHelper.narrow(objRef);
216          }
217 +        // check we managed to talk to the naming service
218 +        if (_ns == null) {
219 +            throw new Error("\nCRITICAL:Unable to resolve reference to the Naming Service!\n" +
220 +                              "         Please check with your CORBA naming service provider.");
221 +        }
222          return _ns;
223      }
224      
225      /**
226       * Returns a reference to the configuration manager
227 <     * This will throw a RuntimeException if there is an error
227 >     * This will throw a Error if there is an error
228       *
229       * @return the reference this class holds
230       */
# Line 228 | Line 232 | public class ReferenceManager {
232          if (_cm == null) {
233              _cm = ConfigurationManagerHelper.narrow(getCORBARef("iscream.ConfigurationManager"));
234          }
235 +        // check we managed to talk to the configuration manager
236 +        if (_cm == null) {
237 +            throw new Error("\nCRITICAL:Unable to resolve reference to the Configuration Manager!\n" +
238 +                              "         Please check with your CORBA naming service provider.");
239 +        }
240          return _cm;
241      }
242  
243      /**
244       * Returns a reference to the logger
245 <     * This will throw a RuntimeException if there is an error
245 >     * This will throw a Error if there is an error
246       *
247       * @return the reference this class holds
248       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines