Top Description Fields Constructors Methods
org.osgi.service.condpermadmin

public Class BundleLocationCondition

extends Object
Class Inheritance
Imports
java.security.AccessController, .PrivilegedAction, java.util.Dictionary, .Hashtable, org.osgi.framework.Bundle, .Filter, .FrameworkUtil, .InvalidSyntaxException

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.

Author
$Id: 262e82a5ba72bf4e142179cf037e09a761743382 $

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String

Returns:

escaped value string.
escapeLocation
(final String
unescaped value string.
value
)

Escape the value string such that '(', ')' and '\' are escaped.

public static Condition

Returns:

Condition object for the requested condition.
getCondition
(final Bundle
The Bundle being evaluated.
bundle
,
final ConditionInfo
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.
info
)

Constructs a condition that tries to match the passed Bundle's location to the location pattern.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONDITION_TYPEback to summary
private static final String CONDITION_TYPE

Constructor Detail

BundleLocationConditionback to summary
private BundleLocationCondition()

Method Detail

escapeLocationback to summary
private static String escapeLocation(final 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:String

unescaped value string.

Returns:String

escaped value string.

getConditionback to summary
public static Condition getCondition(final Bundle bundle, final ConditionInfo info)

Constructs a condition that tries to match the passed Bundle's location to the location pattern.

Parameters
bundle:Bundle

The Bundle being evaluated.

info:ConditionInfo

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

Condition object for the requested condition.