第5章 ルートシードデータ

5.1. はじめに

UDDI v3 では、各レジストリには root publisher が必要です。root publisher は、UDDI サービスのオーナー (inquirypublication など) です。ノード毎に root publisher は 1 つのみとなっています。
jUDDI Registry には、root アカウント用にデフォルトのシートデータが同梱されています。 juddi_install_data/juddi-core-3.x.jar 配下にあります。
デフォルトでは、jUDDI Registry が rootuddi のパブリッシャーを 2 つインストールします。Root には root パーティションを所有し、uddi はその他の全シードデータを所有します (定義済みの tModels など)。

5.2. シードデータファイル

パブリッシャーごとに、シードデータファイルが 4 つあります。
<publisher>_Publisher.xml
<publisher>_tModelKeyGen.xml
<publisher>_BusinessEntity.xml
<publisher>_tModels.xml
root_Publisher.xml のコンテンツは以下のとおりです。
<publisher xmlns="urn:juddi-apache-org:api_v3" authorizedName="root">
    <publisherName>root publisher</publisherName>
    <isAdmin>true</isAdmin>
</publisher>
パブリッシャーごとに、独自のキー生成スキーマ (key generator schema) を持ち、カスタム生成されたキーと、他のパブリッシャーが生成したキーが同じになることがないようにします。これを実装するには、パブリッシャーごとに、KenGenerator tModel を定義する必要があります。tModel Key Generatorroot_tModelKeyGen.xml ファイルで定義されます。
<tModel tModelKey="uddi:juddi.apache.org:keygenerator" xmlns="urn:uddi-org:api_v3">
    <name>uddi-org:keyGenerator</name>
    <description>Root domain key generator</description>
    <overviewDoc>
        <overviewURL useType="text">
        http://uddi.org/pubs/uddi_v3.htm#keyGen
        </overviewURL>
    </overviewDoc>
    <categoryBag>
        <keyedReference tModelKey="uddi:uddi.org:categorization:types" 
            keyName="uddi-org:types:keyGenerator"
            keyValue="keyGenerator" />
    </categoryBag>
