You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by 尹文才 <ba...@gmail.com> on 2017/07/01 08:17:51 UTC

get ControllerService inside Advanced custom UI

Hi guys, I' m currently creating a custom UI for my processor and I need to
get the DBCP Connection ControllerService in the backend code for the UI,
the ControllerService is a property defined in the processor properties. I
saw there's one method in class NiFiWebConfigurationContext as below:

ontrollerService getControllerService(String serviceIdentifier, String
componentId);


However this method requires the serviceIdentifier which I don't know

how to obtain. How exactly should I get the ControllerService?

Thanks.


Regards,

Ben

Re: get ControllerService inside Advanced custom UI

Posted by 尹文才 <ba...@gmail.com>.
Thanks Matt, I was having difficulty getting the serviceIdentifier from
that controller service property defined in my processor, now I got it.

Regards,
Ben

2017-07-02 21:40 GMT+08:00 Matt Gilman <ma...@gmail.com>:

> Ben,
>
> Yes, configuring the Processor with a Controller Service is what I meant.
> If you define a Property that identifies a Controller Service (for instance
> here [1]) the value of that property when accessed through
> getComponentDetails will be the serviceIdentifier.
>
> Matt
>
> [1]
> https://github.com/apache/nifi/blob/master/nifi-nar-
> bundles/nifi-standard-bundle/nifi-standard-processors/src/
> main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L205
>
> On Sun, Jul 2, 2017 at 12:15 AM, 尹文才 <ba...@gmail.com> wrote:
>
> > Thanks Matt, how should I get the service identifier with the method
> > getComponentDetails, do you mean I should add a service identifier
> property
> > in my processor to let user to specify it for the controller service? In
> > that case how could the service identifier configured associate with the
> > configured controller service?
> >
> > Regards,
> > Ben
> >
> > 2017-07-01 21:35 GMT+08:00 Matt Gilman <ma...@gmail.com>:
> >
> > > Ben,
> > >
> > > That is the correct method to invoke. The serviceIdentifier will be the
> > > value of the Property that identifies the service in question. The
> > > componentId will be the identifier of Processor. You'll need to invoke
> > >
> > > ComponentDetails getComponentDetails(NiFiWebRequestContext
> > requestContext)
> > >
> > > in order to get the service identifier from the configured properties.
> > >
> > > Thanks
> > >
> > > Matt
> > >
> > > On Sat, Jul 1, 2017 at 4:17 AM, 尹文才 <ba...@gmail.com> wrote:
> > >
> > > > Hi guys, I' m currently creating a custom UI for my processor and I
> > need
> > > to
> > > > get the DBCP Connection ControllerService in the backend code for the
> > UI,
> > > > the ControllerService is a property defined in the processor
> > properties.
> > > I
> > > > saw there's one method in class NiFiWebConfigurationContext as below:
> > > >
> > > > ontrollerService getControllerService(String serviceIdentifier,
> String
> > > > componentId);
> > > >
> > > >
> > > > However this method requires the serviceIdentifier which I don't know
> > > >
> > > > how to obtain. How exactly should I get the ControllerService?
> > > >
> > > > Thanks.
> > > >
> > > >
> > > > Regards,
> > > >
> > > > Ben
> > > >
> > >
> >
>

Re: get ControllerService inside Advanced custom UI

Posted by Matt Gilman <ma...@gmail.com>.
Ben,

Yes, configuring the Processor with a Controller Service is what I meant.
If you define a Property that identifies a Controller Service (for instance
here [1]) the value of that property when accessed through
getComponentDetails will be the serviceIdentifier.

Matt

[1]
https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L205

On Sun, Jul 2, 2017 at 12:15 AM, 尹文才 <ba...@gmail.com> wrote:

