OJI Plugin Requirements
Author: Ed Burns
Note: This is a first draft of this document.
This document covers the following topics:
Document Purpose
Implementation RequirementsSample Implementation Framework
Document Purpose
This document specifies the requirements for a Mozilla OJI plugin. It is assumed (1) you know what OJI is; (2) you want to start writing an OJI plugin.
Implementation Requirements
To write an OJI plugin, you must:
- implement four shared-library functions in your OJI plugin dll as specified below in Shared Library Functions;
- implement all OJI and plugin interfaces as specified below in OJI and Plugin Interfaces.
Shared Library Functions
An OJI plugin is a Mozilla plugin that also implements the required OJI interfaces. Like all Mozilla plugins, the entry points from Mozilla to your plugin must be in a shared library with a filename starting with
np
, as innpoji.dll
. This shared library must be in the plugins directory, which is currentlymozilla/dist/[WIN32*/]bin/plugins
. Your OJI shared library should implement and export the following four functions (which are Mozilla's component auto-registration functions):
extern "C" nsresult NSGetFactory(nsISupports *pProvider, const nsCID &clsid, const char *aClassName, const char *aProgID, nsIFactory **ppFactory); | |
This points to the current nsIServiceManager. | |
const nsCID %clsid
This is | |
const char *aClass
This value ends up being null when Mozilla calls NSGetFactory for your OJI plugin. | |
const char *progID
This value ends up being null when Mozilla calls NSGetFactory for your OJI plugin. | |
nsIFactory **ppFactory
This is where you store the return value, which must be an instance of nsIPlugin. | |
Note: The above function gets called when LiveConnect is started. It is your opportunity to return an instance of nsIPlugin. You may find it convenient to have this instance also implement nsIJVMPlugin.
| |
extern "C" nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path); | |
nsISupports *serviceMgr
This points to the current nsIServiceManager. | |
const char *path
This is the absolute qualified path to the dll being loaded | |
Note: The above function is not called by the Mozilla plugin system.
| |
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path); | |
nsISupports *serviceMgr
This points to the current nsIServiceManager. | |
const char *path
This is the absolute qualified path to the dll being loaded. | |
Note: The above
function is not called by the Mozilla plugin system. If this were an XPCOM
component that was auto-registering, this function would be called to
allow the component to register itself with the serviceManager.
| |
extern "C" PRBool
NSCanUnload(nsISupports* serviceMgr); | |
nsISupports *serviceMgr
This points to the current nsIServiceManager. | |
Note: The above function is not called by the Mozilla plugin system, but if it were, its purpose would be to determine if it were safe to unload the plugin. |
OJI and Plugin Interfaces
This section lists all interfaces that an OJI plugin must implement, and it provides links to the header files via LXR. Listed for each interface are the interfaces to which it must respond when called by QueryInterface or AggregatedQueryInterface (this is in addition to the mandatory nsISupports).
OJI Interfaces |
mozilla\modules\oji\public\nsIJVMConsole.h :
nsIJVMConsole |
mozilla\modules\oji\public\nsIJVMPlugin.h :
nsIJVMPlugin |
mozilla\modules\oji\public\nsIJVMPluginInstance.h :
nsIJVMPluginInstance |
mozilla\modules\oji\public\nsIJVMPrefsWindow.h :
nsIJVMPrefsWindow |
mozilla\modules\oji\public\nsISecureEnv.h :
nsISecureEnv |
Plugin Interfaces |
mozilla\modules\plugin\public\nsIPlugin.h :
nsIPlugin |
mozilla\modules\plugin\public\nsIPluginInstance.h :
nsIPluginInstance |
mozilla\modules\plugin\public\nsIPluginInstancePeer.h :
nsIPluginInstancePeer PENDING (Ed Burns): Unsure why the plugin needs to implement this. |
mozilla\modules\plugin\public\nsIPluginManager.h :
nsIPluginManager PENDING (Ed Burns): Unsure why the plugin needs to implement this. |
mozilla\modules\plugin\public\nsIPluginStreamInfo.h :
nsIPluginStreamInfo |
mozilla\modules\plugin\public\nsIPluginStreamListener.h :
nsIPluginStreamListener |
|
Sample Implementation Framework
This section lists sample class definitions and the appropriate Mozilla inheritences for each class. You must implement these interfaces, in addition to the above-mentioned NS* functions, in order to implement a Java Plugin.
|