Package com.google.gerrit.server.events
Class EventBroker
java.lang.Object
com.google.gerrit.server.events.EventBroker
- All Implemented Interfaces:
EventDispatcher
Distributes Events to listeners if they are allowed to see them
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final String
protected final PluginSetContext<UserScopedEventListener>
Listeners to receive changes as they happen (limited by visibility of user).protected final ChangeNotes.Factory
protected final ProjectCache
protected final PluginSetContext<EventListener>
Listeners to receive all changes as they happen. -
Constructor Summary
ConstructorsConstructorDescriptionEventBroker
(PluginSetContext<UserScopedEventListener> listeners, PluginSetContext<EventListener> unrestrictedListeners, PermissionBackend permissionBackend, ProjectCache projectCache, ChangeNotes.Factory notesFactory, String gerritInstanceId) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
fireEvent
(BranchNameKey branchName, RefEvent event) protected void
fireEvent
(Change change, ChangeEvent event) protected void
fireEvent
(Project.NameKey project, ProjectEvent event) protected void
protected void
protected boolean
isVisibleTo
(BranchNameKey branchName, CurrentUser user) protected boolean
isVisibleTo
(Change change, CurrentUser user) protected boolean
isVisibleTo
(Project.NameKey project, CurrentUser user) protected boolean
isVisibleTo
(Event event, CurrentUser user) void
postEvent
(BranchNameKey branchName, RefEvent event) Post a stream event that is related to a branchvoid
postEvent
(Change change, ChangeEvent event) Post a stream event that is related to a changevoid
postEvent
(Project.NameKey projectName, ProjectEvent event) Post a stream event that is related to a project.void
Post a stream event generically.protected void
setInstanceIdWhenEmpty
(Event event)
-
Field Details
-
listeners
Listeners to receive changes as they happen (limited by visibility of user). -
unrestrictedListeners
Listeners to receive all changes as they happen. -
projectCache
-
notesFactory
-
gerritInstanceId
-
-
Constructor Details
-
EventBroker
@Inject public EventBroker(PluginSetContext<UserScopedEventListener> listeners, PluginSetContext<EventListener> unrestrictedListeners, PermissionBackend permissionBackend, ProjectCache projectCache, ChangeNotes.Factory notesFactory, String gerritInstanceId)
-
-
Method Details
-
postEvent
Description copied from interface:EventDispatcher
Post a stream event that is related to a change- Specified by:
postEvent
in interfaceEventDispatcher
- Parameters:
change
- The change that the event is related toevent
- The event to post- Throws:
PermissionBackendException
- on failure of permission checks
-
postEvent
Description copied from interface:EventDispatcher
Post a stream event that is related to a branch- Specified by:
postEvent
in interfaceEventDispatcher
- Parameters:
branchName
- The branch that the event is related toevent
- The event to post- Throws:
PermissionBackendException
- on failure of permission checks
-
postEvent
Description copied from interface:EventDispatcher
Post a stream event that is related to a project.- Specified by:
postEvent
in interfaceEventDispatcher
- Parameters:
projectName
- The project that the event is related to.event
- The event to post.
-
postEvent
Description copied from interface:EventDispatcher
Post a stream event generically.If you are creating a RefEvent or ChangeEvent from scratch, it is more efficient to use the specific postEvent methods for those use cases.
- Specified by:
postEvent
in interfaceEventDispatcher
- Parameters:
event
- The event to post.- Throws:
PermissionBackendException
- on failure of permission checks
-
fireEventForUnrestrictedListeners
-
fireEvent
- Throws:
PermissionBackendException
-
fireEvent
-
fireEvent
protected void fireEvent(BranchNameKey branchName, RefEvent event) throws PermissionBackendException - Throws:
PermissionBackendException
-
fireEvent
- Throws:
PermissionBackendException
-
setInstanceIdWhenEmpty
-
isVisibleTo
-
isVisibleTo
- Throws:
PermissionBackendException
-
isVisibleTo
protected boolean isVisibleTo(BranchNameKey branchName, CurrentUser user) throws PermissionBackendException - Throws:
PermissionBackendException
-
isVisibleTo
- Throws:
PermissionBackendException
-