- 追加された行はこの色です。
- 削除された行はこの色です。
// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
#contents
**オンラインアップデート [#w606b6f8]
Eclipseはサーバに置いたプラグインをダウンロードし、アップデートことができますが、ダウンロードできるプラグインはサーバにあるsite.xmlの内容で制御されています。たとえば、こんな感じです。
-site.xmlのサンプル
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/nu.mine.kino.plugin.google_1.0.6.jar"
id="nu.mine.kino.plugin.google" version="1.0.6">
<category name="google"/>
</feature>
<feature url="features/nu.mine.kino.plugin.google_1.0.7.jar"
id="nu.mine.kino.plugin.google" version="1.0.7">
<category name="google"/>
</feature>
<feature url="features/nu.mine.kino.plugin.google_1.0.9.jar"
id="nu.mine.kino.plugin.google" version="1.0.9">
<category name="google"/>
</feature>
<category-def name="google" label="Google Plugin"/>
</site>
**ダウンロードできるプラグインの制御 [#fcf4b9f3]
さて、RCPで普通のアプリを作る場合、あるユーザはhogehogeプラグインのみ使用可能、で特定のユーザはさらにfugaプラグインも使用可能にする、なんてことをやりたくなりますね。しかしsite.xmlは通常静的なファイルであること、さらにこれをServletなどで動的に生成し、パラメータによって返すsite.xmlを変えるなんてことをやったとしても、アップデートサイトへのリクエスト(HTTP)にパラメタを載せる方法がわかりませんでした。
まあサーバ側はIPアドレスとかで判断することもできなくないですが、あんまりエレガントではないですね。
**そこでこんな感じ [#pcb1af9d]
BusyIndicator.showWhile(window.getShell().getDisplay(), new Runnable() {
public void run() {
logger.debug("run() - start");
// UpdateManagerUI.openInstaller(window.getShell());
UpdateJob job = new UpdateJob("Search for new extensions.",
getSearchRequest());
UpdateManagerUI.openInstaller(window.getShell(), job);
logger.debug("run() - end");
}
});
private UpdateSearchRequest getSearchRequest() {
URL url = null;
try {
url = new URL("http://hogehoge.com/site.xml");// <-site.xmlのURL
} catch (MalformedURLException e) {
e.printStackTrace();
}
UpdateSearchRequest result = new UpdateSearchRequest(
UpdateSearchRequest.createDefaultSiteSearchCategory(),
new UpdateSearchScope());
result.addFilter(new BackLevelFilter());
result.addFilter(new EnvironmentFilter());
UpdateSearchScope scope = new UpdateSearchScope();
scope.addSearchSite("HogeApp Site", url, null);
// scope.addSearchSite("aaa", url, null); 複数追加すると複数サーチする
result.setScope(scope);
return result;
}
----
この記事は
#vote(おもしろかった,そうでもない)
-あいかわらず、じかんねー -- [[きの]] &new{2006-08-24 01:32:11 (木)};
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}