@Override public void init(ServiceContext context) throws Exception { logger = context.getLogger(); logger.trace("Initializing AMQP Proxy service"); super.init(context); }
@Override public void sessionCreated(IoSession ioSession) { Logger logger = getServiceContext().getLogger(); if (logger.isDebugEnabled()) { logger.debug("Session created: " + ioSession); } super.sessionCreated(ioSession); }
@Override public void sessionClosed(IoSession ioSession) { Logger logger = getServiceContext().getLogger(); if (logger.isDebugEnabled()) { logger.debug("Session closed: " + ioSession); } super.sessionClosed(ioSession); }
@Override protected void initFilterChain(IoSession session, boolean client) { Logger logger = getServiceContext().getLogger(); if (logger.isDebugEnabled()) { String s = ".initFilterChain() client = " + client; logger.debug(CLASS_NAME + s); } super.initFilterChain(session, client); // Eventually, the protocol will be available as a property of // the service. For time being, let's hardcode it to AMQP 0_9_1. ProtocolCodecFilter codec = new AmqpCodecFilter(client); IoFilterChain filterChain = session.getFilterChain(); filterChain.addLast(AmqpCodecFilter.NAME, codec); if (logger.isDebugEnabled()) { logger.debug(CLASS_NAME + ".initFilterChain(): Add codec filter"); } }
@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()); }
@Override public void init(ServiceContext serviceContext) throws Exception { EarlyAccessFeatures.HTTP_PROXY_SERVICE.assertEnabled(configuration, serviceContext.getLogger()); super.init(serviceContext); Collection<String> connectURIs = serviceContext.getConnects(); if (connectURIs == null || connectURIs.isEmpty()) { throw new IllegalArgumentException("Missing required element: <connect>"); } checkForTrailingSlashes(serviceContext); HttpProxyServiceHandler handler = getHandler(); handler.setConnectURIs(connectURIs); handler.init(); }
this.connectURI = connectURI; this.schedulerProvider = service.getSchedulerProvider(); this.logger = service.getLogger(); this.interval = interval;
onClientMessage, serviceContext.getLogger());
@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); }
@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); }