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
getCondition
method that takes aBundle
object and aConditionInfo
object as arguments. That method must return an object that implements theCondition
interface. - Implement the
Condition
interface and define a public constructor that takes aBundle
object and aConditionInfo
object as arguments.
-
Constructor Summary
ConstructorDescriptionConditionInfo
(String encodedCondition) Constructs aConditionInfo
object from the specified encodedConditionInfo
string.ConditionInfo
(String type, String[] args) Constructs aConditionInfo
from the specified type and args. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines the equality of twoConditionInfo
objects.final String[]
getArgs()
Returns arguments of thisConditionInfo
.final String
Returns the string encoding of thisConditionInfo
in a form suitable for restoring thisConditionInfo
.final String
getType()
Returns the fully qualified class name of the condition represented by thisConditionInfo
.int
hashCode()
Returns the hash code value for this object.toString()
Returns the string representation of thisConditionInfo
.
-
Constructor Details
-
ConditionInfo
Constructs aConditionInfo
from 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
- Iftype
isnull
.
-
ConditionInfo
Constructs aConditionInfo
object from the specified encodedConditionInfo
string. White space in the encodedConditionInfo
string is ignored.- Parameters:
encodedCondition
- The encodedConditionInfo
.- Throws:
IllegalArgumentException
- If the specifiedencodedCondition
is not properly formatted.- See Also:
-
-
Method Details
-
getEncoded
Returns the string encoding of thisConditionInfo
in 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 thegetEncoded
method 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 theConditionInfo
has no arguments.
-
equals
Determines the equality of twoConditionInfo
objects. This method checks that specified object has the same type and args as thisConditionInfo
object. -
hashCode
public int hashCode()Returns the hash code value for this object.
-