A draft UPnP/Jini specification is available at http://jan.newmarch.name/java/jini/upnpLUS/specification.html. JavaDoc supporting this specification is available from http://jan.newmarch.name/java/jini/upnpLUS/doc/index.html
A draft paper is here
Version 0.8 alpha. Last modified 1 August 2005.
The code is full of debugging statements, and large chunks need to
be completed. But it is capable of
UPnP is a TCP-based middleware designed for managing devices such as those found in a home or office. These devices include light switches, home heating systems, etc. The home site for UPnP is www.upnp.org.
UPnP does not use a lookup service. Instead, each device broadcasts an advert about every 2 minutes. Control points can listen for such adverts or send out requests for devices. Devices hosts services - usually one, but a device could host many. In addition, some devices can also include other devices, with their own services. Once a control point has located a service it can send remote procedure calls to it, query state variables or act as a listener to state changes in the service. Remote procedure calls, state queries and state change events are all sent as SOAP messages.
This project builds a Jini lookup service that listens for UPnP device adverts. Each UPnP service can be represented by a Java interface (defined by this project), and Jini clients can query the lookup service using these interfaces. The lookup service will then deliver a Java Proxy that will use SOAP to talk directly to the UPnP service.
This project is built using the
CyberLink UPnP toolkit for Java. This is required to build and run
the lookup service and is downloaded to the client to run the proxy.
The default file clink170.jar
contains
the source code as well as the classes, and it is a waste of bandwidth to
download the source code. A classes-only version is available from
here.
CyberLink also uses XML parsers. The default is the
Xerces parser xercesImpl.jar
and xml-apis.jar
,
but these are really heavyweight (over 1Mbyte).
The kXML
parser is used instead and is available from
SourceForge.
These files clink170-nosrc.jar
(or clink170.jar
)
and kxml2.jar
have to be in the runtime of the lookup service. The project builds a file
upnpLUS-dl.jar
and all of upnpLUS-dl.jar
,
clink170-nosrc.jar
and kxml2.jar
have to be on the codebase
of the lookup service as the proxy
downloaded to clients makes use of them.
This means about 200k has to be downloaded from the HTTP server to a client.
This is larger than many proxies (e.g. reggie-dl.jar
is about
50k) but is not significant.
Still, that is one of the problems with using SOAP...
The source code is available as a zip file.
A UPnP device description file is used to create Java interfaces using
java upnp.Interface destinationDirectory device-description-file|url
The interfaces are written to files in the destination directory.
The interfaces are defined to belong to the package
jiniupnp.service
. Some examples are in the directory
src/jiniupnp/service
.
There may be many services for any device. A device may also contain embedded devices with their own services. All of these service interfaces are generated.
java upnpLUS.UPnPLUS
or by the Ant command
ant runlus
This requires standard Jini jar files to be in the classpath and also the Cyberlink
jar files.
Some devices on the network may already be UPnP services, such as routers.
These will be detected by the UPnP LUS. Other services, such as a clock,
a light and aTV are on the CyberLink site. This package also contains a
simple "echo" service in the directory src/device
. This may be
run by
java device.EchoDevice
or by the Ant command
ant runechoservice
This requires the Cyberlink jar files to be in the classpath.
Some sample Jini clients able to call UPnP services are given in the
src/client
directory. For example, to run the light switch power
client
java client.PowerClient
or by the Ant command
ant runpower
This requires the Jini jar files to be in the classpath.
This software is covered by the Apache 2 license, the same as Jini.
Initial version