re PR c++/17413 (local classes as template argument)
[gcc.git] / libjava / javax / rmi / CORBA / Util.java
1 /* Util.java --
2 Copyright (C) 2002 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
37
38
39 package javax.rmi.CORBA;
40
41 import java.rmi.Remote;
42 import java.rmi.RemoteException;
43 import java.lang.Object;
44 import java.io.*;
45 //import org.omg.CORBA.*;
46 //import org.omg.CORBA.portable.InputStream;
47 //import org.omg.CORBA.portable.OutputStream;
48 import gnu.javax.rmi.CORBA.DelegateFactory;
49 import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
50
51 public class Util
52 {
53
54 private static UtilDelegate delegate;
55 static
56 {
57 try
58 {
59 delegate = (UtilDelegate)DelegateFactory.getInstance("Util");
60 }
61 catch(GetDelegateInstanceException e)
62 {
63 delegate = null;
64 }
65 }
66
67 private Util()
68 {
69 }
70
71 // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
72 public static Object copyObject(Object obj, javax.rmi.ORB orb)
73 throws RemoteException
74 {
75 if(delegate != null)
76 return delegate.copyObject(obj, orb);
77 else
78 return null;
79 }
80
81 // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
82 public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb)
83 throws RemoteException
84 {
85 if(delegate != null)
86 return delegate.copyObjects(obj, orb);
87 else
88 return null;
89 }
90
91 public static ValueHandler createValueHandler()
92 {
93 if(delegate != null)
94 return delegate.createValueHandler();
95 else
96 return null;
97 }
98
99 public static String getCodebase(Class clz)
100 {
101 if(delegate != null)
102 return delegate.getCodebase(clz);
103 else
104 return null;
105 }
106
107 public static Tie getTie(Remote target)
108 {
109 if(delegate != null)
110 return delegate.getTie(target);
111 else
112 return null;
113 }
114
115 public static boolean isLocal(Stub stub)
116 throws RemoteException
117 {
118 if(delegate != null)
119 return delegate.isLocal(stub);
120 else
121 return false;
122 }
123
124 public static Class loadClass(String className, String remoteCodebase, ClassLoader loader)
125 throws ClassNotFoundException
126 {
127 if(delegate != null)
128 return delegate.loadClass(className, remoteCodebase, loader);
129 else
130 throw new ClassNotFoundException(className + ": delegate == null");
131 }
132
133 public static RemoteException mapSystemException(SystemException ex)
134 {
135 if(delegate != null)
136 return delegate.mapSystemException(ex);
137 else
138 return null;
139 }
140
141 public static Object readAny(InputStream in)
142 {
143 if(delegate != null)
144 return delegate.readAny(in);
145 else
146 return null;
147 }
148
149 public static void registerTarget(Tie tie, Remote target)
150 {
151 if(delegate != null)
152 delegate.registerTarget(tie, target);
153 }
154
155 public static void unexportObject(Remote target)
156 {
157 if(delegate != null)
158 delegate.unexportObject(target);
159 }
160
161 public static RemoteException wrapException(Throwable orig)
162 {
163 if(delegate != null)
164 return delegate.wrapException(orig);
165 else
166 return null;
167 }
168
169 public static void writeAbstractObject(OutputStream out, Object obj)
170 {
171 if(delegate != null)
172 delegate.writeAbstractObject(out, obj);
173 }
174
175 public static void writeAny(OutputStream out, Object obj)
176 {
177 if(delegate != null)
178 delegate.writeAny(out, obj);
179 }
180
181 public static void writeRemoteObject(OutputStream out, Object obj)
182 {
183 if(delegate != null)
184 delegate.writeRemoteObject(out, obj);
185 }
186
187 }