KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > rmi > exception > RmiUtility


1 /**
2  * Copyright (C) 2004-2005 - Bull S.A.
3  *
4  * CAROL: Common Architecture for RMI ObjectWeb Layer
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: RmiUtility.java,v 1.3 2005/04/07 15:07:08 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.carol.rmi.exception;
27
28 import org.objectweb.carol.rmi.iiop.exception.IiopUtility;
29 import org.objectweb.carol.util.configuration.ConfigurationRepository;
30 import org.objectweb.carol.util.configuration.TraceCarol;
31
32 /**
33  * Utility class for the rmi exceptions management
34  *
35  * @author Benoit Pelletier
36  */

37 public class RmiUtility {
38
39     /**
40      * private constructor mandatory for utilities class
41      *
42      */

43     private RmiUtility() {
44     }
45
46     /**
47      * check if the exception have to be mapped to a protocol exception
48      * if yes, throw the new one
49      *
50      * @param e exception to process
51      */

52     public static void rethrowRmiException(Exception JavaDoc e) {
53
54         // get the current protocol
55
String JavaDoc protocol = ConfigurationRepository.getCurrentConfiguration().getProtocol().getName();
56
57         if (TraceCarol.isDebugRmiCarol()) {
58             TraceCarol.debugRmiCarol("Current protocol=" + protocol);
59         }
60
61         // iiop case
62
if (protocol.equals("iiop")) {
63             IiopUtility.rethrowCorbaException(e);
64         }
65
66         // for others protocols, nothing to do
67
}
68
69 }
Popular Tags