</tModel>
つまり、root publisher で使用されるキーは uddi:juddi.apache.org:<text-of-choice> の形式でなければなりません。別の形式を使用する場合、illegal key エラーが表示されます。
Root publisher は、KeyGenerator を 1 つしか所有できませんが、他のパブリッシャは複数所有することができます。
できる限り、KeyGenerators は共有しないでください。複数の KeyGenerator tModel からパブリッシャーを確認したい場合、 <publisher>_tModels.xml ファイルを使用してください。
最後に <publisher>_BusinessEntity.xml ファイルを使用して、BusinessService データを設定できます。root_BusinessEntity.xml で、サービスを指定します。
<businessEntity xmlns="urn:uddi-org:api_v3" 
    xmlns:xml="http://www.w3.org/XML/1998/namespace" 
    businessKey="uddi:juddi.apache.org:businesses-asf">
    <!-- Change the name field to represent the name of your registry -->
    <name xml:lang="en">An Apache jUDDI Node</name>
        <!-- Change the description field to provided 
        a brief description of your registry -->
        <description xml:lang="en">
            This is a UDDI v3 registry node as implemented by Apache jUDDI.
        </description>
        <discoveryURLs>
        <!-- This discovery URL should point to the home installation URL of jUDDI -->
        <discoveryURL useType="home">
            http://${juddi.server.name}:${juddi.server.port}/juddiv3
        </discoveryURL>
    </discoveryURLs>
    <categoryBag>
        <keyedReference tModelKey="uddi:uddi.org:categorization:nodes" keyValue="node" />
    </categoryBag>

    <businessServices>
    <!-- As mentioned above, you may want to provide user-defined keys for 
    these (and the services/bindingTemplates below.  Services that you
    don't intend to support should be removed entirely -->
        <businessService serviceKey="uddi:juddi.apache.org:services-inquiry" 
            businessKey="uddi:juddi.apache.org:businesses-asf">
            <name xml:lang="en">UDDI Inquiry Service</name>
            <description xml:lang="en">Web Service supporting UDDI Inquiry API</description>
            <bindingTemplates>
                <bindingTemplate bindingKey="uddi:juddi.apache.org:servicebindings-inquiry-ws" 
                    serviceKey="uddi:juddi.apache.org:services-inquiry">
                    <description>UDDI Inquiry API V3</description>
                    <!-- This should be changed to the WSDL URL of the inquiry API.  
                    An access point inside a bindingTemplate will be found for every service
                    in this file.  They all must point to their API's WSDL URL -->
                    <accessPoint useType="wsdlDeployment">
                        http://${juddi.server.name}:${juddi.server.port}/juddiv3/services/inquiry?wsdl
                    </accessPoint>
                    <tModelInstanceDetails>
                        <tModelInstanceInfo tModelKey="uddi:uddi.org:v3_inquiry">
                            <instanceDetails>
                                <instanceParms>
                                <![CDATA[
                                <?xml version="1.0" encoding="utf-8" ?>
                                <UDDIinstanceParmsContainer 
                                    xmlns="urn:uddi-org:policy_v3_instanceParms">
                                    <defaultSortOrder>
                                        uddi:uddi.org:sortorder:binarysort
                                    </defaultSortOrder>
                                </UDDIinstanceParmsContainer>
                                ]]>
                                </instanceParms>
                            </instanceDetails>
                        </tModelInstanceInfo>
                    </tModelInstanceDetails>
                    <categoryBag>
                        <keyedReference keyName="uddi-org:types:wsdl" keyValue="wsdlDeployment" 
                            tModelKey="uddi:uddi.org:categorization:types"/>
                    </categoryBag>
                </bindingTemplate>
            </bindingTemplates>
        </businessService>
        <businessService serviceKey="uddi:juddi.apache.org:services-publish" 
            businessKey="uddi:juddi.apache.org:businesses-asf">
            <name xml:lang="en">UDDI Publish Service</name>
            ...........
        </businessService>
    </businessServices>
</businessEntity>

警告

シードプロセスは、データベースに publishers がない場合のみ開始しますが、juddi.seed.alwaystrue 設定すれば開始されません (ルートデータファイルの例外が全ファイルに再度適用されます)
このプロセスでは、再度シーディングされたエンティティに追加された情報は消去されてしまうため、データがなくなってしまう場合があります。これは、データのマージが行われないためです。

5.3. シードデータのトークン

お気づきの方もいらっしゃるかもしれませんが、root_BusinessEntity.xml ファイル (${juddi.server.baseurl}) にトークンの値を設定するには、juddiv3.properties ファイルの該当セクションを変更します (値の代入は実行時に行われるため、必要であれば別のノードが独自の値を代入可能です)。

5.4. カスタマーシードデータ

jUDDI Registry で提供されているシードデータを使いたくない場合があります。最も簡単にカスタマイズする方法は、juddiv3.war/WEB-INF/classes/ ディレクトリに juddi_custom_install_data を追加することです (こうすることで、juddi-core-3.x.jar アーカイブを変更する必要がなくなります)。
また、root publisher は root と呼ばれず、juddiv3.properties ファイルの juddi.root.publisher プロパティを下記のもの以外に設定する必要があります。
juddi.root.publisher=root
juddiv3.war アーカイブファイルには、サンプルデータのディレクトリが 2 つ含まれています。1 つ目は、Sales Affiliate で、もう 1 つは Marketing Affiliate です。Sales Seed Data を使うには、juddiv3.war/WEB-INF/classes/ のディレクトリの名前を変更します。以下のコマンドを実行してください。
mv RENAME4Sales_juddi_custom_install_data juddi_custom_install_data
初めて jUDDI Registry を開始する前に実行してください。次に、このデータを使用してデータベースを生成します。

注記

プロセスを再実行する場合は、作成したデータベースを削除して、Tomcat を再起動します (juddiv3.properties ファイルのトークンを忘れずに設定してください) mv RENAME4Sales_juddi_custom_install_data juddi_custom_install_data