D'oh! Sorry. You don't have a ProcessContext for Controller Services.
Controller Services' lifecycles are a bit different than
Processors and Reporting Tasks. For a Controller Service, you would
want to use the @OnEnabled annotation and then use the provided
ConfigurationContext:
private volatile SSLContextService sslContextService;
@OnEnabled
public void obtainControllerService(ConfigurationContext context) {
sslContextService =
context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
}
Then you should be able to reference the sslContextService member variable from
whatever method that you need.
Does this make sense.
Thanks
-Mark
> On Apr 11, 2016, at 10:53 AM, Vincent Russell <[email protected]>
> wrote:
>
> Thank you for the response.
>
> Where can I make the SSLContextService sslContextService = context
> .getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.
> class); call?
>
> Where do I have access to the context within a ControllerService?
>
> Thanks,
>
> On Mon, Apr 11, 2016 at 10:11 AM, Mark Payne <[email protected]> wrote:
>
>> Vincent,
>>
>> I moved users@nifi to the BCC and instead am redirecting this to the
>> dev@nifi mailing list,
>> as this is developer question moreso than a user question.
>>
>> Certainly, you can reference one controller service from another.
>> Generally, controller services
>> are referenced by using a PropertyDescriptor that identifies the
>> controller service. For example:
>>
>> public static final PropertyDescriptor SSL_CONTEXT_SERVICE = new
>> PropertyDescriptor.Builder()
>> .name("SSL Context Service")
>> .description("The Controller Service to use in order to
>> obtain an SSL Context")
>> .required(false)
>> .identifiesControllerService(SSLContextService.class)
>> .build();
>>
>> This allows the user to choose the appropriate Controller Service. Node
>> the 'identifiesControllerService' call.
>> The service itself is then obtained by calling 'asControllerService' on a
>> PropertyValue object:
>>
>> SSLContextService sslContextService = context.getProperty(
>> SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
>>
>> Does this give you what you need?
>>
>> Thanks
>> -Mark
>>
>>
>> On Apr 11, 2016, at 10:04 AM, Vincent Russell <[email protected]>
>> wrote:
>>
>> Is it possible to user one controller service inside of another service?
>> Can it be brought in from the ControllerServiceInitializationContext?
>>
>> If so, how is this done?
>>
>> Thank you,
>> Vincent
>>
>>
>>