/*
 * Automatically generated by jrpcgen 1.1.6 on 21.02.24 22:11
 * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
 * See http://remotetea.sourceforge.net for details
 */
package tests.org.acplt.oncrpc.jrpcgen;
import org.acplt.oncrpc.*;
import java.io.IOException;

import java.net.InetAddress;

import org.acplt.oncrpc.server.*;

/**
 */
public abstract class demoServerStub extends OncRpcServerStub implements OncRpcDispatchable {

    public demoServerStub()
           throws OncRpcException, IOException {
        this(0);
    }

    public demoServerStub(int port)
           throws OncRpcException, IOException {
        this(null, port);
    }

    public demoServerStub(InetAddress bindAddr, int port)
           throws OncRpcException, IOException {
        info = new OncRpcServerTransportRegistrationInfo [] {
            new OncRpcServerTransportRegistrationInfo(demo.DEMO, 1),
            new OncRpcServerTransportRegistrationInfo(demo.DEMO, 2)
        };
        transports = new OncRpcServerTransport [] {
            new OncRpcUdpServerTransport(this, bindAddr, port, info, 32768),
            new OncRpcTcpServerTransport(this, bindAddr, port, info, 32768)
        };
    }

    public void dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure)
           throws OncRpcException, IOException {
        if ( version == 1 ) {
            switch ( procedure ) {
            case 0: {
                call.retrieveCall(XdrVoid.XDR_VOID);
                NULL_1();
                call.reply(XdrVoid.XDR_VOID);
                break;
            }
            case 1: {
                XdrString args$ = new XdrString();
                call.retrieveCall(args$);
                XdrString result$ = new XdrString(echo_1(args$.stringValue()));
                call.reply(result$);
                break;
            }
            case 2: {
                STRINGVECTOR args$ = new STRINGVECTOR();
                call.retrieveCall(args$);
                XdrString result$ = new XdrString(concat_1(args$));
                call.reply(result$);
                break;
            }
            case 3: {
                XdrEnum<ENUMFOO> args$ = new XdrEnum<ENUMFOO>(ENUMFOO.FOO);
                call.retrieveCall(args$);
                XdrBoolean result$ = new XdrBoolean(checkfoo_1(args$.getValue()));
                call.reply(result$);
                break;
            }
            case 4: {
                call.retrieveCall(XdrVoid.XDR_VOID);
                XdrEnum<ENUMFOO> result$ = new XdrEnum<ENUMFOO>(foo_1());
                call.reply(result$);
                break;
            }
            case 5: {
                LINKEDLIST args$ = new LINKEDLIST();
                call.retrieveCall(args$);
                LINKEDLIST result$ = ll_1(args$);
                call.reply(result$);
                break;
            }
            case 42: {
                call.retrieveCall(XdrVoid.XDR_VOID);
                SOMERESULT result$ = readSomeResult_1();
                call.reply(result$);
                break;
            }
            default:
                call.failProcedureUnavailable();
            }
        } else if ( version == 2 ) {
            switch ( procedure ) {
            case 0: {
                call.retrieveCall(XdrVoid.XDR_VOID);
                NULL_2();
                call.reply(XdrVoid.XDR_VOID);
                break;
            }
            case 42: {
                class XdrAble$ implements XdrAble {
                    public String arg1;
                    public String arg2;
                    public void xdrEncode(XdrEncodingStream xdr)
                           throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                           throws OncRpcException, IOException {
                        arg1 = xdr.xdrDecodeString();
                        arg2 = xdr.xdrDecodeString();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrString result$ = new XdrString(cat_2(args$.arg1, args$.arg2));
                call.reply(result$);
                break;
            }
            case 43: {
                class XdrAble$ implements XdrAble {
                    public String one;
                    public String two;
                    public String three;
                    public void xdrEncode(XdrEncodingStream xdr)
                           throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                           throws OncRpcException, IOException {
                        one = xdr.xdrDecodeString();
                        two = xdr.xdrDecodeString();
                        three = xdr.xdrDecodeString();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                XdrString result$ = new XdrString(cat3_2(args$.one, args$.two, args$.three));
                call.reply(result$);
                break;
            }
            case 3: {
                XdrEnum<ENUMFOO> args$ = new XdrEnum<ENUMFOO>(ENUMFOO.FOO);
                call.retrieveCall(args$);
                XdrString result$ = new XdrString(checkfoo_2(args$.getValue()));
                call.reply(result$);
                break;
            }
            case 55: {
                class XdrAble$ implements XdrAble {
                    public LINKEDLIST l1;
                    public LINKEDLIST l2;
                    public void xdrEncode(XdrEncodingStream xdr)
                           throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                           throws OncRpcException, IOException {
                        l1 = new LINKEDLIST(xdr);
                        l2 = new LINKEDLIST(xdr);
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                LINKEDLIST result$ = llcat_2(args$.l1, args$.l2);
                call.reply(result$);
                break;
            }
            case 100: {
                class XdrAble$ implements XdrAble {
                    public String a;
                    public ENUMFOO b;
                    public ENUMFOO c;
                    public int d;
                    public void xdrEncode(XdrEncodingStream xdr)
                           throws OncRpcException, IOException {
                    }
                    public void xdrDecode(XdrDecodingStream xdr)
                           throws OncRpcException, IOException {
                        a = xdr.xdrDecodeString();
                        b = XdrEnum.create(ENUMFOO.FOO, xdr);
                        c = XdrEnum.create(ENUMFOO.FOO, xdr);
                        d = xdr.xdrDecodeInt();
                    }
                };
                XdrAble$ args$ = new XdrAble$();
                call.retrieveCall(args$);
                test_2(args$.a, args$.b, args$.c, args$.d);
                call.reply(XdrVoid.XDR_VOID);
                break;
            }
            default:
                call.failProcedureUnavailable();
            }
        } else {
            call.failProgramUnavailable();
        }
    }

    /**
     * Usually there is no need to define
     * the null-procedure call, explicitely.
     */
    public abstract void NULL_1();

    /**
     * Let's echo the passed string!
     *
     * @param The string to be echoed. 
     * @return The passed string.
     */
    public abstract String echo_1(String arg1);

    /**
     * Call remote procedure concat_1.
     * @param arg1 parameter (of type STRINGVECTOR) to the remote procedure call.
     * @return Result from remote procedure call (of type string).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract String concat_1(STRINGVECTOR arg1);

    /**
     * Call remote procedure checkfoo_1.
     * @param arg1 parameter (of type ENUMFOO) to the remote procedure call.
     * @return Result from remote procedure call (of type bool).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract boolean checkfoo_1(ENUMFOO arg1);

    /**
     * Call remote procedure foo_1.
     * @return Result from remote procedure call (of type ENUMFOO).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract ENUMFOO foo_1();

    /**
     * Call remote procedure ll_1.
     * @param arg1 parameter (of type LINKEDLIST) to the remote procedure call.
     * @return Result from remote procedure call (of type LINKEDLIST).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract LINKEDLIST ll_1(LINKEDLIST arg1);

    /**
     * Call remote procedure readSomeResult_1.
     * @return Result from remote procedure call (of type SOMERESULT).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract SOMERESULT readSomeResult_1();

    /**
     * Call remote procedure NULL_2.
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract void NULL_2();

    /**
     * Call remote procedure cat_2.
     * @param arg1 parameter (of type String) to the remote procedure call.
     * @param arg2 parameter (of type String) to the remote procedure call.
     * @return Result from remote procedure call (of type string).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract String cat_2(String arg1, String arg2);

    /**
     * Concatenates the passed strings.
     *
     * @param one The beginning of the string to build
     * @param two The second part of the string to build
     * @param three The last part of the string to build
     * @return The string resulting from the concatenation of
     * the passed three strings {@code one}, {@code two} and
     * {@code three}.
     */
    public abstract String cat3_2(String one, String two, String three);

    /**
     * Call remote procedure checkfoo_2.
     * @param foo parameter (of type ENUMFOO) to the remote procedure call.
     * @return Result from remote procedure call (of type string).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract String checkfoo_2(ENUMFOO foo);

    /**
     * Call remote procedure llcat_2.
     * @param l1 parameter (of type LINKEDLIST) to the remote procedure call.
     * @param l2 parameter (of type LINKEDLIST) to the remote procedure call.
     * @return Result from remote procedure call (of type LINKEDLIST).
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract LINKEDLIST llcat_2(LINKEDLIST l1, LINKEDLIST l2);

    /**
     * Call remote procedure test_2.
     * @param a parameter (of type String) to the remote procedure call.
     * @param b parameter (of type ENUMFOO) to the remote procedure call.
     * @param c parameter (of type ENUMFOO) to the remote procedure call.
     * @param d parameter (of type int) to the remote procedure call.
     * @throws OncRpcException if an ONC/RPC error occurs.
     * @throws IOException if an I/O error occurs.
     */
    public abstract void test_2(String a, ENUMFOO b, ENUMFOO c, int d);

}
// End of demoServerStub.java
