Package org.jacorb.orb.portableInterceptor

Examples of org.jacorb.orb.portableInterceptor.ClientRequestInfoImpl


                        org.jacorb.orb.ParsedIOR piorOriginal,
                        org.jacorb.orb.giop.ClientConnection connection )
    {
        if ( orb.hasClientRequestInterceptors() )
        {
            info = new ClientRequestInfoImpl (
                    orb,
                    (original != null ? original.info : null), // The original ClientInterceptorHandler might be null
                    ros,
                    self,
                    delegate,
View Full Code Here


                        org.jacorb.orb.ParsedIOR piorOriginal,
                        org.jacorb.orb.giop.ClientConnection connection )
    {
        if ( orb.hasClientRequestInterceptors() )
        {
            info = new ClientRequestInfoImpl (
                    orb,
                    (original != null ? original.info : null), // The original ClientInterceptorHandler might be null
                    ros,
                    self,
                    delegate,
View Full Code Here

        }

        public void send_request( org.omg.PortableInterceptor.ClientRequestInfo ri )
            throws org.omg.PortableInterceptor.ForwardRequest
        {
            ClientRequestInfoImpl cr = (ClientRequestInfoImpl)ri;

            assertTrue (((org.omg.CORBA.portable.ObjectImpl)cr.effective_target())._is_local());

        }
View Full Code Here

    }

    public void send_request(org.omg.PortableInterceptor.ClientRequestInfo cri)
        throws org.omg.PortableInterceptor.ForwardRequest
    {
        ClientRequestInfoImpl ri = (ClientRequestInfoImpl)cri;

        if (ri.isLocalInterceptor())
        {
            return;
        }

        //if (ri.operation().equals("_is_a")) return;
        //if (ri.operation().equals("_non_existent")) return;
        org.omg.CORBA.ORB orb = ri.orb();

        // see if target requires protected requests by looking into the IOR
        CompoundSecMechList csmList = null;
        try
        {
            TaggedComponent tc = ri.get_effective_component(TAG_CSI_SEC_MECH_LIST.value);
            CDRInputStream is = new CDRInputStream(tc.component_data);
            is.openEncapsulatedArray();
            csmList = CompoundSecMechListHelper.read( is );
        }
        catch (BAD_PARAM e)
        {
            if (logger.isDebugEnabled())
                logger.debug("Did not find tagged component TAG_CSI_SEC_MECH_LIST: "+
                             ri.operation());
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("Did not find tagged component TAG_CSI_SEC_MECH_LIST: "+e);
        }

        if(csmList != null &&
           csmList.mechanism_list[0].as_context_mech.target_supports == 0 &&
           csmList.mechanism_list[0].as_context_mech.target_requires == 0 &&
           csmList.mechanism_list[0].sas_context_mech.target_supports == 0 &&
           csmList.mechanism_list[0].sas_context_mech.target_requires == 0)
        {
            return;
        }

        // ask connection for client_context_id
        ClientConnection connection = ri.getConnection();

        long client_context_id = 0;
        if (useStateful)
            client_context_id = connection.cacheSASContext("css".getBytes());
        if (client_context_id < 0)
        {
            if (logger.isInfoEnabled())
                logger.info("New SAS Context: " + (-client_context_id));
        }

        // get ATLAS tokens
        AuthorizationElement[] authorizationList = csmList != null
                                                   ? getATLASTokens(orb, csmList)
                                                   : new AuthorizationElement[0];

        // establish the security context
        try
        {
            Any msg = null;
            if (client_context_id <= 0)
            {
                IdentityToken identityToken = new IdentityToken();
                identityToken.absent(true);
                contextToken = sasContext.createClientContext(orb, codec, csmList);
                msg = makeEstablishContext(orb,
                                           -client_context_id,
                                           authorizationList,
                                           identityToken,
                                           contextToken);
            }
            else
            {
                msg = makeMessageInContext(orb, client_context_id, false);
            }
            ri.add_request_service_context(new ServiceContext(SecurityAttributeService, codec.encode_value( msg ) ), true);
        }
        catch (Exception e)
        {
            logger.error ("Could not set security service context", e);
View Full Code Here

    {
    }

    public void receive_reply(org.omg.PortableInterceptor.ClientRequestInfo cri)
    {
        ClientRequestInfoImpl ri = (ClientRequestInfoImpl)cri;

        if (ri.isLocalInterceptor())
        {
            return;
        }

        // get SAS message
        SASContextBody contextBody = null;
        ServiceContext ctx = null;
        try
        {
            ctx = ri.get_reply_service_context(SecurityAttributeService);
        }
        catch (BAD_PARAM e)
        {
            if (logger.isDebugEnabled())
                logger.debug("No SAS security context found: "+ri.operation());
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("No SAS security context found: "+e);
        }
        if (ctx == null || ctx.context_data.length <= 1) return;

        try
        {
            Any msg = codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
            contextBody = SASContextBodyHelper.extract(msg);
        }
        catch (Exception e)
        {
            logger.error("Could not parse SAS reply", e);

            throw new org.omg.CORBA.NO_PERMISSION("SAS Could not parse SAS reply: " + e,
                                                  MinorCodes.SAS_CSS_FAILURE,
                                                  CompletionStatus.COMPLETED_MAYBE);
        }
        ClientConnection connection = ri.getConnection();

        // process CompleteEstablishContext message
        if (contextBody.discriminator() == MTCompleteEstablishContext.value)
        {
            CompleteEstablishContext reply = contextBody.complete_msg();
View Full Code Here

    }

    public void receive_exception(org.omg.PortableInterceptor.ClientRequestInfo cri)
        throws org.omg.PortableInterceptor.ForwardRequest
    {
        ClientRequestInfoImpl ri = (ClientRequestInfoImpl)cri;

        if (ri.isLocalInterceptor())
        {
            return;
        }
        // get SAS message
        SASContextBody contextBody = null;
        ServiceContext ctx = null;
        try
        {
            ctx = ri.get_reply_service_context(SecurityAttributeService);
        }
        catch (BAD_PARAM e)
        {
            if (logger.isDebugEnabled())
                logger.debug("No SAS security context found (exception): "+ri.operation());
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("No SAS security context found (exception): "+e);
        }
        if (ctx == null || ctx.context_data.length <= 1) return;

        try
        {
            Any msg = codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
            contextBody = SASContextBodyHelper.extract(msg);
        }
        catch (Exception e)
        {
            logger.error ("Could not parse SAS reply", e);

            throw new org.omg.CORBA.NO_PERMISSION("SAS Could not parse SAS reply: " + e,
                                                  MinorCodes.SAS_CSS_FAILURE,
                                                  CompletionStatus.COMPLETED_MAYBE);
        }
        ClientConnection connection = ri.getConnection();

        // process CompleteEstablishContext message
        if (contextBody.discriminator() == MTCompleteEstablishContext.value)
        {
            CompleteEstablishContext reply = contextBody.complete_msg();
            logger.debug("receive_exception MTCompleteEstablishContext: " + reply.client_context_id);

            // if not stateful, remove from connection
            if (reply.client_context_id > 0 && !reply.context_stateful)
                connection.purgeSASContext(reply.client_context_id);
        }

        // process ContextError message
        if (contextBody.discriminator() == MTContextError.value)
        {
            ContextError reply = contextBody.error_msg();
            logger.debug("receive_exception MTContextError: " + reply.client_context_id);

            // if stateful, remove from connection
            if (reply.client_context_id > 0)
                connection.purgeSASContext(reply.client_context_id);

            // if context not found, resend with empty context cache
            if (reply.major_status == 2) throw new org.omg.PortableInterceptor.ForwardRequest(ri.target());
        }
    }
View Full Code Here

TOP

Related Classes of org.jacorb.orb.portableInterceptor.ClientRequestInfoImpl

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.