> Thanks Matt, how should I get the service identifier with the method
> getComponentDetails, do you mean I should add a service identifier property
> in my processor to let user to specify it for the controller service? In
> that case how could the service identifier configured associate with the
> configured controller service?
>
> Regards,
> Ben
>
> 2017-07-01 21:35 GMT+08:00 Matt Gilman <ma...@gmail.com>:
>
> > Ben,
> >
> > That is the correct method to invoke. The serviceIdentifier will be the
> > value of the Property that identifies the service in question. The
> > componentId will be the identifier of Processor. You'll need to invoke
> >
> > ComponentDetails getComponentDetails(NiFiWebRequestContext
> requestContext)
> >
> > in order to get the service identifier from the configured properties.
> >
> > Thanks
> >
> > Matt
> >
> > On Sat, Jul 1, 2017 at 4:17 AM, 尹文才 <ba...@gmail.com> wrote:
> >
> > > Hi guys, I' m currently creating a custom UI for my processor and I
> need
> > to
> > > get the DBCP Connection ControllerService in the backend code for the
> UI,
> > > the ControllerService is a property defined in the processor
> properties.
> > I
> > > saw there's one method in class NiFiWebConfigurationContext as below:
> > >
> > > ontrollerService getControllerService(String serviceIdentifier, String
> > > componentId);
> > >
> > >
> > > However this method requires the serviceIdentifier which I don't know
> > >
> > > how to obtain. How exactly should I get the ControllerService?
> > >
> > > Thanks.
> > >
> > >
> > > Regards,
> > >
> > > Ben
> > >
> >
>

Re: get ControllerService inside Advanced custom UI

Posted by 尹文才 <ba...@gmail.com>.
Thanks Matt, how should I get the service identifier with the method
getComponentDetails, do you mean I should add a service identifier property
in my processor to let user to specify it for the controller service? In
that case how could the service identifier configured associate with the
configured controller service?

Regards,
Ben

2017-07-01 21:35 GMT+08:00 Matt Gilman <ma...@gmail.com>:

> Ben,
>
> That is the correct method to invoke. The serviceIdentifier will be the
> value of the Property that identifies the service in question. The
> componentId will be the identifier of Processor. You'll need to invoke
>
> ComponentDetails getComponentDetails(NiFiWebRequestContext requestContext)
>
> in order to get the service identifier from the configured properties.
>
> Thanks
>
> Matt
>
> On Sat, Jul 1, 2017 at 4:17 AM, 尹文才 <ba...@gmail.com> wrote:
>
> > Hi guys, I' m currently creating a custom UI for my processor and I need
> to
> > get the DBCP Connection ControllerService in the backend code for the UI,
> > the ControllerService is a property defined in the processor properties.
> I
> > saw there's one method in class NiFiWebConfigurationContext as below:
> >
> > ontrollerService getControllerService(String serviceIdentifier, String
> > componentId);
> >
> >
> > However this method requires the serviceIdentifier which I don't know
> >
> > how to obtain. How exactly should I get the ControllerService?
> >
> > Thanks.
> >
> >
> > Regards,
> >
> > Ben
> >
>

Re: get ControllerService inside Advanced custom UI

Posted by Matt Gilman <ma...@gmail.com>.
Ben,

That is the correct method to invoke. The serviceIdentifier will be the
value of the Property that identifies the service in question. The
componentId will be the identifier of Processor. You'll need to invoke

ComponentDetails getComponentDetails(NiFiWebRequestContext requestContext)

in order to get the service identifier from the configured properties.

Thanks

Matt

On Sat, Jul 1, 2017 at 4:17 AM, 尹文才 <ba...@gmail.com> wrote:

> Hi guys, I' m currently creating a custom UI for my processor and I need to
> get the DBCP Connection ControllerService in the backend code for the UI,
> the ControllerService is a property defined in the processor properties. I
> saw there's one method in class NiFiWebConfigurationContext as below:
>
> ontrollerService getControllerService(String serviceIdentifier, String
> componentId);
>
>
> However this method requires the serviceIdentifier which I don't know
>
> how to obtain. How exactly should I get the ControllerService?
>
> Thanks.
>
>
> Regards,
>
> Ben
>