com.virtuosotechnologies.lib.plugin
Class EditablePluginInfo

java.lang.Object
  extended bycom.virtuosotechnologies.lib.plugin.EditablePluginInfo
All Implemented Interfaces:
PluginInfo

public class EditablePluginInfo
extends Object
implements PluginInfo

Editable implementation of PluginInfo.

This class is fully synchronized and thread-safe.


Constructor Summary
EditablePluginInfo(String name, StringID version, String initializerClassName, URL pluginJar, boolean forceUnique)
          Constructor
 
Method Summary
 void addProvidedAPI(String apiName, APIVersion version, URL apiJar)
          Add a provided API
 void addToPluginDescription(String description)
          Add to the description of the plugin.
 void addToProvidedAPIDescription(String providedApiName, String description)
          Add to the description of a provided API.
 void addUsedAPI(String apiName, APIVersion version, boolean optional)
          Add a used API
 String getDescriptionForProvidedAPI(String apiName)
          Get the description for the given provided API.
 URL getJarForProvidedAPI(String apiName)
          Get the Jar URL for the given API spec, or null if no jar is needed.
 String getPluginDescription()
          Get the description of the plugin
 PluginID getPluginID()
          Get the identifier of the plugin
 String getPluginInitializerClassName()
          Get the name of the PluginInitializer implementation class
 URL getPluginJar()
          Get the jar URL for the plugin.
 String getPluginShortDescription()
          Get the short description of the plugin
 String[] getProvidedAPINames()
          Get the provided API names
 String[] getUsedAPINames()
          Get the used API names, both required and optional
 APIVersion getVersionForProvidedAPI(String apiName)
          Get the version for the given provided API.
 APIVersion getVersionForUsedAPI(String apiName)
          Get the version for the given used API.
 boolean isForcingUniqueness()
          Returns true if this plugin wants to be the only version of itself installed.
 boolean isUsedAPIOptional(String apiName)
          Is the given used API optional?
 void setPluginShortDescription(String description)
          Sets the short description of the plugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditablePluginInfo

public EditablePluginInfo(String name,
                          StringID version,
                          String initializerClassName,
                          URL pluginJar,
                          boolean forceUnique)
Constructor

Parameters:
name - name of plugin
version - version of plugin
initializerClassName - name of the PluginInitializer implementation
pluginJar - jar file for the plugin, or null if there is no jar
Method Detail

addProvidedAPI

public void addProvidedAPI(String apiName,
                           APIVersion version,
                           URL apiJar)
                    throws IllegalPluginInfoException
Add a provided API

Parameters:
apiName - name of API to provide
version - version of the API and implementation
apiJar - jar file for the API classes, or null if there is no jar
Throws:
IllegalPluginInfoException - the api name is already present

addUsedAPI

public void addUsedAPI(String apiName,
                       APIVersion version,
                       boolean optional)
                throws IllegalPluginInfoException
Add a used API

Parameters:
apiName - name of API that is used
version - requested version of the API
optional - is the API optional
Throws:
IllegalPluginInfoException - the api name is already present

setPluginShortDescription

public void setPluginShortDescription(String description)
Sets the short description of the plugin

Parameters:
description - description string

addToPluginDescription

public void addToPluginDescription(String description)
Add to the description of the plugin. Automatically inserts a newline if there is already text in the description

Parameters:
description - description string

addToProvidedAPIDescription

public void addToProvidedAPIDescription(String providedApiName,
                                        String description)
                                 throws IllegalPluginInfoException
Add to the description of a provided API. Automatically inserts a newline if there is already text in the description

Parameters:
providedApiName - name of provided API
description - description string
Throws:
IllegalPluginInfoException

getPluginID

public PluginID getPluginID()
Get the identifier of the plugin

Specified by:
getPluginID in interface PluginInfo
Returns:
a PluginID

getPluginDescription

public String getPluginDescription()
Get the description of the plugin

Specified by:
getPluginDescription in interface PluginInfo
Returns:
a String

getPluginShortDescription

public String getPluginShortDescription()
Get the short description of the plugin

Specified by:
getPluginShortDescription in interface PluginInfo
Returns:
a String

getPluginJar

public URL getPluginJar()
Get the jar URL for the plugin.

Specified by:
getPluginJar in interface PluginInfo
Returns:
a URL, or null for no jar

getPluginInitializerClassName

public String getPluginInitializerClassName()
Get the name of the PluginInitializer implementation class

Specified by:
getPluginInitializerClassName in interface PluginInfo
Returns:
a class name

isForcingUniqueness

public boolean isForcingUniqueness()
Returns true if this plugin wants to be the only version of itself installed. If this attribute is true, plugging in this plugin will suppress the simultaneous plugging in of any earlier versions. If an earlier version is already plugged in, this plugin itself will be suppressed. This is useful for plugins that, for example, create GUIs or have other such side effects that should only happen once.

Specified by:
isForcingUniqueness in interface PluginInfo
Returns:
true if this plugin wants to force uniqueness

getProvidedAPINames

public String[] getProvidedAPINames()
Get the provided API names

Specified by:
getProvidedAPINames in interface PluginInfo
Returns:
an array of Strings

getDescriptionForProvidedAPI

public String getDescriptionForProvidedAPI(String apiName)
Get the description for the given provided API.

Specified by:
getDescriptionForProvidedAPI in interface PluginInfo
Parameters:
apiName - name of a provided API
Returns:
a description String
Throws:
NullPointerException - name not found

getVersionForProvidedAPI

public APIVersion getVersionForProvidedAPI(String apiName)
Get the version for the given provided API.

Specified by:
getVersionForProvidedAPI in interface PluginInfo
Parameters:
apiName - name of a provided API
Returns:
an APIVersion
Throws:
NullPointerException - name not found

getJarForProvidedAPI

public URL getJarForProvidedAPI(String apiName)
Get the Jar URL for the given API spec, or null if no jar is needed.

Specified by:
getJarForProvidedAPI in interface PluginInfo
Parameters:
apiName - name of a provided API
Returns:
a URL for the jar, or null for no jar needed
Throws:
NullPointerException - name not found

getUsedAPINames

public String[] getUsedAPINames()
Get the used API names, both required and optional

Specified by:
getUsedAPINames in interface PluginInfo
Returns:
an array of Strings

getVersionForUsedAPI

public APIVersion getVersionForUsedAPI(String apiName)
Get the version for the given used API.

Specified by:
getVersionForUsedAPI in interface PluginInfo
Parameters:
apiName - name of a used API
Returns:
an APIVersion
Throws:
NullPointerException - name not found

isUsedAPIOptional

public boolean isUsedAPIOptional(String apiName)
Is the given used API optional?

Specified by:
isUsedAPIOptional in interface PluginInfo
Parameters:
apiName - name of a used API
Returns:
true if the given needed API is optional
Throws:
NullPointerException - name not found