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 *
012 * $Id$
013 */
014
015package org.nuxeo.ecm.core.event;
016
017import org.nuxeo.ecm.core.api.CoreSession;
018
019/**
020 * Because {@link EventBundle} can be processed asynchronously, they can be executed:
021 * <ul>
022 * <li>in a different security context
023 * <li>with a different {@link CoreSession}
024 * </ul>
025 * This interface is used to mark Bundles that supports this kind of processing. This basically means:
026 * <ul>
027 * <li>Create a JAAS session via {@link org.nuxeo.runtime.api.Framework#login()}
028 * <li>Create a new usage {@link CoreSession}
029 * <li>refetch any {@link EventContext} args / properties according to new session
030 * <li>provide cleanup method
031 * </ul>
032 *
033 * @author tiry
034 */
035public interface ReconnectedEventBundle extends EventBundle {
036
037    /**
038     * Marker to pass and set to true in document models context data when passing it in event properties, to avoid
039     * refetching it when reconnecting.
040     */
041    public static final String SKIP_REFETCH_DOCUMENT_CONTEXT_KEY = "skipRefetchDocument";
042
043    /**
044     * Manage cleanup after processing.
045     */
046    void disconnect();
047
048    /**
049     * Marker for Bundles coming from JMS.
050     */
051    boolean comesFromJMS();
052
053}