Class TopicPermission
- All Implemented Interfaces:
Serializable
,Guard
A topic is a slash-separated string that defines a topic.
For example:
org/osgi/service/foo/FooEvent/ACTION
TopicPermission
has two actions: publish
and
subscribe
.
- See Also:
- "ThreadSafe"
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTopicPermission
(String name, String actions) Defines the authority to publish and/or subscribe to a topic within the EventAdmin service. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines the equality of twoTopicPermission
objects.Returns the canonical string representation of theTopicPermission
actions.int
hashCode()
Returns the hash code value for this object.boolean
Determines if the specified permission is implied by this object.Returns a newPermissionCollection
object suitable for storingTopicPermission
objects.Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
Field Details
-
PUBLISH
The action stringpublish
.- See Also:
-
SUBSCRIBE
The action stringsubscribe
.- See Also:
-
-
Constructor Details
-
TopicPermission
Defines the authority to publish and/or subscribe to a topic within the EventAdmin service.The name is specified as a slash-separated string. Wildcards may be used. For example:
org/osgi/service/fooFooEvent/ACTION com/isv/* *
A bundle that needs to publish events on a topic must have the appropriate
TopicPermission
for that topic; similarly, a bundle that needs to subscribe to events on a topic must have the appropriateTopicPermssion
for that topic.- Parameters:
name
- Topic name.actions
-publish
,subscribe
(canonical order).
-
-
Method Details
-
implies
Determines if the specified permission is implied by this object.This method checks that the topic name of the target is implied by the topic name of this object. The list of
TopicPermission
actions must either match or allow for the list of the target object to imply the targetTopicPermission
action.x/y/*,"publish" -> x/y/z,"publish" is true *,"subscribe" -> x/y,"subscribe" is true *,"publish" -> x/y,"subscribe" is false x/y,"publish" -> x/y/z,"publish" is false
- Specified by:
implies
in classPermission
- Parameters:
p
- The target permission to interrogate.- Returns:
true
if the specifiedTopicPermission
action is implied by this object;false
otherwise.
-
getActions
Returns the canonical string representation of theTopicPermission
actions.Always returns present
TopicPermission
actions in the following order:publish
,subscribe
.- Specified by:
getActions
in classPermission
- Returns:
- Canonical string representation of the
TopicPermission
actions.
-
newPermissionCollection
Returns a newPermissionCollection
object suitable for storingTopicPermission
objects.- Overrides:
newPermissionCollection
in classPermission
- Returns:
- A new
PermissionCollection
object.
-
equals
Determines the equality of twoTopicPermission
objects. This method checks that specifiedTopicPermission
has the same topic name and actions as thisTopicPermission
object.- Specified by:
equals
in classPermission
- Parameters:
obj
- The object to test for equality with thisTopicPermission
object.- Returns:
true
ifobj
is aTopicPermission
, and has the same topic name and actions as thisTopicPermission
object;false
otherwise.
-
hashCode
public int hashCode()Returns the hash code value for this object.- Specified by:
hashCode
in classPermission
- Returns:
- A hash code value for this object.
-