1 /*
   2  * Copyright (c) 2017, 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 (hash != interfaceHash)
  62             throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
  63 
  64         sun.rmi.registry.RegistryImpl server = (sun.rmi.registry.RegistryImpl) obj;
  65         switch (opnum) {
  66             case 0: // bind(String, Remote)
  67             {
  68                 // Check access before reading the arguments
  69                 RegistryImpl.checkAccess("Registry.bind");
  70 
  71                 java.lang.String $param_String_1;
  72                 java.rmi.Remote $param_Remote_2;
  73                 try {
  74                     java.io.ObjectInput in = call.getInputStream();
  75                     $param_String_1 = (java.lang.String) in.readObject();
  76                     $param_Remote_2 = (java.rmi.Remote) in.readObject();
  77                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
  78                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
  79                 } finally {
  80                     call.releaseInputStream();
  81                 }
  82                 server.bind($param_String_1, $param_Remote_2);
  83                 try {
  84                     call.getResultStream(true);
  85                 } catch (java.io.IOException e) {
  86                     throw new java.rmi.MarshalException("error marshalling return", e);
  87                 }
  88                 break;
  89             }
  90 
  91             case 1: // list()
  92             {
  93                 call.releaseInputStream();
  94                 java.lang.String[] $result = server.list();
  95                 try {
  96                     java.io.ObjectOutput out = call.getResultStream(true);
  97                     out.writeObject($result);
  98                 } catch (java.io.IOException e) {
  99                     throw new java.rmi.MarshalException("error marshalling return", e);
 100                 }
 101                 break;
 102             }
 103 
 104             case 2: // lookup(String)
 105             {
 106                 java.lang.String $param_String_1;
 107                 try {
 108                     java.io.ObjectInput in = call.getInputStream();
 109                     $param_String_1 = (java.lang.String) in.readObject();
 110                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
 111                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
 112                 } finally {
 113                     call.releaseInputStream();
 114                 }
 115                 java.rmi.Remote $result = server.lookup($param_String_1);
 116                 try {
 117                     java.io.ObjectOutput out = call.getResultStream(true);
 118                     out.writeObject($result);
 119                 } catch (java.io.IOException e) {
 120                     throw new java.rmi.MarshalException("error marshalling return", e);
 121                 }
 122                 break;
 123             }
 124 
 125             case 3: // rebind(String, Remote)
 126             {
 127                 // Check access before reading the arguments
 128                 RegistryImpl.checkAccess("Registry.rebind");
 129 
 130                 java.lang.String $param_String_1;
 131                 java.rmi.Remote $param_Remote_2;
 132                 try {
 133                     java.io.ObjectInput in = call.getInputStream();
 134                     $param_String_1 = (java.lang.String) in.readObject();
 135                     $param_Remote_2 = (java.rmi.Remote) in.readObject();
 136                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
 137                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
 138                 } finally {
 139                     call.releaseInputStream();
 140                 }
 141                 server.rebind($param_String_1, $param_Remote_2);
 142                 try {
 143                     call.getResultStream(true);
 144                 } catch (java.io.IOException e) {
 145                     throw new java.rmi.MarshalException("error marshalling return", e);
 146                 }
 147                 break;
 148             }
 149 
 150             case 4: // unbind(String)
 151             {
 152                 // Check access before reading the arguments
 153                 RegistryImpl.checkAccess("Registry.unbind");
 154 
 155                 java.lang.String $param_String_1;
 156                 try {
 157                     java.io.ObjectInput in = call.getInputStream();
 158                     $param_String_1 = (java.lang.String) in.readObject();
 159                 } catch (java.io.IOException | java.lang.ClassNotFoundException e) {
 160                     throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
 161                 } finally {
 162                     call.releaseInputStream();
 163                 }
 164                 server.unbind($param_String_1);
 165                 try {
 166                     call.getResultStream(true);
 167                 } catch (java.io.IOException e) {
 168                     throw new java.rmi.MarshalException("error marshalling return", e);
 169                 }
 170                 break;
 171             }
 172 
 173             default:
 174                 throw new java.rmi.UnmarshalException("invalid method number");
 175         }
 176     }
 177 }