Class InstalledBundleObject
- java.lang.Object
-
- ca.cgjennings.apps.arkham.plugins.InstalledBundleObject
-
- All Implemented Interfaces:
IconProvider
,java.lang.Comparable<InstalledBundleObject>
- Direct Known Subclasses:
AbstractInstalledPlugin
,InstalledLibrary
,InstalledTheme
public abstract class InstalledBundleObject extends java.lang.Object implements IconProvider, java.lang.Comparable<InstalledBundleObject>
Implemented by objects that encapsulate a plug-in bundle that has been discovered by the bundle installer. This interface defines a minimal level of functionality; different kinds of plug-in bundles provide more specific concrete implementations.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InstalledBundleObject(PluginBundle bundle)
Creates a new bundle object for the specified bundle.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
compareTo(InstalledBundleObject o)
A comparator that sorts plug-ins by load order, then by priority, then by name, then by catalog ID date.PluginBundle
getBundle()
Returns the bundle that this was loaded from, ornull
if this represents a built-in plug-in.CatalogID
getCatalogID()
Returns theCatalogID
for the source bundle, ornull
if the bundle's root file does not specify an id (or there is no bundle).abstract java.lang.String
getDescription()
Returns a description of the plug-in (or other bundle object).abstract ThemedIcon
getIcon()
Returns an icon for the plug-in (or other bundle object).abstract java.lang.String
getName()
Returns the name of the plug-in (or other bundle object).PluginRoot
getPluginRoot()
Returns the bundle's root file, ornull
if it does not have a root file.int
getPriority()
Returns the startup priority in the bundle's root file, orPluginRoot.PRIORITY_DEFAULT
if none is specified.java.awt.image.BufferedImage
getRepresentativeImage()
Deprecated.UsegetIcon()
.boolean
isUninstallPending()
Returnstrue
if this plug-in's bundle has been marked for uninstallation.boolean
isUpdatePending()
Returnstrue
if there is an update pending for this plug-in.protected void
markFailed()
Marks the bundle for this object as having failed.java.lang.String
toString()
Returns the name of the object.
-
-
-
Constructor Detail
-
InstalledBundleObject
protected InstalledBundleObject(PluginBundle bundle) throws java.io.IOException
Creates a new bundle object for the specified bundle. The bundle's root file will be loaded, so it will be available to the constructors of concrete subclasses viagetPluginRoot()
.- Parameters:
bundle
- the bundle file- Throws:
java.io.IOException
- if an I/O error occurs while loading the plug-in root
-
-
Method Detail
-
getBundle
public PluginBundle getBundle()
Returns the bundle that this was loaded from, ornull
if this represents a built-in plug-in.- Returns:
- the source bundle, or
null
-
getPluginRoot
public PluginRoot getPluginRoot()
Returns the bundle's root file, ornull
if it does not have a root file.- Returns:
- the root file of the source bundle, or
null
-
getCatalogID
public CatalogID getCatalogID()
Returns theCatalogID
for the source bundle, ornull
if the bundle's root file does not specify an id (or there is no bundle).- Returns:
- the bundle's ID, or
null
-
getPriority
public int getPriority()
Returns the startup priority in the bundle's root file, orPluginRoot.PRIORITY_DEFAULT
if none is specified.- Returns:
- the plug-in's start priority
-
getName
public abstract java.lang.String getName()
Returns the name of the plug-in (or other bundle object). If necessary, a new instance of the plug-in will be created temporarily in order to get this information.- Returns:
- the name reported by the plug-in
-
getDescription
public abstract java.lang.String getDescription()
Returns a description of the plug-in (or other bundle object). If necessary, a new instance of the plug-in will be created temporarily in order to get this information.- Returns:
- the description reported by the plug-in
-
getIcon
public abstract ThemedIcon getIcon()
Returns an icon for the plug-in (or other bundle object). If the plug-in has a representative image, an icon is returned based on that image. Otherwise, a generic icon is returned based on the type of plug-in bundle.- Specified by:
getIcon
in interfaceIconProvider
- Returns:
- an icon for the plug-in
-
getRepresentativeImage
@Deprecated public final java.awt.image.BufferedImage getRepresentativeImage()
Deprecated.UsegetIcon()
.Returns the representative image of the plug-in. If necessary, a new instance of the plug-in will be created temporarily in order to get this information.- Returns:
- the representative name reported by the plug-in (may be
null
)
-
isUpdatePending
public boolean isUpdatePending()
Returnstrue
if there is an update pending for this plug-in. A pending update is an updated version of the plug-in that will be installed automatically the next time the application starts.- Returns:
true
if an update is pending
-
isUninstallPending
public boolean isUninstallPending()
Returnstrue
if this plug-in's bundle has been marked for uninstallation. (The plug-in's bundle will be deleted the next time the application starts.)- Returns:
true
if the plug-in will be uninstalled
-
toString
public java.lang.String toString()
Returns the name of the object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the value of
getName()
-
compareTo
public int compareTo(InstalledBundleObject o)
A comparator that sorts plug-ins by load order, then by priority, then by name, then by catalog ID date.- Specified by:
compareTo
in interfacejava.lang.Comparable<InstalledBundleObject>
- Parameters:
o
- the bundle object to compare to- Returns:
- a value that is negative, zero, or positive as the compared bundle object is greater, equal, or less than this bundle object
- Throws:
java.lang.NullPointerException
- if the compared object isnull
- See Also:
getPriority()
,getName()
,getCatalogID()
,CatalogID.compareDates(ca.cgjennings.apps.arkham.plugins.catalog.CatalogID)
-
markFailed
protected final void markFailed()
Marks the bundle for this object as having failed. Subclasses call this when the specific bundle object fails to load or start correctly. If this object has a catalog ID, then the UUID associated with that ID is marked as having failed to start correctly. TheBundleInstaller
maintains a set of all of the failed bundles.- See Also:
BundleInstaller.getFailedUUIDs()
-
-