Modules, as described in "Module Architecture", represent configured module inside PETEP application and are created by user in Settings section.
The main goal of modules is to create workers and store/load configuration.
All the attributes (code, name, description, enabled) are configured by users and you should not modify them in any way.
/**
* Module base class.
* @param <F> Type of parent factory of the module
*/
@Getter
@AllArgsConstructor
@PetepAPI
public abstract class Module<F extends ModuleFactory<?>> {
/**
* Parent factory, which produced this module
*/
protected final F factory;
/**
* Unique code of the module
*/
protected final String code;
/**
* Name of the module for displaying in the GUI
*/
protected final String name;
/**
* Description of the module
*/
protected final String description;
/**
* Whether the module is enabled and should be used in running PETEP core or not
*/
protected final boolean enabled;
@Override
public String toString() {
return name + " (" + code + ")";
}
}
Proxy modules are used to create module workers called Proxies using module configuration.
/**
* Proxy module provides proxy workers when PETEP starts.
* <p>Is created and configured by user in application settings.</p>
*/
@PetepAPI
public abstract class ProxyModule extends Module<ProxyModuleFactory> {
/**
* Constructs proxy module.
* @param factory Factory that created this module
* @param code Code of this module
* @param name Name of this module
* @param description Description of this module
* @param enabled {@code true} if the module should be used
*/
protected ProxyModule(
ProxyModuleFactory factory,
String code,
String name,
String description,
boolean enabled) {
super(factory, code, name, description, enabled);
}
/**
* Creates proxy worker.
* @param helper Helper for allowing the proxy to work with running PETEP core
* @return Created proxy
*/
public abstract Proxy createProxy(PetepHelper helper);
}
Interceptor modules are used to create module workers called Interceptors using module configuration.
/**
* Interceptor module provides interceptor workers when PETEP starts.
* <p>Is created and configured by user in application settings.</p>
*/
@PetepAPI
public abstract class InterceptorModule extends Module<InterceptorModuleFactory> {
/**
* Constructs interceptor module.
* @param factory Factory that created this module
* @param code Code of this module
* @param name Name of this module
* @param description Description of this module
* @param enabled {@code true} if the module should be used
*/
protected InterceptorModule(
InterceptorModuleFactory factory,
String code,
String name,
String description,
boolean enabled) {
super(factory, code, name, description, enabled);
}
/**
* Creates interceptor with specified ID.
* @param id Identifier of the interceptor (index of the interceptor)
* @param helper Helper for allowing the interceptor to work with running PETEP core
* @return Created interceptor
*/
public abstract Interceptor createInterceptor(int id, PetepHelper helper);
}