Package org.jacorb.orb.giop

Examples of org.jacorb.orb.giop.ReplyOutputStream


            try
            {
                if( out == null )
                {
                    out =
                        new ReplyOutputStream(orb,
                                              requestId(),
                                              ReplyStatusType_1_2.from_int(replyStatus),
                                              inputStream.getGIOPMinor(),
                                              inputStream.isLocateRequest(),
                                              logger);
View Full Code Here


            // not do any harm.
            return out;
        }

        out =
            new ReplyOutputStream(orb,
                                  requestId(),
                                  ReplyStatusType_1_2.NO_EXCEPTION,
                                  inputStream.getGIOPMinor(),
                                  inputStream.isLocateRequest(),
                                  logger );
View Full Code Here

        isStreamBased = true;

        replyStatus = ReplyStatusType_1_2._USER_EXCEPTION;

        out =
            new ReplyOutputStream(orb,
                                  requestId(),
                                  ReplyStatusType_1_2.USER_EXCEPTION,
                                  inputStream.getGIOPMinor(),
                                  inputStream.isLocateRequest(),
                                  logger );
View Full Code Here

        /* we need to create a new output stream here because a system exception may
           have occurred *after* a no_exception request header was written onto the
           original output stream*/


        out = new ReplyOutputStream(orb,
                                    requestId(),
                                    ReplyStatusType_1_2.SYSTEM_EXCEPTION,
                                    inputStream.getGIOPMinor(),
                                    inputStream.isLocateRequest(),
                                    logger);
View Full Code Here

    public void setLocationForward(org.omg.PortableServer.ForwardRequest request)
    {
        replyStatus = ReplyStatusType_1_2._LOCATION_FORWARD;

        out = new ReplyOutputStream(orb,
                                    requestId(),
                                    ReplyStatusType_1_2.LOCATION_FORWARD,
                                    inputStream.getGIOPMinor(),
                                    inputStream.isLocateRequest(),
                                    logger );
View Full Code Here

     */
    public ReplyOutputStream get_out()
    {
        if (out == null)
        {
            out = new ReplyOutputStream(orb,
                                        requestId(),
                                        status(),
                                        inputStream.getGIOPMinor(),
                                        inputStream.isLocateRequest(),
                                        logger );
View Full Code Here

                                     RECEIVE_REQUEST_SERVICE_CONTEXTS))
            {
                //an interceptor bailed out, so don't continue request
                //processing and return here. The service contexts for
                //the result have to be set, of course.
                ReplyOutputStream out = request.getReplyOutputStream();
                Enumeration ctx = info.getReplyServiceContexts();

                while( ctx.hasMoreElements() )
                {
                    out.addServiceContext( (ServiceContext) ctx.nextElement() );
                }

                return;
            }

            manager.setTSCurrent(info.current());
        }

        // TODO: The exception replies below should also trigger interceptors.
        // Requires some re-arranging of the entire method.
        if (Time.hasPassed (request.getRequestEndTime()))
        {
            request.setSystemException
                (new org.omg.CORBA.TIMEOUT ("Request End Time exceeded",
                                            0, CompletionStatus.COMPLETED_NO));
            return;
        }
        if (checkReplyEndTime && Time.hasPassed (request.getReplyEndTime()))
        {
            request.setSystemException
                (new org.omg.CORBA.TIMEOUT ("Reply End Time exceeded",
                                            0, CompletionStatus.COMPLETED_NO));
            return;
        }

        Time.waitFor (request.getRequestStartTime());

        if (servantManager != null)
        {
            if (servantManager instanceof org.omg.PortableServer.ServantActivator)
            {
                invokeIncarnate();
            }
            else
            {
                invokePreInvoke();
            }
        }

        if (servant != null)
        {
            if (info != null)
            {
                info.setServant(servant);

                if (servant instanceof org.omg.CORBA.portable.InvokeHandler)
                {
                    if(! invokeInterceptors(info,
                                            ServerInterceptorIterator.RECEIVE_REQUEST ))
                    {
                        //an interceptor bailed out, so don't continue
                        //request processing and return here. The
                        //service contexts for the result have to be
                        //set, of course.

                        if( cookieHolder != null )
                        {
                            invokePostInvoke();
                        }

                        ReplyOutputStream out =
                            request.getReplyOutputStream();
                        Enumeration ctx =
                            info.getReplyServiceContexts();

                        while( ctx.hasMoreElements() )
                        {
                            out.addServiceContext( (ServiceContext) ctx.nextElement() );
                        }

                        return;
                    }
                }
                else if (servant instanceof org.omg.PortableServer.DynamicImplementation)
                {
                    request.setServerRequestInfo(info);
                }
            }

            invokeOperation();
        }

        // preinvoke and postinvoke are always called in pairs
        // but what happens if the servant is null

        if (cookieHolder != null)
        {
            invokePostInvoke();
        }

        if (checkReplyEndTime && Time.hasPassed (request.getReplyEndTime()))
        {
            request.setSystemException
                (new org.omg.CORBA.TIMEOUT ("Reply End Time exceeded after invocation",
                                            0, CompletionStatus.COMPLETED_YES));
        }

        if (info != null)
        {
            InterceptorManager manager =
                controller.getORB().getInterceptorManager();
            info.setCurrent (manager.getCurrent());

            short op = 0;
            switch(request.status().value())
            {
                case ReplyStatusType_1_2._NO_EXCEPTION :
                    op = ServerInterceptorIterator.SEND_REPLY;
                    info.setReplyStatus (SUCCESSFUL.value);
                    break;

                case ReplyStatusType_1_2._USER_EXCEPTION :
                    info.setReplyStatus (USER_EXCEPTION.value);
                    SystemExceptionHelper.insert(info.sending_exception,
                                                 new org.omg.CORBA.UNKNOWN("Stream-based UserExceptions are not available!"));
                    op = ServerInterceptorIterator.SEND_EXCEPTION;
                    break;

                case ReplyStatusType_1_2._SYSTEM_EXCEPTION :
                    info.setReplyStatus (SYSTEM_EXCEPTION.value);
                    SystemExceptionHelper.insert(info.sending_exception,
                                                 request.getSystemException());
                    op = ServerInterceptorIterator.SEND_EXCEPTION;
                    break;

                case ReplyStatusType_1_2._LOCATION_FORWARD :
                    info.setReplyStatus (LOCATION_FORWARD.value);
                    op = ServerInterceptorIterator.SEND_OTHER;
                    break;
            }

            invokeInterceptors(info, op);

            ReplyOutputStream out =
                request.get_out();
            Enumeration ctx =
                info.getReplyServiceContexts();

            while( ctx.hasMoreElements() )
            {
                out.addServiceContext( (ServiceContext) ctx.nextElement() );
            }

            manager.removeTSCurrent();
        }
    }
