package wenrgise.workflow.ejb.facade;

import java.rmi.RemoteException;
import java.rmi.UnexpectedException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import javax.ejb.EJBMetaData;
import javax.ejb.Handle;
import javax.ejb.HomeHandle;
import javax.ejb.RemoveException;
import javax.rmi.CORBA.Stub;
import javax.rmi.CORBA.Util;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.RemarshalException;
import org.omg.CORBA.portable.ServantObject;
import org.omg.CORBA_2_3.portable.InputStream;

public class _WorkFlowFacade2Home_Stub extends Stub implements WorkFlowFacade2Home {
  private static final String[] _type_ids = new String[] { "RMI:wenrgise.workflow.ejb.facade.WorkFlowFacade2Home:0000000000000000", "RMI:javax.ejb.EJBHome:0000000000000000" };
  
  public String[] _ids() {
    return _type_ids;
  }
  
  public WorkFlowFacade2 create() throws CreateException, RemoteException {
    if (!Util.isLocal(this))
      try {
        InputStream inputStream = null;
        try {
          OutputStream outputStream = _request("create", true);
          inputStream = (InputStream)_invoke(outputStream);
          return (WorkFlowFacade2)inputStream.read_Object(WorkFlowFacade2.class);
        } catch (ApplicationException applicationException) {
          inputStream = (InputStream)applicationException.getInputStream();
          String str = inputStream.read_string();
          if (str.equals("IDL:javax/ejb/CreateEx:1.0"))
            throw (CreateException)inputStream.read_value(CreateException.class); 
          throw new UnexpectedException(str);
        } catch (RemarshalException remarshalException) {
          return create();
        } finally {
          _releaseReply(inputStream);
        } 
      } catch (SystemException systemException) {
        throw Util.mapSystemException(systemException);
      }  
    ServantObject servantObject = _servant_preinvoke("create", WorkFlowFacade2Home.class);
    if (servantObject == null)
      return create(); 
    try {
      WorkFlowFacade2 workFlowFacade2 = ((WorkFlowFacade2Home)servantObject.servant).create();
      return (WorkFlowFacade2)Util.copyObject(workFlowFacade2, _orb());
    } catch (Throwable throwable1) {
      Throwable throwable2 = (Throwable)Util.copyObject(throwable1, _orb());
      if (throwable2 instanceof CreateException)
        throw (CreateException)throwable2; 
      throw Util.wrapException(throwable2);
    } finally {
      _servant_postinvoke(servantObject);
    } 
  }
  
  public EJBMetaData getEJBMetaData() throws RemoteException {
    if (!Util.isLocal(this))
      try {
        InputStream inputStream = null;
        try {
          OutputStream outputStream = _request("_get_EJBMetaData", true);
          inputStream = (InputStream)_invoke(outputStream);
          return (EJBMetaData)inputStream.read_value(EJBMetaData.class);
        } catch (ApplicationException applicationException) {
          inputStream = (InputStream)applicationException.getInputStream();
          String str = inputStream.read_string();
          throw new UnexpectedException(str);
        } catch (RemarshalException remarshalException) {
          return getEJBMetaData();
        } finally {
          _releaseReply(inputStream);
        } 
      } catch (SystemException systemException) {
        throw Util.mapSystemException(systemException);
      }  
    ServantObject servantObject = _servant_preinvoke("_get_EJBMetaData", EJBHome.class);
    if (servantObject == null)
      return getEJBMetaData(); 
    try {
      EJBMetaData eJBMetaData = ((EJBHome)servantObject.servant).getEJBMetaData();
      return (EJBMetaData)Util.copyObject(eJBMetaData, _orb());
    } catch (Throwable throwable1) {
      Throwable throwable2 = (Throwable)Util.copyObject(throwable1, _orb());
      throw Util.wrapException(throwable2);
    } finally {
      _servant_postinvoke(servantObject);
    } 
  }
  
