RegistryImpl_Skel.java 8.0 KB
Newer Older
1
/*
2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


package sun.rmi.registry;

import java.io.IOException;

import sun.rmi.transport.StreamRemoteCall;

/**
 * Skeleton to dispatch RegistryImpl methods.
 * Originally generated by RMIC but frozen to match the stubs.
 */
@SuppressWarnings({"deprecation", "serial"})
public final class RegistryImpl_Skel
        implements java.rmi.server.Skeleton {
    private static final java.rmi.server.Operation[] operations = {
            new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
            new java.rmi.server.Operation("java.lang.String list()[]"),
            new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
            new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
            new java.rmi.server.Operation("void unbind(java.lang.String)")
    };

    private static final long interfaceHash = 4905912898345647071L;

    public java.rmi.server.Operation[] getOperations() {
        return operations.clone();
    }

54
    public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall remoteCall, int opnum, long hash)
55
            throws java.lang.Exception {
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
        if (opnum < 0) {
            if (hash == 7583982177005850366L) {
                opnum = 0;
            } else if (hash == 2571371476350237748L) {
                opnum = 1;
            } else if (hash == -7538657168040752697L) {
                opnum = 2;
            } else if (hash == -8381844669958460146L) {
                opnum = 3;
            } else if (hash == 7305022919901907578L) {
                opnum = 4;
            } else {
                throw new java.rmi.UnmarshalException("invalid method hash");
            }
        } else {
            if (hash != interfaceHash)
                throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
        }
74 75

        sun.rmi.registry.RegistryImpl server = (sun.rmi.registry.RegistryImpl) obj;
76
        StreamRemoteCall call = (StreamRemoteCall) remoteCall;
77 78 79 80 81 82 83 84 85 86 87 88
        switch (opnum) {
            case 0: // bind(String, Remote)
            {
                // Check access before reading the arguments
                RegistryImpl.checkAccess("Registry.bind");

                java.lang.String $param_String_1;
                java.rmi.Remote $param_Remote_2;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_String_1 = (java.lang.String) in.readObject();
                    $param_Remote_2 = (java.rmi.Remote) in.readObject();
89 90
                } catch (ClassCastException | IOException | ClassNotFoundException e) {
                    call.discardPendingRefs();
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                server.bind($param_String_1, $param_Remote_2);
                try {
                    call.getResultStream(true);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }

            case 1: // list()
            {
                call.releaseInputStream();
                java.lang.String[] $result = server.list();
                try {
                    java.io.ObjectOutput out = call.getResultStream(true);
                    out.writeObject($result);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }

            case 2: // lookup(String)
            {
                java.lang.String $param_String_1;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_String_1 = (java.lang.String) in.readObject();
123 124
                } catch (ClassCastException | IOException | ClassNotFoundException e) {
                    call.discardPendingRefs();
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                java.rmi.Remote $result = server.lookup($param_String_1);
                try {
                    java.io.ObjectOutput out = call.getResultStream(true);
                    out.writeObject($result);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }

            case 3: // rebind(String, Remote)
            {
                // Check access before reading the arguments
                RegistryImpl.checkAccess("Registry.rebind");

                java.lang.String $param_String_1;
                java.rmi.Remote $param_Remote_2;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_String_1 = (java.lang.String) in.readObject();
                    $param_Remote_2 = (java.rmi.Remote) in.readObject();
150 151
                } catch (ClassCastException | IOException | java.lang.ClassNotFoundException e) {
                    call.discardPendingRefs();
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                server.rebind($param_String_1, $param_Remote_2);
                try {
                    call.getResultStream(true);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }

            case 4: // unbind(String)
            {
                // Check access before reading the arguments
                RegistryImpl.checkAccess("Registry.unbind");

                java.lang.String $param_String_1;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_String_1 = (java.lang.String) in.readObject();
174 175
                } catch (ClassCastException | IOException | ClassNotFoundException e) {
                    call.discardPendingRefs();
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                server.unbind($param_String_1);
                try {
                    call.getResultStream(true);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }

            default:
                throw new java.rmi.UnmarshalException("invalid method number");
        }
    }
}