1 /*
  2  * Copyright (c) 2002, 2020, 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 package java.rmi.activation;
 27 
 28 import java.rmi.Remote;
 29 import java.rmi.RemoteException;
 30 import java.rmi.server.RemoteObject;
 31 
 32 /**
 33  * {@code ActivationGroup_Stub} is a stub class for the subclasses of {@code java.rmi.activation.ActivationGroup}
 34  * that are exported as a {@code java.rmi.server.UnicastRemoteObject}.
 35  *
 36  * @since 1.2
 37  */
 38 @SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
 39 public final class ActivationGroup_Stub
 40         extends java.rmi.server.RemoteStub
 41         implements ActivationInstantiator, Remote {
 42     @java.io.Serial
 43     private static final long serialVersionUID = 2;
 44 
 45     private static java.lang.reflect.Method $method_newInstance_0;
 46 
 47     static {
 48         try {
 49             $method_newInstance_0 =
 50                     ActivationInstantiator.class.getMethod("newInstance",
 51                             new java.lang.Class<?>[] {ActivationID.class, ActivationDesc.class});
 52         } catch (java.lang.NoSuchMethodException e) {
 53             throw new java.lang.NoSuchMethodError(
 54                     "stub class initialization failed");
 55         }
 56     }
 57 
 58     /**
 59      * Constructs a stub for the {@code ActivationGroup} class.
 60      * It invokes the superclass {@code RemoteStub(RemoteRef)}
 61      * constructor with its argument, {@code ref}.
 62      *
 63      * @param ref a remote ref
 64      */
 65     public ActivationGroup_Stub(java.rmi.server.RemoteRef ref) {
 66         super(ref);
 67     }
 68 
 69     /**
 70      * Stub method for {@code ActivationGroup.newInstance}.  Invokes
 71      * the {@code invoke} method on this instance's
 72      * {@code RemoteObject.ref} field, with {@code this} as the
 73      * first argument, a two-element {@code Object[]} as the second
 74      * argument (with {@code id} as the first element and
 75      * {@code desc} as the second element), and -5274445189091581345L
 76      * as the third argument, and returns the result.  If that invocation
 77      * throws a {@code RuntimeException}, {@code RemoteException},
 78      * or an {@code ActivationException}, then that exception is
 79      * thrown to the caller.  If that invocation throws any other
 80      * {@code java.lang.Exception}, then a
 81      * {@code java.rmi.UnexpectedException} is thrown to the caller
 82      * with the original exception as the cause.
 83      *
 84      * @param id   an activation identifier
 85      * @param desc an activation descriptor
 86      * @return the result of the invocation
 87      * @throws RemoteException if invocation results in a {@code RemoteException}
 88      * @throws ActivationException      if invocation results in an {@code ActivationException}
 89      */
 90     public java.rmi.MarshalledObject newInstance(ActivationID id,
 91                                                                          ActivationDesc desc)
 92             throws java.rmi.RemoteException, ActivationException {
 93         try {
 94             Object $result = ref.invoke(this, $method_newInstance_0,
 95                     new java.lang.Object[]{id, desc}, -5274445189091581345L);
 96             return ((java.rmi.MarshalledObject) $result);
 97         } catch (java.lang.RuntimeException | java.rmi.RemoteException | ActivationException e) {
 98             throw e;
 99         } catch (java.lang.Exception e) {
100             throw new java.rmi.UnexpectedException("undeclared checked exception", e);
101         }
102     }
103 }