Java Services

From WebOS Internals
Revision as of 04:19, 10 August 2009 by PuffTheMagic (talk | contribs)
Jump to navigation Jump to search

We will do a quick overview on how to create a Java-based service and get it running under the dbus system.

The service framework of webOS depends largely on dbus, but Palm wrote most of the services in Java (there are maybe two or three native services). They've used a dbus Java library in order to communicate with the dbus and wrote more libraries to make the creation of these services much easier. The library of interest is serviceframework.jar, located under /usr/lib/luna/java.

All Java services extend from either the LunaServiceThread class directly or from a subclass of LunaServiceThread.

Installation / packaging

Files:

<source lang="text"> /etc/event.d/org.webosinternals.hello /usr/share/dbus-1/system-services/org.webosinternals.hello /usr/lib/luna/java/org.webosinternals.services.jar </source>

/usr/share/dbus-1/system-services/org.webosinternals.hello:

<source lang="text"> [D-BUS Service] Name=org.webosinternals.hello Exec=/usr/bin/luna-helper 'luna://com.palm.vm/launch' '{"serviceName":"org.webosinternals.hello","className":"org.webosinternals.services.HelloService"}' </source>

/etc/event.d/org.webosinternals.hello: "I don't believe this is necessary... Where did it come from? PuffTheMagic 03:19, 10 August 2009 (UTC)"

<source lang="text"> start on started java-serviceboot

script /usr/bin/luna-helper 'luna://com.palm.vm/launch' '{"serviceName":"org.webosinternals.hello","className":"org.webosinternals.services.HelloService"}' end script </source>

/usr/lib/luna/java/org.webosinternals.services.jar:

<source lang="text"> META-INF/ META-INF/MANIFEST.MF org/webosinternals/services/HelloService.class </source>