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

java.lang.Object
  extended by org.apache.felix.eventadmin.impl.security.SecureEventAdminFactory
All Implemented Interfaces:
org.osgi.framework.ServiceFactory

public class SecureEventAdminFactory
extends java.lang.Object
implements org.osgi.framework.ServiceFactory

This class is a factory that secures a given EventAdmin service by wrapping it with a new instance of an EventAdminSecurityDecorator on any call to its getService() method. The decorator will determine the appropriate permissions by using the given permission factory and the bundle parameter passed to the getService() method.

Author:
Felix Project Team

Constructor Summary
SecureEventAdminFactory(org.osgi.service.event.EventAdmin admin, TopicPermissions topicPermissions)
          The constructor of the factory.
 
Method Summary
 java.lang.Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration)
          Returns a new EventAdminSecurityDecorator initialized with the given EventAdmin.
 void ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration, java.lang.Object service)
          This method doesn't do anything at the moment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecureEventAdminFactory

public SecureEventAdminFactory(org.osgi.service.event.EventAdmin admin,
                               TopicPermissions topicPermissions)
The constructor of the factory. The factory will use the given event admin and permission factory to create a new EventAdminSecurityDecorator on any call to getService().

Parameters:
admin - The EventAdmin service to secure.
topicPermissions - The permission factory to use for permission lookup.
Method Detail

getService

public java.lang.Object getService(org.osgi.framework.Bundle bundle,
                                   org.osgi.framework.ServiceRegistration registration)
Returns a new EventAdminSecurityDecorator initialized with the given EventAdmin. That in turn will check any call to post or send for the appropriate permissions based on the bundle parameter.

Specified by:
getService in interface org.osgi.framework.ServiceFactory
Parameters:
bundle - The bundle used to determine the permissions of the caller
registration - The ServiceRegistration that is not used
Returns:
The given service instance wrapped by an EventAdminSecuriryDecorator
See Also:
ServiceFactory.getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration)

ungetService

public void ungetService(org.osgi.framework.Bundle bundle,
                         org.osgi.framework.ServiceRegistration registration,
                         java.lang.Object service)
This method doesn't do anything at the moment.

Specified by:
ungetService in interface org.osgi.framework.ServiceFactory
Parameters:
bundle - The bundle object that is not used
registration - The ServiceRegistration that is not used
service - The service object that is not used
See Also:
ServiceFactory.ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object)