|
OSGi™ Service Platform Release 4 Version 4.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.osgi.util.mobile.UserPromptCondition
Class representing a user prompt condition. Instances of this class hold two values: a prompt string that is to be displayed to the user and the permission level string according to MIDP2.0 (oneshot, session, blanket).
Field Summary |
Fields inherited from interface org.osgi.service.condpermadmin.Condition |
FALSE, TRUE |
Method Summary | |
static Condition |
getCondition(Bundle bundle,
ConditionInfo conditionInfo)
Returns a UserPromptCondition object with the given prompt string and permission level. |
boolean |
isMutable()
Checks whether the condition may change during the lifetime of the UserPromptCondition object. |
boolean |
isPostponed()
Checks if the isSatisfied() method needs to prompt the user, thus cannot
give results instantly. |
boolean |
isSatisfied()
Displays the prompt string to the user and returns true if the user accepts. |
boolean |
isSatisfied(Condition[] conds,
java.util.Dictionary context)
Checks an array of UserPrompt conditions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Condition getCondition(Bundle bundle, ConditionInfo conditionInfo)
bundle
- the bundle to ask about.conditionInfo
- the conditionInfo containing the construction information. Its
ConditionInfo.getArgs()
method should return a String array with 4
strings in it:
ResourceBundle
,
or equivalent
from an exporting OSGi Bundle. Thus, if the catalogName is "com.provider.messages.userprompt",
then there should be an OSGi Bundle exporting the "com.provider.messages" package, and inside
it files like "userprompt_en_US.properties".java.lang.IllegalArgumentException
- if the parameters are malformed.
java.lang.NullPointerException
- if one of the parameters is null
.public boolean isPostponed()
isSatisfied()
method needs to prompt the user, thus cannot
give results instantly.
This depends on the permission level given in
getCondition(Bundle, ConditionInfo)
.
isSatisfied()
returns false.
isPostponed
in interface Condition
public boolean isMutable()
getCondition(Bundle, ConditionInfo)
.
isMutable
in interface Condition
public boolean isSatisfied()
getCondition(Bundle, ConditionInfo)
).
It must always be possible for the user
to stop further prompting of this question, even with ONESHOT and SESSION levels.
In case of BLANKET
and SESSION levels, it is possible that the user has already answered the question,
in this case there will be no prompting, but immediate return with the previous answer.
isSatisfied
in interface Condition
public boolean isSatisfied(Condition[] conds, java.util.Dictionary context)
isSatisfied
in interface Condition
conds
- The array containing the UserPrompt conditions to evaluate.context
- Storage area for evaluation. The ConditionalPermissionAdmin
may evaluate a condition several times for one permission check, so this context
will be used to store results of ONESHOT questions. This way asking the same question
twice in a row can be avoided. If context is null, temporary results will not be stored.
java.lang.NullPointerException
- if conds is null.
|
OSGi™ Service Platform Release 4 Version 4.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |