Java Reference
In-Depth Information
This appendix illustrates a JNLP utility library that can be used in any JNLP-launched applica-
tion. We used it in the application example of Chapter 13, “A Complete Example.”
After a brief introduction of the main features provided by this library, we will examine its
implementation and finally discuss a simple example of use.
The example is quite simple, given that the library aims at emulating the runtime services pro-
vided by a JNLP Client, so that the code may be left the same for the two modalities (stand-
alone, usual application, or JNLP-launched execution) without any “two-case” additional code
provided for distinguishing the two execution modalities (within a JNLP Client container or as
a standalone application).
Naturally, the library JAR file must be bundled with your application. See the
example pack provided on the Companion Web site for this appendix. In the
package to be downloaded are both sources and a JAR file containing the compiled executa-
bles, ready to be deployed with your code. This package can be used like any other third-party
library by using its executables without prior source compilation or modifying the provided
source in order to adapt it to your particular needs.
The package associated with this appendix includes the following source code classes:
•
AServiceManagerStub
. An implementation of the JNLP ServiceManagerStub class.
•
BasicServiceImpl
. An implementation of the JNLP
BasicService
class.
•
ClipboardServiceImpl
. An implementation of the JNLP
ClipboardService
class.
•
DownloadServiceImpl
. An implementation of the JNLP
DownloadService
class.
•
FileContentsImpl
. An implementation of the JNLP
FileContentsService
class.
•
FileOpenServiceImpl
. An implementation of the JNLP
FileOpenService
class.
•
FileSaveServiceImpl
. An implementation of the JNLP
FileSaveService
class.
•
GeneralUtilities
. A utility class.
•
PersistenceServiceImpl
. An implementation of the JNLP
PersistenceService
class.
•
PrintServiceImpl
. An implementation of the JNLP
PrintService
class.
•
Test
. A sample test class that shows how the library can be used. Not to be included in
your code.
Each class will be discussed in the following sections.