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.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 Set<String> getExcludedPortletIds() {
033                    return getSPIRegistry().getExcludedPortletIds();
034            }
035    
036            public static SPI getPortletSPI(String portletId) {
037                    return getSPIRegistry().getPortletSPI(portletId);
038            }
039    
040            public static SPI getServletContextSPI(String servletContextName) {
041                    return getSPIRegistry().getServletContextSPI(servletContextName);
042            }
043    
044            public static SPIRegistry getSPIRegistry() {
045                    PortalRuntimePermission.checkGetBeanProperty(SPIRegistryUtil.class);
046    
047                    return _spiRegistry;
048            }
049    
050            public static void registerSPI(SPI spi) throws RemoteException {
051                    getSPIRegistry().registerSPI(spi);
052            }
053    
054            public static void removeExcludedPortletId(String portletId) {
055                    getSPIRegistry().removeExcludedPortletId(portletId);
056            }
057    
058            public static void unregisterSPI(SPI spi) {
059                    getSPIRegistry().unregisterSPI(spi);
060            }
061    
062            public void setSPIRegistry(SPIRegistry spiRegistry) {
063                    PortalRuntimePermission.checkSetBeanProperty(SPIRegistryUtil.class);
064    
065                    _spiRegistry = spiRegistry;
066            }
067    
068            private static SPIRegistry _spiRegistry;
069    
070    }