public abstract class ServerPluginDescriptorUtil extends Object
| Constructor and Description |
|---|
ServerPluginDescriptorUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.rhq.core.domain.plugin.ServerPlugin |
determineObsoletePlugin(org.rhq.core.domain.plugin.ServerPlugin plugin1,
org.rhq.core.domain.plugin.ServerPlugin plugin2)
Determines which of the two plugins is obsolete - in other words, this determines which
plugin is older.
|
static org.apache.maven.artifact.versioning.ComparableVersion |
getPluginVersion(File pluginFile,
ServerPluginDescriptorType descriptor)
Returns the version for the plugin represented by the given descriptor/file.
|
static Unmarshaller |
getServerPluginDescriptorUnmarshaller()
This will return a JAXB unmarshaller that will enable the caller to parse a server plugin
descriptor.
|
static ServerPluginDescriptorType |
loadPluginDescriptorFromUrl(URL pluginJarFileUrl)
Loads a plugin descriptor from the given plugin jar and returns it.
|
public static org.rhq.core.domain.plugin.ServerPlugin determineObsoletePlugin(org.rhq.core.domain.plugin.ServerPlugin plugin1,
org.rhq.core.domain.plugin.ServerPlugin plugin2)
null will be returned.
Otherwise, the versions are compared and the one with the oldest version is obsolete.
If they have the same versions, the one with the oldest timestamp is obsolete.
If they have the same timestamp too, we have no other way to determine obsolescence so plugin1
will be picked arbitrarily and a message will be logged when this occurs.plugin1 - plugin2 - null is returned if they are the same (i.e. they have the same MD5)IllegalArgumentException - if the two plugins have different logical names or different typespublic static org.apache.maven.artifact.versioning.ComparableVersion getPluginVersion(File pluginFile, ServerPluginDescriptorType descriptor) throws Exception
pluginFile - the plugin jardescriptor - the plugin descriptor as found in the plugin jar (if null,
the plugin file will be read and the descriptor parsed from it)Exception - if the plugin is invalid, there is no version for the plugin or the version string is invalidpublic static ServerPluginDescriptorType loadPluginDescriptorFromUrl(URL pluginJarFileUrl) throws Exception
null will be returned, meaning this is not
a server plugin jar.pluginJarFileUrl - URL to a plugin jar filenull if there
is no plugin descriptor in the jar fileException - if failed to parse the descriptor file found in the plugin jarpublic static Unmarshaller getServerPluginDescriptorUnmarshaller() throws Exception
ValidationEventCollector
installed as an event handler which can be used
to obtain error messages if the unmarshaller fails to parse an XML document.Exception - if an unmarshaller could not be createdCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.