Exemplo n.º 1
0
 ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current)
 {
     Ice.Communicator communicator = current.adapter.getCommunicator();
     Ice.InputStream inS = Ice.Util.createInputStream(communicator, inParams);
     inS.startEncapsulation();
     Ice.OutputStream outS = Ice.Util.createOutputStream(communicator);
     outS.startEncapsulation();
     if(current.operation.Equals("opOneway"))
     {
         outParams = new byte[0];
         return true;
     }
     else if(current.operation.Equals("opString"))
     {
         string s = inS.readString();
         outS.writeString(s);
         outS.writeString(s);
         outS.endEncapsulation();
         outParams = outS.finished();
         return true;
     }
     else if(current.operation.Equals("opException"))
     {
         Test.MyException ex = new Test.MyException();
         outS.writeException(ex);
         outS.endEncapsulation();
         outParams = outS.finished();
         return false;
     }
     else if(current.operation.Equals("shutdown"))
     {
         communicator.shutdown();
         outParams = null;
         return true;
     }
     else if(current.operation.Equals("ice_isA"))
     {
         string s = inS.readString();
         if(s.Equals("::Test::MyClass"))
         {
             outS.writeBool(true);
         }
         else
         {
             outS.writeBool(false);
         }
         outS.endEncapsulation();
         outParams = outS.finished();
         return true;
     }
     else
     {
         Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
         ex.id = current.id;
         ex.facet = current.facet;
         ex.operation = current.operation;
         throw ex;
     }
 }
Exemplo n.º 2
0
 ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current)
 {
     Ice.Communicator communicator = current.adapter.getCommunicator();
     Ice.InputStream  inS          = new Ice.InputStream(communicator, inParams);
     inS.startEncapsulation();
     Ice.OutputStream outS = new Ice.OutputStream(communicator);
     outS.startEncapsulation();
     if (current.operation.Equals("opOneway"))
     {
         outParams = new byte[0];
         return(true);
     }
     else if (current.operation.Equals("opString"))
     {
         string s = inS.readString();
         outS.writeString(s);
         outS.writeString(s);
         outS.endEncapsulation();
         outParams = outS.finished();
         return(true);
     }
     else if (current.operation.Equals("opException"))
     {
         Test.MyException ex = new Test.MyException();
         outS.writeException(ex);
         outS.endEncapsulation();
         outParams = outS.finished();
         return(false);
     }
     else if (current.operation.Equals("shutdown"))
     {
         communicator.shutdown();
         outParams = null;
         return(true);
     }
     else if (current.operation.Equals("ice_isA"))
     {
         string s = inS.readString();
         if (s.Equals("::Test::MyClass"))
         {
             outS.writeBool(true);
         }
         else
         {
             outS.writeBool(false);
         }
         outS.endEncapsulation();
         outParams = outS.finished();
         return(true);
     }
     else
     {
         Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
         ex.id        = current.id;
         ex.facet     = current.facet;
         ex.operation = current.operation;
         throw ex;
     }
 }
Exemplo n.º 3
0
 ice_invoke_async(Ice.AMD_Object_ice_invoke cb, byte[] inParams, Ice.Current current)
 {
     Ice.Communicator communicator = current.adapter.getCommunicator();
     Ice.InputStream  inS          = Ice.Util.createInputStream(communicator, inParams);
     inS.startEncapsulation();
     Ice.OutputStream outS = Ice.Util.createOutputStream(communicator);
     outS.startEncapsulation();
     if (current.operation.Equals("opOneway"))
     {
         cb.ice_response(true, new byte[0]);
     }
     else if (current.operation.Equals("opString"))
     {
         string s = inS.readString();
         outS.writeString(s);
         outS.writeString(s);
         outS.endEncapsulation();
         cb.ice_response(true, outS.finished());
     }
     else if (current.operation.Equals("opException"))
     {
         Test.MyException ex = new Test.MyException();
         outS.writeException(ex);
         outS.endEncapsulation();
         cb.ice_response(false, outS.finished());
     }
     else if (current.operation.Equals("shutdown"))
     {
         communicator.shutdown();
         cb.ice_response(true, null);
     }
     else if (current.operation.Equals("ice_isA"))
     {
         string s = inS.readString();
         if (s.Equals("::Test::MyClass"))
         {
             outS.writeBool(true);
         }
         else
         {
             outS.writeBool(false);
         }
         outS.endEncapsulation();
         cb.ice_response(true, outS.finished());
     }
     else
     {
         Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
         ex.id        = current.id;
         ex.facet     = current.facet;
         ex.operation = current.operation;
         throw ex;
     }
 }
