1/*
2 * Copyright (c) 2016, 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 */
25import java.rmi.Remote;
26
27import javax.rmi.CORBA.Tie;
28import javax.rmi.CORBA.Util;
29
30import org.omg.CORBA.BAD_OPERATION;
31import org.omg.CORBA.ORB;
32import org.omg.CORBA.SystemException;
33import org.omg.CORBA.portable.InputStream;
34import org.omg.CORBA.portable.OutputStream;
35import org.omg.CORBA.portable.ResponseHandler;
36import org.omg.CORBA.portable.UnknownException;
37import org.omg.CORBA_2_3.portable.ObjectImpl;
38
39
40/**
41 * ObjectStreamClass$Echo server tie class generated by rmic, do not edit.
42 */
43public class ObjectStreamTest$_Server_Tie extends ObjectImpl implements Tie {
44
45    volatile private ObjectStreamTest.Server target = null;
46
47    private static final String[] _type_ids = {
48        "RMI:ObjectStreamTest\\U0024Echo:0000000000000000"
49    };
50
51    public void setTarget(Remote target) {
52        this.target = (ObjectStreamTest.Server) target;
53    }
54
55    public Remote getTarget() {
56        return target;
57    }
58
59    public org.omg.CORBA.Object thisObject() {
60        return this;
61    }
62
63    public void deactivate() {
64        _orb().disconnect(this);
65        _set_delegate(null);
66        target = null;
67    }
68
69    public ORB orb() {
70        return _orb();
71    }
72
73    public void orb(ORB orb) {
74        orb.connect(this);
75    }
76
77    public String[] _ids() {
78        return _type_ids.clone();
79    }
80
81    public OutputStream  _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
82        try {
83            ObjectStreamTest.Server target = this.target;
84            if (target == null) {
85                throw new java.io.IOException();
86            }
87            org.omg.CORBA_2_3.portable.InputStream in =
88                (org.omg.CORBA_2_3.portable.InputStream) _in;
89            if (method.equals("echo")) {
90                Object arg0 = Util.readAny(in);
91                Object result = target.echo(arg0);
92                OutputStream out = reply.createReply();
93                Util.writeAny(out,result);
94                return out;
95            }
96            throw new BAD_OPERATION();
97        } catch (SystemException ex) {
98            throw ex;
99        } catch (Throwable ex) {
100            throw new UnknownException(ex);
101        }
102    }
103}
104