50 |
* String passwd = AccessController.doPrivileged(action); |
* String passwd = AccessController.doPrivileged(action); |
51 |
* </code> |
* </code> |
52 |
*/ |
*/ |
53 |
public class GetSecurityPropertyAction extends GetPropertyAction |
public class GetSecurityPropertyAction implements PrivilegedAction |
54 |
{ |
{ |
55 |
|
private String name; |
56 |
|
private String value; |
57 |
|
|
58 |
public GetSecurityPropertyAction() |
public GetSecurityPropertyAction() |
59 |
{ |
{ |
60 |
} |
} |
61 |
|
|
62 |
public GetSecurityPropertyAction (String propName) |
public GetSecurityPropertyAction(String propName) |
63 |
{ |
{ |
64 |
super (propName); |
setParameters(propName); |
65 |
} |
} |
66 |
|
|
67 |
public GetSecurityPropertyAction(String propName, String defaultValue) |
public GetSecurityPropertyAction(String propName, String defaultValue) |
68 |
{ |
{ |
69 |
super (propName, defaultValue); |
setParameters(propName, defaultValue); |
70 |
|
} |
71 |
|
|
72 |
|
public GetSecurityPropertyAction setParameters(String propName) |
73 |
|
{ |
74 |
|
this.name = propName; |
75 |
|
this.value = null; |
76 |
|
return this; |
77 |
|
} |
78 |
|
|
79 |
|
public GetSecurityPropertyAction setParameters(String propName, String defaultValue) |
80 |
|
{ |
81 |
|
this.name = propName; |
82 |
|
this.value = defaultValue; |
83 |
|
return this; |
84 |
} |
} |
85 |
|
|
86 |
public Object run() |
public Object run() |
87 |
{ |
{ |
88 |
String val = Security.getProperty (name); |
String val = Security.getProperty(name); |
89 |
if (val == null) |
if (val == null) |
90 |
val = value; |
val = value; |
91 |
return val; |
return val; |