View Full Code Here

                                     RECEIVE_REQUEST_SERVICE_CONTEXTS))
            {
                //an interceptor bailed out, so don't continue request
                //processing and return here. The service contexts for
                //the result have to be set, of course.
                ReplyOutputStream out = request.getReplyOutputStream();
                Enumeration ctx = info.getReplyServiceContexts();

                while( ctx.hasMoreElements() )
                {
                    out.addServiceContext( (ServiceContext) ctx.nextElement() );
                }

                return;
            }

            manager.setTSCurrent(info.current());
        }

        // TODO: The exception replies below should also trigger interceptors.
        // Requires some re-arranging of the entire method.
        if (Time.hasPassed (request.getRequestEndTime()))
        {
            request.setSystemException
                (new org.omg.CORBA.TIMEOUT ("Request End Time exceeded",
                                            0, CompletionStatus.COMPLETED_NO));
            return;
        }
        if (checkReplyEndTime && Time.hasPassed (request.getReplyEndTime()))
        {
            request.setSystemException
                (new org.omg.CORBA.TIMEOUT ("Reply End Time exceeded",
                                            0, CompletionStatus.COMPLETED_NO));
            return;
        }

        Time.waitFor (request.getRequestStartTime());

        if (servantManager != null)
        {
            if (servantManager instanceof org.omg.PortableServer.ServantActivator)
            {
                invokeIncarnate();
            }
            else
            {
                invokePreInvoke();
            }
        }

        if (servant != null)
        {
            if (info != null)
            {
                info.setServant(servant);

                if (servant instanceof org.omg.CORBA.portable.InvokeHandler)
                {
                    if(! invokeInterceptors(info,
                                            ServerInterceptorIterator.RECEIVE_REQUEST ))
                    {
                        //an interceptor bailed out, so don't continue
                        //request processing and return here. The
                        //service contexts for the result have to be
                        //set, of course.

                        if( cookieHolder != null )
                        {
                            invokePostInvoke();
                        }

                        ReplyOutputStream out =
                            request.getReplyOutputStream();
                        Enumeration ctx =
                            info.getReplyServiceContexts();

                        while( ctx.hasMoreElements() )
                        {
                            out.addServiceContext( (ServiceContext) ctx.nextElement() );
                        }

                        return;
                    }
                }
                else if (servant instanceof org.omg.PortableServer.DynamicImplementation)
                {
                    request.setServerRequestInfo(info);
                }
            }

            invokeOperation();
        }

        // preinvoke and postinvoke are always called in pairs
        // but what happens if the servant is null

        if (cookieHolder != null)
        {
            invokePostInvoke();
        }

        if (checkReplyEndTime && Time.hasPassed (request.getReplyEndTime()))
        {
            request.setSystemException
                (new org.omg.CORBA.TIMEOUT ("Reply End Time exceeded after invocation",
                                            0, CompletionStatus.COMPLETED_YES));
        }

        if (info != null)
        {
            InterceptorManager manager =
                controller.getORB().getInterceptorManager();
            info.setCurrent (manager.getCurrent());

            short op = 0;
            switch(request.status().value())
            {
                case ReplyStatusType_1_2._NO_EXCEPTION :
                    op = ServerInterceptorIterator.SEND_REPLY;
                    info.setReplyStatus (SUCCESSFUL.value);
                    break;

                case ReplyStatusType_1_2._USER_EXCEPTION :
                    info.setReplyStatus (USER_EXCEPTION.value);
                    SystemExceptionHelper.insert(info.sending_exception,
                                                 new org.omg.CORBA.UNKNOWN("Stream-based UserExceptions are not available!"));
                    op = ServerInterceptorIterator.SEND_EXCEPTION;
                    break;

                case ReplyStatusType_1_2._SYSTEM_EXCEPTION :
                    info.setReplyStatus (SYSTEM_EXCEPTION.value);
                    SystemExceptionHelper.insert(info.sending_exception,
                                                 request.getSystemException());
                    op = ServerInterceptorIterator.SEND_EXCEPTION;
                    break;

                case ReplyStatusType_1_2._LOCATION_FORWARD :
                    info.setReplyStatus (LOCATION_FORWARD.value);
                    op = ServerInterceptorIterator.SEND_OTHER;
                    break;
            }

            invokeInterceptors(info, op);

            ReplyOutputStream out =
                request.get_out();
            Enumeration ctx =
                info.getReplyServiceContexts();

            while( ctx.hasMoreElements() )
            {
                out.addServiceContext( (ServiceContext) ctx.nextElement() );
            }

            manager.removeTSCurrent();
        }
    }