Exemplo n.º 4
0
 public override Task<Ice.Object_Ice_invokeResult> ice_invokeAsync(byte[] inParams, Ice.Current current)
 {
     Ice.Communicator communicator = current.adapter.getCommunicator();
     Ice.InputStream inS = new Ice.InputStream(communicator, inParams);
     inS.startEncapsulation();
     Ice.OutputStream outS = new Ice.OutputStream(communicator);
     outS.startEncapsulation();
     if(current.operation.Equals("opOneway"))
     {
         return Task.FromResult<Ice.Object_Ice_invokeResult>(new Ice.Object_Ice_invokeResult(true, new byte[0]));
     }
     else if(current.operation.Equals("opString"))
     {
         string s = inS.readString();
         outS.writeString(s);
         outS.writeString(s);
         outS.endEncapsulation();
         return Task.FromResult<Ice.Object_Ice_invokeResult>(new Ice.Object_Ice_invokeResult(true, outS.finished()));
     }
     else if(current.operation.Equals("opException"))
     {
         Test.MyException ex = new Test.MyException();
         outS.writeException(ex);
         outS.endEncapsulation();
         return Task.FromResult<Ice.Object_Ice_invokeResult>(new Ice.Object_Ice_invokeResult(false, outS.finished()));
     }
     else if(current.operation.Equals("shutdown"))
     {
         communicator.shutdown();
         return Task.FromResult<Ice.Object_Ice_invokeResult>(new Ice.Object_Ice_invokeResult(true, null));
     }
     else if(current.operation.Equals("ice_isA"))
     {
         string s = inS.readString();
         if(s.Equals("::Test::MyClass"))
         {
             outS.writeBool(true);
         }
         else
         {
             outS.writeBool(false);
         }
         outS.endEncapsulation();
         return Task.FromResult<Ice.Object_Ice_invokeResult>(new Ice.Object_Ice_invokeResult(true, outS.finished()));
     }
     else
     {
         Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
         ex.id = current.id;
         ex.facet = current.facet;
         ex.operation = current.operation;
         throw ex;
     }
 }
Exemplo n.º 5
0
 public override void ice_invoke_async(Ice.AMD_Object_ice_invoke cb, byte[] inParams, Ice.Current current)
 {
     Ice.Communicator communicator = current.adapter.getCommunicator();
     Ice.InputStream inS = Ice.Util.createInputStream(communicator, inParams);
     Ice.OutputStream outS = Ice.Util.createOutputStream(communicator);
     if(current.operation.Equals("opOneway"))
     {
         cb.ice_response(true, new byte[0]);
     }
     else if(current.operation.Equals("opString"))
     {
         string s = inS.readString();
         outS.writeString(s);
         outS.writeString(s);
         cb.ice_response(true, outS.finished());
     }
     else if(current.operation.Equals("opException"))
     {
         Test.MyException ex = new Test.MyException();
         outS.writeException(ex);
         cb.ice_response(false, outS.finished());
     }
     else if(current.operation.Equals("shutdown"))
     {
         communicator.shutdown();
         cb.ice_response(true, null);
     }
     else if(current.operation.Equals("ice_isA"))
     {
         string s = inS.readString();
         if(s.Equals("::Test::MyClass"))
         {
             outS.writeBool(true);
         }
         else
         {
             outS.writeBool(false);
         }
         cb.ice_response(true, outS.finished());
     }
     else
     {
         Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
         ex.id = current.id;
         ex.facet = current.facet;
         ex.operation = current.operation;
         throw ex;
     }
 }
