public class ComponentCache extends java.lang.Object implements ComponentWrapper.ComponentServiceBackend
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOG_RATE |
Constructor and Description |
---|
ComponentCache() |
ComponentCache(ComponentWrapper.ComponentServiceBackend backend,
MaskingLogService.MaskingLogServiceConfig maskingLogServiceConfigIn) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Clean up all component instances know to the cache.
|
ComponentWrapper |
createComponentInstance(java.lang.String instanceName)
This method creates an instance of an algorithm known to the cache.
|
ComponentWrapper |
createComponentInstance(java.lang.String instanceName,
boolean isTracked)
This method creates an instance of an algorithm known to the cache.
|
MaskingComponent |
createRawComponentInstance(java.lang.String pluginName,
java.lang.String pluginJarPath,
java.lang.String className,
boolean builtIn)
Create an anonymous component instance of the specified class without configuring or calling
setup.
|
java.util.Set<MaskingComponent> |
discoverFrameworks(java.lang.String pluginName)
Discover all algorithm framework classes provided by a plugin.
|
java.util.Map<java.lang.String,ComponentWrapper.ComponentInstanceDetails> |
discoverInstanceDetails(java.lang.String pluginName)
Discover all algorithm component instances provided by a plugin.
|
ComponentWrapper.ComponentInstanceDetails |
getAlgorithmComponentDetail(java.lang.String algorithmCd) |
byte[] |
getAlgorithmKey(java.lang.String algorithmCd) |
java.sql.Driver |
getDriver(java.lang.Integer driverId) |
java.util.List<java.lang.String> |
getInstanceNames()
Returns a list of component instance names.
|
java.util.List<java.lang.String> |
getInstanceNames(java.lang.String frameworkName)
Returns list of algorithm instances for given algorithm framework.
|
java.sql.Connection |
getMdsConnection() |
PluginLoader |
getOrCreatePluginLoader(java.lang.String pluginName,
java.lang.String pluginPath,
boolean isBuiltIn)
Create a new plugin loader and add it to the component cache.
|
boolean |
knowsComponentInstance(java.lang.String instanceName)
Check whether a particular component instance name is known to the component cache.
|
void |
loadInstances(java.lang.String pluginName,
java.lang.String algoInstanceFile)
Read a file containing a set of algorithm instance descriptions and add each instance's
configuration to the internal cache of instance configurations,
|
void |
newInstance(java.lang.String instanceName,
ComponentWrapper.ComponentInstanceDetails details,
boolean update)
Add the configuration for a component instance to the cache.
|
java.io.InputStream |
openFile(java.lang.String instanceName,
FileReference fileRef,
MaskingComponent component) |
void |
setRandomKey(boolean randomKey)
Controls how the internal backend provider generates keys for algorithms.
|
public static final int DEFAULT_LOG_RATE
public ComponentCache()
public ComponentCache(ComponentWrapper.ComponentServiceBackend backend, MaskingLogService.MaskingLogServiceConfig maskingLogServiceConfigIn)
public PluginLoader getOrCreatePluginLoader(java.lang.String pluginName, java.lang.String pluginPath, boolean isBuiltIn)
pluginName
- The name of the pluginpluginPath
- The path to the plugin's JARisBuiltIn
- Whether the plugin is builtinpublic void newInstance(java.lang.String instanceName, ComponentWrapper.ComponentInstanceDetails details, boolean update)
instanceName
- The name of the component instance. This must be unique.details
- The values specifying the type and configuration of the new instance.update
- Whether this operation should update an existing component instance if one
exists.public java.util.List<java.lang.String> getInstanceNames()
public java.util.List<java.lang.String> getInstanceNames(java.lang.String frameworkName)
frameworkName
- The name of the algorithm.public ComponentWrapper createComponentInstance(java.lang.String instanceName)
instanceName
- The name of the algorithm instance to create or return.public ComponentWrapper createComponentInstance(java.lang.String instanceName, boolean isTracked)
instanceName
- The name of the algorithm instance to create or return.isTracked
- Whether the cache should track the component for cleanuppublic MaskingComponent createRawComponentInstance(java.lang.String pluginName, java.lang.String pluginJarPath, java.lang.String className, boolean builtIn)
pluginName
- The name of the plugin that provides the framework class.pluginJarPath
- The path to the plugin JAR file.className
- The framework class of the component to create. The returned object will be
of this class.builtIn
- Whether the referenced plugin should be considered built-in.public void cleanup()
public java.util.Set<MaskingComponent> discoverFrameworks(java.lang.String pluginName)
pluginName
- The name of the plugin.public java.util.Map<java.lang.String,ComponentWrapper.ComponentInstanceDetails> discoverInstanceDetails(java.lang.String pluginName)
pluginName
- The name of the plugin from which the instances are to be constructed.public void loadInstances(java.lang.String pluginName, java.lang.String algoInstanceFile) throws java.io.IOException
pluginName
- The name of the plugin from which the instances are to be constructed.algoInstanceFile
- The file containing algorithm instance descriptions.java.io.IOException
- When problems occur reading the instance file.public void setRandomKey(boolean randomKey)
randomKey
- Whether algorithms keys are generated randomly.public boolean knowsComponentInstance(java.lang.String instanceName)
instanceName
- The name of to checkpublic ComponentWrapper.ComponentInstanceDetails getAlgorithmComponentDetail(java.lang.String algorithmCd)
getAlgorithmComponentDetail
in interface ComponentWrapper.ComponentServiceBackend
public java.io.InputStream openFile(java.lang.String instanceName, FileReference fileRef, MaskingComponent component)
openFile
in interface ComponentWrapper.ComponentServiceBackend
public java.sql.Driver getDriver(java.lang.Integer driverId)
getDriver
in interface ComponentWrapper.ComponentServiceBackend
public byte[] getAlgorithmKey(java.lang.String algorithmCd)
getAlgorithmKey
in interface ComponentWrapper.ComponentServiceBackend
public java.sql.Connection getMdsConnection()
getMdsConnection
in interface ComponentWrapper.ComponentServiceBackend