public class ComponentWrapper extends java.lang.Object implements ComponentService
Modifier and Type | Class and Description |
---|---|
static class |
ComponentWrapper.ComponentInstanceDetails |
static interface |
ComponentWrapper.ComponentServiceBackend |
Constructor and Description |
---|
ComponentWrapper(java.lang.String pluginNameIn,
java.lang.String instanceNameIn,
ComponentCache componentCacheIn,
MaskingComponent componentIn,
MaskingLogService.MaskingLogServiceConfig maskingLogServiceConfig)
Create a wrapper for a top level component
|
Modifier and Type | Method and Description |
---|---|
void |
checkComponentDependencies(boolean isExternalAllowed)
Recursively check all component dependencies referenced directly or indirectly by the wrapped
component.
|
void |
cleanupComponent()
Initiate cleanup on this component and any closeables opened by this wrapper for the
component.
|
void |
cookJaninoExpression(org.codehaus.janino.ExpressionEvaluator evaluator,
java.lang.String expression)
"Cooks" (reads, scans, parses, and compiles) a one-line Java expression with the given Janino
expression evaluator.
|
org.codehaus.janino.ExpressionEvaluator |
createJaninoExpressionEvaluator()
Creates a Janino expression evaluator.
|
<U> MaskingAlgorithm<U> |
getAlgorithmByName(AlgorithmInstanceReference algorithmReference,
MaskingAlgorithm.MaskingType type,
MaskValueMetadata metadata)
Get a MaskingAlgorithm object for the algorithm specified by the reference and type.
|
CryptoService |
getCryptoService(KeyReference reference)
This implements the ComponentService method that provides access to the algorithm's key
wrapped by the CryptoServiceImpl, which implements a number of cryptographic functions using
that key.
|
java.lang.String |
getInstanceName()
Get the name of this component instance.
|
JobInfo |
getJobInfo()
Get a JobInfo object, which contains references to the schema, table names, and column names
in a masking rule set.
|
LogService |
getLogService()
Get a Logger object that can be used to log messages.
|
MaskingAlgorithm.MaskingType |
getMaskingTypeForInstanceReference(AlgorithmInstanceReference algorithmReference)
The method getAlgorithmByNamePrivileged above expects a type, then creates an instance of the
algorithm and checks that type against it.
|
MaskValueMetadata |
getMaskValueMetadata()
Retrieve the metadata access interface for the masked field.
|
java.lang.String |
getPluginName() |
java.sql.Connection |
getTargetConnection()
Get a Connection object, through which a DriverSupport Task will execute prepared statements
on the target database.
|
MaskingComponent |
getUnreadyComponent()
Get the component without calling setup.
|
java.io.InputStream |
openInputFile(FileReference fileRef)
Method to open a file resource by URI.
|
java.sql.Connection |
openJdbcConnection(JdbcReference jdbcReference)
Method to open a JDBC resource.
|
java.sql.Connection |
openMappingConnection(MappingSetReference mappingSetReference)
Method to open a connection to mapping database.
|
void |
setLogService(MaskingLogService logService) |
void |
setMaskingMode(MaskingAlgorithm.MaskingMode mode)
Set the mode of operation for the wrapped algorithm.
|
MaskingComponent |
setupComponentIfNeeded()
Set up the wrapped component only if needed.
|
void |
setValueMetadata(MaskValueMetadataImpl valueMetadata) |
void |
validate() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAlgorithmByName, getSingleOperationTaskInfo
public ComponentWrapper(java.lang.String pluginNameIn, java.lang.String instanceNameIn, ComponentCache componentCacheIn, MaskingComponent componentIn, MaskingLogService.MaskingLogServiceConfig maskingLogServiceConfig)
pluginNameIn
- The name of the plugininstanceNameIn
- The name of the component instancecomponentCacheIn
- The component caching loadercomponentIn
- The component being wrappedmaskingLogServiceConfig
- A MaskingLogService.MaskingLogServiceConfig
object for
The configuration of the logger.public MaskingComponent setupComponentIfNeeded()
public MaskingComponent getUnreadyComponent()
public void cleanupComponent()
public void validate() throws ComponentConfigurationException
ComponentConfigurationException
public java.lang.String getInstanceName()
getInstanceName
in interface ComponentService
public void checkComponentDependencies(boolean isExternalAllowed)
isExternalAllowed
- Whether dependencies may exist outside of the plugin that provided
the componentInvalidDependencyException
- When a dependency is invalid or would result in a
dependency loopMissingDependencyException
- When a dependency is missingpublic java.sql.Connection openJdbcConnection(@Nonnull JdbcReference jdbcReference)
ComponentService
Connection
remains valid for the life
of the calling MaskingAlgorithm object, but may be closed be when no longer needed to free
resources.openJdbcConnection
in interface ComponentService
jdbcReference
- A JdbcReference
object to provide the jdbc connection
information.Connection
object.public java.sql.Connection openMappingConnection(@Nonnull MappingSetReference mappingSetReference)
ComponentService
openMappingConnection
in interface ComponentService
mappingSetReference
- A MappingSetReference
object which provides all the needed
information to establish the connection.Connection
object.public java.io.InputStream openInputFile(@Nonnull FileReference fileRef)
ComponentService
openInputFile
in interface ComponentService
fileRef
- A reference to the file to be opened.public <U> MaskingAlgorithm<U> getAlgorithmByName(@Nonnull AlgorithmInstanceReference algorithmReference, @Nonnull MaskingAlgorithm.MaskingType type, @Nonnull MaskValueMetadata metadata)
ComponentService
MaskingAlgorithm.MaskingMode
value as the caller.getAlgorithmByName
in interface ComponentService
U
- The data type masked by the returned algorithm, must exactly match what is
requested in typealgorithmReference
- A reference describing the algorithm instance to gettype
- The masking data type the named algorithm is expected maskmetadata
- The mask value metadata for the values that will be passed to the instance
being createdpublic JobInfo getJobInfo()
ComponentService
getJobInfo
in interface ComponentService
public java.sql.Connection getTargetConnection()
ComponentService
getTargetConnection
in interface ComponentService
Connection
objectpublic CryptoService getCryptoService(KeyReference reference)
getCryptoService
in interface ComponentService
reference
- A reference to the key to use. Currently, the reference value must be "",
referring to the default algorithm key assigned to this algorithm.public org.codehaus.janino.ExpressionEvaluator createJaninoExpressionEvaluator()
createJaninoExpressionEvaluator
in interface ComponentService
public MaskingAlgorithm.MaskingType getMaskingTypeForInstanceReference(@Nonnull AlgorithmInstanceReference algorithmReference)
getMaskingTypeForInstanceReference
in interface ComponentService
algorithmReference
- The reference to the algorithm instance from which to get the
masking type.public void cookJaninoExpression(org.codehaus.janino.ExpressionEvaluator evaluator, java.lang.String expression) throws java.lang.Exception
cookJaninoExpression
in interface ComponentService
evaluator
- The Janino expression evaluator that will cook the expressionexpression
- The expression to be cooked by the Janino expression evaluatorjava.lang.Exception
- If the expression cannot be evaluatedpublic void setMaskingMode(MaskingAlgorithm.MaskingMode mode)
mode
- The mode of operation in which the algorithm should operate.public LogService getLogService()
ComponentService
getLogService
in interface ComponentService
MaskingLogService
object.public MaskValueMetadata getMaskValueMetadata()
ComponentService
getMaskValueMetadata
in interface ComponentService
public void setValueMetadata(MaskValueMetadataImpl valueMetadata)
public java.lang.String getPluginName()
public void setLogService(MaskingLogService logService)