com.softwareag.cis.plugin.registry
Class PlugIn

java.lang.Object
  extended by com.softwareag.cis.plugin.registry.PlugIn

public class PlugIn
extends java.lang.Object

A PlugIn represents an installable component in the PluggableUI


Constructor Summary
PlugIn(PlugInRegistry pluginRegistry, java.io.InputStream inputStream)
          Constructs a plug-in from an input stream
PlugIn(PlugInRegistry pluginRegistry, java.lang.String filePath)
          Constructs a plug-in from a file path
 
Method Summary
 void addExtension(Extension extension)
          Adds new extensions to this plug-in.
 void addExtensionPoint(ExtensionPoint extensionPoint)
          Adds new extension point to this plug-in.
 void checkExtensions()
          Check consistency of plug-in dependencies for each extension provided by this plug-in.
 void disable()
          Disable this plug-in Implies disabling transitive closure of dependent plug-ins by removing them from PlugInRegistry
 java.lang.ClassLoader getClassLoader()
          Obtain class loader to be used for loading extension classes
 java.net.URL[] getClassPathURLs()
          Get array of URLs contributing to the class path for this PlugIn
 Extension getExtension(java.lang.String extensionId)
          Get extension provided by this plug-in
 ExtensionPoint getExtensionPoint(java.lang.String extensionPointId)
           
 java.util.List<ExtensionPoint> getExtensionPoints()
          Obtains collection of this plug-in extension points
 java.util.List<Extension> getExtensions()
          Obtains collection of this plug-in extensions
 java.util.List<Extension> getExtensions(java.lang.String id)
          Get list of plug-in info extensions provided by this plug-in
 java.util.List<Extension> getExtensionsWithExtensionPointId(java.lang.String extensionPointId)
          Get list of extensions provided by this plug-in with given extension point id
 java.lang.String getFileName()
          Obtains the full path to the plug-in descriptor file
 java.lang.String getName()
          Obtain name of plug-in - is retrieved from PlugInInfo - fallback: plug-in id
 int getPlugInDependencyOrder()
          Get the plug-in order on basis plug-in dependency
 java.lang.String getPlugInFolderName()
          Get folder relative to webapp base dir where plug-in is installed
 java.lang.String getPlugInId()
           
 PlugInInfo getPlugInInfo()
          Obtains PlugInInfo object which should be used for extracting some information i.e. the name of the plug-in
 int getPlugInOrder()
          Obtains the order in which the plug-in should be loaded (as specified in the plug-in descriptor)
 PlugInRegistry getPlugInRegistry()
          Get the PlugInRegistry
 java.util.List<java.lang.String> getRequiredPluginIDs()
          Get set of IDs of required plug-ins
 java.util.Set<java.lang.String> getRequiredPluginIDsClosure()
          Get transitive closure of IDs of required plug-ins
 void popContextClassLoader(java.lang.ClassLoader saveClassLoader)
          Restore thread context classloader
 java.lang.ClassLoader pushContextClassLoader()
          Set thread context class loader to this plug-in's class loader
 void registerClassLoader()
          Obtains class loader to be used for loading extension classes
 boolean requires(PlugIn piToCheckDependencyOn)
          Check whether this plugIn depends directly or indirectly on given plugIn
 void setFileName(java.lang.String fileName)
          Set the full path of the plug-in descriptor file
 void setPlugInDependencyOrder(int inDependencyOrder)
          Set the plug-in order on basis plug-in dependency
 void setPluginId(java.lang.String pluginId)
          Set the Id of this plug-in
 void setPlugInOrder(int pluginOrder)
          Set the order in which the plug-in should be loaded
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlugIn

public PlugIn(PlugInRegistry pluginRegistry,
              java.lang.String filePath)
Constructs a plug-in from a file path

Parameters:
pluginRegistry - register the plug-in to the passed plug-in registry
filePath - to the plug-in descriptor
Throws:
java.lang.RuntimeException - if file is not found

PlugIn

public PlugIn(PlugInRegistry pluginRegistry,
              java.io.InputStream inputStream)
Constructs a plug-in from an input stream

