1 /*
   2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 
  27 package sun.rmi.registry;
  28 
  29 import java.io.IOException;
  30 import java.io.InputStream;
  31 import java.rmi.AccessException;
  32 import java.rmi.server.RemoteCall;
  33 
  34 import sun.rmi.transport.Connection;
  35 import sun.rmi.transport.StreamRemoteCall;
  36 import sun.rmi.transport.tcp.TCPConnection;
  37 
  38 /**
  39  * Skeleton to dispatch RegistryImpl methods.
  40  * Originally generated by RMIC but frozen to match the stubs.
  41  */
  42 @SuppressWarnings({"deprecation", "serial"})
  43 public final class RegistryImpl_Skel
  44         implements java.rmi.server.Skeleton {
  45     private static final java.rmi.server.Operation[] operations = {
  46             new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
  47             new java.rmi.server.Operation("java.lang.String list()[]"),
  48             new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
  49             new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
  50             new java.rmi.server.Operation("void unbind(java.lang.String)")
  51     };
  52 
  53     private static final long interfaceHash = 4905912898345647071L;
  54 
  55     public java.rmi.server.Operation[] getOperations() {
  56         return operations.clone();
  57     }
  58 
  59     public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash)
  60             throws java.lang.Exception {
  61         if (opnum < 0) {
  62             if (hash == 7583982177005850366L) {
  63                 opnum = 0;
  64             } else if (hash == 2571371476350237748L) {
  65                 opnum = 1;
  66             } else if (hash == -7538657168040752697L) {
  67                 opnum = 2;
  68             } else if (hash == -8381844669958460146L) {
  69                 opnum = 3;
  70             } else if (hash == 7305022919901907578L) {
  71                 opnum = 4;
  72             } else {
  73                 throw new java.rmi.UnmarshalException("invalid method hash");
  74             }
  75         } else {
  76             if (hash != interfaceHash)
  77                 throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
  78         }
  79 
  80         sun.rmi.registry.RegistryImpl server = (sun.rmi.registry.RegistryImpl) obj;
  81         switch (opnum) {
  82             case 0: // bind(String, Remote)
  83             {
  84                 // Check access before reading the arguments
  85                 RegistryImpl.checkAccess("Registry.bind");
  86 
  87                 java.lang.String $param_String_1;
  88                 java.rmi.Remote $param_Remote_2;
  89                 try {
  90                     java.io.ObjectInput in = call.getInputStream();
  91                     $param_String_1 = (java.lang.String) in.readObject();
  92                     $param_Remote_2 = (java.rmi.Remote) in.readObject();
  93                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
  94                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
  95                 } finally {
  96                     call.releaseInputStream();
  97                 }
  98                 server.bind($param_String_1, $param_Remote_2);
  99                 try {
 100                     call.getResultStream(true);
 101                 } catch (java.io.IOException e) {
 102                     throw new java.rmi.MarshalException("error marshalling return", e);
 103                 }
 104                 break;
 105             }
 106 
 107             case 1: // list()
 108             {
 109                 call.releaseInputStream();
 110                 java.lang.String[] $result = server.list();
 111                 try {
 112                     java.io.ObjectOutput out = call.getResultStream(true);
 113                     out.writeObject($result);
 114                 } catch (java.io.IOException e) {
 115                     throw new java.rmi.MarshalException("error marshalling return", e);
 116                 }
 117                 break;
 118             }
 119 
 120             case 2: // lookup(String)
 121             {
 122                 java.lang.String $param_String_1;
 123                 try {
 124                     java.io.ObjectInput in = call.getInputStream();
 125                     $param_String_1 = (java.lang.String) in.readObject();
 126                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
 127                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
 128                 } finally {
 129                     call.releaseInputStream();
 130                 }
 131                 java.rmi.Remote $result = server.lookup($param_String_1);
 132                 try {
 133                     java.io.ObjectOutput out = call.getResultStream(true);
 134                     out.writeObject($result);
 135                 } catch (java.io.IOException e) {
 136                     throw new java.rmi.MarshalException("error marshalling return", e);
 137                 }
 138                 break;
 139             }
 140 
 141             case 3: // rebind(String, Remote)
 142             {
 143                 // Check access before reading the arguments
 144                 RegistryImpl.checkAccess("Registry.rebind");
 145 
 146                 java.lang.String $param_String_1;
 147                 java.rmi.Remote $param_Remote_2;
 148                 try {
 149                     java.io.ObjectInput in = call.getInputStream();
 150                     $param_String_1 = (java.lang.String) in.readObject();
 151                     $param_Remote_2 = (java.rmi.Remote) in.readObject();
 152                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
 153                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
 154                 } finally {
 155                     call.releaseInputStream();
 156                 }
 157                 server.rebind($param_String_1, $param_Remote_2);
 158                 try {
 159                     call.getResultStream(true);
 160                 } catch (java.io.IOException e) {
 161                     throw new java.rmi.MarshalException("error marshalling return", e);
 162                 }
 163                 break;
 164             }
 165 
 166             case 4: // unbind(String)
 167             {
 168                 // Check access before reading the arguments
 169                 RegistryImpl.checkAccess("Registry.unbind");
 170 
 171                 java.lang.String $param_String_1;
 172                 try {
 173                     java.io.ObjectInput in = call.getInputStream();
 174                     $param_String_1 = (java.lang.String) in.readObject();
 175                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
 176                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
 177                 } finally {
 178                     call.releaseInputStream();
 179                 }
 180                 server.unbind($param_String_1);
 181                 try {
 182                     call.getResultStream(true);
 183                 } catch (java.io.IOException e) {
 184                     throw new java.rmi.MarshalException("error marshalling return", e);
 185                 }
 186                 break;
 187             }
 188 
 189             default:
 190                 throw new java.rmi.UnmarshalException("invalid method number");
 191         }
 192     }
 193 }