Package org.osgi.service.condpermadmin
Class ConditionInfo
java.lang.Object
org.osgi.service.condpermadmin.ConditionInfo
Condition representation used by the Conditional Permission Admin service.
This class encapsulates two pieces of information: a Condition type
(class name), which must implement Condition, and the arguments
passed to its constructor.
In order for a Condition represented by a ConditionInfo to be
instantiated and considered during a permission check, its Condition class
must be available from the system classpath.
The Condition class must either:
- Declare a public static
getConditionmethod that takes aBundleobject and aConditionInfoobject as arguments. That method must return an object that implements theConditioninterface. - Implement the
Conditioninterface and define a public constructor that takes aBundleobject and aConditionInfoobject as arguments.
-
Constructor Summary
ConstructorsConstructorDescriptionConditionInfo(String encodedCondition) Constructs aConditionInfoobject from the specified encodedConditionInfostring.ConditionInfo(String type, String[] args) Constructs aConditionInfofrom the specified type and args. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines the equality of twoConditionInfoobjects.final String[]getArgs()Returns arguments of thisConditionInfo.final StringReturns the string encoding of thisConditionInfoin a form suitable for restoring thisConditionInfo.final StringgetType()Returns the fully qualified class name of the condition represented by thisConditionInfo.inthashCode()Returns the hash code value for this object.toString()Returns the string representation of thisConditionInfo.
-
Constructor Details
-
ConditionInfo
Constructs aConditionInfofrom the specified type and args.- Parameters:
type- The fully qualified class name of the Condition represented by thisConditionInfo.args- The arguments for the Condition. These arguments are available to the newly created Condition by calling thegetArgs()method.- Throws:
NullPointerException- Iftypeisnull.
-
ConditionInfo
Constructs aConditionInfoobject from the specified encodedConditionInfostring. White space in the encodedConditionInfostring is ignored.- Parameters:
encodedCondition- The encodedConditionInfo.- Throws:
IllegalArgumentException- If the specifiedencodedConditionis not properly formatted.- See Also:
-
-
Method Details
-
getEncoded
Returns the string encoding of thisConditionInfoin a form suitable for restoring thisConditionInfo.The encoded format is:
[type "arg0" "arg1" ...]
where argN are strings that must be encoded for proper parsing. Specifically, the",\, carriage return, and line feed characters must be escaped using\",\\,\r, and\n, respectively.The encoded string contains no leading or trailing whitespace characters. A single space character is used between type and "arg0" and between the arguments.
- Returns:
- The string encoding of this
ConditionInfo.
-
toString
Returns the string representation of thisConditionInfo. The string is created by calling thegetEncodedmethod on thisConditionInfo. -
getType
Returns the fully qualified class name of the condition represented by thisConditionInfo.- Returns:
- The fully qualified class name of the condition represented by
this
ConditionInfo.
-
getArgs
Returns arguments of thisConditionInfo.- Returns:
- The arguments of this
ConditionInfo. An empty array is returned if theConditionInfohas no arguments.
-
equals
Determines the equality of twoConditionInfoobjects. This method checks that specified object has the same type and args as thisConditionInfoobject. -
hashCode
public int hashCode()Returns the hash code value for this object.
-