public class UserPromptCondition extends Object implements org.osgi.service.condpermadmin.Condition
Modifier and Type | Method and Description |
---|---|
static org.osgi.service.condpermadmin.Condition |
getCondition(org.osgi.framework.Bundle bundle,
org.osgi.service.condpermadmin.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(org.osgi.service.condpermadmin.Condition[] conds,
Dictionary context)
Checks an array of UserPrompt conditions.
|
public static org.osgi.service.condpermadmin.Condition getCondition(org.osgi.framework.Bundle bundle, org.osgi.service.condpermadmin.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".IllegalArgumentException
- if the parameters are malformed.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 org.osgi.service.condpermadmin.Condition
public boolean isMutable()
getCondition(Bundle, ConditionInfo)
.
isMutable
in interface org.osgi.service.condpermadmin.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 org.osgi.service.condpermadmin.Condition
public boolean isSatisfied(org.osgi.service.condpermadmin.Condition[] conds, Dictionary context)
isSatisfied
in interface org.osgi.service.condpermadmin.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.NullPointerException
- if conds is null.Copyright © 2006–2017 OSGi Alliance. All rights reserved.