001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * bstefanescu 011 */ 012package org.nuxeo.ecm.automation.core.events; 013 014import java.util.List; 015 016import org.nuxeo.ecm.core.event.Event; 017import org.nuxeo.ecm.core.event.EventListener; 018import org.nuxeo.runtime.api.Framework; 019 020/** 021 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 022 */ 023public class OperationEventListener implements EventListener { 024 025 protected EventHandlerRegistry registry; 026 027 @Override 028 public void handleEvent(Event event) { 029 if (registry == null) { 030 registry = Framework.getLocalService(EventHandlerRegistry.class); 031 } 032 List<EventHandler> handlers = registry.getEventHandlers(event.getName()); 033 registry.handleEvent(event, handlers, false); 034 } 035 036}