public class EventBroker extends java.lang.Object implements EventDispatcher
Modifier and Type | Class and Description |
---|---|
static class |
EventBroker.Module |
Modifier and Type | Field and Description |
---|---|
protected com.google.inject.Provider<ReviewDb> |
dbProvider |
protected DynamicSet<UserScopedEventListener> |
listeners
Listeners to receive changes as they happen (limited by visibility of user).
|
protected ChangeNotes.Factory |
notesFactory |
protected ProjectCache |
projectCache |
protected DynamicSet<EventListener> |
unrestrictedListeners
Listeners to receive all changes as they happen.
|
Constructor and Description |
---|
EventBroker(DynamicSet<UserScopedEventListener> listeners,
DynamicSet<EventListener> unrestrictedListeners,
PermissionBackend permissionBackend,
ProjectCache projectCache,
ChangeNotes.Factory notesFactory,
com.google.inject.Provider<ReviewDb> dbProvider) |
Modifier and Type | Method and Description |
---|---|
protected void |
fireEvent(Branch.NameKey branchName,
RefEvent event) |
protected void |
fireEvent(Change change,
ChangeEvent event) |
protected void |
fireEvent(Event event) |
protected void |
fireEvent(Project.NameKey project,
ProjectEvent event) |
protected void |
fireEventForUnrestrictedListeners(Event event) |
protected boolean |
isVisibleTo(Branch.NameKey branchName,
CurrentUser user) |
protected boolean |
isVisibleTo(Change change,
CurrentUser user) |
protected boolean |
isVisibleTo(Event event,
CurrentUser user) |
protected boolean |
isVisibleTo(Project.NameKey project,
CurrentUser user) |
void |
postEvent(Branch.NameKey branchName,
RefEvent event)
Post a stream event that is related to a branch
|
void |
postEvent(Change change,
ChangeEvent event)
Post a stream event that is related to a change
|
void |
postEvent(Event event)
Post a stream event generically.
|
void |
postEvent(Project.NameKey projectName,
ProjectEvent event)
Post a stream event that is related to a project.
|
protected final DynamicSet<UserScopedEventListener> listeners
protected final DynamicSet<EventListener> unrestrictedListeners
protected final ProjectCache projectCache
protected final ChangeNotes.Factory notesFactory
protected final com.google.inject.Provider<ReviewDb> dbProvider
@Inject public EventBroker(DynamicSet<UserScopedEventListener> listeners, DynamicSet<EventListener> unrestrictedListeners, PermissionBackend permissionBackend, ProjectCache projectCache, ChangeNotes.Factory notesFactory, com.google.inject.Provider<ReviewDb> dbProvider)
public void postEvent(Change change, ChangeEvent event) throws com.google.gwtorm.server.OrmException, PermissionBackendException
EventDispatcher
postEvent
in interface EventDispatcher
change
- The change that the event is related toevent
- The event to postcom.google.gwtorm.server.OrmException
- on failure to post the event due to DB errorPermissionBackendException
- on failure of permission checkspublic void postEvent(Branch.NameKey branchName, RefEvent event) throws PermissionBackendException
EventDispatcher
postEvent
in interface EventDispatcher
branchName
- The branch that the event is related toevent
- The event to postPermissionBackendException
- on failure of permission checkspublic void postEvent(Project.NameKey projectName, ProjectEvent event)
EventDispatcher
postEvent
in interface EventDispatcher
projectName
- The project that the event is related to.event
- The event to post.public void postEvent(Event event) throws com.google.gwtorm.server.OrmException, PermissionBackendException
EventDispatcher
If you are creating a RefEvent or ChangeEvent from scratch, it is more efficient to use the specific postEvent methods for those use cases.
postEvent
in interface EventDispatcher
event
- The event to post.com.google.gwtorm.server.OrmException
- on failure to post the event due to DB errorPermissionBackendException
- on failure of permission checksprotected void fireEventForUnrestrictedListeners(Event event)
protected void fireEvent(Change change, ChangeEvent event) throws com.google.gwtorm.server.OrmException, PermissionBackendException
com.google.gwtorm.server.OrmException
PermissionBackendException
protected void fireEvent(Project.NameKey project, ProjectEvent event)
protected void fireEvent(Branch.NameKey branchName, RefEvent event) throws PermissionBackendException
PermissionBackendException
protected void fireEvent(Event event) throws com.google.gwtorm.server.OrmException, PermissionBackendException
com.google.gwtorm.server.OrmException
PermissionBackendException
protected boolean isVisibleTo(Project.NameKey project, CurrentUser user)
protected boolean isVisibleTo(Change change, CurrentUser user) throws com.google.gwtorm.server.OrmException, PermissionBackendException
com.google.gwtorm.server.OrmException
PermissionBackendException
protected boolean isVisibleTo(Branch.NameKey branchName, CurrentUser user) throws PermissionBackendException
PermissionBackendException
protected boolean isVisibleTo(Event event, CurrentUser user) throws com.google.gwtorm.server.OrmException, PermissionBackendException
com.google.gwtorm.server.OrmException
PermissionBackendException