View Full Code Here

                                  request_id,
                                  giop_minor );
                return;
            }

            ReplyOutputStream out =
                new ReplyOutputStream( (org.jacorb.orb.ORB) orb,
                                       request_id,
                                       org.omg.GIOP.ReplyStatusType_1_2.LOCATION_FORWARD,
                                       giop_minor,
                                       isLocateRequest,
                                       logger);

            // The typecode is for org.omg.CORBA.Object, but avoiding
            // creation of new ObjectHolder Instance.
            IIOPAddress addr = new IIOPAddress (_poa.host,(short)_poa.port);
            org.omg.IOP.IOR _ior = null;
            try
            {
                addr.configure(configuration);
                IIOPProfile p = new IIOPProfile (addr,object_key,giop_minor);
                p.configure(configuration);
                _ior = ParsedIOR.createObjectIOR(p);
            }
            catch(ConfigurationException e)
            {
                logger.error("Error while configuring address/profile", e);
            }

            if( !_old_poa_state )
            {
                // if POA has been reactivated, we have to wait for
                // the requested object to become ready again. This is
                // for avoiding clients to get confused by
                // OBJECT_NOT_EXIST exceptions which they might get
                // when trying to contact the server too early.

                org.omg.CORBA.Object _object =
                    orb.string_to_object(
                        (new ParsedIOR( (org.jacorb.orb.ORB) orb, _ior)).getIORString());

                // Sort of busy waiting here, no other way possible
                for( int _i = 0; _i < object_activation_retries; _i++ )
                {
                    try
                    {
                        Thread.sleep( object_activation_sleep );

                        // This will usually throw an OBJECT_NOT_EXIST
                        if( ! _object._non_existent() ) // "CORBA ping"
                        {
                            break;
                        }
                    }
                    catch(Exception _e)
                    {
                        logger.info("Exception while waiting for object", _e);
                    }
                }
            }

            try
            {
                // write new location to stream
                out.write_IOR(_ior);

                if (logger.isDebugEnabled())
                {
                    logger.debug("ImR: Sending location forward for " +
                                      _server.name);
View Full Code Here

        private void sendSysException( org.omg.CORBA.SystemException sys_ex,
                                       GIOPConnection connection,
                                       int request_id,
                                       int giop_minor )
        {
            ReplyOutputStream out =
                new ReplyOutputStream( (org.jacorb.orb.ORB) orb,
                                       request_id,
                                       org.omg.GIOP.ReplyStatusType_1_2.SYSTEM_EXCEPTION,
                                       giop_minor,
                                       false,
                                       logger);
View Full Code Here

TOP

Related Classes of org.jacorb.orb.giop.ReplyOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.