001    /**
002     * Copyright (c) 2000-present 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.resiliency.spi;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.rmi.RemoteException;
020    
021    import java.util.Set;
022    
023    /**
024     * @author Shuyang Zhou
025     */
026    public class SPIRegistryUtil {
027    
028            public static void addExcludedPortletId(String portletId) {
029                    getSPIRegistry().addExcludedPortletId(portletId);
030            }
031    
032            public static SPI getErrorSPI() {
033                    return getSPIRegistry().getErrorSPI();
034            }
035    
036            public static Set<String> getExcludedPortletIds() {
037                    return getSPIRegistry().getExcludedPortletIds();
038            }
039    
040            public static SPI getPortletSPI(String portletId) {
041                    return getSPIRegistry().getPortletSPI(portletId);
042            }
043    
044            public static SPI getServletContextSPI(String servletContextName) {
045                    return getSPIRegistry().getServletContextSPI(servletContextName);
046            }
047    
048            public static SPIRegistry getSPIRegistry() {
049                    PortalRuntimePermission.checkGetBeanProperty(SPIRegistryUtil.class);
050    
051                    return _spiRegistry;
052            }
053    
054            public static void registerSPI(SPI spi) throws RemoteException {
055                    getSPIRegistry().registerSPI(spi);
056            }
057    
058            public static void removeExcludedPortletId(String portletId) {
059                    getSPIRegistry().removeExcludedPortletId(portletId);
060            }
061    
062            public static void setSPIRegistryValidator(
063                    SPIRegistryValidator spiRegistryValidator) {
064    
065                    getSPIRegistry().setSPIRegistryValidator(spiRegistryValidator);
066            }
067    
068            public static void unregisterSPI(SPI spi) {
069                    getSPIRegistry().unregisterSPI(spi);
070            }
071    
072            public void setSPIRegistry(SPIRegistry spiRegistry) {
073                    PortalRuntimePermission.checkSetBeanProperty(SPIRegistryUtil.class);
074    
075                    _spiRegistry = spiRegistry;
076            }
077    
078            private static SPIRegistry _spiRegistry;
079    
080    }