Exemplo n.º 6
0
        public override bool Sent() => base.SentImpl(!Proxy.IsTwoway); // done = true if it's not a two-way proxy

        public override bool Response()
        {
            Debug.Assert(Is != null);
            //
            // NOTE: this method is called from ConnectionI.parseMessage
            // with the connection locked. Therefore, it must not invoke
            // any user callbacks.
            //
            Debug.Assert(Proxy.IsTwoway); // Can only be called for twoways.

            if (ChildObserver != null)
            {
                ChildObserver.Reply(Is.Size - Protocol.headerSize - 4);
                ChildObserver.Detach();
                ChildObserver = null;
            }

            byte replyStatus;

            try
            {
                replyStatus = Is.ReadByte();

                switch (replyStatus)
                {
                case ReplyStatus.replyOK:
                    {
                        break;
                    }

                case ReplyStatus.replyUserException:
                {
                    if (Observer != null)
                    {
                        Observer.UserException();
                    }
                    break;
                }

                case ReplyStatus.replyObjectNotExist:
                case ReplyStatus.replyFacetNotExist:
                case ReplyStatus.replyOperationNotExist:
                {
                    var ident = new Ice.Identity(Is);

                    //
                    // For compatibility with the old FacetPath.
                    //
                    string[] facetPath = Is.ReadStringSeq();
                    string   facet;
                    if (facetPath.Length > 0)
                    {
                        if (facetPath.Length > 1)
                        {
                            throw new Ice.MarshalException();
                        }
                        facet = facetPath[0];
                    }
                    else
                    {
                        facet = "";
                    }

                    string operation = Is.ReadString();

                    Ice.RequestFailedException ex;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyObjectNotExist:
                    {
                        ex = new Ice.ObjectNotExistException();
                        break;
                    }

                    case ReplyStatus.replyFacetNotExist:
                    {
                        ex = new Ice.FacetNotExistException();
                        break;
                    }

                    case ReplyStatus.replyOperationNotExist:
                    {
                        ex = new Ice.OperationNotExistException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        throw new System.InvalidOperationException();
                    }
                    }

                    ex.Id        = ident;
                    ex.Facet     = facet;
                    ex.Operation = operation;
                    throw ex;
                }

                case ReplyStatus.replyUnknownException:
                case ReplyStatus.replyUnknownLocalException:
                case ReplyStatus.replyUnknownUserException:
                {
                    string unknown = Is.ReadString();

                    Ice.UnknownException ex;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyUnknownException:
                    {
                        ex = new Ice.UnknownException();
                        break;
                    }

                    case ReplyStatus.replyUnknownLocalException:
                    {
                        ex = new Ice.UnknownLocalException();
                        break;
                    }

                    case ReplyStatus.replyUnknownUserException:
                    {
                        ex = new Ice.UnknownUserException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        throw new System.InvalidOperationException();
                    }
                    }

                    ex.Unknown = unknown;
                    throw ex;
                }

                default:
                {
                    throw new Ice.UnknownReplyStatusException();
                }
                }

                return(ResponseImpl(false, replyStatus == ReplyStatus.replyOK, true));
            }
            catch (Ice.Exception ex)
            {
                return(Exception(ex));
            }
        }
