JPF 0.10

org.java.plugin
Class Plugin

java.lang.Object
  extended byorg.java.plugin.Plugin
Direct Known Subclasses:
ApplicationPlugin

public abstract class Plugin
extends java.lang.Object

This is base for "home" class of plug-in runtime. Using this class, plug-in code can get access to plug-in framework (manager, registry) which was loaded it. It is also used by manager during plug-in life cycle management (activation and deactivation).
Plug-in vendor may provide it's own implementation of this class if some actions should be performed during plug-in activation/deactivation. When no class specified, framework provides default "empty" implementation that does nothing when plug-in started and stopped.

Version:
$Id: Plugin.java,v 1.4 2005/07/20 18:43:46 ddimon Exp $

Field Summary
protected  org.apache.commons.logging.Log log
          Makes logging service available for descending classes.
 
Constructor Summary
protected Plugin()
          Constructor to be used by plug-in manager for plug-in instantiation.
  Plugin(PluginManager aManager, PluginDescriptor descr)
          Deprecated. Define no-arguments constructor instead of this one if you need to run come code during class instantiation. Not though that it is not recommended to put any code within class constructor, use plug-in "lifecyle" methods doStart() and doStop() for that purposes.
 
Method Summary
protected abstract  void doStart()
          This method will be called once during plug-in activation before any access to any code from this plug-in.
protected abstract  void doStop()
          This method will be called once during plug-in deactivation.
 PluginDescriptor getDescriptor()
           
 PluginManager getManager()
           
 boolean isActive()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Makes logging service available for descending classes.

Constructor Detail

Plugin

protected Plugin()
Constructor to be used by plug-in manager for plug-in instantiation.

See Also:
Class.newInstance()

Plugin

public Plugin(PluginManager aManager,
              PluginDescriptor descr)
Deprecated. Define no-arguments constructor instead of this one if you need to run come code during class instantiation. Not though that it is not recommended to put any code within class constructor, use plug-in "lifecyle" methods doStart() and doStop() for that purposes.

Constructor to be used by plug-in manager for plug-in instantiation. Your plug-ins have to provide constructor with this exact signature to be successfully loaded by manager.

Parameters:
aManager - manager, which controls this plug-in
descr - descriptor of this plug-in
Method Detail

getDescriptor

public final PluginDescriptor getDescriptor()
Returns:
descriptor of this plug-in

getManager

public final PluginManager getManager()
Returns:
manager which controls this plug-in

isActive

public final boolean isActive()
Returns:
true if this plug-in is in active state

doStart

protected abstract void doStart()
                         throws java.lang.Exception
This method will be called once during plug-in activation before any access to any code from this plug-in.

Throws:
java.lang.Exception - if an error has occurred during plug-in start-up

doStop

protected abstract void doStop()
                        throws java.lang.Exception
This method will be called once during plug-in deactivation. After this method call, no other code from this plug-in can be accessed, unless doStart() method will be called again (but for another instance of this class).

Throws:
java.lang.Exception - if an error has occurred during plug-in shutdown

toString

public java.lang.String toString()
See Also:
Object.toString()

JPF 0.10

Copyright © 2004-2005 Dmitry Olshansky. All Rights Reserved.