org.ceryle.plugin
Class PluginBase

java.lang.Object
  extended by org.ceryle.plugin.PluginBase
All Implemented Interfaces:
Disposable, Plugin

public class PluginBase
extends Object
implements Plugin

This is the base class for all Ceryle plugins. This implements the Plugin interface.

The basic Ceryle application services are provided via one single object, Services. The getServices() method thus provides most of the necessary functionality, with several convenience methods for messaging.

Since:
JDK1.4
Version:
$Id: PluginBase.java,v 3.5 2007-06-20 01:28:13 altheim Exp $
Author:
Murray Altheim
See Also:
Desktop, MessageHandler, PropertyManager, Services

Field Summary
protected static Plugin m_plugin
          The singleton instance of this plugin.
 
Constructor Summary
protected PluginBase(Desktop desktop, String path)
          Constructor for a base Ceryle plugin.
 
Method Summary
 boolean closing()
          Warns of the imminent closing of the plugin, allowing it to finish up any remaining tasks prior to disposal.
 void dispose()
          Disposes of the plugin.
 void error(String id)
          Display an error message id.
static Plugin getInstance(Desktop desktop, String path)
          Initializes the plugin and its services.
 String getName()
          Returns this plugin's name/identifier (i.e., its path).
 Services getServices()
          Returns the singleton instance of Services.
 ViewManager getViewManager()
          Returns the Ceryle ViewManager.
 void init()
          Initializes this plugin's services and features.
 void loadClass(String path)
          Loads a Java class whose path identifier is the String path.
 void log(String message)
          Write the String message to the log file, if open.
 void message(String id)
          Display an informational message id.
 void warning(String id)
          Display a warning message id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_plugin

protected static Plugin m_plugin
The singleton instance of this plugin.

Constructor Detail

PluginBase

protected PluginBase(Desktop desktop,
                     String path)
              throws PluginException
Constructor for a base Ceryle plugin. All extensions to this constructor should call super() to initialize the plugin's basic services.

Throws:
PluginException
Method Detail

getInstance

public static Plugin getInstance(Desktop desktop,
                                 String path)
                          throws PluginException
Initializes the plugin and its services. Extensions of this method should call super() to be sure to initialize the basic services.

Throws:
PluginException

getName

public String getName()
Returns this plugin's name/identifier (i.e., its path).


init

public void init()
          throws PluginException
Initializes this plugin's services and features.

Throws:
PluginException

loadClass

public void loadClass(String path)
               throws PluginException
Loads a Java class whose path identifier is the String path.

Specified by:
loadClass in interface Plugin
Throws:
PluginException

getServices

public Services getServices()
Returns the singleton instance of Services.


getViewManager

public ViewManager getViewManager()
Returns the Ceryle ViewManager.

See Also:
ViewManager

log

public void log(String message)
Write the String message to the log file, if open.


message

public void message(String id)
Display an informational message id. If this message is part of the resource bundle, it will be localized, otherwise the String is treated as the message text.


warning

public void warning(String id)
Display a warning message id. If this message is part of the resource bundle, it will be localized, otherwise the String is treated as the message text.


error

public void error(String id)
Display an error message id. If this message is part of the resource bundle, it will be localized, otherwise the String is treated as the message text.


closing

public boolean closing()
Warns of the imminent closing of the plugin, allowing it to finish up any remaining tasks prior to disposal.

Specified by:
closing in interface Disposable
Returns:
true if the plugin closed without a problem

dispose

public void dispose()
Disposes of the plugin.

Specified by:
dispose in interface Disposable


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.