Exemplo n.º 7
0
        public void finished(BasicStream istr)
        {
            _m.Lock();
            try
            {
                Debug.Assert(_handler.getReference().getMode() == Reference.Mode.ModeTwoway); // Only for twoways.

                Debug.Assert(_state <= StateInProgress);

                if(_remoteObserver != null)
                {
                    _remoteObserver.reply(istr.size() - Protocol.headerSize - 4);
                    _remoteObserver.detach();
                    _remoteObserver = null;
                }

                if(_is == null)
                {
                    _is = new IceInternal.BasicStream(_handler.getReference().getInstance(), 
                                                      Ice.Util.currentProtocolEncoding);
                }
                _is.swap(istr);
                byte replyStatus = _is.readByte();

                switch(replyStatus)
                {
                    case ReplyStatus.replyOK:
                    {
                        _state = StateOK; // The state must be set last, in case there is an exception.
                        break;
                    }

                    case ReplyStatus.replyUserException:
                    {
                        if(_observer != null)
                        {
                            _observer.userException();
                        }
                        _state = StateUserException; // The state must be set last, in case there is an exception.
                        break;
                    }

                    case ReplyStatus.replyObjectNotExist:
                    case ReplyStatus.replyFacetNotExist:
                    case ReplyStatus.replyOperationNotExist:
                    {
                        Ice.RequestFailedException ex = null;
                        switch(replyStatus)
                        {
                            case ReplyStatus.replyObjectNotExist:
                            {
                                ex = new Ice.ObjectNotExistException();
                                break;
                            }

                            case ReplyStatus.replyFacetNotExist:
                            {
                                ex = new Ice.FacetNotExistException();
                                break;
                            }

                            case ReplyStatus.replyOperationNotExist:
                            {
                                ex = new Ice.OperationNotExistException();
                                break;
                            }

                            default:
                            {
                                Debug.Assert(false);
                                break;
                            }
                        }

                        ex.id = new Ice.Identity();
                        ex.id.read__(_is);

                        //
                        // For compatibility with the old FacetPath.
                        //
                        string[] facetPath = _is.readStringSeq();
                        if(facetPath.Length > 0)
                        {
                            if(facetPath.Length > 1)
                            {
                                throw new Ice.MarshalException();
                            }
                            ex.facet = facetPath[0];
                        }
                        else
                        {
                            ex.facet = "";
                        }

                        ex.operation = _is.readString();
                        _exception = ex;

                        _state = StateLocalException; // The state must be set last, in case there is an exception.
                        break;
                    }

                    case ReplyStatus.replyUnknownException:
                    case ReplyStatus.replyUnknownLocalException:
                    case ReplyStatus.replyUnknownUserException:
                    {
                        Ice.UnknownException ex = null;
                        switch(replyStatus)
                        {
                            case ReplyStatus.replyUnknownException:
                            {
                                ex = new Ice.UnknownException();
                                break;
                            }

                            case ReplyStatus.replyUnknownLocalException:
                            {
                                ex = new Ice.UnknownLocalException();
                                break;
                            }

                            case ReplyStatus.replyUnknownUserException:
                            {
                                ex = new Ice.UnknownUserException();
                                break;
                            }

                            default:
                            {
                                Debug.Assert(false);
                                break;
                            }
                        }

                        ex.unknown = _is.readString();
                        _exception = ex;

                        _state = StateLocalException; // The state must be set last, in case there is an exception.
                        break;
                    }

                    default:
                    {
                        _exception = new Ice.UnknownReplyStatusException();
                        _state = StateLocalException;
                        break;
                    }
                }

                _m.Notify();
            }
            finally
            {
                _m.Unlock();
            }
        }
Exemplo n.º 8
0
        public override bool response()
        {
            //
            // NOTE: this method is called from ConnectionI.parseMessage
            // with the connection locked. Therefore, it must not invoke
            // any user callbacks.
            //
            Debug.Assert(proxy_.IsTwoway); // Can only be called for twoways.

            if (childObserver_ != null)
            {
                childObserver_.reply(is_.size() - Protocol.headerSize - 4);
                childObserver_.detach();
                childObserver_ = null;
            }

            byte replyStatus;

            try
            {
                replyStatus = is_.ReadByte();

                switch (replyStatus)
                {
                case ReplyStatus.replyOK:
                {
                    break;
                }

                case ReplyStatus.replyUserException:
                {
                    if (observer_ != null)
                    {
                        observer_.userException();
                    }
                    break;
                }

                case ReplyStatus.replyObjectNotExist:
                case ReplyStatus.replyFacetNotExist:
                case ReplyStatus.replyOperationNotExist:
                {
                    Ice.Identity ident = new Ice.Identity();
                    ident.ice_readMembers(is_);

                    //
                    // For compatibility with the old FacetPath.
                    //
                    string[] facetPath = is_.ReadStringSeq();
                    ;
                    string facet;
                    if (facetPath.Length > 0)
                    {
                        if (facetPath.Length > 1)
                        {
                            throw new Ice.MarshalException();
                        }
                        facet = facetPath[0];
                    }
                    else
                    {
                        facet = "";
                    }

                    string operation = is_.ReadString();

                    Ice.RequestFailedException ex = null;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyObjectNotExist:
                    {
                        ex = new Ice.ObjectNotExistException();
                        break;
                    }

                    case ReplyStatus.replyFacetNotExist:
                    {
                        ex = new Ice.FacetNotExistException();
                        break;
                    }

                    case ReplyStatus.replyOperationNotExist:
                    {
                        ex = new Ice.OperationNotExistException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        break;
                    }
                    }

                    ex.id        = ident;
                    ex.facet     = facet;
                    ex.operation = operation;
                    throw ex;
                }

                case ReplyStatus.replyUnknownException:
                case ReplyStatus.replyUnknownLocalException:
                case ReplyStatus.replyUnknownUserException:
                {
                    string unknown = is_.ReadString();

                    Ice.UnknownException ex = null;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyUnknownException:
                    {
                        ex = new Ice.UnknownException();
                        break;
                    }

                    case ReplyStatus.replyUnknownLocalException:
                    {
                        ex = new Ice.UnknownLocalException();
                        break;
                    }

                    case ReplyStatus.replyUnknownUserException:
                    {
                        ex = new Ice.UnknownUserException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        break;
                    }
                    }

                    ex.unknown = unknown;
                    throw ex;
                }

                default:
                {
                    throw new Ice.UnknownReplyStatusException();
                }
                }

                return(responseImpl(false, replyStatus == ReplyStatus.replyOK, true));
            }
            catch (Ice.Exception ex)
            {
                return(exception(ex));
            }
        }
