All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tacitknowledge.slowlight.proxyserver.config.ServerConfig Maven / Gradle / Ivy

The newest version!
package com.tacitknowledge.slowlight.proxyserver.config;

import java.util.ArrayList;
import java.util.List;

/**
 * This class represents a server configuration model.
 * To configure a server you have to specify the id of the server, type - type alias (this must be specified in the serverTypes
 * list see {@link com.tacitknowledge.slowlight.proxyserver.config.SlowlightConfig}), local port this server will listen on,
 * handlers stack (see {@link com.tacitknowledge.slowlight.proxyserver.config.HandlerConfig}) and server params if any.
* *
* An example of servers configuration (JSON) *
 * {@code
 * "servers" : [
 *      {
 *          "id" : "testServer1",
 *          "type" : "simple",
 *          "localPort" : "9011",
 *          "handlers" : [
 *              ...
 *          ]
 *      },
 *      {
 *          "id" : "testServer2",
 *          "type" : "proxy",
 *          "localPort" : "9012",
 *          "params" : {
 *              "host" : "localhost",
 *              "port" : "8080"
 *          },
 *          "handlers" : [
 *              ...
 *          ]
 *      }
 * ]
 * }
 * 
* * @author Alexandr Donciu ([email protected]) * */ public class ServerConfig extends ParameterizedConfig { private String id; private String type; private int localPort; private List handlers = new ArrayList(); public String getId() { return id; } public void setId(final String id) { this.id = id; } public String getType() { return type; } public void setType(final String type) { this.type = type; } public int getLocalPort() { return localPort; } public void setLocalPort(final int localPort) { this.localPort = localPort; } public List getHandlers() { return handlers; } public void setHandlers(final List handlers) { this.handlers = handlers; } }