Difference between revisions of "Java Services"

From WebOS Internals
Jump to navigation Jump to search
(New page: 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 ...)
 
(basics on service file layout)
Line 5: Line 5:
 
All Java services extend from either the LunaServiceThread class directly or from a subclass of LunaServiceThread.
 
All Java services extend from either the LunaServiceThread class directly or from a subclass of LunaServiceThread.
  
TODO: finish! need to research a little bit more
+
== 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:
 +
 
 +
<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>

Revision as of 08:32, 30 July 2009

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:

<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>