com.sun.n1.sps.plugin.export パッケージには、コンポーネントの定義と作成機能を指定するための 7 つのインタフェースと 1 つの例外クラスが含まれます。
ComponentExporter – 一覧プロセスからコンポーネントを作成するには、すべてのプラグインでこの基本インタフェースを実装する必要があります。
ComponentMonitor – システムによって作成され、特定のコンポーネントのコンポーネント作成プロセスを管理するモニターです。
ComponentToken – 包含コンポーネントを CompositeComponentMonitor に追加するためにコンポーネントを表すトークンです。
CompositeComponentMonitor – ほかのコンポーネントを含むコンポーネントのモニターです。
ResourceProcessor – リソースのイントロスペクションを可能にします。
SimpleComponentMonitor – リソースを含むコンポーネントのモニターです。
SystemData – 現在のエクスポートと一覧の処理に関連するさまざまな持続システムオブジェクトによって定義される変数へのアクセスを提供します。
ComponentExportException – コンポーネントのエクスポートに関連するエラーに使用する強く型付けされた例外です。
エクスポート機能を有効にするには、次のような手順に従います。
コンポーネントタイプのバッキングコンポーネントで、exporterClass 変数で componentExporter の完全指定のクラス名を宣言します。
<varList> <var name="exporterClassName" default="com.sun.n1.sps.pluginimpl.sample.export.StaticCompExporter"/> </varList>
ComponentExporter インタフェースを実装するクラスを定義します。
ComponentExporter で ComponentMonitor 入力引数に対してさまざまなメソッドを呼び出し、コンポーネントを構築します。addComponentVar 、addSourceInfoParam、setComponentDescription、setComponentLabel などのメソッドを使用できます。
ComponentExporter では get ルーチンを呼び出して ComponentMonitor から情報を取得することもできます。get ルーチンには、getPluginComponentVars、getPluginHostVars、getActiveBrowser、getSourceInfoParam、getLocation などがあります。
ComponentExporter では exportResource を呼び出して、制御ブロック内で、コンポーネントをエクスポートするコンポーネントタイプに固有の機能を実行することもできます。
コンポーネントの作成後、ComponentExporter では setResource を呼び出して、コンポーネントに含める物理リソースを設定し、エクスポートプロセスを完了できます。
public class implements ComponentExporter { public ExampleExporter() { } public BrowserContext getBrowserContext() { return new BrowserContext(); } public BrowserInfo[] getAvailableBrowsers() { return new BrowserInfo[] { new BrowserInfo("example", //relevant comp type "Example Browser", //browser ui display name "example ss", //relevant ss null, //valid for all platforms null, //no host set restriction new PromptParamList()) //no checkin params }; } public String getBrowserClassPath(BrowserInfo browser) { return null; } public void constructComponent(ComponentMonitor mon) throws ComponentExportException { //It's the responsibility of the infrastructure to identify the type //of component and construct the component with the appropriate monitor SimpleComponentMonitor sMon = (SimpleComponentMonitor)mon; sMon.setComponentDescription("This is an example component"); sMon.setComponentLabel("What the hell is a label for?"); sMon.setResource(ResourceType.FILE, //our sample type is a file sMon.getLocation(), //get the location specified false, //do not use differential checkin false, //not a config template false, //file->symlinks meaningless true, //capture permissions null, //file->checkinmode meaningless null); //no special processing of rsrc } }