Skip to main content



      Home
Home » Eclipse Projects » Kura » Configure default instance of a service
Configure default instance of a service [message #1801849] Mon, 28 January 2019 07:19 Go to next message
Eclipse UserFriend
Hi,

I've created a service to be used as singleton. I was wondering if there is a way to create the instance by default and make it non-deletable similarly to, for example, the ClockService?

Kind regards,
Re: Configure default instance of a service [message #1802029 is a reply to message #1801849] Thu, 31 January 2019 02:25 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
I believe you should replicate the configuration of ClockService into your bundle files.
Furthermore, you could customise the config.ini file to locate and start the jar that wraps your bundle at Kura boot.

Best regards,
Matteo
Re: Configure default instance of a service [message #1803672 is a reply to message #1802029] Wed, 06 March 2019 09:28 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for your response.

I've replicated ClockService configuration to hide the service implementation and avoid a recreation, but I was unable to avoid deletion of the service.

About the config.ini file, could you point me more precisely to one example. I've configured the snapshot_0.xml to include the service in the initial execution, is there a better approach? This method is vulnerable if a configuration without the service is uploaded as there would be no way to create the service from the interface.
Re: Configure default instance of a service [message #1803765 is a reply to message #1803672] Fri, 08 March 2019 11:53 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, I don't understand this:
Quote:
but I was unable to avoid deletion of the service

A singleton cannot be deleted from the Kura web ui.

If you had a look at the clock service configuration, https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.linux.clock/OSGI-INF/clock.xml
it says:
configuration-policy="require" enabled="true" immediate="true"
Re: Configure default instance of a service [message #1803811 is a reply to message #1803765] Mon, 11 March 2019 07:21 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
A singleton cannot be deleted from the Kura web ui


Then maybe I've configured wrongly the component. I've used the following annotation over the class:

@Component(scope = ServiceScope.SINGLETON)


I'll test the immediate clause soon. Thanks for the indication
Re: Configure default instance of a service [message #1803959 is a reply to message #1803811] Thu, 14 March 2019 06:48 Go to previous messageGo to next message
Eclipse UserFriend
I've tried the immediate clause and the service effectively gets instantiated but it can be configured in the web UI as it is not listed among Kura services. Not even in the snapshot file.
Re: Configure default instance of a service [message #1803963 is a reply to message #1803959] Thu, 14 March 2019 09:08 Go to previous messageGo to next message
Eclipse UserFriend
Maybe the service did not start.
Please have a look at the OSGi console.

Re: Configure default instance of a service [message #1804463 is a reply to message #1803963] Tue, 26 March 2019 08:08 Go to previous message
Eclipse UserFriend
Well, definitively I got it. Thanks for all the help provided.

The Singleton declaration was completely counter-productive. Besides it was needed to remove factoryPid from Designate in the configuration file. With these two modifications (ClockService was made this way, so the initial indication you made was correct) the service works like a charm.
Previous Topic:Is Raspberry Pi 3 Model B+ fully supported?
Next Topic:Connect Wireless Devices to Kura
Goto Forum:
  


Current Time: Sat Jun 14 14:26:43 EDT 2025

Powered by FUDForum. Page generated in 0.06310 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top