Class ImportResourcePlugin
- java.lang.Object
-
- biz.aQute.bnd.reporter.plugins.entries.any.ImportResourcePlugin
-
- All Implemented Interfaces:
Plugin,RegistryPlugin,ReportEntryPlugin<java.lang.Object>
public class ImportResourcePlugin extends java.lang.Object implements ReportEntryPlugin<java.lang.Object>, Plugin, RegistryPlugin
This plugin allows to add a local or remote file to the report. The file will be converted into DTO. TheURL_PROPERTYproperty must be set and theTYPE_PROPERTYcan be set if the file type is not obvious (derived from its extension).
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>_propertiesprivate Registry_registryprivate Reporter_reporterstatic java.lang.StringTYPE_PROPERTYstatic java.lang.StringURL_PROPERTY-
Fields inherited from interface aQute.bnd.service.reporter.ReportEntryPlugin
ENTRY_NAME_PROPERTY, SOURCE_CLASS_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description ImportResourcePlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.ObjectconvertFile(java.io.InputStream inputStream, java.lang.String extension)java.lang.Objectextract(java.lang.Object source, java.util.Locale locale)Extracts a piece of information from the source in arguments.private java.lang.String[]getAvailableConverterExtensions()java.util.Map<java.lang.String,java.lang.String>getProperties()private java.lang.StringgetType()private java.lang.StringgetUrl()private java.io.InputStreamresolveFile()voidsetProperties(java.util.Map<java.lang.String,java.lang.String> map)Give the plugin the remaining properties.voidsetRegistry(Registry registry)voidsetReporter(Reporter processor)Set the current reporter.
-
-
-
Field Detail
-
URL_PROPERTY
public static final java.lang.String URL_PROPERTY
- See Also:
- Constant Field Values
-
TYPE_PROPERTY
public static final java.lang.String TYPE_PROPERTY
- See Also:
- Constant Field Values
-
_reporter
private Reporter _reporter
-
_registry
private Registry _registry
-
_properties
private final java.util.Map<java.lang.String,java.lang.String> _properties
-
-
Method Detail
-
extract
public java.lang.Object extract(java.lang.Object source, java.util.Locale locale) throws java.lang.ExceptionDescription copied from interface:ReportEntryPluginExtracts a piece of information from the source in arguments.If the source contains localized data, it will be extracted for the specified locale or a less specific if not found.
- Specified by:
extractin interfaceReportEntryPlugin<java.lang.Object>- Parameters:
source- the source to inspect, must not benulllocale- theStringrepresentation of aLocale, must not benull- Returns:
- a DTO representation or
nullif no data is available - Throws:
java.lang.Exception
-
resolveFile
private java.io.InputStream resolveFile() throws java.lang.Exception- Throws:
java.lang.Exception
-
convertFile
private java.lang.Object convertFile(java.io.InputStream inputStream, java.lang.String extension) throws java.lang.Exception- Throws:
java.lang.Exception
-
getAvailableConverterExtensions
private java.lang.String[] getAvailableConverterExtensions()
-
getUrl
private java.lang.String getUrl()
-
getType
private java.lang.String getType()
-
setRegistry
public void setRegistry(Registry registry)
- Specified by:
setRegistryin interfaceRegistryPlugin
-
setProperties
public void setProperties(java.util.Map<java.lang.String,java.lang.String> map) throws java.lang.ExceptionDescription copied from interface:PluginGive the plugin the remaining properties. When a plugin is declared, the clause can contain extra properties. All the properties and directives are given to the plugin to use.- Specified by:
setPropertiesin interfacePlugin- Parameters:
map- attributes and directives for this plugin's clause- Throws:
java.lang.Exception
-
setReporter
public void setReporter(Reporter processor)
Description copied from interface:PluginSet the current reporter. This is called at init time. This plugin should report all errors and warnings to this reporter.- Specified by:
setReporterin interfacePlugin
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
- Specified by:
getPropertiesin interfaceReportEntryPlugin<java.lang.Object>- Returns:
- a map of properties, never
null
-
-