use of org.apache.qpid.server.plugin.QpidServiceLoader in project qpid-broker-j by apache.
the class BrokerImpl method registerSystemAddressSpaces.
private void registerSystemAddressSpaces() {
QpidServiceLoader qpidServiceLoader = new QpidServiceLoader();
Iterable<SystemAddressSpaceCreator> factories = qpidServiceLoader.instancesOf(SystemAddressSpaceCreator.class);
for (SystemAddressSpaceCreator creator : factories) {
creator.register(_addressSpaceRegistry);
}
}
use of org.apache.qpid.server.plugin.QpidServiceLoader 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;
}
}
}
use of org.apache.qpid.server.plugin.QpidServiceLoader in project qpid-broker-j by apache.
the class AmqpPortImpl method onOpen.
@Override
protected void onOpen() {
super.onOpen();
_protocolHandshakeTimeout = getContextValue(Long.class, AmqpPort.PROTOCOL_HANDSHAKE_TIMEOUT);
_connectionWarnCount = getContextValue(Integer.class, OPEN_CONNECTIONS_WARN_PERCENT);
_closeWhenNoRoute = getContextValue(Boolean.class, AmqpPort.CLOSE_WHEN_NO_ROUTE);
_sessionCountLimit = getContextValue(Integer.class, AmqpPort.SESSION_COUNT_LIMIT);
_heartBeatDelay = getContextValue(Integer.class, AmqpPort.HEART_BEAT_DELAY);
_tlsSessionTimeout = getContextValue(Integer.class, AmqpPort.TLS_SESSION_TIMEOUT);
_tlsSessionCacheSize = getContextValue(Integer.class, AmqpPort.TLS_SESSION_CACHE_SIZE);
@SuppressWarnings("unchecked") List<String> configurationPropertyEnrichers = getContextValue(List.class, AmqpPort.CONNECTION_PROPERTY_ENRICHERS);
List<ConnectionPropertyEnricher> enrichers = new ArrayList<>(configurationPropertyEnrichers.size());
final Map<String, ConnectionPropertyEnricher> enrichersByType = new QpidServiceLoader().getInstancesByType(ConnectionPropertyEnricher.class);
for (String enricherName : configurationPropertyEnrichers) {
ConnectionPropertyEnricher enricher = enrichersByType.get(enricherName);
if (enricher != null) {
enrichers.add(enricher);
} else {
LOGGER.warn("Ignoring unknown Connection Property Enricher type: '" + enricherName + "' on port " + this.getName());
}
}
_connectionPropertyEnrichers = Collections.unmodifiableList(enrichers);
}
use of org.apache.qpid.server.plugin.QpidServiceLoader in project qpid-broker-j by apache.
the class PreferenceFactory method convertMapToPreferenceValue.
private static PreferenceValue convertMapToPreferenceValue(String type, Map<String, Object> preferenceValueAttributes) {
String implementationType = type;
if (type != null && type.startsWith("X-")) {
implementationType = "X-generic";
}
final Map<String, PreferenceValueFactoryService> preferenceValueFactories = new QpidServiceLoader().getInstancesByType(PreferenceValueFactoryService.class);
final PreferenceValueFactoryService preferenceValueFactory = preferenceValueFactories.get(implementationType);
if (preferenceValueFactory == null) {
throw new IllegalArgumentException(String.format("Cannot find preference type factory for type '%s'", implementationType));
}
return preferenceValueFactory.createInstance(preferenceValueAttributes);
}
use of org.apache.qpid.server.plugin.QpidServiceLoader in project qpid-broker-j by apache.
the class BrokerAdminFactory method createInstance.
BrokerAdmin createInstance(String type) {
Map<String, BrokerAdmin> adminFacades = new QpidServiceLoader().getInstancesByType(BrokerAdmin.class);
BrokerAdmin brokerAdmin = adminFacades.get(type);
if (brokerAdmin == null) {
throw new RuntimeException(String.format("Could not find BrokerAdmin implementation of type '%s'", type));
}
return brokerAdmin;
}
Aggregations