Examples of AMQConnectionModel


Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        {
            _logger.debug("Closing connection registry :" + _registry.size() + " connections.");
        }
        while (!_registry.isEmpty())
        {
            AMQConnectionModel connection = _registry.get(0);
            closeConnection(connection, AMQConstant.CONNECTION_FORCED, replyText);
        }
    }
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        }
    }

    protected String generateSessionMessage(final AMQSessionModel session)
    {
        AMQConnectionModel connection = session.getConnectionModel();
        return "[" + MessageFormat.format(CHANNEL_FORMAT, connection == null ? -1L : connection.getConnectionId(),
                                          (connection == null || connection.getAuthorizedPrincipal() == null)
                                                  ? "?"
                                                  : connection.getAuthorizedPrincipal().getName(),
                                          (connection == null || connection.getRemoteAddressString() == null)
                                                  ? "?"
                                                  : connection.getRemoteAddressString(),
                                          (connection == null || connection.getVirtualHostName() == null)
                                                  ? "?"
                                                  : connection.getVirtualHostName(),
                                          session.getChannelId())
               + "] ";
    }
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

         * 1 - User ID
         * 2 - IP
         * 3 - Virtualhost
         * 4 - Channel ID
         */
        AMQConnectionModel connection = session.getConnectionModel();
        setLogStringWithFormat(CHANNEL_FORMAT,
                               connection == null ? -1L : connection.getConnectionId(),
                               (connection == null || connection.getAuthorizedPrincipal() == null) ? "?" : connection.getAuthorizedPrincipal().getName(),
                               (connection == null || connection.getRemoteAddressString() == null) ? "?" : connection.getRemoteAddressString(),
                               (connection == null || connection.getVirtualHostName() == null) ? "?" : connection.getVirtualHostName(),
                               session.getChannelId());

    }
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        final Iterator<AMQConnectionModel> connections =
                        ((ServerConnection)conn).getVirtualHost().getConnectionRegistry().getConnections().iterator();
        while(connections.hasNext())
        {
            final AMQConnectionModel amqConnectionModel = connections.next();
            final String userName = amqConnectionModel.getAuthorizedPrincipal() == null
                    ? ""
                    : amqConnectionModel.getAuthorizedPrincipal().getName();
            if (userId.equals(userName) && !amqConnectionModel.isSessionNameUnique(name))
            {
                return false;
            }
        }
        return true;
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        switch(_exclusivityPolicy)
        {
            case NONE:
            case CONTAINER:
            case PRINCIPAL:
                AMQConnectionModel con = null;
                for(ConsumerImpl c : getConsumers())
                {
                    if(con == null)
                    {
                        con = c.getSessionModel().getConnectionModel();
                    }
                    else if(!con.equals(c.getSessionModel().getConnectionModel()))
                    {
                        throw new ExistingConsumerPreventsExclusive();
                    }
                }
                _exclusiveOwner = con;
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        final Iterator<AMQConnectionModel> connections =
                        ((ServerConnection)conn).getVirtualHost().getConnectionRegistry().getConnections().iterator();
        while(connections.hasNext())
        {
            final AMQConnectionModel amqConnectionModel = connections.next();
            final String userName = amqConnectionModel.getAuthorizedPrincipal() == null
                    ? ""
                    : amqConnectionModel.getAuthorizedPrincipal().getName();
            if (userId.equals(userName) && !amqConnectionModel.isSessionNameUnique(name))
            {
                return false;
            }
        }
        return true;
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        switch(_exclusive)
        {
            case NONE:
            case CONTAINER:
            case PRINCIPAL:
                AMQConnectionModel con = null;
                for(ConsumerImpl c : getConsumers())
                {
                    if(con == null)
                    {
                        con = c.getSessionModel().getConnectionModel();
                    }
                    else if(!con.equals(c.getSessionModel().getConnectionModel()))
                    {
                        throw new ExistingConsumerPreventsExclusive();
                    }
                }
                _exclusiveOwner = con;
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        queueArguments.put(Queue.NAME, queueName);
        queueArguments.put(Queue.DURABLE, durable);
        queueArguments.put(Queue.LIFETIME_POLICY, LifetimePolicy.PERMANENT);
        queueArguments.put(Queue.EXCLUSIVE, exclusive ? ExclusivityPolicy.CONTAINER : ExclusivityPolicy.NONE);
        AMQSessionModel sessionModel = mock(AMQSessionModel.class);
        AMQConnectionModel connectionModel = mock(AMQConnectionModel.class);
        when(sessionModel.getConnectionModel()).thenReturn(connectionModel);
        when(connectionModel.getRemoteContainerName()).thenReturn(queueOwner);
        SessionPrincipal principal = new SessionPrincipal(sessionModel);
        AMQQueue<?> queue = Subject.doAs(new Subject(true,
                                                     Collections.singleton(principal),
                                                     Collections.emptySet(),
                                                     Collections.emptySet()),
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

        final Subject subject = TestPrincipalUtils.createTestSubject("user1");
        final String testVirtualHost = getName();
        final InetAddress inetAddress = InetAddress.getLocalHost();
        final InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, 1);

        AMQConnectionModel connectionModel = mock(AMQConnectionModel.class);
        when(connectionModel.getRemoteAddress()).thenReturn(inetSocketAddress);

        subject.getPrincipals().add(new ConnectionPrincipal(connectionModel));

        Subject.doAs(subject, new PrivilegedExceptionAction<Object>()
        {
View Full Code Here

Examples of org.apache.qpid.server.protocol.AMQConnectionModel

    {
        final Subject subject = TestPrincipalUtils.createTestSubject("user1");
        final InetAddress inetAddress = InetAddress.getLocalHost();
        final InetSocketAddress inetSocketAddress = new InetSocketAddress(inetAddress, 1);

        AMQConnectionModel connectionModel = mock(AMQConnectionModel.class);
        when(connectionModel.getRemoteAddress()).thenReturn(inetSocketAddress);

        subject.getPrincipals().add(new ConnectionPrincipal(connectionModel));

        Subject.doAs(subject, new PrivilegedExceptionAction<Object>()
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.