Package org.osgi.service.condpermadmin
Class BundleLocationCondition
- java.lang.Object
-
- org.osgi.service.condpermadmin.BundleLocationCondition
-
public class BundleLocationCondition extends java.lang.Object
Condition to test if the location of a bundle matches or does not match a pattern. Since the bundle's location cannot be changed, this condition is immutable.Pattern matching is done according to the filter string matching rules.
- Version:
- $Revision: 5901 $
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CONDITION_TYPE
-
Constructor Summary
Constructors Modifier Constructor Description private
BundleLocationCondition()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
escapeLocation(java.lang.String value)
Escape the value string such that '(', ')' and '\' are escaped.static Condition
getCondition(Bundle bundle, ConditionInfo info)
Constructs a condition that tries to match the passed Bundle's location to the location pattern.
-
-
-
Field Detail
-
CONDITION_TYPE
private static final java.lang.String CONDITION_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCondition
public static Condition getCondition(Bundle bundle, ConditionInfo info)
Constructs a condition that tries to match the passed Bundle's location to the location pattern.- Parameters:
bundle
- The Bundle being evaluated.info
- The ConditionInfo from which to construct the condition. The ConditionInfo must specify one or two arguments. The first argument of the ConditionInfo specifies the location pattern against which to match the bundle location. Matching is done according to the filter string matching rules. Any '*' characters in the first argument are used as wildcards when matching bundle locations unless they are escaped with a '\' character. The Condition is satisfied if the bundle location matches the pattern. The second argument of the ConditionInfo is optional. If a second argument is present and equal to "!", then the satisfaction of the Condition is negated. That is, the Condition is satisfied if the bundle location does NOT match the pattern. If the second argument is present but does not equal "!", then the second argument is ignored.- Returns:
- Condition object for the requested condition.
-
escapeLocation
private static java.lang.String escapeLocation(java.lang.String value)
Escape the value string such that '(', ')' and '\' are escaped. The '\' char is only escaped if it is not followed by a '*'.- Parameters:
value
- unescaped value string.- Returns:
- escaped value string.
-
-