// **********************************************************************
//
// Generated by the ORBacus IDL to Java Translator
//
// Copyright (c) 2005
// IONA Technologies, Inc.
// Waltham, MA, USA
//
// All Rights Reserved
//
// **********************************************************************

// Version: 4.3.2

package org.exolab.jms.jobserver;

//
// IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession:1.0
//
public abstract class ServerSessionPOA
    extends org.omg.PortableServer.Servant
    implements org.omg.CORBA.portable.InvokeHandler,
               ServerSessionOperations
{
    static final String[] _ob_ids_ =
    {
        "IDL:org.exolab.jms/org/exolab/jms/jobserver/ServerSession:1.0",
    };

    public ServerSession
    _this()
    {
        return ServerSessionHelper.narrow(super._this_object());
    }

    public ServerSession
    _this(org.omg.CORBA.ORB orb)
    {
        return ServerSessionHelper.narrow(super._this_object(orb));
    }

    public String[]
    _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId)
    {
        return _ob_ids_;
    }

    public org.omg.CORBA.portable.OutputStream
    _invoke(String opName,
            org.omg.CORBA.portable.InputStream in,
            org.omg.CORBA.portable.ResponseHandler handler)
    {
        final String[] _ob_names =
        {
            "acknowledgeMessage",
            "close",
            "closeConsumer",
            "createConsumer",
            "receive",
            "receiveNoWait",
            "send"
        };

        int _ob_left = 0;
        int _ob_right = _ob_names.length;
        int _ob_index = -1;

        while(_ob_left < _ob_right)
        {
            int _ob_m = (_ob_left + _ob_right) / 2;
            int _ob_res = _ob_names[_ob_m].compareTo(opName);
            if(_ob_res == 0)
            {
                _ob_index = _ob_m;
                break;
            }
            else if(_ob_res > 0)
                _ob_right = _ob_m;
            else
                _ob_left = _ob_m + 1;
        }

        if(_ob_index == -1 && opName.charAt(0) == '_')
        {
            _ob_left = 0;
            _ob_right = _ob_names.length;
            String _ob_ami_op =
                opName.substring(1);

            while(_ob_left < _ob_right)
            {
                int _ob_m = (_ob_left + _ob_right) / 2;
                int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
                if(_ob_res == 0)
                {
                    _ob_index = _ob_m;
                    break;
                }
                else if(_ob_res > 0)
                    _ob_right = _ob_m;
                else
                    _ob_left = _ob_m + 1;
            }
        }

        switch(_ob_index)
        {
        case 0: // acknowledgeMessage
            return _OB_op_acknowledgeMessage(in, handler);

        case 1: // close
            return _OB_op_close(in, handler);

        case 2: // closeConsumer
            return _OB_op_closeConsumer(in, handler);

        case 3: // createConsumer
            return _OB_op_createConsumer(in, handler);

        case 4: // receive
            return _OB_op_receive(in, handler);

        case 5: // receiveNoWait
            return _OB_op_receiveNoWait(in, handler);

        case 6: // send
            return _OB_op_send(in, handler);
        }

        throw new org.omg.CORBA.BAD_OPERATION();
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_acknowledgeMessage(org.omg.CORBA.portable.InputStream in,
                              org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        long _ob_a0 = in.read_longlong();
        String _ob_a1 = in.read_string();
        acknowledgeMessage(_ob_a0, _ob_a1);
        out = handler.createReply();
        return out;
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_close(org.omg.CORBA.portable.InputStream in,
                 org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        close();
        out = handler.createReply();
        return out;
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_closeConsumer(org.omg.CORBA.portable.InputStream in,
                         org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        long _ob_a0 = in.read_longlong();
        closeConsumer(_ob_a0);
        out = handler.createReply();
        return out;
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_createConsumer(org.omg.CORBA.portable.InputStream in,
                          org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        DestinationData _ob_a0 = DestinationDataHelper.read(in);
        String _ob_a1 = in.read_string();
        boolean _ob_a2 = in.read_boolean();
        long _ob_r = createConsumer(_ob_a0, _ob_a1, _ob_a2);
        out = handler.createReply();
        out.write_longlong(_ob_r);
        return out;
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_receive(org.omg.CORBA.portable.InputStream in,
                   org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        long _ob_a0 = in.read_longlong();
        long _ob_a1 = in.read_longlong();
        MessageData _ob_r = receive(_ob_a0, _ob_a1);
        out = handler.createReply();
        MessageDataHelper.write(out, _ob_r);
        return out;
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_receiveNoWait(org.omg.CORBA.portable.InputStream in,
                         org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        long _ob_a0 = in.read_longlong();
        MessageData _ob_r = receiveNoWait(_ob_a0);
        out = handler.createReply();
        MessageDataHelper.write(out, _ob_r);
        return out;
    }

    private org.omg.CORBA.portable.OutputStream
    _OB_op_send(org.omg.CORBA.portable.InputStream in,
                org.omg.CORBA.portable.ResponseHandler handler)
    {
        org.omg.CORBA.portable.OutputStream out = null;
        MessageData _ob_a0 = MessageDataHelper.read(in);
        send(_ob_a0);
        out = handler.createReply();
        return out;
    }
}
