jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
author lana
Fri, 18 Sep 2015 14:20:00 -0700
changeset 32689 ede6e8912b79
parent 25859 3317bb8137f4
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 13589
diff changeset
     2
 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
     4
 *
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4167
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4167
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    10
 *
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    15
 * accompanied this code).
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    16
 *
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4167
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4167
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4167
diff changeset
    23
 * questions.
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    24
 */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    25
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    26
package com.sun.jmx.remote.internal;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    27
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    28
import java.util.Properties;
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
    29
import java.io.IOException;
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    30
import java.rmi.Remote;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    31
import java.rmi.NoSuchObjectException;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    32
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    33
import java.security.AccessController;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    34
import java.security.PrivilegedAction;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    35
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    36
/**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    37
 * A helper class for RMI-IIOP and CORBA APIs.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    38
 */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    39
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    40
public final class IIOPHelper {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    41
    private IIOPHelper() { }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    42
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    43
    // loads IIOPProxy implementation class if available
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    44
    private static final String IMPL_CLASS =
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    45
        "com.sun.jmx.remote.protocol.iiop.IIOPProxyImpl";
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    46
    private static final IIOPProxy proxy =
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    47
        AccessController.doPrivileged(new PrivilegedAction<IIOPProxy>() {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    48
            public IIOPProxy run() {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    49
                try {
13589
da4cb574f4a6 7193339: Prepare system classes be defined by a non-null module loader
mchung
parents: 5506
diff changeset
    50
                    Class<?> c = Class.forName(IMPL_CLASS, true,
da4cb574f4a6 7193339: Prepare system classes be defined by a non-null module loader
mchung
parents: 5506
diff changeset
    51
                                               IIOPHelper.class.getClassLoader());
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    52
                    return (IIOPProxy)c.newInstance();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    53
                } catch (ClassNotFoundException cnf) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    54
                    return null;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    55
                } catch (InstantiationException e) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    56
                    throw new AssertionError(e);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    57
                } catch (IllegalAccessException e) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    58
                    throw new AssertionError(e);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    59
                }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    60
            }});
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    61
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    62
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    63
     * Returns true if RMI-IIOP and CORBA is available.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    64
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    65
    public static boolean isAvailable() {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    66
        return proxy != null;
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    67
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    68
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    69
    private static void ensureAvailable() {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    70
        if (proxy == null)
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    71
            throw new AssertionError("Should not here");
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    72
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    73
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    74
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    75
     * Returns true if the given object is a Stub.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    76
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    77
    public static boolean isStub(Object obj) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    78
        return (proxy == null) ? false : proxy.isStub(obj);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    79
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    80
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    81
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    82
     * Returns the Delegate to which the given Stub delegates.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    83
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    84
    public static Object getDelegate(Object stub) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    85
        ensureAvailable();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    86
        return proxy.getDelegate(stub);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    87
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    88
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    89
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    90
     * Sets the Delegate for a given Stub.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    91
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    92
    public static void setDelegate(Object stub, Object delegate) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    93
        ensureAvailable();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    94
        proxy.setDelegate(stub, delegate);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    95
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    96
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    97
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    98
     * Returns the ORB associated with the given stub
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
    99
     *
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   100
     * @throws  UnsupportedOperationException
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   101
     *          if the object does not support the operation that
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   102
     *          was invoked
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   103
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   104
    public static Object getOrb(Object stub) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   105
        ensureAvailable();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   106
        return proxy.getOrb(stub);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   107
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   108
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   109
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   110
     * Connects the Stub to the given ORB.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   111
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   112
    public static void connect(Object stub, Object orb)
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   113
        throws IOException
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   114
    {
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   115
        if (proxy == null)
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   116
            throw new IOException("Connection to ORB failed, RMI/IIOP not available");
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   117
        proxy.connect(stub, orb);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   118
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   119
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   120
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   121
     * Returns true if the given object is an ORB.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   122
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   123
    public static boolean isOrb(Object obj) {
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   124
        return (proxy == null) ? false : proxy.isOrb(obj);
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   125
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   126
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   127
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   128
     * Creates, and returns, a new ORB instance.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   129
     */
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   130
    public static Object createOrb(String[] args, Properties props)
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   131
        throws IOException
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   132
    {
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   133
        if (proxy == null)
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   134
            throw new IOException("ORB initialization failed, RMI/IIOP not available");
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   135
        return proxy.createOrb(args, props);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   136
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   137
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   138
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   139
     * Converts a string, produced by the object_to_string method, back
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   140
     * to a CORBA object reference.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   141
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   142
    public static Object stringToObject(Object orb, String str) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   143
        ensureAvailable();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   144
        return proxy.stringToObject(orb, str);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   145
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   146
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   147
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   148
     * Converts the given CORBA object reference to a string.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   149
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   150
    public static String objectToString(Object orb, Object obj) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   151
        ensureAvailable();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   152
        return proxy.objectToString(orb, obj);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   153
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   154
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   155
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   156
     * Checks to ensure that an object of a remote or abstract interface
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   157
     * type can be cast to a desired type.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   158
     */
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   159
    public static <T> T narrow(Object narrowFrom, Class<T> narrowTo) {
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   160
        ensureAvailable();
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   161
        return proxy.narrow(narrowFrom, narrowTo);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   162
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   163
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   164
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   165
     * Makes a server object ready to receive remote calls
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   166
     */
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   167
    public static void exportObject(Remote obj) throws IOException {
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   168
        if (proxy == null)
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   169
            throw new IOException("RMI object cannot be exported, RMI/IIOP not available");
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   170
        proxy.exportObject(obj);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   171
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   172
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   173
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   174
     * Deregisters a server object from the runtime.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   175
     */
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   176
    public static void unexportObject(Remote obj) throws IOException {
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   177
        if (proxy == null)
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   178
            throw new NoSuchObjectException("Object not exported");
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   179
        proxy.unexportObject(obj);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   180
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   181
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   182
    /**
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   183
     * Returns a stub for the given server object.
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   184
     */
14917
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   185
    public static Remote toStub(Remote obj) throws IOException {
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   186
        if (proxy == null)
bf08557604f8 8001048: JSR-160: Allow IIOP transport to be optional
alanb
parents: 14342
diff changeset
   187
            throw new NoSuchObjectException("Object not exported");
4167
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   188
        return proxy.toStub(obj);
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   189
    }
76f44f2d5d4d 6888179: Separate out dependency on CORBA
alanb
parents:
diff changeset
   190
}