Object
Report
- Direct Known Subclasses:
AuthorityCodesReport
,OperationParametersReport
Base class for tools generating reports as HTML pages. The reports are based on HTML templates
with a few keywords to be replaced by user-provided values. The values associated to keywords
can be specified in two ways:
- Specified at construction time.
- Stored directly in the properties map by subclasses.
Key | Remarks | Meaning |
---|---|---|
TITLE | Title of the web page to produce. | |
DATE | automatic | Date of report creation. |
DESCRIPTION | optional | Description to write after the introductory paragraph. |
OBJECTS.KIND | Kind of objects listed in the page (e.g. Operation Methods). | |
PRODUCT.NAME | Name of the product for which the report is generated. | |
PRODUCT.VERSION | Version of the product for which the report is generated. | |
PRODUCT.URL | URL where more information is available about the product. | |
JAVADOC.GEOAPI | predefined | Base URL of GeoAPI javadoc. |
FILENAME | predefined | Name of the file to create if the write(File) argument is a directory. |
How to use this class:
- Create a
Properties
map with the values documented in the subclass to be instantiated. Default values exist for many keys, but those defaults may depend on the environment (information found inMETA-INF/MANIFEST.MF
, etc). It is safer to specify values explicitly when they are known. - Create a new instance of the
Report
subclass with the above properties map given to the constructor. - All
Report
subclasses define at least oneadd(…)
method for declaring the objects to include in the HTML page. At least one object or factory needs to be declared. - Invoke
write(File)
.
- Since:
- 3.1
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Properties
The values to substitute to keywords in the HTML templates. -
Constructor Summary
ModifierConstructorDescriptionprotected
Report
(Properties properties) Creates a new report generator using the given property values. -
Method Summary
-
Field Details
-
properties
The values to substitute to keywords in the HTML templates. This map is initialized to a copy of the map given by the user at construction time, or to an empty map if the user gave anull
map. Subclasses can freely add, edit or remove entries in this map.The list of expected entries and their default values (if any) are subclass-specific. See the subclass javadoc for a list of expected values.
-
-
Constructor Details
-
Report
Creates a new report generator using the given property values. The list of expected entries is subclass specific and shall be documented in their javadoc.- Parameters:
properties
- the property values, ornull
for the default values.
-
-
Method Details
-
getLocale
Returns the locale to use for producing messages in the reports. The locale may be used for fetching the character sequences fromInternationalString
objects, for converting to lower-cases or for formatting numbers.The locale is fixed to English for now, but may become modifiable in a future version.
- Returns:
- the locale to use for formatting messages.
- See Also:
-
write
Generates the HTML report in the given file or directory. If the given argument is a directory, then the path will be completed with the"FILENAME"
properties value if any, or an implementation specific default filename otherwise.Note that the target directory must exist; this method does not create any new directory.
- Parameters:
destination
- the destination file or directory. If this file already exists, then its content will be overwritten without warning.- Returns:
- the file to the HTML page generated by this report. This is usually the given
destination
argument, unless the destination was a directory. - Throws:
IOException
- if an error occurred while writing the report.
-