com.kaazing.gateway.server
Interface Gateway


public interface Gateway

Gateway for configuring, launching, and destroying a Launcher instance. The GatewayFactory is used to create Gateways, for example:

 Gateway embeddedGateway = GatewayFactory.createGateway();
 
 

Once a Gateway has been created, it can be immediately launched with the default environment. The default environment is to have GATEWAY_HOME set to the parent directory of the location of the JAR file containing the Gateway class file. Any configuration files, content files, and the license file are searched for under this directory.

If another environment is desired, or properties in the Gateway's configuration file (e.g. gateway-config.xml) are to be overridden, then invoke the configure(java.util.Properties) method first with the desired properties.

See Also:
GatewayFactory

Field Summary
static String BYPASS_PLATFORM_CHECK_PROPERTY
           
static String GATEWAY_CONFIG_DIRECTORY_PROPERTY
          The location of configuration files used by the Gateway.
static String GATEWAY_CONFIG_PROPERTY
          The fully qualified path to the configuration file of the Gateway.
static String GATEWAY_HOME_PROPERTY
          The root directory of the Gateway.
static String GATEWAY_LICENSE_DIRECTORY_PROPERTY
          The location of the license file used by the Gateway.
static String GATEWAY_LOG_DIRECTORY_PROPERTY
          The location of the Gateway's log files.
static String GATEWAY_TEMP_DIRECTORY_PROPERTY
          The location of temp files used by the Gateway.
static String GATEWAY_USER_LIB_DIRECTORY_PROPERTY
          The location custom code used by the Gateway.
static String GATEWAY_WEB_DIRECTORY_PROPERTY
          The location of web content served by the Gateway.
static String LOG4J_CONFIG_PROPERTY
          The fully qualified path to a Log4J configuration file.
static String LOG4J_CONFIG_REFRESH_INTERVAL
          By default, the Gateway will check for changes in the log4j config file every minute.
static String OVERRIDE_LOGGING
          In order to override the Gateway's default logging configuration this property can be set to true.
static String TCP_BACKLOG
           
static String TCP_MAXIMUM_READ_BUFFER_SIZE
           
static String TCP_MINIMUM_READ_BUFFER_SIZE
           
static String TCP_NO_DELAY
           
static String TCP_PROCESSOR_COUNT
           
static String TCP_READ_BUFFER_SIZE
           
static String TCP_WRITE_TIMEOUT
           
static String UDP_MAXIMUM_READ_BUFFER_SIZE
           
static String UDP_MINIMUM_READ_BUFFER_SIZE
           
static String UDP_READ_BUFFER_SIZE
           
 
Method Summary
 void destroy()
          Stops the running Gateway.
 Properties getProperties()
          Get the current set of properties used to configure the Gateway.
 void launch()
          Starts the Gateway, which in turn initializes and starts up all the configured services, including binding to host and port specified in the service's accept tag.
 void setMBeanServer(MBeanServer server)
          Set an MBeanServer on the Gateway.
 void setProperties(Properties properties)
          Set up the Gateway with the given properties.
 

Field Detail

GATEWAY_HOME_PROPERTY

static final String GATEWAY_HOME_PROPERTY
The root directory of the Gateway. Startup scripts are located in GATEWAY_HOME/bin and Gateway libraries are located in GATEWAY_HOME/lib. This property can be set to something like /usr/share/kaazing/html5/3.3

See Also:
Constant Field Values

GATEWAY_CONFIG_PROPERTY

static final String GATEWAY_CONFIG_PROPERTY
The fully qualified path to the configuration file of the Gateway. For example, /etc/kaazing/conf/gateway-config.xml. This file contains the set of properties and services that will be exposed by the running Gateway. See "Configuring Kaazing WebSocket Gateway" in the admin guide for more information.

See Also:
Constant Field Values

GATEWAY_CONFIG_DIRECTORY_PROPERTY

static final String GATEWAY_CONFIG_DIRECTORY_PROPERTY
The location of configuration files used by the Gateway. For example, /etc/kaazing/conf/. This directory will be searched for gateway-config.xml if the GATEWAY_CONFIG_PROPERTY is not set. Any configuration files (e.g. for login modules) are located in this directory.

See Also:
Constant Field Values

GATEWAY_WEB_DIRECTORY_PROPERTY

static final String GATEWAY_WEB_DIRECTORY_PROPERTY
The location of web content served by the Gateway. For example, /var/lib/kaazing/web/. This directory serves as the root of any directory service configured in the Gateway. The directory property of a directory service is treated as a child of the GATEWAY_WEB_DIRECTORY.

See Also:
Constant Field Values

GATEWAY_TEMP_DIRECTORY_PROPERTY

static final String GATEWAY_TEMP_DIRECTORY_PROPERTY
The location of temp files used by the Gateway. During execution the Gateway may need to create temporary files, and those files are created in this directory. For example, /var/lib/kaazing/temp/.

See Also:
Constant Field Values

GATEWAY_LICENSE_DIRECTORY_PROPERTY

static final String GATEWAY_LICENSE_DIRECTORY_PROPERTY
The location of the license file used by the Gateway. On startup the Gateway will read the license.txt file located in this directory in order to configure maximum connection counts, available services, etc. For example, /etc/kaazing/license/.

See Also:
Constant Field Values

