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