Search in sources :

Example 1 with Protocol

use of org.apache.qpid.server.model.Protocol in project qpid-broker-j by apache.

the class JmsTestBase method setUpTestBase.

@BeforeClass
public static void setUpTestBase() {
    Protocol protocol = getProtocol();
    _managementFacade = new AmqpManagementFacade(protocol);
    if (protocol == Protocol.AMQP_1_0) {
        _jmsProvider = new QpidJmsClientProvider(_managementFacade);
    } else {
        _jmsProvider = new QpidJmsClient0xProvider();
    }
    LOGGER.debug("Test receive timeout is {} milliseconds", getReceiveTimeout());
}
Also used : Protocol(org.apache.qpid.server.model.Protocol) BeforeClass(org.junit.BeforeClass)

Example 2 with Protocol

use of org.apache.qpid.server.model.Protocol in project qpid-broker-j by apache.

the class HttpTestBase method setUpTestBase.

@Before
public void setUpTestBase() throws Exception {
    System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
    HttpRequestConfig config = getHttpRequestConfig();
    _helper = new HttpTestHelper(getBrokerAdmin(), config != null && config.useVirtualHostAsHost() ? getVirtualHost() : null);
    Protocol protocol = getProtocol();
    AmqpManagementFacade managementFacade = new AmqpManagementFacade(protocol);
    if (protocol == Protocol.AMQP_1_0) {
        _jmsProvider = new QpidJmsClientProvider(managementFacade);
    } else {
        _jmsProvider = new QpidJmsClient0xProvider();
    }
}
Also used : QpidJmsClient0xProvider(org.apache.qpid.systests.QpidJmsClient0xProvider) QpidJmsClientProvider(org.apache.qpid.systests.QpidJmsClientProvider) AmqpManagementFacade(org.apache.qpid.systests.AmqpManagementFacade) Protocol(org.apache.qpid.server.model.Protocol) Before(org.junit.Before)

Example 3 with Protocol

use of org.apache.qpid.server.model.Protocol in project qpid-broker-j by apache.

the class AmqpPortImpl method onActivate.

@Override
protected State onActivate() {
    if (getAncestor(SystemConfig.class).isManagementMode()) {
        return State.QUIESCED;
    } else {
        Collection<Transport> transports = getTransports();
        TransportProvider transportProvider = null;
        final HashSet<Transport> transportSet = new HashSet<>(transports);
        for (TransportProviderFactory tpf : (new QpidServiceLoader()).instancesOf(TransportProviderFactory.class)) {
            if (tpf.getSupportedTransports().contains(transports)) {
                transportProvider = tpf.getTransportProvider(transportSet);
            }
        }
        if (transportProvider == null) {
            throw new IllegalConfigurationException("No transport providers found which can satisfy the requirement to support the transports: " + transports);
        }
        if (transports.contains(Transport.SSL) || transports.contains(Transport.WSS)) {
            _sslContext = createSslContext();
        }
        Protocol defaultSupportedProtocolReply = getDefaultAmqpSupportedReply();
        try {
            _transport = transportProvider.createTransport(transportSet, _sslContext, this, getProtocols(), defaultSupportedProtocolReply);
            _transport.start();
            _boundPort = _transport.getAcceptingPort();
            for (Transport transport : getTransports()) {
                _container.getEventLogger().message(BrokerMessages.LISTENING(String.valueOf(transport), _transport.getAcceptingPort()));
            }
            return State.ACTIVE;
        } catch (PortBindFailureException e) {
            _container.getEventLogger().message(PortMessages.BIND_FAILED(getType().toUpperCase(), getPort()));
            throw e;
        }
    }
}
Also used : SystemConfig(org.apache.qpid.server.model.SystemConfig) QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader) PortBindFailureException(org.apache.qpid.server.transport.PortBindFailureException) TransportProviderFactory(org.apache.qpid.server.plugin.TransportProviderFactory) IllegalConfigurationException(org.apache.qpid.server.configuration.IllegalConfigurationException) AcceptingTransport(org.apache.qpid.server.transport.AcceptingTransport) Transport(org.apache.qpid.server.model.Transport) Protocol(org.apache.qpid.server.model.Protocol) TransportProvider(org.apache.qpid.server.transport.TransportProvider) HashSet(java.util.HashSet)