GATEWAY_LOG_DIRECTORY_PROPERTY

static final String GATEWAY_LOG_DIRECTORY_PROPERTY
The location of the Gateway's log files. For example, /var/log/kaazing/.

See Also:
Constant Field Values

GATEWAY_USER_LIB_DIRECTORY_PROPERTY

static final String GATEWAY_USER_LIB_DIRECTORY_PROPERTY
The location custom code used by the Gateway. Any JAR files in this directory will be added to the Gateway's classpath. Custom login-modules or libraries used to access a custom server (e.g. a message broker) would be located in this directory. For example, /home/kaazing/lib/.

See Also:
Constant Field Values

BYPASS_PLATFORM_CHECK_PROPERTY

static final String BYPASS_PLATFORM_CHECK_PROPERTY
See Also:
Constant Field Values

LOG4J_CONFIG_PROPERTY

static final String LOG4J_CONFIG_PROPERTY
The fully qualified path to a Log4J configuration file. See http://logging.apache.org/log4j/ for more information about configuring Log4J. By default, the Gateway will look for log4j-config.xml in this directory.

See Also:
Constant Field Values

OVERRIDE_LOGGING

static final String OVERRIDE_LOGGING
In order to override the Gateway's default logging configuration this property can be set to true. By default the Gateway configures Log4J as the logging system, but any logging system that supports SLF4J (see http://www.slf4j.org/ for more information) can be substituted.

See Also:
Constant Field Values

LOG4J_CONFIG_REFRESH_INTERVAL

static final String LOG4J_CONFIG_REFRESH_INTERVAL
By default, the Gateway will check for changes in the log4j config file every minute. When a change is detected, the log levels are refreshed as for the new configuration values. By specifying the LOG4J_CONFIG_REFRESH_INTERVAL the default value can be changed. The value is an integer that specifies the interval in seconds. The default is 60 seconds. By setting the value to 0 the feature is disabled and the Gateway will never check for changes in the log4j config file.

See Also:
Constant Field Values

TCP_BACKLOG

static final String TCP_BACKLOG
See Also:
Constant Field Values

TCP_MAXIMUM_READ_BUFFER_SIZE

static final String TCP_MAXIMUM_READ_BUFFER_SIZE
See Also:
Constant Field Values

TCP_MINIMUM_READ_BUFFER_SIZE

static final String TCP_MINIMUM_READ_BUFFER_SIZE
See Also:
Constant Field Values

TCP_NO_DELAY

static final String TCP_NO_DELAY
See Also:
Constant Field Values

TCP_PROCESSOR_COUNT

static final String TCP_PROCESSOR_COUNT
See Also:
Constant Field Values

TCP_READ_BUFFER_SIZE

static final String TCP_READ_BUFFER_SIZE
See Also:
Constant Field Values

TCP_WRITE_TIMEOUT

static final String TCP_WRITE_TIMEOUT
See Also:
Constant Field Values

UDP_MAXIMUM_READ_BUFFER_SIZE

static final String UDP_MAXIMUM_READ_BUFFER_SIZE
See Also:
Constant Field Values

UDP_MINIMUM_READ_BUFFER_SIZE

static final String UDP_MINIMUM_READ_BUFFER_SIZE
See Also:
Constant Field Values

UDP_READ_BUFFER_SIZE

static final String UDP_READ_BUFFER_SIZE
See Also:
Constant Field Values
Method Detail

setProperties

void setProperties(Properties properties)
Set up the Gateway with the given properties. Example of properties used by the Gateway are GATEWAY_HOME and GATEWAY_CONFIG. The gateway-config.xml configuration file also specifies property names and values that can be overridden by the configured properties.

Parameters:
properties - the name/value pairs used to configure the Gateway by setting the location of the GATEWAY_HOME, GATEWAY_CONFIG, etc. and/or the names of properties in the gateway-config.xml and the values to which those properties should be set.

getProperties

Properties getProperties()
Get the current set of properties used to configure the Gateway.

Returns:
The name/value pairs used to configure the Gateway

setMBeanServer

void setMBeanServer(MBeanServer server)
Set an MBeanServer on the Gateway. This will be the MBeanServer the Gateway populates with its management information, e.g. information about services configured in the Gateway and current sessions connected to the Gateway. If an MBeanServer is set on the Gateway then management should not be configured in the Gateway's configuration file. The presence of management in the configuration file causes the platform MBeanServer to be used for the Gateway's management information.

Parameters:
server - the MBeanServer the Gateway should use to populate with its management information.

launch

void launch()
            throws Exception
Starts the Gateway, which in turn initializes and starts up all the configured services, including binding to host and port specified in the service's accept tag. If launch() is called on an already launched Gateway then an exception is thrown. After calling destroy, the Gateway can be launched again.

Throws:
Exception - examples of exceptions thrown by the Gateway at launch time: unable to read the configuration file, unable to bind to a network port specified in a service configuration, or a directory service's directory property is not a valid directory.

destroy

void destroy()
             throws Exception
Stops the running Gateway. If the Gateway has already been destroyed this has no effect.

Throws:
Exception - an example of exceptions thrown by the Gateway at destroy time is unable to clean up management information from the MBeanServer, which could happen if the MBeanServer is destroyed out from underneath the Gateway unexpectedly.


Copyright © 2014. All Rights Reserved.