001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.patcher;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.io.File;
020    
021    import java.util.Properties;
022    
023    /**
024     * @author Zsolt Balogh
025     * @author Brian Wing Shun Chan
026     */
027    public class PatcherUtil {
028    
029            public static boolean applyPatch(File patchFile) {
030                    return getPatcher().applyPatch(patchFile);
031            }
032    
033            public static String[] getFixedIssues() {
034                    return getPatcher().getFixedIssues();
035            }
036    
037            public static String[] getInstalledPatches() {
038                    return getPatcher().getInstalledPatches();
039            }
040    
041            public static File getPatchDirectory() {
042                    return getPatcher().getPatchDirectory();
043            }
044    
045            public static Patcher getPatcher() {
046                    PortalRuntimePermission.checkGetBeanProperty(Patcher.class);
047    
048                    return _patcher;
049            }
050    
051            public static int getPatchingToolVersion() {
052                    return getPatcher().getPatchingToolVersion();
053            }
054    
055            public static String getPatchingToolVersionDisplayName() {
056                    return getPatcher().getPatchingToolVersionDisplayName();
057            }
058    
059            public static String[] getPatchLevels() {
060                    return getPatcher().getPatchLevels();
061            }
062    
063            public static Properties getProperties() {
064                    return getPatcher().getProperties();
065            }
066    
067            public static boolean isConfigured() {
068                    return getPatcher().isConfigured();
069            }
070    
071            public static boolean hasInconsistentPatchLevels() {
072                    return getPatcher().hasInconsistentPatchLevels();
073            }
074    
075            public void setPatcher(Patcher patcher) {
076                    PortalRuntimePermission.checkSetBeanProperty(getClass());
077    
078                    _patcher = patcher;
079            }
080    
081            public static void verifyPatchLevels() throws PatchInconsistencyException {
082                    getPatcher().verifyPatchLevels();
083            }
084    
085            private static Patcher _patcher;
086    
087    }