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

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

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

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

/**
 * This class represents a handler configuration model.
 * To configure a handler you have to specify handler name, type - fully qualified class name and parameters if any.
 * Also it is possible to configure a handler so it is reused or not between communication channels (same instance of handler),
 * this could be configured by setting reusable property accordingly - by default this property is set to true.
*
* An example of handler configuration (JSON) * *
 * {@code
 * ...
 * "handlers" : [
 *      {
 *          "name" : "delayHandler",
 *          "type" : "com.tacitknowledge.slowlight.proxyserver.handler.DelayChannelHandler",
 *          "params" : {"maxDataSize" : "0", "delay" : "500"}
 *      },
 *      {
 *          "name" : "logHandler",
 *          "type" : "com.tacitknowledge.slowlight.proxyserver.handler.LogChannelHandler",
 *          "reusable" : "true"
 *      }
 * ]
 * ...}
 * 
* * @author Alexandr Donciu ([email protected]) * */ public class HandlerConfig extends ParameterizedConfig { public static final HandlerConfig EMPTY = new HandlerConfig(); private String name; private String type; private boolean reusable = true; private List behaviorFunctions = new ArrayList(); public String getName() { return name; } public void setName(final String name) { this.name = name; } public String getType() { return type; } public void setType(final String type) { this.type = type; } public boolean isReusable() { return reusable; } public void setReusable(final boolean reusable) { this.reusable = reusable; } public List getBehaviorFunctions() { return behaviorFunctions; } public void setBehaviorFunctions(final List behaviorFunctions) { this.behaviorFunctions = behaviorFunctions; } }