001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.workflow;
016    
017    import com.liferay.portal.kernel.messaging.DestinationNames;
018    import com.liferay.portal.kernel.messaging.MessageBusUtil;
019    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020    
021    import java.util.Map;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     * @author Raymond Aug??
026     */
027    public class WorkflowEngineManagerUtil {
028    
029            public static String getKey() {
030                    return getWorkflowEngineManager().getKey();
031            }
032    
033            public static String getName() {
034                    return getWorkflowEngineManager().getName();
035            }
036    
037            public static Map<String, Object> getOptionalAttributes() {
038                    return getWorkflowEngineManager().getOptionalAttributes();
039            }
040    
041            public static String getVersion() {
042                    return getWorkflowEngineManager().getVersion();
043            }
044    
045            public static WorkflowEngineManager getWorkflowEngineManager() {
046                    PortalRuntimePermission.checkGetBeanProperty(
047                            WorkflowEngineManagerUtil.class);
048    
049                    return _workflowEngineManager;
050            }
051    
052            public static boolean isDeployed() {
053                    getWorkflowEngineManager();
054    
055                    if (MessageBusUtil.hasMessageListener(
056                                    DestinationNames.WORKFLOW_ENGINE)) {
057    
058                            return true;
059                    }
060                    else {
061                            return false;
062                    }
063            }
064    
065            public void setWorkflowEngineManager(
066                    WorkflowEngineManager workflowEngineManager) {
067    
068                    PortalRuntimePermission.checkSetBeanProperty(getClass());
069    
070                    _workflowEngineManager = workflowEngineManager;
071            }
072    
073            private static WorkflowEngineManager _workflowEngineManager;
074    
075    }