Exemplo n.º 9
0
        public void finished(BasicStream istr)
        {
            _m.Lock();
            try
            {
                Debug.Assert(_handler.getReference().getMode() == Reference.Mode.ModeTwoway); // Only for twoways.

                Debug.Assert(_state <= StateInProgress);

                if (_remoteObserver != null)
                {
                    _remoteObserver.reply(istr.size() - Protocol.headerSize - 4);
                    _remoteObserver.detach();
                    _remoteObserver = null;
                }

                if (_is == null)
                {
                    _is = new IceInternal.BasicStream(_handler.getReference().getInstance(),
                                                      Ice.Util.currentProtocolEncoding);
                }
                _is.swap(istr);
                byte replyStatus = _is.readByte();

                switch (replyStatus)
                {
                case ReplyStatus.replyOK:
                {
                    _state = StateOK;     // The state must be set last, in case there is an exception.
                    break;
                }

                case ReplyStatus.replyUserException:
                {
                    if (_observer != null)
                    {
                        _observer.userException();
                    }
                    _state = StateUserException;     // The state must be set last, in case there is an exception.
                    break;
                }

                case ReplyStatus.replyObjectNotExist:
                case ReplyStatus.replyFacetNotExist:
                case ReplyStatus.replyOperationNotExist:
                {
                    Ice.RequestFailedException ex = null;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyObjectNotExist:
                    {
                        ex = new Ice.ObjectNotExistException();
                        break;
                    }

                    case ReplyStatus.replyFacetNotExist:
                    {
                        ex = new Ice.FacetNotExistException();
                        break;
                    }

                    case ReplyStatus.replyOperationNotExist:
                    {
                        ex = new Ice.OperationNotExistException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        break;
                    }
                    }

                    ex.id = new Ice.Identity();
                    ex.id.read__(_is);

                    //
                    // For compatibility with the old FacetPath.
                    //
                    string[] facetPath = _is.readStringSeq();
                    if (facetPath.Length > 0)
                    {
                        if (facetPath.Length > 1)
                        {
                            throw new Ice.MarshalException();
                        }
                        ex.facet = facetPath[0];
                    }
                    else
                    {
                        ex.facet = "";
                    }

                    ex.operation = _is.readString();
                    _exception   = ex;

                    _state = StateLocalException;     // The state must be set last, in case there is an exception.
                    break;
                }

                case ReplyStatus.replyUnknownException:
                case ReplyStatus.replyUnknownLocalException:
                case ReplyStatus.replyUnknownUserException:
                {
                    Ice.UnknownException ex = null;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyUnknownException:
                    {
                        ex = new Ice.UnknownException();
                        break;
                    }

                    case ReplyStatus.replyUnknownLocalException:
                    {
                        ex = new Ice.UnknownLocalException();
                        break;
                    }

                    case ReplyStatus.replyUnknownUserException:
                    {
                        ex = new Ice.UnknownUserException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        break;
                    }
                    }

                    ex.unknown = _is.readString();
                    _exception = ex;

                    _state = StateLocalException;     // The state must be set last, in case there is an exception.
                    break;
                }

                default:
                {
                    _exception = new Ice.UnknownReplyStatusException();
                    _state     = StateLocalException;
                    break;
                }
                }

                _m.Notify();
            }
            finally
            {
                _m.Unlock();
            }
        }
Exemplo n.º 10
0
        override public Ice.AsyncCallback completed()
        {
            Debug.Assert(_is != null); // _is has been initialized prior to this call

            //
            // NOTE: this method is called from ConnectionI.parseMessage
            // with the connection locked. Therefore, it must not invoke
            // any user callbacks.
            //

            Debug.Assert(proxy_.ice_isTwoway()); // Can only be called for twoways.

            if (childObserver_ != null)
            {
                childObserver_.reply(_is.size() - Protocol.headerSize - 4);
                childObserver_.detach();
                childObserver_ = null;
            }

            byte replyStatus;

            try
            {
                replyStatus = _is.readByte();

                switch (replyStatus)
                {
                case ReplyStatus.replyOK:
                {
                    break;
                }

                case ReplyStatus.replyUserException:
                {
                    if (observer_ != null)
                    {
                        observer_.userException();
                    }
                    break;
                }

                case ReplyStatus.replyObjectNotExist:
                case ReplyStatus.replyFacetNotExist:
                case ReplyStatus.replyOperationNotExist:
                {
                    Ice.Identity id = new Ice.Identity();
                    id.read__(_is);

                    //
                    // For compatibility with the old FacetPath.
                    //
                    string[] facetPath = _is.readStringSeq();
                    string   facet;
                    if (facetPath.Length > 0)
                    {
                        if (facetPath.Length > 1)
                        {
                            throw new Ice.MarshalException();
                        }
                        facet = facetPath[0];
                    }
                    else
                    {
                        facet = "";
                    }

                    string operation = _is.readString();

                    Ice.RequestFailedException ex = null;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyObjectNotExist:
                    {
                        ex = new Ice.ObjectNotExistException();
                        break;
                    }

                    case ReplyStatus.replyFacetNotExist:
                    {
                        ex = new Ice.FacetNotExistException();
                        break;
                    }

                    case ReplyStatus.replyOperationNotExist:
                    {
                        ex = new Ice.OperationNotExistException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        break;
                    }
                    }

                    ex.id        = id;
                    ex.facet     = facet;
                    ex.operation = operation;
                    throw ex;
                }

                case ReplyStatus.replyUnknownException:
                case ReplyStatus.replyUnknownLocalException:
                case ReplyStatus.replyUnknownUserException:
                {
                    string unknown = _is.readString();

                    Ice.UnknownException ex = null;
                    switch (replyStatus)
                    {
                    case ReplyStatus.replyUnknownException:
                    {
                        ex = new Ice.UnknownException();
                        break;
                    }

                    case ReplyStatus.replyUnknownLocalException:
                    {
                        ex = new Ice.UnknownLocalException();
                        break;
                    }

                    case ReplyStatus.replyUnknownUserException:
                    {
                        ex = new Ice.UnknownUserException();
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false);
                        break;
                    }
                    }

                    ex.unknown = unknown;
                    throw ex;
                }

                default:
                {
                    throw new Ice.UnknownReplyStatusException();
                }
                }

                return(finished(replyStatus == ReplyStatus.replyOK));
            }
            catch (Ice.Exception ex)
            {
                return(completed(ex));
            }
        }
