org.apache.felix.eventadmin.impl.security
Class CacheTopicPermissions

java.lang.Object
  extended by org.apache.felix.eventadmin.impl.security.CacheTopicPermissions
All Implemented Interfaces:
TopicPermissions

public class CacheTopicPermissions
extends java.lang.Object
implements TopicPermissions

An implementation of the TopicPermissions factory that uses a given cache in order to speed-up topic permission creation. Note that a java.lang.Object is returned in case creating a new TopicPermission fails. This assumes that Bundle.hasPermission is used in order to evaluate the created Permission which in turn will return true if security is not supported by the framework. Otherwise, it will return false due to receiving something that is not a subclass of java.lang.SecurityPermission hence, this combination ensures that access is granted in case a topic permission could not be created due to missing security support by the framework.

Author:
Felix Project Team
See Also:
TopicPermissions

Constructor Summary
CacheTopicPermissions(CacheMap cache, java.lang.String type)
          The constructor of this permission factory.
 
Method Summary
 java.lang.Object createTopicPermission(java.lang.String topic)
          Creates a TopicPermission for the given topic and the type of this factory (i.e., PUBLISH or SUBSCRIBE).
 java.lang.String getType()
          Returns the type of the permissions created by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheTopicPermissions

public CacheTopicPermissions(CacheMap cache,
                             java.lang.String type)
The constructor of this permission factory. The given cache will be used to speed-up permission creation and the created permissions will be of the given type (i.e., PUBLISH or SUBSCRIBE).

Parameters:
cache - The cache to be used
type - The type that created permissions will be of (i.e, PUBLISH or SUBSCRIBE)
See Also:
TopicPermissions, TopicPermission.PUBLISH, TopicPermission.SUBSCRIBE
Method Detail

getType

public java.lang.String getType()
Returns the type of the permissions created by this factory.

Specified by:
getType in interface TopicPermissions
Returns:
The type of the permissions created by this factory
See Also:
TopicPermissions.getType(), TopicPermission.PUBLISH, TopicPermission.SUBSCRIBE

createTopicPermission

public java.lang.Object createTopicPermission(java.lang.String topic)
Creates a TopicPermission for the given topic and the type of this factory (i.e., PUBLISH or SUBSCRIBE). Note that a java.lang.Object is returned in case creating a new TopicPermission fails. This assumes that Bundle.hasPermission is used in order to evaluate the created Permission which in turn will return true if security is not supported by the framework. Otherwise, it will return false due to receiving something that is not a subclass of java.lang.SecurityPermission hence, this combination ensures that access is granted in case a topic permission could not be created due to missing security support by the framework.

Specified by:
createTopicPermission in interface TopicPermissions
Parameters:
topic - The target topic
Returns:
The created permission or a java.lang.Object in case the permission could not be created.
See Also:
TopicPermissions.createTopicPermission(String), TopicPermission