use of com.google.gerrit.common.UserScopedEventListener in project gerrit by GerritCodeReview.
the class StreamEvents method start.
@Override
public void start(final Environment env) throws IOException {
try {
parseCommandLine();
} catch (UnloggedFailure e) {
String msg = e.getMessage();
if (!msg.endsWith("\n")) {
msg += "\n";
}
err.write(msg.getBytes(UTF_8));
err.flush();
onExit(1);
return;
}
stdout = toPrintWriter(out);
eventListenerRegistration = eventListeners.add(new UserScopedEventListener() {
@Override
public void onEvent(final Event event) {
if (subscribedToEvents.isEmpty() || subscribedToEvents.contains(event.getType())) {
offer(event);
}
}
@Override
public CurrentUser getUser() {
return currentUser;
}
});
gson = new GsonBuilder().registerTypeAdapter(Supplier.class, new SupplierSerializer()).registerTypeAdapter(Project.NameKey.class, new ProjectNameKeySerializer()).create();
}
Aggregations