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 protectedInstalledBundleObject(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 intcompareTo(InstalledBundleObject o)A comparator that sorts plug-ins by load order, then by priority, then by name, then by catalog ID date.PluginBundlegetBundle()Returns the bundle that this was loaded from, ornullif this represents a built-in plug-in.CatalogIDgetCatalogID()Returns theCatalogIDfor the source bundle, ornullif the bundle's root file does not specify an id (or there is no bundle).abstract java.lang.StringgetDescription()Returns a description of the plug-in (or other bundle object).abstract ThemedIcongetIcon()Returns an icon for the plug-in (or other bundle object).abstract java.lang.StringgetName()Returns the name of the plug-in (or other bundle object).PluginRootgetPluginRoot()Returns the bundle's root file, ornullif it does not have a root file.intgetPriority()Returns the startup priority in the bundle's root file, orPluginRoot.PRIORITY_DEFAULTif none is specified.java.awt.image.BufferedImagegetRepresentativeImage()Deprecated.UsegetIcon().booleanisUninstallPending()Returnstrueif this plug-in's bundle has been marked for uninstallation.booleanisUpdatePending()Returnstrueif there is an update pending for this plug-in.protected voidmarkFailed()Marks the bundle for this object as having failed.java.lang.StringtoString()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, ornullif this represents a built-in plug-in.- Returns:
- the source bundle, or
null
-
getPluginRoot
public PluginRoot getPluginRoot()
Returns the bundle's root file, ornullif it does not have a root file.- Returns:
- the root file of the source bundle, or
null
-
getCatalogID
public CatalogID getCatalogID()
Returns theCatalogIDfor the source bundle, ornullif 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_DEFAULTif 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:
getIconin 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()
Returnstrueif 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:
trueif an update is pending
-
isUninstallPending
public boolean isUninstallPending()
Returnstrueif 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:
trueif the plug-in will be uninstalled
-
toString
public java.lang.String toString()
Returns the name of the object.- Overrides:
toStringin 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:
compareToin 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. TheBundleInstallermaintains a set of all of the failed bundles.- See Also:
BundleInstaller.getFailedUUIDs()
-
-