  public HomeHandle getHomeHandle() throws RemoteException {
    if (!Util.isLocal(this))
      try {
        InputStream inputStream = null;
        try {
          OutputStream outputStream = _request("_get_homeHandle", true);
          inputStream = (InputStream)_invoke(outputStream);
          return (HomeHandle)inputStream.read_abstract_interface(HomeHandle.class);
        } catch (ApplicationException applicationException) {
          inputStream = (InputStream)applicationException.getInputStream();
          String str = inputStream.read_string();
          throw new UnexpectedException(str);
        } catch (RemarshalException remarshalException) {
          return getHomeHandle();
        } finally {
          _releaseReply(inputStream);
        } 
      } catch (SystemException systemException) {
        throw Util.mapSystemException(systemException);
      }  
    ServantObject servantObject = _servant_preinvoke("_get_homeHandle", EJBHome.class);
    if (servantObject == null)
      return getHomeHandle(); 
    try {
      HomeHandle homeHandle = ((EJBHome)servantObject.servant).getHomeHandle();
      return (HomeHandle)Util.copyObject(homeHandle, _orb());
    } catch (Throwable throwable1) {
      Throwable throwable2 = (Throwable)Util.copyObject(throwable1, _orb());
      throw Util.wrapException(throwable2);
    } finally {
      _servant_postinvoke(servantObject);
    } 
  }
  
  public void remove(Object paramObject) throws RemoteException, RemoveException {
    if (!Util.isLocal(this))
      try {
        InputStream inputStream = null;
        try {
          OutputStream outputStream = _request("remove__java_lang_Object", true);
          Util.writeAny(outputStream, paramObject);
          _invoke(outputStream);
          return;
        } catch (ApplicationException applicationException) {
          inputStream = (InputStream)applicationException.getInputStream();
          String str = inputStream.read_string();
          if (str.equals("IDL:javax/ejb/RemoveEx:1.0"))
            throw (RemoveException)inputStream.read_value(RemoveException.class); 
          throw new UnexpectedException(str);
        } catch (RemarshalException remarshalException) {
          remove(paramObject);
          return;
        } finally {
          _releaseReply(inputStream);
        } 
      } catch (SystemException systemException) {
        throw Util.mapSystemException(systemException);
      }  
    ServantObject servantObject = _servant_preinvoke("remove__java_lang_Object", EJBHome.class);
    if (servantObject == null) {
      remove(paramObject);
      return;
    } 
    try {
      Object object = Util.copyObject(paramObject, _orb());
      ((EJBHome)servantObject.servant).remove(object);
      return;
    } catch (Throwable throwable1) {
      Throwable throwable2 = (Throwable)Util.copyObject(throwable1, _orb());
      if (throwable2 instanceof RemoveException)
        throw (RemoveException)throwable2; 
      throw Util.wrapException(throwable2);
    } finally {
      _servant_postinvoke(servantObject);
    } 
  }
  
  public void remove(Handle paramHandle) throws RemoteException, RemoveException {
    if (!Util.isLocal(this))
      try {
        InputStream inputStream = null;
        try {
          OutputStream outputStream = _request("remove__javax_ejb_Handle", true);
          Util.writeAbstractObject(outputStream, paramHandle);
          _invoke(outputStream);
          return;
        } catch (ApplicationException applicationException) {
          inputStream = (InputStream)applicationException.getInputStream();
          String str = inputStream.read_string();
          if (str.equals("IDL:javax/ejb/RemoveEx:1.0"))
            throw (RemoveException)inputStream.read_value(RemoveException.class); 
          throw new UnexpectedException(str);
        } catch (RemarshalException remarshalException) {
          remove(paramHandle);
          return;
        } finally {
          _releaseReply(inputStream);
        } 
      } catch (SystemException systemException) {
        throw Util.mapSystemException(systemException);
      }  
    ServantObject servantObject = _servant_preinvoke("remove__javax_ejb_Handle", EJBHome.class);
    if (servantObject == null) {
      remove(paramHandle);
      return;
    } 
    try {
      Handle handle = (Handle)Util.copyObject(paramHandle, _orb());
      ((EJBHome)servantObject.servant).remove(handle);
      return;
    } catch (Throwable throwable1) {
      Throwable throwable2 = (Throwable)Util.copyObject(throwable1, _orb());
      if (throwable2 instanceof RemoveException)
        throw (RemoveException)throwable2; 
      throw Util.wrapException(throwable2);
    } finally {
      _servant_postinvoke(servantObject);
    } 
  }
}
