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.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 String[] getPatchLevels() {
052                    return getPatcher().getPatchLevels();
053            }
054    
055            public static Properties getProperties() {
056                    return getPatcher().getProperties();
057            }
058    
059            public static boolean isConfigured() {
060                    return getPatcher().isConfigured();
061            }
062    
063            public static boolean hasInconsistentPatchLevels() {
064                    return getPatcher().hasInconsistentPatchLevels();
065            }
066    
067            public void setPatcher(Patcher patcher) {
068                    PortalRuntimePermission.checkSetBeanProperty(getClass());
069    
070                    _patcher = patcher;
071            }
072    
073            public static void verifyPatchLevels() throws PatchInconsistencyException {
074                    getPatcher().verifyPatchLevels();
075            }
076    
077            private static Patcher _patcher;
078    
079    }