Example 4 with Protocol

use of org.apache.qpid.server.model.Protocol in project qpid-broker-j by apache.

the class AmqpPortImpl method getDefaultAmqpSupportedReply.

private Protocol getDefaultAmqpSupportedReply() {
    String defaultAmqpSupportedReply = getContextKeys(false).contains(AmqpPort.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY) ? getContextValue(String.class, AmqpPort.PROPERTY_DEFAULT_SUPPORTED_PROTOCOL_REPLY) : null;
    Protocol protocol = null;
    if (defaultAmqpSupportedReply != null && defaultAmqpSupportedReply.length() != 0) {
        try {
            protocol = Protocol.valueOf("AMQP_" + defaultAmqpSupportedReply.substring(1));
        } catch (IllegalArgumentException e) {
            LOGGER.warn("The configured default reply ({}) is not a valid value for a protocol.  This value will be ignored", defaultAmqpSupportedReply);
        }
    }
    final Set<Protocol> protocolSet = getProtocols();
    if (protocol != null && !protocolSet.contains(protocol)) {
        LOGGER.warn("The configured default reply ({}) to an unsupported protocol version initiation is not" + " supported on this port.  Only the following versions are supported: {}", defaultAmqpSupportedReply, protocolSet);
        protocol = null;
    }
    return protocol;
}
Also used : Protocol(org.apache.qpid.server.model.Protocol)

Example 5 with Protocol

use of org.apache.qpid.server.model.Protocol in project qpid-broker-j by apache.

the class Main method printVersion.

private void printVersion() {
    final StringBuilder protocol = new StringBuilder("AMQP version(s) [major.minor]: ");
    boolean first = true;
    Set<Protocol> protocols = new TreeSet<>();
    for (ProtocolEngineCreator installedEngine : (new QpidServiceLoader()).instancesOf(ProtocolEngineCreator.class)) {
        protocols.add(installedEngine.getVersion());
    }
    for (Protocol supportedProtocol : protocols) {
        if (first) {
            first = false;
        } else {
            protocol.append(", ");
        }
        protocol.append(supportedProtocol.getProtocolVersion());
    }
    System.out.println(CommonProperties.getVersionString() + " (" + protocol + ")");
}
Also used : QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader) TreeSet(java.util.TreeSet) ProtocolEngineCreator(org.apache.qpid.server.plugin.ProtocolEngineCreator) Protocol(org.apache.qpid.server.model.Protocol)

Aggregations

Protocol (org.apache.qpid.server.model.Protocol)11 Set (java.util.Set)4 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 StringWriter (java.io.StringWriter)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)2 QpidServiceLoader (org.apache.qpid.server.plugin.QpidServiceLoader)2 ConfiguredObjectRecord (org.apache.qpid.server.store.ConfiguredObjectRecord)2 TreeSet (java.util.TreeSet)1 UUID (java.util.UUID)1 ConfiguredObjectAttribute (org.apache.qpid.server.model.ConfiguredObjectAttribute)1 ConfiguredObjectTypeRegistry (org.apache.qpid.server.model.ConfiguredObjectTypeRegistry)1 ConfiguredSettableAttribute (org.apache.qpid.server.model.ConfiguredSettableAttribute)1 Model (org.apache.qpid.server.model.Model)1 ProtocolType (org.apache.qpid.server.model.Protocol.ProtocolType)1 SystemConfig (org.apache.qpid.server.model.SystemConfig)1 Transport (org.apache.qpid.server.model.Transport)1