public abstract class Extractors
extends java.lang.Object
Extractor
s.Constructor and Description |
---|
Extractors() |
Modifier and Type | Method and Description |
---|---|
static java.io.InputStream |
callExternalExtractor(java.lang.String command,
boolean fileAsArgument,
ExtractorDataSource dataSource)
Calls an external extractor command and returns its output.
|
static <T extends LocalAbstractObject> |
cast(java.lang.Object extractorInstance,
java.lang.Class<? extends T> extractedClass)
Returns a type-safe cast of a given extractor instance.
|
static <T extends LocalAbstractObject> |
castToMultiExtractor(java.lang.Object object,
java.lang.Class<? extends T> extractedClass,
boolean allowPlainExtractor)
Returns a type-safe cast of a given multi-extractor instance.
|
static Extractor<MetaObjectParametricMap> |
createCombinedExtractorFromProperties(ExtendedProperties properties,
java.lang.String[] extractorPropertyKeys,
java.lang.String contentParameter,
boolean expandMetaObjects)
Creates extractor that combines multiple extractors defined in properties
into one
MetaObjectParametricMap object. |
static <T extends LocalAbstractObject> |
createExternalExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command)
Creates an extractor that creates objects from binary data by external command.
|
static <T extends LocalAbstractObject> |
createExternalExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command,
boolean fileAsArgument,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from binary data by external command.
|
static <T extends LocalAbstractObject> |
createExternalExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command,
boolean fileAsArgument,
java.lang.String locatorParameter,
int parameterMapArgument,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from binary data by external command.
|
static <T extends LocalAbstractObject> |
createExternalExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command,
boolean fileAsArgument,
java.lang.String locatorParameter,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from binary data by external command.
|
static <T extends LocalAbstractObject> |
createExternalExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command,
java.lang.String locatorParameter)
Creates an extractor that creates objects from binary data by external command.
|
static <T extends LocalAbstractObject> |
createExternalMultiExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command,
boolean fileAsArgument,
java.lang.String locatorParameter,
int parameterMapArgument,
java.lang.Object[] additionalArguments)
Creates an extractor that creates multiple objects from binary data by external command.
|
static <T extends LocalAbstractObject> |
createExternalMultiExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String command,
boolean fileAsArgument,
java.lang.String locatorParameter,
java.lang.Object[] additionalArguments)
Creates an extractor that creates multiple objects from binary data by external command.
|
static Extractor<?> |
createExtractor(java.lang.Class<?> usingClass)
Creates extractor for the provided class.
|
static <T extends LocalAbstractObject> |
createExtractorFromProperties(java.lang.Class<? extends T> objectClass,
ExtendedProperties properties,
java.lang.String key)
Creates an instance of
Extractor from property values. |
static Extractor<?> |
createExtractorFromProperties(ExtendedProperties properties,
java.lang.String key)
Creates an instance of
Extractor from property values. |
static Extractor<? extends MetaObject> |
createMetaObjectExtractor(Extractor<? extends LocalAbstractObject> extractor,
java.lang.String fieldName,
DistanceFunction<MetaObject> distance)
The created extractor takes an existing extractor and wraps each of the created object
as
MetaObjectFixedMap . |
static <T extends LocalAbstractObject> |
createMultiExtractorFromProperties(java.lang.Class<? extends T> objectClass,
ExtendedProperties properties,
java.lang.String key)
Creates an instance of
MultiExtractor from property values. |
static <T extends LocalAbstractObject> |
createResourcesExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String resourcePath)
Creates an extractor encapsulated in application resources that creates objects from binary data.
|
static <T extends LocalAbstractObject> |
createSocketExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String host,
int port)
Creates an external extractor that runs as a TCP service on a remote host.
|
static <T extends LocalAbstractObject> |
createSocketExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String host,
int port,
java.lang.String locatorParameter)
Creates an external extractor that runs as a TCP service on a remote host.
|
static <T extends LocalAbstractObject> |
createSocketExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String host,
int port,
java.lang.String locatorParameter,
int parameterMapArgument,
java.lang.Object[] additionalArguments)
Creates an external extractor that runs as a TCP service on a remote host.
|
static <T extends LocalAbstractObject> |
createSocketExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String host,
int port,
java.lang.String dataParameter,
java.lang.String locatorParameter,
int parameterMapArgument,
java.lang.Object[] additionalArguments)
Creates an external extractor that runs as a TCP service on a remote host.
|
static <T extends LocalAbstractObject> |
createTextExtractor(java.lang.Class<? extends T> objectClass,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from text InputStream using the
constructor that takes
BufferedReader as argument. |
static <T extends LocalAbstractObject> |
createTextExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String locatorParameter,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from text InputStream using the
constructor that takes
BufferedReader as argument. |
static <T extends LocalAbstractObject> |
createTextExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String dataParameter,
java.lang.String locatorParameter,
int parameterMapArgument,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from text InputStream using the
constructor that takes
BufferedReader as argument. |
static <T extends LocalAbstractObject> |
createTextExtractor(java.lang.Class<? extends T> objectClass,
java.lang.String dataParameter,
java.lang.String locatorParameter,
java.lang.Object[] additionalArguments)
Creates an extractor that creates objects from text InputStream using the
constructor that takes
BufferedReader as argument. |
static <T extends LocalAbstractObject> |
extract(Extractor<? extends T> extractor,
java.io.File file)
Extracts object from the
file using the given extractor . |
static <T extends LocalAbstractObject> |
extract(Extractor<? extends T> extractor,
java.net.URL url,
java.lang.String mimeTypeRegexp)
Extracts object downloaded from the
url using the given extractor . |
static <T extends LocalAbstractObject> |
extractorToMultiExtractor(Extractor<? extends T> extractor)
Converts a plain
Extractor to MultiExtractor . |
static void |
setExternalExtractorTempFileSuffix(java.lang.String suffix)
Set the global external extractor temp file suffix.
|
static <T extends LocalAbstractObject> |
wrapUrlDataSource(Extractor<T> extractor,
java.lang.String urlParameterName)
Returns an extractor wrapper that uses an URL stored in a parameter to get the data.
|
public static void setExternalExtractorTempFileSuffix(java.lang.String suffix)
suffix
- the new suffixpublic static <T extends LocalAbstractObject> MultiExtractor<T> extractorToMultiExtractor(Extractor<? extends T> extractor)
Extractor
to MultiExtractor
.
The returned multi-extractor iterator will return the single object
returned by the encapsulated extractor.T
- the class of objects the extractor createsextractor
- the plain extractor to wrappublic static Extractor<? extends MetaObject> createMetaObjectExtractor(Extractor<? extends LocalAbstractObject> extractor, java.lang.String fieldName, DistanceFunction<MetaObject> distance)
MetaObjectFixedMap
.extractor
- existing extractorfieldName
- name of a field under which the created object should be putdistance
- a distance to be used with the created MetaObjectFixedMap
public static <T extends LocalAbstractObject> Extractor<T> cast(java.lang.Object extractorInstance, java.lang.Class<? extends T> extractedClass) throws java.lang.ClassCastException
T
- the class of objects the extractor createsextractorInstance
- the instance to castextractedClass
- the class of objects the extractor createsjava.lang.ClassCastException
- if the specified extractorInstance
is not an Extractor
or it extracts an incompatible classpublic static <T extends LocalAbstractObject> MultiExtractor<T> castToMultiExtractor(java.lang.Object object, java.lang.Class<? extends T> extractedClass, boolean allowPlainExtractor) throws java.lang.ClassCastException
T
- the class of objects the multi-extractor createsobject
- the instance to castextractedClass
- the class of objects the multi-extractor createsallowPlainExtractor
- flag whether to require the object to be MultiExtractor
(false), or
also Extractor
is allowed and converted via extractorToMultiExtractor(messif.objects.extraction.Extractor<? extends T>)
java.lang.ClassCastException
- if the specified multiExtractorInstance
is not an MultiExtractor
or it extracts an incompatible classpublic static <T extends LocalAbstractObject> T extract(Extractor<? extends T> extractor, java.net.URL url, java.lang.String mimeTypeRegexp) throws ExtractorException
url
using the given extractor
.T
- the type of object returned by the extractorextractor
- the extractor to use on the dataurl
- the URL from which to download the datamimeTypeRegexp
- regular expression for the mimetype of the data on the given url
url
ExtractorException
- if there was an error reading or extracting the datapublic static <T extends LocalAbstractObject> T extract(Extractor<? extends T> extractor, java.io.File file) throws ExtractorException
file
using the given extractor
.T
- the type of object returned by the extractorextractor
- the extractor to use on the datafile
- the file from which to load the dataExtractorException
- if there was an error reading or extracting the datapublic static <T extends LocalAbstractObject> Extractor<T> createTextExtractor(java.lang.Class<? extends T> objectClass, java.lang.String dataParameter, java.lang.String locatorParameter, int parameterMapArgument, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
BufferedReader
as argument.
Note that data are read either from a data source parameter dataParameter
or the data source stream (if dataParameter
is null).T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractordataParameter
- parameter of the data source that contains the object datalocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryparameterMapArgument
- index of a additional parameter that will get the
data source parameter map
additionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createTextExtractor(java.lang.Class<? extends T> objectClass, java.lang.String dataParameter, java.lang.String locatorParameter, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
BufferedReader
as argument.
Note that data are read either from a data source parameter dataParameter
or the data source stream (if dataParameter
is null).T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractordataParameter
- parameter of the data source that contains the object datalocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryadditionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createTextExtractor(java.lang.Class<? extends T> objectClass, java.lang.String locatorParameter, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
BufferedReader
as argument.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorlocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryadditionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createTextExtractor(java.lang.Class<? extends T> objectClass, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
BufferedReader
as argument.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractoradditionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static java.io.InputStream callExternalExtractor(java.lang.String command, boolean fileAsArgument, ExtractorDataSource dataSource) throws java.io.IOException
fileAsArgument
is true, the dataSource
must
represent a valid file, which is passed in place of %s parameter in the command
.
Otherwise, the external extractor receives the data from the dataSource
on its standard input. Note that variable substitution using question-mark enclosure
is applied using data source parameters
, i.e.
every ?variable-name:default-value? is replaced with the value of ParametricBase.getParameter(java.lang.String)
("variable-name").command
- the external command (including all necessary arguments)fileAsArgument
- if true, the "%s" argument of external command is replaced with the filenamedataSource
- the source of binary data for the extractioncommand
java.io.IOException
- if there was a problem calling the external command or passing arguments to itpublic static <T extends LocalAbstractObject> ExtractorCloseable<T> createResourcesExtractor(java.lang.Class<? extends T> objectClass, java.lang.String resourcePath) throws java.lang.IllegalArgumentException, java.io.IOException
objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorresourcePath
- the absolute path of the extractor resourcejava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorjava.io.IOException
- if there was an error preparing the extractor from resourcespublic static <T extends LocalAbstractObject> Extractor<T> createExternalExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input and return the text parsable by
the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)java.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createExternalExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command, java.lang.String locatorParameter) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input and return the text parsable by
the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)locatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createExternalExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command, boolean fileAsArgument, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input if fileAsArgument
is true
or the data are read from file that is passed as "%s" argument to the external command if
fileAsArgument
is false.
The extractor must return the text parsable by the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)fileAsArgument
- if true, the "%s" argument of external command is replaced with the filenameadditionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createExternalExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command, boolean fileAsArgument, java.lang.String locatorParameter, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input if fileAsArgument
is true
or the data are read from file that is passed as "%s" argument to the external command if
fileAsArgument
is false.
The extractor must return the text parsable by the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)fileAsArgument
- if true, the "%s" argument of external command is replaced with the filenamelocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryadditionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createExternalExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command, boolean fileAsArgument, java.lang.String locatorParameter, int parameterMapArgument, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input if fileAsArgument
is true
or the data are read from file that is passed as "%s" argument to the external command if
fileAsArgument
is false.
The extractor must return the text parsable by the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)fileAsArgument
- if true, the "%s" argument of external command is replaced with the filenamelocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryparameterMapArgument
- index of a additional parameter that will get the
data source parameter map
additionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> MultiExtractor<T> createExternalMultiExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command, boolean fileAsArgument, java.lang.String locatorParameter, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input if fileAsArgument
is false
or the data are read from file that is passed as "%s" argument to the external command if
fileAsArgument
is true.
The extractor must return the text parsable by the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)fileAsArgument
- if true, the "%s" argument of external command is replaced with the filenamelocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryadditionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> MultiExtractor<T> createExternalMultiExtractor(java.lang.Class<? extends T> objectClass, java.lang.String command, boolean fileAsArgument, java.lang.String locatorParameter, int parameterMapArgument, java.lang.Object[] additionalArguments) throws java.lang.IllegalArgumentException
command
and is expected to
receive the binary data on its standard input if fileAsArgument
is false
or the data are read from file that is passed as "%s" argument to the external command if
fileAsArgument
is true.
The extractor must return the text parsable by the constructor of objectClass
on its standard output.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorcommand
- the external command (including all necessary arguments)fileAsArgument
- if true, the "%s" argument of external command is replaced with the filenamelocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryparameterMapArgument
- index of a additional parameter that will get the
data source parameter map
additionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createSocketExtractor(java.lang.Class<? extends T> objectClass, java.lang.String host, int port, java.lang.String dataParameter, java.lang.String locatorParameter, int parameterMapArgument, java.lang.Object[] additionalArguments)
LocalAbstractObject
is returned and converted by a factory method.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorhost
- the remote extractor host address (either IP or domain name)port
- the remote extractor TCP portdataParameter
- parameter of the data source that contains the object data;
if null the data source input stream is usedlocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryparameterMapArgument
- index of a additional parameter that will get the
data source parameter map
additionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createSocketExtractor(java.lang.Class<? extends T> objectClass, java.lang.String host, int port, java.lang.String locatorParameter, int parameterMapArgument, java.lang.Object[] additionalArguments)
LocalAbstractObject
is returned and converted by a factory method.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorhost
- the remote extractor host address (either IP or domain name)port
- the remote extractor TCP portlocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factoryparameterMapArgument
- index of a additional parameter that will get the
data source parameter map
additionalArguments
- additional arguments for the constructorjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createSocketExtractor(java.lang.Class<? extends T> objectClass, java.lang.String host, int port, java.lang.String locatorParameter)
LocalAbstractObject
is returned and converted by a factory method.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorhost
- the remote extractor host address (either IP or domain name)port
- the remote extractor TCP portlocatorParameter
- parameter of the data source used to set the extracted object's locator;
if null, the object uses the default locator set by the factory * @return extractor that runs as a TCP service on a remote hostjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static <T extends LocalAbstractObject> Extractor<T> createSocketExtractor(java.lang.Class<? extends T> objectClass, java.lang.String host, int port)
LocalAbstractObject
is returned and converted by a factory method.T
- the class of object that is created by the extractorobjectClass
- the class of object that is created by the extractorhost
- the remote extractor host address (either IP or domain name)port
- the remote extractor TCP portjava.lang.IllegalArgumentException
- if the objectClass
has no valid constructorpublic static Extractor<?> createExtractor(java.lang.Class<?> usingClass)
LocalAbstractObject
, a
text extractor
is returned.
If the class implements Extractor
interface, a new instance
of this class is returned (using nullary constructor).usingClass
- the class used to create the extractorusingClass
public static <T extends LocalAbstractObject> Extractor<T> createExtractorFromProperties(java.lang.Class<? extends T> objectClass, ExtendedProperties properties, java.lang.String key) throws ExtendedPropertiesException, java.lang.IllegalArgumentException
Extractor
from property values.
A property with the given key
must be a type of extractor to create.
If type is "external", additional property <key>.command
is required
to contain the external command to execute. Optionally, <key>.fileAsArgument
,
<key>.locatorParameter
, <key>.parameterArg
, and <key>.additionalArg1...n
can be specified
- see createExternalExtractor
.
If type is "text", no additional parameters are required. Optionally,
<key>.dataParameter
, <key>.locatorParameter
, <key>.parameterArg
,
and <key>.additionalArg1...n
can be specified - see
createTextExtractor
.
If type is "constructor", additional property <key>.constructorClass
is required.
The parameter specify a class with public constructor having a single ExtendedProperties
argument.
If type is "method", additional properties <key>.methodClass
and <key>.methodName
are required.
The parameters specify the class and the static method name in that class with a single ExtendedProperties
argument.
T
- the class of objects that will be created by the extractorobjectClass
- the class of objects that will be created by the extractorproperties
- the properties with valueskey
- the key property nameExtendedPropertiesException
- if there some of the required properties were missing or invalidjava.lang.IllegalArgumentException
- if the extractor cannot be created with the specified parameterspublic static <T extends LocalAbstractObject> MultiExtractor<T> createMultiExtractorFromProperties(java.lang.Class<? extends T> objectClass, ExtendedProperties properties, java.lang.String key) throws ExtendedPropertiesException, java.lang.IllegalArgumentException
MultiExtractor
from property values.
A property with the given key
must be a type of extractor to create.
If type is "external", additional property <key>.command
is required
to contain the external command to execute. Optionally, <key>.fileAsArgument
,
<key>.locatorParameter
, <key>.parameterArg
, and <key>.additionalArg1...n
can be specified
- see createExternalExtractor
.
If type is "text", no additional parameters are required. Optionally,
<key>.dataParameter
, <key>.locatorParameter
, <key>.parameterArg
,
and <key>.additionalArg1...n
can be specified - see
createTextExtractor
.
If type is "constructor", additional property <key>.constructorClass
is required.
The parameter specify a class with public constructor having a single ExtendedProperties
argument.
If type is "method", additional properties <key>.methodClass
and <key>.methodName
are required.
The parameters specify the class and the static method name in that class with a single ExtendedProperties
argument.
T
- the class of objects that will be created by the extractorobjectClass
- the class of objects that will be created by the extractorproperties
- the properties with valueskey
- the key property nameExtendedPropertiesException
- if there some of the required properties were missing or invalidjava.lang.IllegalArgumentException
- if the extractor cannot be created with the specified parameterspublic static Extractor<?> createExtractorFromProperties(ExtendedProperties properties, java.lang.String key) throws ExtendedPropertiesException, java.lang.IllegalArgumentException
Extractor
from property values.
A property with the given key
must be a type of extractor to create.
A property <key>.class
must contain the name of the object class
(descendant of LocalAbstractObject
) that will be created by the extractor.
If type is "external", additional property <key>.command
is required
to contain the external command to execute. Optionally, <key>.fileAsArgument
,
<key>.locatorParameter
, <key>.parameterArg
, and <key>.additionalArg1...n
can be specified
- see createExternalExtractor
.
If type is "text", no additional parameters are required. Optionally,
<key>.dataParameter
, <key>.locatorParameter
, <key>.parameterArg
,
and <key>.additionalArg1...n
can be specified - see
createTextExtractor
.
properties
- the properties with valueskey
- the key property nameExtendedPropertiesException
- if there some of the required properties were missing or invalidjava.lang.IllegalArgumentException
- if the extractor cannot be created with the specified parameterspublic static Extractor<MetaObjectParametricMap> createCombinedExtractorFromProperties(ExtendedProperties properties, java.lang.String[] extractorPropertyKeys, java.lang.String contentParameter, boolean expandMetaObjects) throws ExtendedPropertiesException, java.lang.IllegalArgumentException
MetaObjectParametricMap
object.properties
- the properties where the extractors are definedextractorPropertyKeys
- the properties key (prefix) that defines the respective extractors
(see createExtractorFromProperties(messif.utility.ExtendedProperties, java.lang.String)
)contentParameter
- the name of the parameter where the original
binary data source (e.g. the image) is stored; nothing is stored if nullexpandMetaObjects
- flag whether the MetaObject
instances created by the respective
extractors are put into the created object as multiple separated LocalAbstractObject
s (true),
or without expansion directly as the extracted MetaObject
s (false)ExtendedPropertiesException
- if there some of the required properties were missing or invalidjava.lang.IllegalArgumentException
- if the extractor cannot be created with the specified parameterspublic static <T extends LocalAbstractObject> Extractor<T> wrapUrlDataSource(Extractor<T> extractor, java.lang.String urlParameterName)
T
- the type of object returned by the extractorextractor
- the extractor to use on the dataurlParameterName
- the name of the parameter where the URL is stored