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 List<String[]> getLevelsRequiredDeploymentContexts() {
060                    return getDeployManager().getLevelsRequiredDeploymentContexts();
061            }
062    
063            public static List<String[]> getLevelsRequiredDeploymentWARFileNames() {
064                    return getDeployManager().getLevelsRequiredDeploymentWARFileNames();
065            }
066    
067            public static boolean isDeployed(String context) {
068                    return getDeployManager().isDeployed(context);
069            }
070    
071            public static boolean isRequiredDeploymentContext(String context) {
072                    return getDeployManager().isRequiredDeploymentContext(context);
073            }
074    
075            public static PluginPackage readPluginPackageProperties(
076                    String displayName, Properties properties) {
077    
078                    return getDeployManager().readPluginPackageProperties(
079                            displayName, properties);
080            }
081    
082            public static PluginPackage readPluginPackageXml(String xml)
083                    throws Exception {
084    
085                    return getDeployManager().readPluginPackageXml(xml);
086            }
087    
088            public static void redeploy(String context) throws Exception {
089                    getDeployManager().redeploy(context);
090            }
091    
092            public static void reset() {
093                    PortalRuntimePermission.checkSetBeanProperty(DeployManagerUtil.class);
094    
095                    _deployManager = null;
096            }
097    
098            public static void undeploy(String context) throws Exception {
099                    getDeployManager().undeploy(context);
100            }
101    
102            public void setDeployManager(DeployManager deployManager) {
103                    PortalRuntimePermission.checkSetBeanProperty(getClass());
104    
105                    _deployManager = deployManager;
106            }
107    
108            private static DeployManager _deployManager;
109    
110    }