ilog.views.appframe.plugin
Class IlvPlugin

java.lang.Object
  extended by ilog.views.appframe.plugin.IlvPlugin

public class IlvPlugin
extends Object

A plug-in is a set of libraries and resource files that are dynamically loaded and added to an application to extend its features. There is no limitation on a plug-in for extending the application features. All that is specified when creating an application can be done from within a plug-in.
For example, a plug-in can specify new types of document that the application can open or can override the settings of the application. A plug-in can also override the processing of the actions of the application by adding new action handlers with its associated plug-in installer.

Plug-in properties
Properties of a plug-in are defined with the attributes of the root <plugin> element in the plugin.xml of the plug-in. Plug-in properties are:

Plug-in resource files
When plug-ins are installed, settings and resource property files specific to the plug-in are added to the application. Files are referred to in the plugin.xml file of the plug-in with file names that are relative to the root path of the library Jar file of the plug-in that contains them.
Settings files are declared in the XML elements selected with the /plugin/settings/file XPath expression. The relative file name of the settings file is provided with the name attribute of those selected elements.
Resource property files are declared in the XML elements selected with the /plugin/resources/resource XPath expression. The relative filename of the resource property file is provided with the name attribute of those selected elements.

Plug-in libraries
Classes and resource files specific to a plug-in are contained in library Jar files that are added to the class loader of the host application when the plug-in is installed. Libraries are declared in the plugin.xml file of the plug-in in the settings elements selected with the /plugin/runtime/library XPath expression. The filename is defined in the name attribute of those settings elements and is relative to the directory that contains the plug-in.

You can find documentation and examples of using plug-ins in the ILOG JViews Application Framework User's Manual, in the chapter on Plug-ins.

See Also:
IlvPluginManager

Method Summary
 IlvApplication getApplication()
          Returns the application of the plug-in.
 ClassLoader getClassLoader()
          The class loader associated with this plugin.
 ClassLoader[] getClassLoaders()
          Deprecated. Only one class loader is created for each plugin. This class loader takes into account all the libraries of the plugin as well as all the plugin that are required by this plugin.

This method returns an array of one class loader that contains the class loader given with the method getClassLoader().

 IlvPlugin getDependentPlugin(int index)
          Returns the plug-in at the specified storage index in the list of installed plug-ins that depend on this plug-in.
 int getDependentPluginCount()
          Returns the number of installed plug-ins that depend on this plug-in.
 String getDescription()
          Returns the description of the plug-in.
 File getDirectory()
          Returns the file directory where this plug-in is defined.
 String getID()
          Returns the ID of this plug-in.
 IlvPluginInstaller getInstaller()
          Returns the installer of the plug-in.
 String getInstallMode()
          Returns the installation mode of this plug-in as defined in the plugin.xml file of this plug-in.
 String getName()
          Returns the name of the plug-in.
 IlvPlugin getParentPlugin()
          Returns the plug-in that owns the plug-in.
 IlvPlugin getPlugin(int index)
          Returns the child plug-in stored at the specified index.
 IlvPlugin getPlugin(String id)
          Returns the child plug-in of this plug-in with the specified ID.
 int getPluginCount()
          Returns the number of child plug-ins owned by this plug-in.
 IlvPluginManager getPluginManager()
          Returns the plugin manager that contains this plugin.
 IlvPlugin[] getPlugins()
          Returns the child plug-ins of this plug-in.
 IlvPluginVersion getPluginVersion()
          Returns the IlvPluginVersion of this plug-in.
 String getPropertyFile(int index)
          Returns the property file at the specified storage index.
 int getPropertyFileCount()
          Returns the number of property files declared in the plugin.xml file of this plug-in.
 String getProviderName()
          Returns the name of the provider of this plug-in.
 ResourceBundle getResourceBundle()
          Returns the resource bundle that contains all the internationalization resources declared in the plugin.xml file of this plug-in.
 IlvSettingsElement getSettingsElement()
          Returns the <plugin> root settings element that defines the plug-in in its associated plugin.xml file.
 IlvSettingsManager getSettingsManager()
          Returns the settings manager that manages the settings of this plug-in.
 URL getURL()
          Returns the URL of the file directory where this plug-in is defined.
 IlvURLResolver getURLResolver()
          Returns the URL resolver that resolves URLs for resources defined in this plug-in.
 String getVersion()
          Returns the version of this plug-in as a string.
 boolean isInstalled()
          Determines whether the plug-in is installed.
 void setApplication(IlvApplication application)
          Sets the application of the plug-in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProviderName

public String getProviderName()
Returns the name of the provider of this plug-in.


getVersion

public String getVersion()
Returns the version of this plug-in as a string.

See Also:
getPluginVersion()

getPluginVersion

public IlvPluginVersion getPluginVersion()
Returns the IlvPluginVersion of this plug-in.

See Also:
getVersion()

getID

public String getID()
Returns the ID of this plug-in. If no ID has been specified in the plugin.xml definition file, the returned ID the name of the directory that contains the plug-in.


setApplication

public void setApplication(IlvApplication application)
Sets the application of the plug-in. This method is invoked by the plug-in manager to set the application that this plug-in will be added to. This method should not be overridden by adding initialization code that may impact the host application, since this plug-in may not be installed in the application. Instead, you are recommended to add some initialization code to the plug-in installer associated with this plug-in.

Parameters:
application - The application of the plug-in.
See Also:
getApplication(), IlvPluginInstaller

