You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by 尹文才 <ba...@gmail.com> on 2017/06/23 02:17:04 UTC

get configured property values of DBCPConnectionPool controller service

Hi guys, I'm writing a customized processor that needs to use
DBCPConnectionPool controller service, as you know database information
like database url and driver name, etc are configured inside the properties
of the DBCPConnectionPool Controller Service, is there a way inside my
processor to get the property values of the controller servcie? (I'm
actually trying to use these information to determine the database type
from the configured information of the controller service) Thanks

Regards,

Ben

Re: get configured property values of DBCPConnectionPool controller service

Posted by 尹文才 <ba...@gmail.com>.
thanks James, I think I will simply use the connection got from DBCPService
to get the database name to determine the database type because I only use
Sql server and hive.

Regards,
Ben

2017-06-23 13:01 GMT+08:00 James Wing <jv...@gmail.com>:

> Ben,
>
> Processors typically get the DBCPConnectionPool controller service only
> through the DBCPService interface.  I believe it is possible to cast the
> interface to the DBCPConnectionPool class.  However, DBCPConnectionPool
> does not expose the property values you are looking for through public
> methods.  It's probably possible to use reflection to access the values.
>
> You might be better off defining your own controller service interface
> with an API that supports the information you want, and building an
> implementation by inheriting from DBCPConnectionPool.
>
> Thanks,
>
> James
>
> On Thu, Jun 22, 2017 at 7:17 PM, 尹文才 <ba...@gmail.com> wrote:
>
>> Hi guys, I'm writing a customized processor that needs to use
>> DBCPConnectionPool controller service, as you know database information
>> like database url and driver name, etc are configured inside the properties
>> of the DBCPConnectionPool Controller Service, is there a way inside my
>> processor to get the property values of the controller servcie? (I'm
>> actually trying to use these information to determine the database type
>> from the configured information of the controller service) Thanks
>>
>> Regards,
>>
>> Ben
>>
>
>

Re: get configured property values of DBCPConnectionPool controller service

Posted by James Wing <jv...@gmail.com>.
Ben,

Processors typically get the DBCPConnectionPool controller service only
through the DBCPService interface.  I believe it is possible to cast the
interface to the DBCPConnectionPool class.  However, DBCPConnectionPool
does not expose the property values you are looking for through public
methods.  It's probably possible to use reflection to access the values.

You might be better off defining your own controller service interface with
an API that supports the information you want, and building an
implementation by inheriting from DBCPConnectionPool.

Thanks,

James

On Thu, Jun 22, 2017 at 7:17 PM, 尹文才 <ba...@gmail.com> wrote:

> Hi guys, I'm writing a customized processor that needs to use
> DBCPConnectionPool controller service, as you know database information
> like database url and driver name, etc are configured inside the properties
> of the DBCPConnectionPool Controller Service, is there a way inside my
> processor to get the property values of the controller servcie? (I'm
> actually trying to use these information to determine the database type
> from the configured information of the controller service) Thanks
>
> Regards,
>
> Ben
>