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.template;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.util.List;
020    
021    /**
022     * @author Juan Fern??ndez
023     */
024    public class TemplateHandlerRegistryUtil {
025    
026            public static long[] getClassNameIds() {
027                    return getTemplateRegistry().getClassNameIds();
028            }
029    
030            public static TemplateHandler getTemplateHandler(long classNameId) {
031                    return getTemplateRegistry().getTemplateHandler(classNameId);
032            }
033    
034            public static TemplateHandler getTemplateHandler(String className) {
035                    return getTemplateRegistry().getTemplateHandler(className);
036            }
037    
038            public static List<TemplateHandler> getTemplateHandlers() {
039                    return getTemplateRegistry().getTemplateHandlers();
040            }
041    
042            public static TemplateHandlerRegistry getTemplateRegistry() {
043                    PortalRuntimePermission.checkGetBeanProperty(
044                            TemplateHandlerRegistryUtil.class);
045    
046                    return _templateHandlerRegistry;
047            }
048    
049            public static void register(TemplateHandler templateHandler) {
050                    getTemplateRegistry().register(templateHandler);
051            }
052    
053            public static void unregister(TemplateHandler templateHandler) {
054                    getTemplateRegistry().unregister(templateHandler);
055            }
056    
057            public void setTemplateHandlerRegistry(
058                    TemplateHandlerRegistry templateHandlerRegistry) {
059    
060                    PortalRuntimePermission.checkSetBeanProperty(getClass());
061    
062                    _templateHandlerRegistry = templateHandlerRegistry;
063            }
064    
065            private static TemplateHandlerRegistry _templateHandlerRegistry;
066    
067    }