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.deploy;
016    
017    import com.liferay.portal.kernel.deploy.auto.context.AutoDeploymentContext;
018    import com.liferay.portal.kernel.plugin.PluginPackage;
019    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020    
021    import java.util.List;
022    import java.util.Properties;
023    
024    /**
025     * @author Jonathan Potter
026     * @author Brian Wing Shun Chan
027     * @author Ryan Park
028     */
029    public class DeployManagerUtil {
030    
031            public static void deploy(AutoDeploymentContext autoDeploymentContext)
032                    throws Exception {
033    
034                    getDeployManager().deploy(autoDeploymentContext);
035            }
036    
037            public static String getDeployDir() throws Exception {
038                    return getDeployManager().getDeployDir();
039            }
040    
041            public static DeployManager getDeployManager() {
042                    PortalRuntimePermission.checkGetBeanProperty(DeployManagerUtil.class);
043    
044                    return _deployManager;
045            }
046    
047            public static String getInstalledDir() throws Exception {
048                    return getDeployManager().getInstalledDir();
049            }
050    
051            public static PluginPackage getInstalledPluginPackage(String context) {
052                    return getDeployManager().getInstalledPluginPackage(context);
053            }
054    
055            public static List<PluginPackage> getInstalledPluginPackages() {
056                    return getDeployManager().getInstalledPluginPackages();
057            }
058    
059            public static boolean isDeployed(String context) {
060                    return getDeployManager().isDeployed(context);
061            }
062    
063            public static PluginPackage readPluginPackageProperties(
064                    String displayName, Properties properties) {
065    
066                    return getDeployManager().readPluginPackageProperties(
067                            displayName, properties);
068            }
069    
070            public static PluginPackage readPluginPackageXml(String xml)
071                    throws Exception {
072    
073                    return getDeployManager().readPluginPackageXml(xml);
074            }
075    
076            public static void redeploy(String context) throws Exception {
077                    getDeployManager().redeploy(context);
078            }
079    
080            public static void reset() {
081                    PortalRuntimePermission.checkSetBeanProperty(DeployManagerUtil.class);
082    
083                    _deployManager = null;
084            }
085    
086            public static void undeploy(String context) throws Exception {
087                    getDeployManager().undeploy(context);
088            }
089    
090            public void setDeployManager(DeployManager deployManager) {
091                    PortalRuntimePermission.checkSetBeanProperty(getClass());
092    
093                    _deployManager = deployManager;
094            }
095    
096            private static DeployManager _deployManager;
097    
098    }