001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021
022package org.nuxeo.ecm.core.event;
023
024import org.nuxeo.ecm.core.api.CoreSession;
025
026/**
027 * Because {@link EventBundle} can be processed asynchronously, they can be executed:
028 * <ul>
029 * <li>in a different security context
030 * <li>with a different {@link CoreSession}
031 * </ul>
032 * This interface is used to mark Bundles that supports this kind of processing. This basically means:
033 * <ul>
034 * <li>Create a JAAS session via {@link org.nuxeo.runtime.api.Framework#login()}
035 * <li>Create a new usage {@link CoreSession}
036 * <li>refetch any {@link EventContext} args / properties according to new session
037 * <li>provide cleanup method
038 * </ul>
039 *
040 * @author tiry
041 */
042public interface ReconnectedEventBundle extends EventBundle {
043
044    /**
045     * Marker to pass and set to true in document models context data when passing it in event properties, to avoid
046     * refetching it when reconnecting.
047     */
048    public static final String SKIP_REFETCH_DOCUMENT_CONTEXT_KEY = "skipRefetchDocument";
049
050    /**
051     * Manage cleanup after processing.
052     */
053    void disconnect();
054
055    /**
056     * Marker for Bundles coming from JMS.
057     */
058    boolean comesFromJMS();
059
060}