gluu
公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.gluu.credmanager.core.label.PluginLabelLocator クラス
org.gluu.credmanager.core.label.PluginLabelLocator の継承関係図
Inheritance graph
org.gluu.credmanager.core.label.PluginLabelLocator 連携図
Collaboration graph

公開メンバ関数

 PluginLabelLocator (Path path, String subDir)
 
URL locate (Locale locale) throws MalformedURLException
 
void close () throws IOException
 

非公開変数類

JarFile jarFile
 
String uri
 
String basePath
 
String subDirectory
 
boolean closed
 

静的非公開変数類

static final String DEFAULT_PROPS_FILE = "zk-label"
 

詳解

著者
jgomer

構築子と解体子

◆ PluginLabelLocator()

org.gluu.credmanager.core.label.PluginLabelLocator.PluginLabelLocator ( Path  path,
String  subDir 
)
inline
34  {
35 
36  try {
37  this.subDirectory = subDir;
38  this.basePath = path.toString();
39  uri = path.toUri().toString();
40 
41  if (Files.isRegularFile(path) && basePath.toLowerCase().endsWith(".jar")) {
42  jarFile = new JarFile(path.toFile(), false, ZipFile.OPEN_READ);
43  }
44  } catch (IOException e) {
45  //Intentionally left empty
46  }
47  }
String uri
Definition: PluginLabelLocator.java:29
String subDirectory
Definition: PluginLabelLocator.java:31
JarFile jarFile
Definition: PluginLabelLocator.java:28
String basePath
Definition: PluginLabelLocator.java:30

関数詳解

◆ close()

void org.gluu.credmanager.core.label.PluginLabelLocator.close ( ) throws IOException
inline
75  {
76 
77  if (jarFile != null) {
78  //closed field is needed since there is no way to de-register a LabelLocator in ZK so it flags this label locator
79  //is not needed anylonger
80  closed = true;
81  jarFile.close();
82  jarFile = null;
83  }
84 
85  }
JarFile jarFile
Definition: PluginLabelLocator.java:28
boolean closed
Definition: PluginLabelLocator.java:32

◆ locate()

URL org.gluu.credmanager.core.label.PluginLabelLocator.locate ( Locale  locale) throws MalformedURLException
inline
49  {
50 
51  String location = null;
52  if (!closed) {
53 
54  String suffix = DEFAULT_PROPS_FILE;
55  suffix += locale == null ? "" : "_" + locale.toString();
56  suffix += ".properties";
57 
58  if (jarFile == null) {
59  Path path = Paths.get(basePath, subDirectory, suffix);
60  if (Files.exists(path)) {
61  location = path.toUri().toString();
62  }
63  } else {
64  suffix = subDirectory + "/" + suffix;
65  if (jarFile.getEntry(suffix) != null) {
66  location = "jar:" + uri + "!/" + suffix;
67  }
68  }
69  //System.out.println("@locate " + location + "-" + uri + "!/" + suffix);
70  }
71  return location == null ? null : new URL(location);
72 
73  }
static final String DEFAULT_PROPS_FILE
Definition: PluginLabelLocator.java:26
String uri
Definition: PluginLabelLocator.java:29
String subDirectory
Definition: PluginLabelLocator.java:31
JarFile jarFile
Definition: PluginLabelLocator.java:28
boolean closed
Definition: PluginLabelLocator.java:32
String basePath
Definition: PluginLabelLocator.java:30

メンバ詳解

◆ basePath

String org.gluu.credmanager.core.label.PluginLabelLocator.basePath
private

◆ closed

boolean org.gluu.credmanager.core.label.PluginLabelLocator.closed
private

◆ DEFAULT_PROPS_FILE

final String org.gluu.credmanager.core.label.PluginLabelLocator.DEFAULT_PROPS_FILE = "zk-label"
staticprivate

◆ jarFile

JarFile org.gluu.credmanager.core.label.PluginLabelLocator.jarFile
private

◆ subDirectory

String org.gluu.credmanager.core.label.PluginLabelLocator.subDirectory
private

◆ uri

String org.gluu.credmanager.core.label.PluginLabelLocator.uri
private

このクラス詳解は次のファイルから抽出されました: