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
-
ALWAYS
- The byte array to the tuner on EVERY request.
-
ASK_ME
- This means that when the request for this data is made, the
plugin should handle this request.
-
IF_NEEDED
- Send the byte array to the tuner only of the tuner doesn't
already have the data.
-
PERSISTENT
- Treats this byte array as though it were a file.
-
Plugin()
-
-
_construct(Channel, Server)
- Method that's called when the server plugin is first loaded.
-
addFile(Checksum, File)
-
-
calculateChecksum(byte[])
-
-
calculateChecksum(String)
-
-
debugPrint(String)
- String diagnostic routine to help debug plugins.
-
debugPrint(Throwable)
- Exception diagnostic routine to help debug plugins.
-
debugWrite(byte[])
- Byte array diagnostic routine to help debug plugins.
-
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).
-
finalize()
-
-
getChannelFile(String)
- Returns a File object for the specified path which should be a
path to a file that is part of the channel.
-
getChannelName()
- Returns the channel name of this plugin.
-
getData(Checksum)
-
-
getDataFile(String)
- Generate a File object for a 'path' in this plugin's data directory.
-
getDataLength(Checksum)
-
-
getLogEntries(RequestContext)
- Process logging data
-
getLogStream()
- Returns the log stream, opening it if necessary.
-
init()
- Method that's called when the server plugin is first loaded.
-
openLogFile()
- Returns an output stream which can be used to log client data
to the default log file (logs/log.) for this
plugin.
-
openLogFile(String)
- Returns an output stream which can be used to log client data
for this plugin.
-
processLog(RequestContext)
- Process logging data
-
processRedirect(RequestContext)
-
-
processRequest(RequestContext)
- Processes a subscribe or update request for this plugin.
-
processUnsubscribe(RequestContext)
- Process an unsubscribe request for this plugin.
-
registerDebugClient(DebugClient)
- This routine is used by the plugin debugger channel.
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.
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.
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.
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.
Plugin
public Plugin()
_construct
public final void _construct(Channel channel,
Server server)
- Method that's called when the server plugin is first loaded.
finalize
public void finalize()
- Overrides:
- finalize in class Object
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.
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.
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.
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.
getChannelName
public String getChannelName()
- Returns the channel name of this plugin.
debugPrint
public final void debugPrint(String s)
- String diagnostic routine to help debug plugins.
debugPrint
public final void debugPrint(Throwable t)
- Exception diagnostic routine to help debug plugins.
debugWrite
public final void debugWrite(byte data[])
- Byte array diagnostic routine to help debug plugins.
registerDebugClient
protected void registerDebugClient(DebugClient dbg)
- This routine is used by the plugin debugger channel. Plugin writers
do not use this method.
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.
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.
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
getLogEntries
public Vector getLogEntries(RequestContext context)
- Process logging data
processLog
public void processLog(RequestContext context)
- Process logging data
calculateChecksum
public Checksum calculateChecksum(String path)
calculateChecksum
public Checksum calculateChecksum(byte data[])
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.
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.
processRedirect
public void processRedirect(RequestContext context)
addFile
public void addFile(Checksum cs,
File file)
getDataLength
public int getDataLength(Checksum cs)
getData
public InputStream getData(Checksum cs) throws IOException
All Packages Class Hierarchy This Package Previous Next Index