Class TopicPermission
- java.lang.Object
-
- java.security.Permission
-
- org.osgi.service.event.TopicPermission
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Guard
public final class TopicPermission extends java.security.PermissionA bundle's authority to publish or subscribe to event on a topic.A topic is a slash-separated string that defines a topic.
For example:
org/osgi/service/foo/FooEvent/ACTION
TopicPermissionhas two actions:publishandsubscribe.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TopicPermission(java.lang.String name, java.lang.String actions)Defines the authority to publish and/or subscribe to a topic within the EventAdmin service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Determines the equality of twoTopicPermissionobjects.java.lang.StringgetActions()Returns the canonical string representation of theTopicPermissionactions.inthashCode()Returns the hash code value for this object.booleanimplies(java.security.Permission p)Determines if the specified permission is implied by this object.java.security.PermissionCollectionnewPermissionCollection()Returns a newPermissionCollectionobject suitable for storingTopicPermissionobjects.
-
-
-
Field Detail
-
PUBLISH
public static final java.lang.String PUBLISH
The action stringpublish.- See Also:
- Constant Field Values
-
SUBSCRIBE
public static final java.lang.String SUBSCRIBE
The action stringsubscribe.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TopicPermission
public TopicPermission(java.lang.String name, java.lang.String actions)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
TopicPermissionfor that topic; similarly, a bundle that needs to subscribe to events on a topic must have the appropriateTopicPermssionfor that topic.- Parameters:
name- Topic name.actions-publish,subscribe(canonical order).
-
-
Method Detail
-
implies
public boolean implies(java.security.Permission p)
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
TopicPermissionactions must either match or allow for the list of the target object to imply the targetTopicPermissionaction.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:
impliesin classjava.security.Permission- Parameters:
p- The target permission to interrogate.- Returns:
trueif the specifiedTopicPermissionaction is implied by this object;falseotherwise.
-
getActions
public java.lang.String getActions()
Returns the canonical string representation of theTopicPermissionactions.Always returns present
TopicPermissionactions in the following order:publish,subscribe.- Specified by:
getActionsin classjava.security.Permission- Returns:
- Canonical string representation of the
TopicPermissionactions.
-
newPermissionCollection
public java.security.PermissionCollection newPermissionCollection()
Returns a newPermissionCollectionobject suitable for storingTopicPermissionobjects.- Overrides:
newPermissionCollectionin classjava.security.Permission- Returns:
- A new
PermissionCollectionobject.
-
equals
public boolean equals(java.lang.Object obj)
Determines the equality of twoTopicPermissionobjects. This method checks that specifiedTopicPermissionhas the same topic name and actions as thisTopicPermissionobject.- Specified by:
equalsin classjava.security.Permission- Parameters:
obj- The object to test for equality with thisTopicPermissionobject.- Returns:
trueifobjis aTopicPermission, and has the same topic name and actions as thisTopicPermissionobject;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code value for this object.- Specified by:
hashCodein classjava.security.Permission- Returns:
- A hash code value for this object.
-
-