Class ServiceFromDatabase
- All Implemented Interfaces:
ComponentLifecycle
,ServiceExtractor
This executes the configured query, takes the first column of the first ResultSet and uses that as the source for the dynamic service.
Since it supports the expression syntax; this is perfectly acceptable; It is up to you to protect against SQL injection attacks.
SELECT dynamicService FROM services
WHERE src='%message{source}'
AND dest='%message{destination}'
AND msgType='%message{messageType}'
The alternative to this would be to use JdbcDataQueryService
with a
FirstRowMetadataTranslator
and subsequently a ServiceFromDataInputParameter
(from
metadata). That might be more performant as you would benefit from prepared statement caching and
mitigate against SQL injection style attacks.
- See Also:
In the adapter configuration file this class is aliased as dynamic-service-from-database which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
Fields inherited from class com.adaptris.core.services.dynamic.ServiceExtractorImpl
log
-
Constructor Summary
-
Method Summary
Methods inherited from class com.adaptris.core.services.dynamic.ExtractorWithConnection
close, getConnection, init, setConnection, start, stop, withConnection
Methods inherited from class com.adaptris.core.services.dynamic.ServiceExtractorImpl
getService
-
Constructor Details
-
ServiceFromDatabase
public ServiceFromDatabase()
-
-
Method Details
-
getInputStream
- Specified by:
getInputStream
in classServiceExtractorImpl
- Throws:
Exception
-
getQuery
-
setQuery
-
withQuery
-