卒業研究のネタ募集中
まだ来年の話だけど、卒業研究で何をやるか(作るか)は考えておかないと。
誰か面白いネタ持ってないかな?
星野をタダで使うチャンスですよ、と言ってみる。
とりあえず今、案としてあがっている(=作りたいなと思っている)のは、以下の2つ。
Oracleの組み込みSQL関数をPostgreSQLに、
PostgreSQLの組み込みSQL関数をOracleに移植する。
SQL関数の移植より、SQL文の互換性が高くなり、
RDBMSの乗換えや、複数RDBMS対応が容易になる。
- 個人用蔵書管理システム(最近やる気が失せて来た)
非コレクターで、記憶力に自信のない活字中毒者向け(=星野向け)の個人用蔵書管理システム。
コレクターではないので、初版本か否か等の区別は不要。
ISBNコードのレベルで管理できて、
-
- 既に持っているかどうかの確認(=2度買いの防止)
- 何処にあるのかの確認
が出来れば十分。
SCA0.95
Tuscany calculatorサンプル実行
http://incubator.apache.org/tuscany/java-projects.html
に従い、Tuscanyの最新版をインストール。
SCA 0.95 - IT-Walker on hatena
に従い、calculatorサンプルを動かす。
LANにつながらない
ケーブルはHUBにつないであるのに、LANに接続できない。
昨日はちゃんとつながったのに、なぜ接続できない?
トラブルシューティングに時間を食うのもなんなので、
PHS通信カードをさして作業開始。
作業しつつも、パソコンの設定をいじくって何とかLANに接続できないか試してみる。
ThinkPadのAccess Connectionsが悪さしているんだろうか?
昨日インストールした、VMWare Server 1.0.1が悪さしているんだろうか?
その時、隣で作業していた同級生が原因を教えてくれました。
え?HUBがおかしい?
ケーブルを別のHUBにつなぎなおしたら、あっさりLANに接続できました。
Tuscany calculatorサンプル
クライアントプログラムの変更点
Tuscanyを使うクライアントプログラムが、きわめて単純になっている。
Simple is the best.
いいですねー。
普通のJavaプログラムとの違いは、
CalculatorServiceのインスタンス生成が、
CompositeContext#locateServiceに置き換わった位。
M1の頃のクライアントではめんどくさすぎて使う気になりませんでしたが、
これだけ単純になれば、使い物になりますね。
- 旧calculatorクライアント(Tuscany M1)
public class CalculatorClient { public static final void main(String[] args) throws Exception { // Setup Tuscany monitoring to use java.util.logging LogManager.getLogManager().readConfiguration(CalculatorClient.class.getResourceAsStream("/logging.properties")); Properties levels = new Properties(); MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages"); // Create a Tuscany runtime for the sample module component TuscanyRuntime tuscany = new TuscanyRuntime("CalculatorModuleComponent", "http://calculator", monitorFactory); // Start the Tuscany runtime and associate it with this thread tuscany.start(); // Get the SCA module context. ModuleContext moduleContext = CurrentModuleContext.getContext(); // Locate the Calculator service CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("CalculatorServiceComponent"); // Calculate System.out.println("3 + 2="+calculatorService.add(3, 2)); System.out.println("3 - 2="+calculatorService.subtract(3, 2)); System.out.println("3 * 2="+calculatorService.multiply(3, 2)); System.out.println("3 / 2="+calculatorService.divide(3, 2)); System.out.flush(); // Disassociate the runtime from this thread tuscany.stop(); // Shut down the runtime tuscany.shutdown(); } }
- 新calculatorクライアント(2006-8-27時点)
public class CalculatorClient { public static void main(String[] args) throws Exception { CompositeContext context = CurrentCompositeContext.getContext(); CalculatorService calculatorService = context.locateService(CalculatorService.class, "CalculatorServiceComponent"); // Calculate System.out.println("3 + 2=" + calculatorService.add(3, 2)); System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); System.out.println("3 / 2=" + calculatorService.divide(3, 2)); } }
設定ファイルの変更点
module が composite になった。
addService・subtractServiceなど、
referenceの名前が、タグ名 から referenceタグのname属性になった。
タグ名がreference固定になったのは、
XMLエディタなどで、XMLの検証をやりやすくするためかな?
- sca.module(SCA 0.9)
<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" name="calculator"> <component name="CalculatorServiceComponent"> <implementation.java class="calculator.CalculatorServiceImpl"/> <references> <v:addService>AddServiceComponent</v:addService> <v:subtractService>SubtractServiceComponent</v:subtractService> <v:multiplyService>MultiplyServiceComponent</v:multiplyService> <v:divideService>DivideServiceComponent</v:divideService> </references> </component> <component name="AddServiceComponent"> <implementation.java class="calculator.AddServiceImpl"/> </component> ...... </module>
- META-INF/sca/default.scdl(SCA 0.95)
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="CalculatorComposite"> <component name="CalculatorServiceComponent"> <implementation.java class="calculator.CalculatorServiceImpl"/> <references> <reference name="addService">AddServiceComponent</reference> <reference name="subtractService">SubtractServiceComponent</reference> <reference name="multiplyService">MultiplyServiceComponent</reference> <reference name="divideService">DivideServiceComponent</reference> </references> </component> <component name="AddServiceComponent"> <implementation.java class="calculator.AddServiceImpl"/> </component> ...... </composite>
Recursive Modell
SCA0.9の頃は、moduleの中にcomponentが含まれる2階層の構造。
moduleとcomponetでは、同じ概念のものでも別々の名前をつけていた。
SCA0.95では、composite(SCA0.9のmoduleに対応)の中に、
componentとして別のcompositeを含めることも出来る再帰的な構造。
compositeとcomponentで、極力同じ名前をつけるようにしている。
覚える名前が少なくて済むのは、単純で良いですね。
でも、その代わり階層間の役割分担が、あいまいになってしまいそうな気も。