001/*
002 * Copyright (c) 2006-2013 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.jms;
016
017import org.nuxeo.runtime.api.Framework;
018
019/**
020 * Helper class to configured is Async Post Commit EventListener must be processed:
021 * <ul>
022 * <li>by the core directly, or
023 * <li>by the JMS bus.
024 * <p>
025 * (Mainly used for testing).
026 *
027 * @author tiry
028 */
029public class AsyncProcessorConfig {
030
031    protected static Boolean forceJMSUsage;
032
033    protected static final String forceJMSUsageKey = "org.nuxeo.ecm.event.forceJMS";
034
035    public static boolean forceJMSUsage() {
036        if (forceJMSUsage == null) {
037            forceJMSUsage = Boolean.valueOf(Framework.isBooleanPropertyTrue(forceJMSUsageKey));
038        }
039        return forceJMSUsage;
040    }
041
042    public static void setForceJMSUsage(boolean flag) {
043        forceJMSUsage = flag;
044    }
045
046}