Parameters:
pluginRegistry - register the plug-in to the passed plug-in registry
inputStream - of the plug-in descriptor
Throws:
java.lang.RuntimeException - if file is not found
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPlugInRegistry

public PlugInRegistry getPlugInRegistry()
Get the PlugInRegistry


getRequiredPluginIDs

public java.util.List<java.lang.String> getRequiredPluginIDs()
Get set of IDs of required plug-ins

Returns:
the set of IDs

getRequiredPluginIDsClosure

public java.util.Set<java.lang.String> getRequiredPluginIDsClosure()
Get transitive closure of IDs of required plug-ins

Returns:
the set of IDs

getExtension

public Extension getExtension(java.lang.String extensionId)
Get extension provided by this plug-in

Returns:
extension or null if not found

addExtension

public void addExtension(Extension extension)
Adds new extensions to this plug-in.


getExtensionPoint

public ExtensionPoint getExtensionPoint(java.lang.String extensionPointId)

addExtensionPoint

public void addExtensionPoint(ExtensionPoint extensionPoint)
Adds new extension point to this plug-in.


getFileName

public java.lang.String getFileName()
Obtains the full path to the plug-in descriptor file


setFileName

public void setFileName(java.lang.String fileName)
Set the full path of the plug-in descriptor file


getPlugInId

public java.lang.String getPlugInId()

setPluginId

public void setPluginId(java.lang.String pluginId)
Set the Id of this plug-in


getPlugInOrder

public int getPlugInOrder()
Obtains the order in which the plug-in should be loaded (as specified in the plug-in descriptor)


setPlugInOrder

public void setPlugInOrder(int pluginOrder)
Set the order in which the plug-in should be loaded


getPlugInDependencyOrder

public int getPlugInDependencyOrder()
Get the plug-in order on basis plug-in dependency


setPlugInDependencyOrder

public void setPlugInDependencyOrder(int inDependencyOrder)
Set the plug-in order on basis plug-in dependency


getExtensionPoints

public java.util.List<ExtensionPoint> getExtensionPoints()
Obtains collection of this plug-in extension points


getExtensions

public java.util.List<Extension> getExtensions()
Obtains collection of this plug-in extensions


registerClassLoader

public void registerClassLoader()
Obtains class loader to be used for loading extension classes


getClassLoader

public java.lang.ClassLoader getClassLoader()
Obtain class loader to be used for loading extension classes

Returns:
the class loader

getPlugInFolderName

public java.lang.String getPlugInFolderName()
Get folder relative to webapp base dir where plug-in is installed


getClassPathURLs

public java.net.URL[] getClassPathURLs()
Get array of URLs contributing to the class path for this PlugIn

Returns:
the array of URLs contributing to the class path for this PlugIn

pushContextClassLoader

public java.lang.ClassLoader pushContextClassLoader()
Set thread context class loader to this plug-in's class loader

Returns:
the original thread context class loader

popContextClassLoader

public void popContextClassLoader(java.lang.ClassLoader saveClassLoader)
Restore thread context classloader

Parameters:
saveClassLoader - the original thread context classloader

getPlugInInfo

public PlugInInfo getPlugInInfo()
Obtains PlugInInfo object which should be used for extracting some information i.e. the name of the plug-in

Returns:
PlugInInfo (may be null)

getName

public java.lang.String getName()
Obtain name of plug-in - is retrieved from PlugInInfo - fallback: plug-in id

Returns:
name of plug-in

getExtensions

public java.util.List<Extension> getExtensions(java.lang.String id)
Get list of plug-in info extensions provided by this plug-in


getExtensionsWithExtensionPointId

public java.util.List<Extension> getExtensionsWithExtensionPointId(java.lang.String extensionPointId)
Get list of extensions provided by this plug-in with given extension point id


requires

public boolean requires(PlugIn piToCheckDependencyOn)
Check whether this plugIn depends directly or indirectly on given plugIn

Parameters:
piToCheckDependencyOn - plug-in to check dependency on
Returns:
true or false

checkExtensions

public void checkExtensions()
Check consistency of plug-in dependencies for each extension provided by this plug-in. Removes each inconsistent extension.


disable

public void disable()
Disable this plug-in Implies disabling transitive closure of dependent plug-ins by removing them from PlugInRegistry