Sun N1 Service Provisioning System 5.2 プラグイン開発ガイド

エクスポート機能

com.sun.n1.sps.plugin.export パッケージには、コンポーネントの定義と作成機能を指定するための 7 つのインタフェースと 1 つの例外クラスが含まれます。

ComponentExporter プロセス

エクスポート機能を有効にするには、次のような手順に従います。

  1. コンポーネントタイプのバッキングコンポーネントで、exporterClass 変数で componentExporter の完全指定のクラス名を宣言します。

    <varList>
      <var name="exporterClassName" 
        default="com.sun.n1.sps.pluginimpl.sample.export.StaticCompExporter"/>
    </varList>
  2. ComponentExporter インタフェースを実装するクラスを定義します。

    ComponentExporterComponentMonitor 入力引数に対してさまざまなメソッドを呼び出し、コンポーネントを構築します。addComponentVar addSourceInfoParamsetComponentDescriptionsetComponentLabel などのメソッドを使用できます。

    ComponentExporter では get ルーチンを呼び出して ComponentMonitor から情報を取得することもできます。get ルーチンには、getPluginComponentVarsgetPluginHostVarsgetActiveBrowsergetSourceInfoParamgetLocation などがあります。

    ComponentExporter では exportResource を呼び出して、制御ブロック内で、コンポーネントをエクスポートするコンポーネントタイプに固有の機能を実行することもできます。

  3. コンポーネントの作成後、ComponentExporter では setResource を呼び出して、コンポーネントに含める物理リソースを設定し、エクスポートプロセスを完了できます。

ComponentExporter の例


例 4–2 ComponentExporter

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
    }    
}