Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.ConnectionOpenBody


        session.writeFrame(tuneOkBody.generateFrame(channelId));

        String host = session.getAMQConnection().getVirtualHost();
        AMQShortString virtualHost = new AMQShortString("/" + host);

        ConnectionOpenBody openBody = methodRegistry.createConnectionOpenBody(virtualHost,null,true);

        // Be aware of possible changes to parameter order as versions change.
        session.writeFrame(openBody.generateFrame(channelId));
    }
View Full Code Here


    }

    public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<ConnectionOpenBody> evt) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();
        ConnectionOpenBody body = evt.getMethod();

        //ignore leading '/'
        String virtualHostName;
        if ((body.virtualHost != null) && body.virtualHost.charAt(0) == '/')
        {
            virtualHostName = new StringBuilder(body.virtualHost.subSequence(1, body.virtualHost.length())).toString();
        }
        else
        {
            virtualHostName = body.virtualHost == null ? null : String.valueOf(body.virtualHost);
        }

        VirtualHost virtualHost = stateManager.getVirtualHostRegistry().getVirtualHost(virtualHostName);

        if (virtualHost == null)
        {
            throw body.getConnectionException(AMQConstant.NOT_FOUND, "Unknown virtual host: '" + virtualHostName + "'");
        }
        else
        {
            session.setVirtualHost(virtualHost);

            AccessResult result = virtualHost.getAccessManager().isAuthorized(virtualHost, session.getAuthorizedID(), AccessRights.Rights.ANY);

            switch (result.getStatus())
            {
                default:
                case REFUSED:
                    String error = "Any access denied to vHost '" + virtualHostName + "' by "
                                   + result.getAuthorizer();
                   
                    _logger.warn(error);

                    throw body.getConnectionException(AMQConstant.ACCESS_REFUSED, error);
                case GRANTED:
                    _logger.info("Granted any access to vHost '" + virtualHostName + "' for " + session.getAuthorizedID()
                                 + " by '" + result.getAuthorizer() + "'");
            }
View Full Code Here

        session.writeFrame(tuneOkBody.generateFrame(channelId));

        String host = session.getAMQConnection().getVirtualHost();
        AMQShortString virtualHost = new AMQShortString("/" + host);

        ConnectionOpenBody openBody = methodRegistry.createConnectionOpenBody(virtualHost,null,true);

        // Be aware of possible changes to parameter order as versions change.
        session.writeFrame(openBody.generateFrame(channelId));
    }
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, QueueRegistry queueRegistry,
                               ExchangeRegistry exchangeRegistry, AMQProtocolSession protocolSession,
                               AMQMethodEvent<ConnectionOpenBody> evt) throws AMQException
    {
        ConnectionOpenBody body = evt.getMethod();
        String contextKey = body.virtualHost;

        //todo //FIXME The virtual host must be validated by the server for the connection to open-ok
        // See Spec (0.8.2). Section  3.1.2 Virtual Hosts
        if (contextKey == null)
View Full Code Here

        session.writeFrame(tuneOkBody.generateFrame(channelId));

        String host = session.getAMQConnection().getVirtualHost();
        AMQShortString virtualHost = new AMQShortString("/" + host);

        ConnectionOpenBody openBody = methodRegistry.createConnectionOpenBody(virtualHost,null,true);

        // Be aware of possible changes to parameter order as versions change.
        session.writeFrame(openBody.generateFrame(channelId));
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.framing.ConnectionOpenBody

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.