public interface PersistenceService
PersistenceService
は、信頼されていない実行環境で実行されているアプリケーションに対しても、クライアント・システム上にローカルにデータを格納するためのメソッドを提供します。このサービスは、クッキー・メカニズムがHTMLベースのアプリケーションに提供するサービスに若干似ています。
持続的データ・ストアの各エントリには、URLを使って名前が付けられます。これにより、従来のファイル・システムと同様の階層構造が提供されます。
アプリケーションは、コード・ベースに基づくURLを使う場合だけ、格納されたデータにアクセスが許可されます。たとえば、http://www.mysite.com/apps/App1/
コード・ベースが与えられた場合、アプリケーションは次に示す関連付けられたURLでデータにアクセスすることが許可されます。
http://www.mysite.com/apps/App1/
http://www.mysite.com/apps/
http://www.mysite.com/
このスキームは、同じホストから異なるアプリケーション間でデータを共有できるようにします。たとえば、別のアプリケーションがhttp://www.mysite.com/apps/App2/
にある場合、これらのアプリケーションはhttp://www.mysite.com/
ディレクトリとhttp://www.mysite.com/apps/
ディレクトリでデータを共有できます。
JNLPクライアントは、特定のアプリケーションが使用する記憶領域の容量を追跡する必要があります。PersistenceService
実装は、現在の記憶領域の使用率と限界を取得し、さらに記憶領域を要求するメソッドを提供します。記憶領域は、ファイル単位に割り当てられますが、JNLPクライアントは一般にアプリケーションで使用される合計記憶領域に基づいて付与または要求を拒否するようになります。
このメカニズムを使って格納されたデータは、リモート・サーバーに格納されたデータのローカル・コピーであることを目的としています。各エントリには、サーバーが最新のコピーを持っていることを意味するcached、サーバーが最新のコピーを持たないことを意味するdirty、ファイルを常に再作成できることを意味するtemporaryというタグを付けることができます。
修飾子と型 | メソッドと説明 |
---|---|
long |
create(java.net.URL url, long maxsize)
指定されたURLを使って名前が付けられたクライアント・サイドの新しい持続的記憶領域エントリを作成します。
|
void |
delete(java.net.URL url)
クライアントのデータの持続的データ・ストアから、指定されたURLに関連付けられたストリームを削除します。
|
FileContents |
get(java.net.URL url)
このファイルの内容を表す
FileContents オブジェクトを返します。 |
java.lang.String[] |
getNames(java.net.URL url)
指定されたURLのすべてのエントリの名前を含むStringsの配列を返します。
|
int |
getTag(java.net.URL url)
指定されたURLに関連付けられた持続的データ・ストア・エントリのタグの現在の値に対応する
int を返します。 |
void |
setTag(java.net.URL url, int tag)
指定されたURLに関連付けられた持続的データ・ストアに、指定されたタグ値を使ってタグを付けます。
|
static final int CACHED
static final int TEMPORARY
static final int DIRTY
long create(java.net.URL url, long maxsize) throws java.net.MalformedURLException, java.io.IOException
url
- 持続的データ・ストアのエントリの名前を表すURL。maxsize
- このエントリに書き込むことができる記憶領域の最大サイズ。java.net.MalformedURLException
- アプリケーションが指定されたURLにより表された持続的データ・ストアへのアクセスを拒否された場合、またはURLがnullの場合。java.io.IOException
- I/O例外が発生した場合、またはエントリがすでに存在する場合。FileContents get(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException, java.io.FileNotFoundException
FileContents
オブジェクトを返します。url
- 持続的データ・ストアのエントリを表すURL。java.io.IOException
- 入出力エラーが発生した場合。java.net.MalformedURLException
- アプリケーションが指定されたURLにより表された持続的データ・ストアへのアクセスを拒否された場合、またはURLがnullの場合。java.io.FileNotFoundException
- 指定されたURLの持続的データ・ストアが見つからない場合。void delete(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException
url
- 持続的データ・ストアから削除するエントリを表すURL。java.net.MalformedURLException
- アプリケーションが指定されたURLにより表された持続的データ・ストアへのアクセスを拒否された場合、またはURLがnullの場合。java.io.IOException
- 入出力例外が発生した場合。java.lang.String[] getNames(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException
url
- エントリ名を検索するためのルート・ディレクトリを表すURL。String
配列。java.net.MalformedURLException
- アプリケーションが指定されたURLにより表された持続的データ・ストアへのアクセスを拒否された場合、またはURLがnullの場合。java.io.IOException
- 入出力例外が発生した場合。int getTag(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException
int
を返します。void setTag(java.net.URL url, int tag) throws java.net.MalformedURLException, java.io.IOException
url
- タグの値を設定する持続的データ・ストアのエントリを表すURL。tag
- 設定するタグの値。java.net.MalformedURLException
- アプリケーションが指定されたURLにより表された持続的データ・ストアへのアクセスを拒否された場合、またはURLがnullの場合。java.io.IOException
- 入出力例外が発生した場合。Copyright © 1998, 2020, Oracle and/or its affiliates. All rights reserved.