URL Resource Collector |
Documentation Contents |
The URL Resource Collector (oni.resource.URLResouceCollector) collects resources according to the settings of the version definition file that exists in the location specified by a URL. This function enables to get differential files for dynamically updating the resource/program using only a Web server. Typically, differential files are JAR files.
The version definition file consists of sets of version strings, names and sizes of the corresponding differential files. The names of differential files are specified by a URL absolute or relative to the version definition file. The URL Resource Collector refers to the version definition file first, and compares it with the current version of a local archive. If the version definition file has one or more newer files than the current version, it starts to collect the corresponding differential files. The status or completion of the collection is notified to bound listeners.
The URL Resource Collector returns the obtained differential files as archives. Merging this set of differential archives with the local archive completes updating.
The version definition file is formatted as shown below. Version data are listed in random order.
#Version string = differential file URL: file size (if unknown, leave blank) 1.1 = ver1.0-ver1.1.jar : 4321 1.2 = ver1.1-ver1.2.jar : 5555 1.3 = ver1.2-ver1.3.jar : 999The version definition file can be created or added by specifying the -list option when executing archivediff (a tool for extracting the difference between archives). If this option is not specified, or other differential files are added, the version definition file is directly edited.
For example, if the version definition file is located in the URL, http://www.hogehoge/app/versions, differential files must be referred to in the URL, http://www.hogehoge/app/ver1.0-ver1.1.jar since the location of these differential files is relatively specified.
In this application, to construct URLResourceCollector, do as follows:
ResouceCollector collector = new URLResouceCollector( new URL("http://www.hogehoge/app/versions"), archive.getVersion() );The constructor's first argument is the URL of the version definition file, and the second argument is the current version of the local archive. For example, if the current version is "1.1", newer versions, ver1.1-ver1.2.jar and ver1.2-ver1.3.jar are to be collected. To start the execution of the resource collector, call ResouceCollector#start. The status, error and completion of the collection are notified through ResouceCollectionListener. If the collection is properly completed, the following code updates the local archive.
Archive[] patchs = collector.getCollections(); archive.merge(patchs);To update the application's class files, see ArchiveClassLoader#update.
|
Copyright © 2001-2002 CyberStep, Inc. All Rights Reserved. |
Oni Software |