前の関連記事:LibreOffice(65)Writing UNO componentsのThumbs Exampleその1
idlファイルをコンパイルしてurdファイルができたのであとはregmergeでこれらurdファイルをまとめてrdbファイルにして、今度はそのrdbファイルを元にして各idlタイプをclassファイルに出力します。
regmergeでurdファイルをrdbファイルにまとめる
続きの13行目からみていきます。
rm -f /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb mkdir -p /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample "/opt/libreoffice4.3/ure-link/bin/regmerge" /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb /UCR /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/XImageShrink.urd /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/XImageShrinkFilter.urd /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.urdまず既存の/home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdbがあればそれを削除しています。
"/opt/libreoffice4.3/ure-link/bin/regmerge" /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb /UCR /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/XImageShrink.urd /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/XImageShrinkFilter.urd /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.urd15行目を見やすいようにコマンドの途中で改行をいれました。
/opt/libreoffice4.3/ure-link/bin/regmerge で3つのurdファイルを1つのrdbファイルにまとめています。
regmerge <rdbファイル名> /UCR <urdファイル名_1> ... <urdファイル名_n>
/UCRはmergeKeyNameというのですが、UNO core reflectionという意味だそうです。(Generating Source Code from UNOIDL Definitions)
これでImageShrink.uno.rdbという名前のrdbファイルができました。
javamakerで各idlに対するclassファイルを生成する
mkdir -p /home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample/org/openoffice/test "/opt/libreoffice4.3/sdk/bin/javamaker" -nD -Torg.openoffice.test.XImageShrink -Torg.openoffice.test.XImageShrinkFilter -Torg.openoffice.test.ImageShrink -O/home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb -X"/opt/libreoffice4.3/ure-link/share/misc/types.rdb" -X"/opt/libreoffice4.3/sdk/../program/types/offapi.rdb" mkdir -p /home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample/org/openoffice/test "/opt/libreoffice4.3/sdk/bin/javamaker" -nD -Torg.openoffice.test.XImageShrink -Torg.openoffice.test.XImageShrinkFilter -Torg.openoffice.test.ImageShrink -O/home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb -X"/opt/libreoffice4.3/ure-link/share/misc/types.rdb" -X"/opt/libreoffice4.3/sdk/../program/types/offapi.rdb" mkdir -p /home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample/org/openoffice/test "/opt/libreoffice4.3/sdk/bin/javamaker" -nD -Torg.openoffice.test.XImageShrink -Torg.openoffice.test.XImageShrinkFilter -Torg.openoffice.test.ImageShrink -O/home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb -X"/opt/libreoffice4.3/ure-link/share/misc/types.rdb" -X"/opt/libreoffice4.3/sdk/../program/types/offapi.rdb" make[1]: ディレクトリ `/opt/libreoffice4.3/sdk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test' から出ます17、19、21行目で/opt/libreoffice4.3/sdk/bin/javamakerが実行されていますが全く同じ引数、同じオプションのコマンドが3回も実行されています。
どういうことでしょう?
たくさんオプションがあるので各オプションと引数を改行してみます。
"/opt/libreoffice4.3/sdk/bin/javamaker" -nD -Torg.openoffice.test.XImageShrink -Torg.openoffice.test.XImageShrinkFilter -Torg.openoffice.test.ImageShrink -O/home/pq/libreoffice4.3_sdk/LINUXexample.out/class/ComponentThumbsExample /home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb -X"/opt/libreoffice4.3/ure-link/share/misc/types.rdb" -X"/opt/libreoffice4.3/sdk/../program/types/offapi.rdb"javamakerだけでなくGenerating Source Code from UNOIDL Definitionsの実行例のコメントにもオプションの解説があります。
-nDは、、、依存関係のidlタイプのclassファイルを生成しないオプション、だと思います。
-Tはclassファイルを生成するidlタイプを指定するオプションです。
そのidlタイプの依存関係にあるidlタイプのすべてのclassファイルが出力されるようです。
-Tオプションを指定しない場合はすべてのidlタイプのclassファイルが出力されるようです。
ワイルドカード(*)でも指定可能です。
うーん、-nDオプションを指定しない場合は-Tオプションを指定しなくてもImageShrink.uno.rdbにあるidlタイプはすべてclassファイルが出力されるのだろうか?
それとも-nDオプションを指定しない場合は依存関係にあるcom.sun.star.document.XFilterのclassファイルも出力されてしまうのだろうか。
とするとワイルドカードを使って-Torg.openoffice.test.*とすればよいのだろうか。
そのうちゆとりができたら確認してみます。
-Oはclassファイルを入れる基点となるフォルダの指定です。
└── org
    └── openoffice
        └── test
            ├── ImageShrink.class
            ├── XImageShrink.class
            └── XImageShrinkFilter.class
treeコマンドで確認すると-Oオプションで指定したフォルダ内にこんな感じに出力されていました。
-Xは考慮しなくてよいidlタイプだそうです。
-Xは考慮しなくてよいidlタイプだそうです。
Makefileの変数名から推測するに、types.rdbはURE(UNO Runtime Environment)のIDL、offapi.rdbはLibreOfficeのIDL、を示しそれらを除外するということのようです。
しかしこれらのファイルは次に説明するregviewで中を見ようと思ってもopen registry failedとでてきて見れませんでした。
全く同じjavamakerコマンドを3回も実行しているのはMakefileを覗いてみると3つ出力されるclassファイルが3つともターゲットになってしまっているからとわかりました。
regviewでrdbファイルの中身をみる
javamakerのオプション指定の理解の足しになるかと思ってImageShrink.uno.rdbの中を見てみました。
"/opt/libreoffice4.3/ure-link/bin/regview"がrdbファイルをみるツールになります。
pq@linuxBean:~/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample$ "/opt/libreoffice4.3/ure-link/bin/regview" ImageShrink.uno.rdb
Registry "file:///home/pq/libreoffice4.3_sdk/LINUXexample.out/misc/ComponentThumbsExample/ImageShrink.uno.rdb":
/
 / UCR
   / org
     / openoffice
       / test
         / XImageShrinkFilter
           Value: Type = RG_VALUETYPE_BINARY
                  Size = 160
                  Data = version: 1
                         documentation: ""
                         file name: ""
                         type class: interface
                         type name: "org/openoffice/test/XImageShrinkFilter"
                         super type count: 2
                         super type name 0: "org/openoffice/test/XImageShrink"
                         super type name 1: "com/sun/star/document/XFilter"
                         field count: 0
                         method count: 0
                         reference count: 0
         / XImageShrink
           Value: Type = RG_VALUETYPE_BINARY
                  Size = 268
                  Data = version: 0
                         documentation: ""
                         file name: ""
                         type class: interface
                         type name: "org/openoffice/test/XImageShrink"
                         super type count: 1
                         super type name 0: "com/sun/star/uno/XInterface"
                         field count: 3
                         field 0:
                             documentation: ""
                             file name: ""
                             flags: readwrite
                             name: "SourceDirectory"
                             type name: "string"
                             value: none
                         field 1:
                             documentation: ""
                             file name: ""
                             flags: readwrite
                             name: "DestinationDirectory"
                             type name: "string"
                             value: none
                         field 2:
                             documentation: ""
                             file name: ""
                             flags: readwrite
                             name: "Dimension"
                             type name: "com/sun/star/awt/Size"
                             value: none
                         method count: 0
                         reference count: 0
         / ImageShrink
           Value: Type = RG_VALUETYPE_BINARY
                  Size = 150
                  Data = version: 1
                         documentation: ""
                         file name: ""
                         type class: service
                         type name: "org/openoffice/test/ImageShrink"
                         super type count: 1
                         super type name 0: "org/openoffice/test/XImageShrinkFilter"
                         field count: 0
                         method count: 1
                         method 0:
                             documentation: ""
                             flags: synchronous
                             name: ""
                             return type name: "void"
                             parameter count: 0
                             exception count: 0
                         reference count: 0
         Value: Type = RG_VALUETYPE_BINARY
                Size = 62
                Data = version: 0
                       documentation: ""
                       file name: ""
                       type class: module
                       type name: "org/openoffice/test"
                       super type count: 0
                       field count: 0
                       method count: 0
                       reference count: 0
       Value: Type = RG_VALUETYPE_BINARY
              Size = 57
              Data = version: 0
                     documentation: ""
                     file name: ""
                     type class: module
                     type name: "org/openoffice"
                     super type count: 0
                     field count: 0
                     method count: 0
                     reference count: 0
     Value: Type = RG_VALUETYPE_BINARY
            Size = 46
            Data = version: 0
                   documentation: ""
                   file name: ""
                   type class: module
                   type name: "org"
                   super type count: 0
                   field count: 0
                   method count: 0
                   reference count: 0
参考にしたサイト
Writing UNO Components - Apache OpenOffice Wiki
デベロッパーズガイドの第3章。
Linuxコマンド集 - 【 rm 】 ファイルやディレクトリを削除する:ITpro
rm -fで削除対象がなくても警告がでないようにできます。
 

0 件のコメント:
コメントを投稿