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 *     Nuxeo - initial API and implementation
011 * $Id$
012 */
013
014package org.nuxeo.runtime.services.event;
015
016/**
017 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
018 */
019public class Event {
020
021    private final String topic;
022
023    private final String id;
024
025    private final Object source;
026
027    private final Object data;
028
029    public Event(String topic, String id, Object source, Object data) {
030        this.topic = topic == null ? "" : topic.intern();
031        this.id = id;
032        this.source = source;
033        this.data = data;
034    }
035
036    public String getTopic() {
037        return topic;
038    }
039
040    public String getId() {
041        return id;
042    }
043
044    public Object getSource() {
045        return source;
046    }
047
048    public Object getData() {
049        return data;
050    }
051
052    @Override
053    public String toString() {
054        return topic + '/' + id + " [" + data + ']';
055    }
056
057}