public class PluginInformation extends Object
Modifier and Type | Field and Description |
---|---|
Map<String,String> |
attr
All manifest attributes.
|
String |
author
The plugin author.
|
boolean |
canloadatruntime
Plugin can be loaded at any time and not just at start.
|
String |
className
The plugin class name.
|
String |
description
The plugin description.
|
String |
downloadlink
The plugin download link.
|
boolean |
early
Determines if the plugin must be loaded early or not.
|
private static ImageIcon |
emptyIcon |
File |
file
The plugin jar file.
|
ImageIcon |
icon
The plugin icon.
|
String |
iconPath
The plugin icon path inside jar.
|
List<URL> |
libraries
The libraries referenced in Class-Path manifest attribute.
|
String |
link
The plugin link (for documentation).
|
int |
localmainversion
The lowest JOSM version required by this plugin (from locally available jar).
|
String |
localrequires
The list of required plugins, separated by ';' (from locally available jar).
|
String |
localversion
The plugin version (from locally available jar).
|
int |
mainversion
The lowest JOSM version required by this plugin (from plugin list).
|
String |
name
The plugin name.
|
boolean |
oldmode
Determines if the plugin is an old version loaded for incompatibility with latest JOSM (from plugin list)
|
String |
requires
The list of required plugins, separated by ';' (from plugin list).
|
int |
stage
The plugin stage, determining the loading sequence order of plugins.
|
String |
version
The plugin version (from plugin list).
|
Constructor and Description |
---|
PluginInformation(File file)
Creates a plugin information object by reading the plugin information from
the manifest in the plugin jar.
|
PluginInformation(File file,
String name)
Creates a plugin information object for the plugin with name
name . |
PluginInformation(InputStream manifestStream,
String name,
String url)
Creates a plugin information object by reading plugin information in Manifest format
from the input stream
manifestStream . |
Modifier and Type | Method and Description |
---|---|
static PluginInformation |
findPlugin(String pluginName)
Try to find a plugin after some criterias.
|
String |
getDescriptionAsHtml()
Replies the description as HTML document, including a link to a web page with
more information, provided such a link is available.
|
List<String> |
getLocalRequiredPlugins()
Replies the list of plugins required by the local instance of this plugin.
|
String |
getName()
Replies the name of the plugin.
|
static Collection<String> |
getPluginLocations()
Returns all possible plugin locations.
|
List<String> |
getRequiredPlugins()
Replies the list of plugins required by the up-to-date version of this plugin.
|
private static List<String> |
getRequiredPlugins(String pluginList) |
ImageIcon |
getScaledIcon()
Replies the plugin icon, scaled to 24x24 pixels.
|
boolean |
isUpdateRequired()
Replies true if this this plugin should be updated/downloaded because either
it is not available locally (its local version is null) or its local version is
older than the available version on the server.
|
boolean |
isUpdateRequired(String referenceVersion)
Replies true if the plugin with the given information is most likely outdated with
respect to the referenceVersion.
|
PluginProxy |
load(Class<?> klass)
Loads and instantiates the plugin.
|
Class<?> |
loadClass(ClassLoader classLoader)
Loads the class of the plugin.
|
boolean |
matches(String filter)
Replies true if either the name, the description, or the version match (case insensitive)
one of the words in filter.
|
protected boolean |
matches(String filter,
String value) |
private void |
scanManifest(Manifest manifest,
boolean oldcheck) |
void |
setName(String name)
Sets the name
|
String |
toString() |
void |
updateFromJar(PluginInformation other)
Updates the plugin information of this plugin information object with the
plugin information in a plugin information object retrieved from a plugin
jar.
|
void |
updateFromPluginSite(PluginInformation other)
Updates the plugin information of this plugin information object with the
plugin information in a plugin information object retrieved from a plugin
update site.
|
void |
updateLocalInfo(PluginInformation info)
Updates the local fields (
localversion , localmainversion , localrequires )
to values contained in the up-to-date fields (version , mainversion , requires )
of the given PluginInformation. |
public int mainversion
public int localmainversion
public boolean oldmode
public String localrequires
public String description
public boolean early
public int stage
public String localversion
public String downloadlink
public boolean canloadatruntime
public PluginInformation(File file) throws PluginException
file
- the plugin jar filePluginException
- if reading the manifest failspublic PluginInformation(File file, String name) throws PluginException
name
.
Information about the plugin is extracted from the manifest file in the plugin jar
file
.file
- the plugin jarname
- the plugin namePluginException
- thrown if reading the manifest file failspublic PluginInformation(InputStream manifestStream, String name, String url) throws PluginException
manifestStream
.manifestStream
- the stream to read the manifest fromname
- the plugin nameurl
- the download URL for the pluginPluginException
- thrown if the plugin information can't be read from the input streampublic void updateFromPluginSite(PluginInformation other)
other
- the plugin information object retrieved from the update sitepublic void updateFromJar(PluginInformation other)
other
- the plugin information object retrieved from the jar fileprivate final void scanManifest(Manifest manifest, boolean oldcheck)
public String getDescriptionAsHtml()
public PluginProxy load(Class<?> klass) throws PluginException
klass
- the plugin classPluginException
- if the plugin cannot be loaded or instanciatedpublic Class<?> loadClass(ClassLoader classLoader) throws PluginException
classLoader
- the class loader to usePluginException
- if the class cannot be loadedpublic static PluginInformation findPlugin(String pluginName) throws PluginException
pluginName
- The name of the plugin (in all lowercase). E.g. "lang-de"null
, if the plugin
was nowhere to be found.PluginException
- In case of broken plugins.public static Collection<String> getPluginLocations()
public boolean isUpdateRequired(String referenceVersion)
referenceVersion
- the reference version. Can be null if we don't know a
reference versionpublic boolean isUpdateRequired()
public boolean matches(String filter)
filter
- the filter expressionpublic ImageIcon getScaledIcon()
private static List<String> getRequiredPlugins(String pluginList)
public List<String> getRequiredPlugins()
public List<String> getLocalRequiredPlugins()
public void updateLocalInfo(PluginInformation info)
localversion
, localmainversion
, localrequires
)
to values contained in the up-to-date fields (version
, mainversion
, requires
)
of the given PluginInformation.info
- The plugin information to get the data from.