Package org.forgerock.openig.filter
Class FileAttributesFilter
- java.lang.Object
-
- org.forgerock.openig.filter.FileAttributesFilter
-
- All Implemented Interfaces:
org.forgerock.http.Filter
public class FileAttributesFilter extends Object implements org.forgerock.http.Filter
Retrieves and exposes a record from a delimiter-separated file. Lookup of the record is performed using a specified key, whose value is derived from an expression. The resulting record is exposed in aMapobject, whose location is specified by thetargetexpression. If a matching record cannot be found, then the resulting map will be empty.The retrieval of the record is performed lazily; it does not occur until the first attempt to access a value in the target. This defers the overhead of file operations and text processing until a value is first required. This also means that the
valueexpression will not be evaluated until the map is first accessed.- See Also:
SeparatedValuesFile
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileAttributesFilter.HeapletCreates and initializes a separated values file attribute provider in a heap environment.
-
Constructor Summary
Constructors Constructor Description FileAttributesFilter(SeparatedValuesFile file, String key, Expression<String> value, LeftValueExpression<Map> target)Builds a new FileAttributesFilter extracting values from the given separated values file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.forgerock.util.promise.Promise<org.forgerock.http.protocol.Response,org.forgerock.util.promise.NeverThrowsException>filter(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request, org.forgerock.http.Handler next)
-
-
-
Constructor Detail
-
FileAttributesFilter
public FileAttributesFilter(SeparatedValuesFile file, String key, Expression<String> value, LeftValueExpression<Map> target)
Builds a new FileAttributesFilter extracting values from the given separated values file.- Parameters:
file- The file to read separated values from (csv file)key- The name of the field in the file to perform the lookup onvalue- Expression that yields the value to be looked-up within the filetarget- Expression that yields the target object that will contain the record
-
-
Method Detail
-
filter
public org.forgerock.util.promise.Promise<org.forgerock.http.protocol.Response,org.forgerock.util.promise.NeverThrowsException> filter(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request, org.forgerock.http.Handler next)- Specified by:
filterin interfaceorg.forgerock.http.Filter
-
-