Source for javax.rmi.CORBA.Util

   1: /* Util.java -- 
   2:    Copyright (C) 2002, 2004 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., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 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 gnu.javax.rmi.CORBA.DelegateFactory;
  42: import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
  43: 
  44: import java.io.InputStream;
  45: import java.io.OutputStream;
  46: import java.rmi.Remote;
  47: import java.rmi.RemoteException;
  48: 
  49: public class Util
  50: {
  51: 
  52:   private static UtilDelegate delegate;
  53:   static
  54:   {
  55:     try
  56:       {
  57:     delegate = (UtilDelegate)DelegateFactory.getInstance("Util");
  58:       }
  59:     catch(GetDelegateInstanceException e)
  60:       {
  61:     delegate = null;
  62:       }
  63:   }
  64: 
  65:   private Util()
  66:   {
  67:   }
  68: 
  69:   // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
  70:   public static Object copyObject(Object obj, javax.rmi.ORB orb)
  71:     throws RemoteException
  72:   {
  73:     if(delegate != null)
  74:       return delegate.copyObject(obj, orb);
  75:     else
  76:       return null;
  77:   }
  78: 
  79:   // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
  80:   public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb)
  81:     throws RemoteException
  82:   {
  83:     if(delegate != null)
  84:       return delegate.copyObjects(obj, orb);
  85:     else
  86:       return null;
  87:   }
  88:     
  89:   public static ValueHandler createValueHandler()
  90:   {
  91:     if(delegate != null)
  92:       return delegate.createValueHandler();
  93:     else
  94:       return null;
  95:   }
  96:     
  97:   public static String getCodebase(Class clz)
  98:   {
  99:     if(delegate != null)
 100:       return delegate.getCodebase(clz);
 101:     else
 102:       return null;
 103:   }
 104:     
 105:   public static Tie getTie(Remote target)
 106:   {
 107:     if(delegate != null)
 108:       return delegate.getTie(target);
 109:     else
 110:       return null;
 111:   }
 112: 
 113:   public static boolean isLocal(Stub stub)
 114:     throws RemoteException
 115:   {
 116:     if(delegate != null)
 117:       return delegate.isLocal(stub);
 118:     else
 119:       return false;
 120:   }
 121: 
 122:   public static Class loadClass(String className, String remoteCodebase, ClassLoader loader)
 123:     throws ClassNotFoundException
 124:   {
 125:     if(delegate != null)
 126:       return delegate.loadClass(className, remoteCodebase, loader);
 127:     else
 128:       throw new ClassNotFoundException(className + ": delegate == null");
 129:   }
 130:     
 131:   public static RemoteException mapSystemException(SystemException ex)
 132:   {
 133:     if(delegate != null)
 134:       return delegate.mapSystemException(ex);
 135:     else
 136:       return null;
 137:   }
 138: 
 139:   public static Object readAny(InputStream in)
 140:   {
 141:     if(delegate != null)
 142:       return delegate.readAny(in);
 143:     else
 144:       return null;
 145:   }
 146: 
 147:   public static void registerTarget(Tie tie, Remote target)
 148:   {
 149:     if(delegate != null)
 150:       delegate.registerTarget(tie, target);
 151:   }
 152:     
 153:   public static void unexportObject(Remote target)
 154:   {
 155:     if(delegate != null)
 156:       delegate.unexportObject(target);
 157:   }
 158:     
 159:   public static RemoteException wrapException(Throwable orig)
 160:   {
 161:     if(delegate != null)
 162:       return delegate.wrapException(orig);
 163:     else
 164:       return null;
 165:   }
 166:     
 167:   public static void writeAbstractObject(OutputStream out, Object obj)
 168:   {
 169:     if(delegate != null)
 170:       delegate.writeAbstractObject(out, obj);
 171:   }
 172:     
 173:   public static void writeAny(OutputStream out, Object obj)
 174:   {
 175:     if(delegate != null)
 176:       delegate.writeAny(out, obj);
 177:   }
 178:     
 179:   public static void writeRemoteObject(OutputStream out, Object obj)
 180:   {
 181:     if(delegate != null)
 182:       delegate.writeRemoteObject(out, obj);
 183:   }
 184: 
 185: }