Exemplo n.º 11
0
 public void SendBuffer2(string aServiceName, string aBufferGuid, int aSendIndex, int aTotalBufferLength, int aCurrentBufferLength, byte[] aSeq, Ice.Context context__)
 {
     Ice.Current current__ = new Ice.Current();
     initCurrent__(ref current__, "SendBuffer2", Ice.OperationMode.Normal, context__);
     while(true)
     {
         IceInternal.Direct direct__ = new IceInternal.Direct(current__);
         object servant__ = direct__.servant();
         if(servant__ is BufferTransfer)
         {
             try
             {
                 ((InfoDTV.Multiplexer.Dynamic.Provider.BufferTransfer)servant__).SendBuffer2(aServiceName, aBufferGuid, aSendIndex, aTotalBufferLength, aCurrentBufferLength, aSeq, current__);
                 return;
             }
             catch(Ice.LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
             finally
             {
                 direct__.destroy();
             }
         }
         else
         {
             direct__.destroy();
             Ice.OperationNotExistException opEx__ = new Ice.OperationNotExistException();
             opEx__.id = current__.id;
             opEx__.facet = current__.facet;
             opEx__.operation = current__.operation;
             throw opEx__;
         }
     }
 }
Exemplo n.º 12
0
 public void Login(Ice.Context context__)
 {
     Ice.Current current__ = new Ice.Current();
     initCurrent__(ref current__, "Login", Ice.OperationMode.Normal, context__);
     while(true)
     {
         IceInternal.Direct direct__ = new IceInternal.Direct(current__);
         object servant__ = direct__.servant();
         if(servant__ is BufferTransfer)
         {
             try
             {
                 ((InfoDTV.Multiplexer.Dynamic.Provider.BufferTransfer)servant__).Login(current__);
                 return;
             }
             catch(Ice.LocalException ex__)
             {
                 throw new IceInternal.LocalExceptionWrapper(ex__, false);
             }
             finally
             {
                 direct__.destroy();
             }
         }
         else
         {
             direct__.destroy();
             Ice.OperationNotExistException opEx__ = new Ice.OperationNotExistException();
             opEx__.id = current__.id;
             opEx__.facet = current__.facet;
             opEx__.operation = current__.operation;
             throw opEx__;
         }
     }
 }
Exemplo n.º 13
0
    public override bool ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current)
    {
        outParams = null;

        Ice.Communicator communicator = current.adapter.getCommunicator();

        Ice.InputStream inStream = null;
        if(inParams.Length > 0)
        {
            inStream = Ice.Util.createInputStream(communicator, inParams);
            inStream.startEncapsulation();
        }

        if(current.operation.Equals("printString"))
        {
            string message = inStream.readString();
            inStream.endEncapsulation();
            inStream.destroy();
            Console.WriteLine("Printing string `" + message + "'");
            return true;
        }
        else if(current.operation.Equals("printStringSequence"))
        {
            String[] seq = Demo.StringSeqHelper.read(inStream);
            inStream.endEncapsulation();
            inStream.destroy();
            Console.Write("Printing string sequence {");
            for(int i = 0; i < seq.Length; ++i)
            {
                if(i > 0)
                {
                    Console.Write(", ");
                }
                Console.Write("'" + seq[i] + "'");
            }
            Console.WriteLine("}");
            return true;
        }
        else if(current.operation.Equals("printDictionary"))
        {
            Dictionary<string, string> dict = Demo.StringDictHelper.read(inStream);
            inStream.endEncapsulation();
            inStream.destroy();
            Console.Write("Printing dictionary {");
            bool first = true;
            foreach(KeyValuePair<string, string> e in dict)
            {
                if(!first)
                {
                    Console.Write(", ");
                }
                first = false;
                Console.Write(e.Key + "=" + e.Value);
            }
            Console.WriteLine("}");
            return true;
        }
        else if(current.operation.Equals("printEnum"))
        {
            Demo.Color c = Demo.ColorHelper.read(inStream);
            inStream.endEncapsulation();
            inStream.destroy();
            Console.WriteLine("Printing enum " + c);
            return true;
        }
        else if(current.operation.Equals("printStruct"))
        {
            Demo.Structure s = new Demo.Structure();
            s.ice_read(inStream);
            inStream.endEncapsulation();
            inStream.destroy();
            Console.WriteLine("Printing struct: name=" + s.name + ", value=" + s.value);
            return true;
        }
        else if(current.operation.Equals("printStructSequence"))
        {
            Demo.Structure[] seq = Demo.StructureSeqHelper.read(inStream);
            inStream.endEncapsulation();
            inStream.destroy();
            Console.Write("Printing struct sequence: {");
            for(int i = 0; i < seq.Length; ++i)
            {
                if(i > 0)
                {
                    Console.Write(", ");
                }
                Console.Write(seq[i].name + "=" + seq[i].value);
            }
            Console.WriteLine("}");
            return true;
        }
        else if(current.operation.Equals("printClass"))
        {
            Demo.CHelper ch = new Demo.CHelper(inStream);
            ch.read();
            inStream.readPendingObjects();
            inStream.endEncapsulation();
            inStream.destroy();
            Demo.C c = ch.value;
            Console.WriteLine("Printing class: s.name=" + c.s.name + ", s.value=" + c.s.value);
            return true;
        }
        else if(current.operation.Equals("getValues"))
        {
            Demo.C c = new Demo.C();
            c.s = new Demo.Structure();
            c.s.name = "green";
            c.s.value = Demo.Color.green;
            Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator);
            outStream.startEncapsulation();
            Demo.CHelper.write(outStream, c);
            outStream.writeString("hello");
            outStream.writePendingObjects();
            outStream.endEncapsulation();
            outParams = outStream.finished();
            return true;
        }
        else if(current.operation.Equals("throwPrintFailure"))
        {
            Console.WriteLine("Throwing PrintFailure");
            Demo.PrintFailure ex = new Demo.PrintFailure();
            ex.reason = "paper tray empty";
            Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator);
            outStream.startEncapsulation();
            outStream.writeException(ex);
            outStream.endEncapsulation();
            outParams = outStream.finished();
            return false;
        }
        else if(current.operation.Equals("shutdown"))
        {
            current.adapter.getCommunicator().shutdown();
            return true;
        }
        else
        {
            Ice.OperationNotExistException ex = new Ice.OperationNotExistException();
            ex.id = current.id;
            ex.facet = current.facet;
            ex.operation = current.operation;
            throw ex;
        }
    }