@Override public String getProperties() { ServiceProperties properties = serviceContext.getProperties(); return properties == null ? "" : asJSONObject(properties).toString(); }
private void validateProperties(ServiceContext serviceContext) { ServiceProperties properties = serviceContext.getProperties(); // validate all properties: rewrite-cookie-domain, rewrite-cookie-path, rewrite-location Iterable<String> simpleProperties = properties.simplePropertyNames(); Set<String> unknownProperties = StreamSupport.stream(simpleProperties.spliterator(), false) .filter(p -> !KNOWN_SIMPLE_PROPERTIES.contains(p)) .collect(Collectors.toSet()); Iterable<String> nestedProperties = properties.nestedPropertyNames(); StreamSupport.stream(nestedProperties.spliterator(), false) .filter(p -> !KNOWN_NESTED_PROPERTIES.contains(p)) .forEach(unknownProperties::add); if (!unknownProperties.isEmpty()) { throw new IllegalArgumentException(serviceContext.getServiceName() + " http.proxy service specifies unknown properties : " + unknownProperties); } }
@Override public void init(ServiceContext serviceContext) throws Exception { this.serviceContext = serviceContext; ServiceProperties properties = serviceContext.getProperties(); int repeatCount = getOptionalIntProperty(properties, "repeat", EchoServiceHandler.DEFAULT_REPEAT_COUNT); handler = new EchoServiceHandler(repeatCount, serviceContext.getLogger()); }
schemeNames.add(schemeName); ServiceProperties properties = serviceContext.getProperties(); String accept = properties.get("accept"); if (accept != null) {
OnClientMessage onClientMessage = OnClientMessage.fromString(serviceContext.getProperties().get(ON_CLIENT_MESSAGE)); if ( maximumScheduledWriteBytes != Long.MAX_VALUE ) { ServiceProperties properties = serviceContext.getProperties(); String reconnectDelay = properties.get("reconnect.delay"); if ((connectURIs == null || connectURIs.isEmpty())) {
@Override public void stop() throws Exception { quiesce(); // KG-10156: Add some logging to indicate that JMX has stopped ServiceProperties properties = serviceContext.getProperties(); String connectorServerAddress = properties.get("connector.server.address"); if (connectorServerAddress == null) { connectorServerAddress = "jmx://localhost:2020"; } Logger startupLogger = Launcher.getGatewayStartupLogger(); startupLogger.info(format("Stopping JMX Management service with URI %s", connectorServerAddress)); // cleanup the MBeans that were added... handler.cleanupRegisteredBeans(); if (connectorServer != null) { connectorServer.stop(); connectorServer = null; } if (sRMIRegistry != null) { UnicastRemoteObject.unexportObject(sRMIRegistry, true); sRMIRegistry = null; } }
ServiceProperties properties = serviceContext.getProperties();
@Override public void init(ServiceContext serviceContext) throws Exception { this.serviceContext = serviceContext; EarlyAccessFeatures.TURN_REST_SERVICE.assertEnabled(getConfiguration(), serviceContext.getLogger()); ServiceProperties properties = serviceContext.getProperties(); String urls = properties.get("url"); TurnRestCredentialsGenerator credentialGeneratorInstance = setUpCredentialsGenerator(properties); long ttl = Utils.parseTimeInterval(properties.get("credentials.ttl"), TimeUnit.SECONDS, DEFAULT_CREDENTIALS_TTL); handler = new TurnRestServiceHandler(Long.toString(ttl), credentialGeneratorInstance, urls); }
@Override public void init(ServiceContext serviceContext) throws Exception { this.serviceContext = serviceContext; EarlyAccessFeatures.TURN_REST_SERVICE.assertEnabled(getConfiguration(), serviceContext.getLogger()); ServiceProperties properties = serviceContext.getProperties(); String urls = properties.get("url"); TurnRestCredentialsGenerator credentialGeneratorInstance = setUpCredentialsGenerator(properties); long ttl = Utils.parseTimeInterval(properties.get("credentials.ttl"), TimeUnit.SECONDS, DEFAULT_CREDENTIALS_TTL); handler = new TurnRestServiceHandler(Long.toString(ttl), credentialGeneratorInstance, urls); }
handler = new HttpDirectoryServiceHandler(); File webDir = serviceContext.getWebDirectory(); ServiceProperties properties = serviceContext.getProperties();
ServiceProperties properties = serviceContext.getProperties(); String connectorServerAddress = properties.get("connector.server.address"); if (connectorServerAddress != null) {
@Override public void initializeSession(IoSession connectSession, ConnectFuture future) { if (acceptSession.isClosing()) { connectSession.close(true); } else { BridgeSession.NEXT_PROTOCOL_KEY.set(connectSession, nextProtocol); // guarantee strongly-typed buffers; this is the connect-side where // the service is the client of the broker. initFilterChain(connectSession, true); // hook in any ProxyServiceExtensions here and give them a chance // to initialize the accept side of the proxy connection for (ProxyServiceExtensionSpi extension : extensions) { extension.initConnectSession(connectSession, getServiceContext().getProperties()); } } } });
@Override public void init(ServiceContext serviceContext) throws Exception { EarlyAccessFeatures.HTTP_REDIRECT.assertEnabled(configuration, serviceContext.getLogger()); this.serviceContext = serviceContext; handler = new HttpRedirectServiceHandler(logger); ServiceProperties properties = serviceContext.getProperties(); String location = properties.get("location"); if (location == null || "".equals(location)) { throw new IllegalArgumentException("Missing required property: location"); } HttpStatus statusCode; String strStatusCode = properties.get("status-code"); if (strStatusCode == null) statusCode = HttpStatus.REDIRECT_MULTIPLE_CHOICES; else statusCode = HttpStatus.getHttpStatus(strStatusCode); if (statusCode.code() > 399 || statusCode.code() < 300) { throw new IllegalArgumentException( "Wrong value for status-code:" + statusCode + ". Valid values are integers between 300 and 399"); } String cacheControlDirectives = properties.get("cache-control"); // this is null-able handler.setLocation(location); handler.setStatusCode(statusCode); handler.setCacheControl(cacheControlDirectives); }
@Override public void init(ServiceContext serviceContext) throws Exception { EarlyAccessFeatures.HTTP_REDIRECT.assertEnabled(configuration, serviceContext.getLogger()); this.serviceContext = serviceContext; handler = new HttpRedirectServiceHandler(logger); ServiceProperties properties = serviceContext.getProperties(); String location = properties.get("location"); if (location == null || "".equals(location)) { throw new IllegalArgumentException("Missing required property: location"); } HttpStatus statusCode; String strStatusCode = properties.get("status-code"); if (strStatusCode == null) statusCode = HttpStatus.REDIRECT_MULTIPLE_CHOICES; else statusCode = HttpStatus.getHttpStatus(strStatusCode); if (statusCode.code() > 399 || statusCode.code() < 300) { throw new IllegalArgumentException( "Wrong value for status-code:" + statusCode + ". Valid values are integers between 300 and 399"); } String cacheControlDirectives = properties.get("cache-control"); // this is null-able handler.setLocation(location); handler.setStatusCode(statusCode); handler.setCacheControl(cacheControlDirectives); }
@Override public void init(ServiceContext serviceContext) throws Exception { this.serviceContext = serviceContext; // lookup service properties ServiceProperties properties = serviceContext.getProperties(); int maximumPendingBytes = getOptionalDataSizeProperty(properties, PROPERTY_MAXIMUM_PENDING_BYTES, PROPERTY_MAXIMUM_PENDING_BYTES_DEFAULT); int maximumTransferredBytes = getOptionalDataSizeProperty(properties, PROPERTY_MAXIMUM_TRANSFERRED_BYTES, PROPERTY_MAXIMUM_TRANSFERRED_BYTES_DEFAULT); int maximumRecoveryInterval = getOptionalIntProperty(properties, PROPERTY_MAXIMUM_RECOVERY_INTERVAL, PROPERTY_MAXIMUM_RECOVERY_INTERVAL_DEFAULT); int preparedConnectionCount = getOptionalIntProperty(properties, PROPERTY_PREPARED_CONNECTION_COUNT, PROPERTY_PREPARED_CONNECTION_COUNT_DEFAULT); String connectStrategy = getOptionalProperty(properties, PROPERTY_CONNECT_STRATEGY, PROPERTY_CONNECT_STRATEGY_DEFAULT.apply(preparedConnectionCount)); handler = createHandler(); handler.setServiceContext(serviceContext); handler.setMaximumPendingBytes(maximumPendingBytes); handler.setMaximumTransferredBytes(maximumTransferredBytes); handler.setMaximumRecoveryInterval(maximumRecoveryInterval); handler.setPreparedConnectionCount(connectStrategy, preparedConnectionCount, serviceContext.getProcessorCount()); }
ServiceProperties properties = serviceContext.getProperties(); String followSymlink = properties.get("symbolic-links"); if (followSymlink == null) {
extension.initAcceptSession(acceptSession, getServiceContext().getProperties());