org.getopt.luke
Class LukePlugin

java.lang.Object
  extended by org.getopt.luke.LukePlugin
Direct Known Subclasses:
AnalyzerToolPlugin, HadoopPlugin, ScriptingPlugin, SimilarityDesignerPlugin, VocabAnalysisPlugin, ZipfAnalysisPlugin

public abstract class LukePlugin
extends java.lang.Object

LukePlugin is a superclass of any plugin that wants to be loaded automatically, and to work with the current index.

Author:
abial

Field Summary
protected  Luke app
           
protected  org.apache.lucene.store.Directory dir
           
protected  org.apache.lucene.index.IndexReader ir
           
protected  java.lang.Object myUi
           
 
Constructor Summary
LukePlugin()
           
 
Method Summary
 Luke getApplication()
          Get current application context.
 org.apache.lucene.store.Directory getDirectory()
           
 org.apache.lucene.index.IndexReader getIndexReader()
          Returns a reference to the IndexReader currently open in the application.
 java.lang.Object getMyUi()
          Returns this plugin's UI object.
abstract  java.lang.String getPluginHome()
          Return URL to plugin home page or author's e-mail.
abstract  java.lang.String getPluginInfo()
          Return short one-line info about the plugin.
abstract  java.lang.String getPluginName()
          Returns a plugin name.
abstract  java.lang.String getXULName()
          This method should return a fully qualified name/path of the XUL resource used to build the UI for the plugin.
abstract  boolean init()
          Initialize this component.
 void setApplication(Luke app)
          Set application context.
 void setDirectory(org.apache.lucene.store.Directory dir)
           
 void setIndexReader(org.apache.lucene.index.IndexReader ir)
          Set a reference to the IndexReader currently open in the application.
 void setMyUi(java.lang.Object ui)
          Set a reference to this plugin's UI object (a panel).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

app

protected Luke app

myUi

protected java.lang.Object myUi

ir

protected org.apache.lucene.index.IndexReader ir

dir

protected org.apache.lucene.store.Directory dir
Constructor Detail

LukePlugin

public LukePlugin()
Method Detail

setApplication

public void setApplication(Luke app)
Set application context. In addition to providing all Thinlet methods for UI manipulation it provides also all public methods of Luke to the plugin.

Parameters:
app - parent application.

getApplication

public Luke getApplication()
Get current application context.


setMyUi

public void setMyUi(java.lang.Object ui)
Set a reference to this plugin's UI object (a panel).

Parameters:
ui - this plugin's UI object

getMyUi

public java.lang.Object getMyUi()
Returns this plugin's UI object.


setIndexReader

public void setIndexReader(org.apache.lucene.index.IndexReader ir)
Set a reference to the IndexReader currently open in the application.

Parameters:
ir - IndexReader for the current index

getIndexReader

public org.apache.lucene.index.IndexReader getIndexReader()
Returns a reference to the IndexReader currently open in the application.


setDirectory

public void setDirectory(org.apache.lucene.store.Directory dir)

getDirectory

public org.apache.lucene.store.Directory getDirectory()

init

public abstract boolean init()
                      throws java.lang.Exception
Initialize this component. Parent view, this view, directory and index reader should already be initialized.
This method will be called repeatedly, whenever new index is loaded into Luke.

Returns:
true on success, false on non-catastrophic failure
Throws:
java.lang.Exception - when an unrecoverable error occurs

getXULName

public abstract java.lang.String getXULName()
This method should return a fully qualified name/path of the XUL resource used to build the UI for the plugin. The path should follow the rules specified in the ClassLoader documentation fo finding resources.
The top level element for the UI should always be a panel. The size of this panel must NOT be specified, but its "halign", "valign" attributes should be set to "fill", and "weightx", "weighty" attributes set to "1" - then the size of the panel will be determined at runtime and will always fill available space for the plugin UI.

Returns:
full path to the XUL resource (filename or URL)

getPluginName

public abstract java.lang.String getPluginName()
Returns a plugin name. NOTE: this should be a short (preferably one word) String, because it's length affects the amount of available screen space.

Returns:
short plugin name

getPluginInfo

public abstract java.lang.String getPluginInfo()
Return short one-line info about the plugin.


getPluginHome

public abstract java.lang.String getPluginHome()
Return URL to plugin home page or author's e-mail. NOTE: this MUST be a fully qualified URL, i.e. including the protocol part.