Class EventAdminSecurityDecorator
- java.lang.Object
-
- org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator
-
- All Implemented Interfaces:
org.osgi.service.event.EventAdmin
public class EventAdminSecurityDecorator extends Object implements org.osgi.service.event.EventAdmin
This class is a decorator for anEventAdmin
service. It secures the service by checking any call from a given bundle (i.e., the caller) to the admins post or send methods for the appropriate permissions based on a given permission factory. This methods then in turn throw aSecurityException
in case the given bundle doesn't pass the check or delegate the call to decorated service instance, respectively.- Author:
- Felix Project Team
-
-
Constructor Summary
Constructors Constructor Description EventAdminSecurityDecorator(org.osgi.framework.Bundle bundle, org.osgi.service.event.EventAdmin admin)
The constructor of this decorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Overridesequals()
and delegates the call to the decorated service instance.int
hashCode()
OverrideshashCode()
and returns the hash code of the decorated service instance.void
postEvent(org.osgi.service.event.Event event)
This method checks whether the given (i.e., calling) bundle has appropriate permissions to post an event to the targeted topic.void
sendEvent(org.osgi.service.event.Event event)
This method checks whether the given (i.e., calling) bundle has appropriate permissions to send an event to the targeted topic.
-
-
-
Constructor Detail
-
EventAdminSecurityDecorator
public EventAdminSecurityDecorator(org.osgi.framework.Bundle bundle, org.osgi.service.event.EventAdmin admin)
The constructor of this decorator. The given bundle and permission factory will be used to determine appropriate permissions for any call topostEvent()
orsendEvent()
, respectively. This method then in turn throw aSecurityException
in case the given bundle doesn't pass the check.- Parameters:
bundle
- The calling bundle used to determine appropriate permissionsadmin
- The decorated service instance
-
-
Method Detail
-
postEvent
public void postEvent(org.osgi.service.event.Event event)
This method checks whether the given (i.e., calling) bundle has appropriate permissions to post an event to the targeted topic. ASecurityException
is thrown in case it has not. Otherwise, the event is posted using this decorator's service instance.- Specified by:
postEvent
in interfaceorg.osgi.service.event.EventAdmin
- Parameters:
event
- The event that should be posted- See Also:
EventAdmin.postEvent(org.osgi.service.event.Event)
-
sendEvent
public void sendEvent(org.osgi.service.event.Event event)
This method checks whether the given (i.e., calling) bundle has appropriate permissions to send an event to the targeted topic. ASecurityException
is thrown in case it has not. Otherwise, the event is posted using this decorator's service instance.- Specified by:
sendEvent
in interfaceorg.osgi.service.event.EventAdmin
- Parameters:
event
- The event that should be send- See Also:
EventAdmin.sendEvent(org.osgi.service.event.Event)
-
hashCode
public int hashCode()
OverrideshashCode()
and returns the hash code of the decorated service instance.- Overrides:
hashCode
in classObject
- Returns:
- The hash code of the decorated service instance
- See Also:
Object.hashCode()
,EventAdmin
-
equals
public boolean equals(Object o)
Overridesequals()
and delegates the call to the decorated service instance. In case that o is an instance of this class it passes o's service instance instead of o.- Overrides:
equals
in classObject
- Parameters:
o
- The object to compare with this decorator's service instance- See Also:
Object.equals(java.lang.Object)
,EventAdmin
-
-