getApplication

public IlvApplication getApplication()
Returns the application of the plug-in.

See Also:
setApplication(ilog.views.appframe.IlvApplication)

getDirectory

public File getDirectory()
Returns the file directory where this plug-in is defined.


getURL

public URL getURL()
Returns the URL of the file directory where this plug-in is defined. If the plugin is entirely located inside a jar file, it returns the base location inside the jar file.

Since:
JViews 7.5

getName

public String getName()
Returns the name of the plug-in. This name is set in the plugin.xml file defining the plug-in.


getClassLoaders

public ClassLoader[] getClassLoaders()
Deprecated. Only one class loader is created for each plugin. This class loader takes into account all the libraries of the plugin as well as all the plugin that are required by this plugin.

This method returns an array of one class loader that contains the class loader given with the method getClassLoader().

Returns the array of class loaders for this plug-in. One class loader is created for each library referenced in the plugin.xml file of the plug-in.


getURLResolver

public IlvURLResolver getURLResolver()
Returns the URL resolver that resolves URLs for resources defined in this plug-in.


getResourceBundle

public ResourceBundle getResourceBundle()
Returns the resource bundle that contains all the internationalization resources declared in the plugin.xml file of this plug-in.

Returns:
The resource bundle of the application.
See Also:
getPropertyFileCount(), getPropertyFile(int)

getPropertyFileCount

public int getPropertyFileCount()
Returns the number of property files declared in the plugin.xml file of this plug-in.

See Also:
getPropertyFile(int)

getPropertyFile

public String getPropertyFile(int index)
Returns the property file at the specified storage index.

See Also:
getResourceBundle(), getPropertyFileCount()

getClassLoader

public ClassLoader getClassLoader()
The class loader associated with this plugin.

This class loader allows to find resources and classes that are in the directory of the plugin or in the libraries declared in the plugin.xml manifest file of the plugin.

Returns:
The class loader of this plugin.
Since:
Java Application Framework 2.0

isInstalled

public boolean isInstalled()
Determines whether the plug-in is installed.

Returns:
true if the plug-in is installed; false otherwise.

getPlugin

public IlvPlugin getPlugin(String id)
Returns the child plug-in of this plug-in with the specified ID. Child plug-ins are optional and are defined in the plugin.xml file of this plug-in as child elements of the element selected with plugin/plugins.

Parameters:
id - The ID of the plug-in to return.
Returns:
The child plug-in with the specified ID or null if no child plug-ins are defined with this ID.
See Also:
getPlugin(int), getPlugins()

getPlugin

public IlvPlugin getPlugin(int index)
Returns the child plug-in stored at the specified index.

See Also:
getPlugin(String), getPlugins()

getPlugins

public IlvPlugin[] getPlugins()
Returns the child plug-ins of this plug-in. Child plug-ins are optional and are defined in the plugin.xml file of this plug-in as child elements of the element selected with plugin/plugins.


getPluginCount

public int getPluginCount()
Returns the number of child plug-ins owned by this plug-in.

See Also:
getPlugins()

getSettingsManager

public IlvSettingsManager getSettingsManager()
Returns the settings manager that manages the settings of this plug-in. Settings of a plug-in are defined in the plugin.xml file of this plug-in with the elements selected with plugin/settings/file XPath expression.


getParentPlugin

public IlvPlugin getParentPlugin()
Returns the plug-in that owns the plug-in.

Returns:
The parent plug-in.

getDependentPluginCount

public int getDependentPluginCount()
Returns the number of installed plug-ins that depend on this plug-in. If a plug-in has dependent plug-ins, it cannot be uninstalled.

A plug-in A depends on another plug-in B if A refers to B in its list of required plug-ins or if A is a child plug-in of B.

Returns:
The number of dependent plug-ins.
See Also:
getDependentPlugin(int)

getDependentPlugin

public IlvPlugin getDependentPlugin(int index)
Returns the plug-in at the specified storage index in the list of installed plug-ins that depend on this plug-in.

Returns:
The dependent plug-in at the specified index.
See Also:
getDependentPluginCount()

getInstallMode

public String getInstallMode()
Returns the installation mode of this plug-in as defined in the plugin.xml file of this plug-in. The return value can be one of the following:. It is also possible to provide another value for this mode. It is then the responsibility of the plug-in manager to interpret this value with the method IlvPluginManager.isInitiallyInstalled(ilog.views.appframe.plugin.IlvPlugin) to determine whether this plug-in should be installed when the application is being launched.


getInstaller

public IlvPluginInstaller getInstaller()
Returns the installer of the plug-in. The installer is instantiated from the installer class specified in the plugin.xml file of the plug-in.

Returns:
The installer of the plug-in or null if no plug-in installer is specified in the plugin.xml file of the plug-in.

getSettingsElement

public IlvSettingsElement getSettingsElement()
Returns the <plugin> root settings element that defines the plug-in in its associated plugin.xml file.

This settings element can be used for accessing user information that has not been interpreted for the plug-in.


getDescription

public String getDescription()
Returns the description of the plug-in. The returned string corresponds to the value of the "description" attribute of the root <plugin> element in the plugin.xml file of this plug-in. This string is probably a key of a resource string that should be translated according to the locale.

Returns:
The description of the plug-in.

getPluginManager

public IlvPluginManager getPluginManager()
Returns the plugin manager that contains this plugin.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.