OJI Pluginの必要条件
著者: Ed Burns
注釈: これはこのドキュメントの最初のドラフトです。
このドキュメントは次のトピックをカバーします:
ドキュメントの目的
このドキュメントは、Mozilla OJI pluginのための必要条件を指定します。 このように仮定しましょう (1)あなたは OJIがいかなるものか知っている; (2)あなたは OJI Pluginを書き始めたい。
実装に必要な条件
OJI pluginを書くためにはあなたは以下のことをしなければなりません:
- あなたは共有ライブラリー関数(Shared Library Functions)の中で、以下に指定されるような OJI plugin dllの4つの共有ライブラリー関数を実装します;
- OJI と Plugin Interfacesで指定されるような OJI と Plugin Interfacesをすべて実装します。
共有ライブラリ関数
OJI pluginは必要な OJIインターフェースをさらに実装する Mozilla pluginです。すべての Mozilla plugins のように、Mozillaからあなたの pluginまでのエントリー・ポイントは
npoji.dllのようにnpで始まるファイル名をが付けられた共有ライブラリでなくてはなりません。 この共有ライブラリは、現在 mozilla/dist/[WIN32*/]bin/plugins という pluginsディレクトリの中になくてはなりません。 あなたの OJI 共有ライブラリは下記機能(それらは実際にmozillaのコンポーネントの auto registration functionsである)を実装し export するべきです:
extern "C" nsresult NSGetFactory(nsISupports *pProvider,
const nsCID &clsid,
const char *aClassName,
const char *aProgID,
nsIFactory **ppFactory); | |
|
これは現在の nsIServiceManagerを指します。 | |
const nsCID %clsid
これは | |
const char *aClass
mozillaがあなたの OJI pluginのための NSGetFactoryを呼ぶ場合、この値は null です。 | |
const char *progID
mozillaがあなたの OJI pluginのための NSGetFactoryを呼ぶ場合、この値は null です。 | |
nsIFactory **ppFactory
あなたが返り値(nsIPluginのインスタンス)を格納するところです。 | |
|
注釈: この関数は LiveConnect が始められる時、呼び出されます。 それはあなたが nsIPluginのインスタンスを返す時です。あなたはこの nsIJVMPlugin の実装のインスタンスを持つことを便利に感じるかもしれません。 | |
extern "C" nsresult NSRegisterSelf(nsISupports* serviceMgr,
const char *path); | |
nsISupports *serviceMgr
これは現在の nsIServiceManager を示します。 | |
const char *path
ロードされている dll への絶対パス | |
|
注釈:この関数は mozilla plugin システムによって呼び出されません。
| |
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr,
const char *path); | |
nsISupports *serviceMgr
これは現在の nsIServiceManager を示します。 | |
const char *path
ロードされている dll への絶対パス | |
| 注釈:
上記の関数は mozilla pluginシステムによって呼ばれません。 もしこれが autoregisteringしていた XPCOMコンポーネントならば、この関数はコンポーネントが serviceManagerでそれ自体を登録することを可能にするために呼ばれるでしょう。 (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
これは現在の nsIServiceManager を示します。 | |
| 注釈:この関数は mozilla pluginシステムによって呼ばれません。しかし、そうだった場合、pluginを unloadすることが安全かどうか決めることが目的です。 (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:
nsIPluginInstancePeerPENDING (Ed Burns): Unsure why the plugin needs to implement this. |
mozilla\modules\plugin\public\nsIPluginManager.h:
nsIPluginManagerPENDING (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.
|