KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > rmi > iiop > exception > IiopUtility


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: IiopUtility.java,v 1.2 2005/03/10 09:51:46 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

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

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

43     private IiopUtility() {
44     }
45
46     /**
47      * Map a java exception to a corba exception
48      *
49      * @param e exception to process
50      */

51     public static void rethrowCorbaException(Exception JavaDoc e) {
52
53         TraceCarol.debugRmiCarol("");
54
55         if (e instanceof java.rmi.MarshalException JavaDoc) {
56             throw new org.omg.CORBA.MARSHAL JavaDoc(e.toString());
57         } else if (e instanceof java.rmi.NoSuchObjectException JavaDoc) {
58             throw new org.omg.CORBA.OBJECT_NOT_EXIST JavaDoc(e.toString());
59         } else if (e instanceof java.rmi.AccessException JavaDoc) {
60             throw new org.omg.CORBA.NO_PERMISSION JavaDoc(e.toString());
61         } else if (e instanceof javax.transaction.TransactionRequiredException JavaDoc) {
62             throw new org.omg.CORBA.TRANSACTION_REQUIRED JavaDoc(e.toString());
63         } else if (e instanceof javax.transaction.TransactionRolledbackException JavaDoc) {
64             throw new org.omg.CORBA.TRANSACTION_ROLLEDBACK JavaDoc(e.toString());
65         } else if (e instanceof javax.transaction.InvalidTransactionException JavaDoc) {
66             throw new org.omg.CORBA.INVALID_TRANSACTION JavaDoc(e.toString());
67         }
68     }
69 }
70
Popular Tags