![]() |
Download archive here |
![]() |
Version: 1.2, 27.11.2000
The package openfuture.packageinfo and all its sub-packages and extensions is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the
Free Software Foundation, Inc.,
59 Temple Place,
Suite 330, Boston,
MA 02111-1307
USA
Or visit http://www.gnu.org/copyleft/lesser.html.
The objectives of the openfuture.packageinfo classes are to provide the means to retrieve package information and configuration at runtime. Therefore all packages of an application and its components have to provide a class named _PackageDescription which at least implements a method named version() which provides the version number of the package.
The classes of openfuture.packageinfo now can read the information of these classes using the Java reflection mechanisms. To create configuration information for a system an instance of the class Configuration is used, which searches for classes with the name _PackageDescription within a given package name and recursively within all packages specified in the package description's prerequisites() method. Finally this configuration informatin can be dumped to a Writer or a HTML file.
The following methods of a class _PackageDescription are exploited:
Type | Method | Description |
---|---|---|
String |
version() |
The version number of the package, e.g. "1.0" |
String |
author() |
The author of the package |
String |
description() |
A textual description for the package |
String |
name() |
The Name of the package / component / application / bean / framework.... |
String |
url() |
A URL where documentation and/or downloadable versions of the package is available |
String |
copyright() |
A copyright statement (e.g. GNU licence statement) |
String |
jdk() |
A statement describing the required JDK to run the package. |
String[] |
prerequisites() |
An array of String which describe, which packages must be available at runtime to load and instantiate the classes of the package. |
To retrieve a configuration of your system simply create an instance of the class Configuration:
Configuration conf = new Configuration("your.top.packagename");
The package name passed as argument should indicate a "top" package of the system. There must be a _PackageDescription class within this package. To provide information about the available versions of other packages the prerequisites() method of this package description should list all packages used by the system (see all used import statements to identify the prerequsisites of your system!).
To output the configuration just request the toString() presentation of the configuration.
To write a HTML file of the configuration use the writeHTML() method of the the Configuration:
conf.writeHTML("<filename.html>")
To write a XML file of the configuration use the writeXML() method of the the Configuration:
conf.writeXML("<filename.xml>")
1.0 |
First release of the component |
|
1.1 |
Version history support added |
|
1.2 |
XML export structure improved; HistoryRecord introduced; XMLWriter and HTMLWriter introduced to improve file generation |
[R1] GNU Lesser General Public License
[R2] Download Sources here.