Class marimba.plugin.Plugin
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class marimba.plugin.Plugin

java.lang.Object
   |
   +----marimba.plugin.Plugin

public class Plugin
extends Object
This class defines and implements the server Plugin API. Plugins are responsible for producing Indexes for requests and for processing client logging data. The default plugin produces an index from the official, static transmitter index, but other plugin's can produce their own Indexes.
Version:
1.40, 01/07/97
Author:
Jonathan Payne

Variable Index

 o ALWAYS
The byte array to the tuner on EVERY request.
 o ASK_ME
This means that when the request for this data is made, the plugin should handle this request.
 o IF_NEEDED
Send the byte array to the tuner only of the tuner doesn't already have the data.
 o PERSISTENT
Treats this byte array as though it were a file.

Constructor Index

 o Plugin()

Method Index

 o _construct(Channel, Server)
Method that's called when the server plugin is first loaded.
 o addFile(Checksum, File)
 o calculateChecksum(byte[])
 o calculateChecksum(String)
 o debugPrint(String)
String diagnostic routine to help debug plugins.
 o debugPrint(Throwable)
Exception diagnostic routine to help debug plugins.
 o debugWrite(byte[])
Byte array diagnostic routine to help debug plugins.
 o destroy()
This is called when a plugin is being unloaded, which is usually because a hot update on this channel occurred, but also when the server is brought down (nicely).
 o finalize()
 o getChannelFile(String)
Returns a File object for the specified path which should be a path to a file that is part of the channel.
 o getChannelName()
Returns the channel name of this plugin.
 o getData(Checksum)
 o getDataFile(String)
Generate a File object for a 'path' in this plugin's data directory.
 o getDataLength(Checksum)
 o getLogEntries(RequestContext)
Process logging data
 o getLogStream()
Returns the log stream, opening it if necessary.
 o init()
Method that's called when the server plugin is first loaded.
 o openLogFile()
Returns an output stream which can be used to log client data to the default log file (logs/log.) for this plugin.
 o openLogFile(String)
Returns an output stream which can be used to log client data for this plugin.
 o processLog(RequestContext)
Process logging data
 o processRedirect(RequestContext)
 o processRequest(RequestContext)
Processes a subscribe or update request for this plugin.
 o processUnsubscribe(RequestContext)
Process an unsubscribe request for this plugin.
 o registerDebugClient(DebugClient)
This routine is used by the plugin debugger channel.

Variables

 o IF_NEEDED
  public final static int IF_NEEDED
Send the byte array to the tuner only of the tuner doesn't already have the data. The data is sent as immediate data, which means it will not be cached by a marimba PROXY. This data will be part of the channel's index, and will have an effect on optimized update requests.
 o ALWAYS
  public final static int ALWAYS
The byte array to the tuner on EVERY request. The data is sent as immediate data, which means it will not be cached by a Marimba proxy. This file is not part of the channel's index, and will not have any effect on optimized updates.
 o PERSISTENT
  public final static int PERSISTENT
Treats this byte array as though it were a file. It makes this byte array persistent (for a limited amount of time - at least 5 minutes) so that the request for this data can be satisfied in a subsequent request by a tuner (or proxy) without plugin intervention.
 o ASK_ME
  public final static int ASK_ME
This means that when the request for this data is made, the plugin should handle this request. The plugin getData and getDataLength() methods need to be overridden in order to satisfy the request. This would be used to get the data for a request from a database, perhaps.

Constructors

 o Plugin
  public Plugin()

Methods

 o _construct
  public final void _construct(Channel channel,
                               Server server)
Method that's called when the server plugin is first loaded.
 o finalize
  public void finalize()
Overrides:
finalize in class Object
 o init
  public void init()
Method that's called when the server plugin is first loaded. This is for the plugin to do its own initialization.
 o getDataFile
  public File getDataFile(String path)
Generate a File object for a 'path' in this plugin's data directory. Each plugin can have a unique data directory in which it may safely create files for its own usage. This method automatically prepends the plugin's data directory to 'path' and creates a File for the resulting path.
 o getChannelFile
  public File getChannelFile(String path)
Returns a File object for the specified path which should be a path to a file that is part of the channel. This returns null if there is no such file by that name in the channel. This file should be considered read-only. Modifying it or deleting it will render the channel incapable of transmission to tuners.
 o destroy
  public void destroy()
This is called when a plugin is being unloaded, which is usually because a hot update on this channel occurred, but also when the server is brought down (nicely). If it's just killed, then this will not be called.
 o getChannelName
  public String getChannelName()
Returns the channel name of this plugin.
 o debugPrint
  public final void debugPrint(String s)
String diagnostic routine to help debug plugins.
 o debugPrint
  public final void debugPrint(Throwable t)
Exception diagnostic routine to help debug plugins.
 o debugWrite
  public final void debugWrite(byte data[])
Byte array diagnostic routine to help debug plugins.
 o registerDebugClient
  protected void registerDebugClient(DebugClient dbg)
This routine is used by the plugin debugger channel. Plugin writers do not use this method.
 o openLogFile
  protected OutputStream openLogFile(String name)
Returns an output stream which can be used to log client data for this plugin. If the file already exists, it is opened for appending. The stream should be closed by the destroy() method if it is left open between requests.
 o openLogFile
  protected OutputStream openLogFile()
Returns an output stream which can be used to log client data to the default log file (logs/log.) for this plugin. If the file already exists, it is opened for appending. The stream should be closed by the destroy() method if it is left open between requests.
 o getLogStream
  protected FastOutputStream getLogStream()
Returns the log stream, opening it if necessary. The log stream is opened with openLogFile() which uses the channel name as the name for the log file. It's possible to explicitely open the log stream with openLogFile(String name) to use your own name.
Returns:
s null if can't open the stream
 o getLogEntries
  public Vector getLogEntries(RequestContext context)
Process logging data
 o processLog
  public void processLog(RequestContext context)
Process logging data
 o calculateChecksum
  public Checksum calculateChecksum(String path)
 o calculateChecksum
  public Checksum calculateChecksum(byte data[])
 o processRequest
  public void processRequest(RequestContext context) throws IOException
Processes a subscribe or update request for this plugin. This is where logging data is processed and the personalization of the index occurs. If this returns without an exception it is assumed that the logging data, if any, was processed successfully. An IOException can be thrown if there's a problem processing the logging data.
 o processUnsubscribe
  public void processUnsubscribe(RequestContext context) throws IOException
Process an unsubscribe request for this plugin. This is different from an update request because there is no profiling data, and there is no persronalization to be performed because no data will be going back to the tuner that made the request. This is called when a tuner indicates it is no longer subscribed to a channel. Logging data exists and you will be able process that as usual.
 o processRedirect
  public void processRedirect(RequestContext context)
 o addFile
  public void addFile(Checksum cs,
                      File file)
 o getDataLength
  public int getDataLength(Checksum cs)
 o getData
  public InputStream getData(Checksum cs) throws IOException

All Packages  Class Hierarchy  This Package  Previous  Next  Index