DataBufferPOA.java 2.51 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.service;

import com.adobe.service.BufDataHelper;
import com.adobe.service.DataBuffer;
import com.adobe.service.DataBufferHelper;
import com.adobe.service.DataBufferOperations;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.InvokeHandler;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ResponseHandler;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.Servant;

import java.util.Hashtable;

public abstract class DataBufferPOA
extends Servant
implements InvokeHandler,
DataBufferOperations {
    private static final Hashtable m_opsHash = new Hashtable();
    private String[] ids = new String[]{"IDL:com/adobe/service/DataBuffer:1.0"};

    public DataBuffer _this() {
        return DataBufferHelper.narrow(this._this_object());
    }

    public DataBuffer _this(ORB orb) {
        return DataBufferHelper.narrow(this._this_object(orb));
    }

    public OutputStream _invoke(String method, InputStream _input, ResponseHandler handler) throws SystemException {
        OutputStream _out = null;
        Integer opsIndex = (Integer)m_opsHash.get(method);
        if (null == opsIndex) {
            throw new BAD_OPERATION(method + " not found");
        }
        switch (opsIndex) {
            case 0: {
                _out = handler.createReply();
                _out.write_string(this.getContentType());
                break;
            }
            case 1: {
                String _arg0 = _input.read_string();
                _out = handler.createReply();
                this.setContentType(_arg0);
                break;
            }
            case 2: {
                long _arg0 = _input.read_longlong();
                long _arg1 = _input.read_longlong();
                _out = handler.createReply();
                BufDataHelper.write(_out, this.getBytes(_arg0, _arg1));
                break;
            }
            case 3: {
                _out = handler.createReply();
                _out.write_longlong(this.getBufLength());
            }
        }
        return _out;
    }

    public String[] _all_interfaces(POA poa, byte[] obj_id) {
        return this.ids;
    }

    static {
        m_opsHash.put("getContentType", new Integer(0));
        m_opsHash.put("setContentType", new Integer(1));
        m_opsHash.put("getBytes", new Integer(2));
        m_opsHash.put("getBufLength", new Integer(3));
    }
}