001    /**
002     * Copyright (c) 2000-2010 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.portlet.asset;
016    
017    import com.liferay.portlet.asset.model.AssetRendererFactory;
018    
019    import java.util.List;
020    
021    /**
022     * @author Bruno Farache
023     * @author Marcellus Tavares
024     */
025    public class AssetRendererFactoryRegistryUtil {
026    
027            public static List<AssetRendererFactory> getAssetRendererFactories() {
028                    return getAssetRendererFactoryRegistry().getAssetRendererFactories();
029            }
030    
031            public static AssetRendererFactory getAssetRendererFactoryByClassName(
032                    String className) {
033    
034                    return getAssetRendererFactoryRegistry().
035                            getAssetRendererFactoryByClassName(className);
036            }
037    
038            public static AssetRendererFactory getAssetRendererFactoryByType(
039                    String type) {
040    
041                    return getAssetRendererFactoryRegistry().getAssetRendererFactoryByType(
042                            type);
043            }
044    
045            public static AssetRendererFactoryRegistry
046                    getAssetRendererFactoryRegistry() {
047    
048                    return _assetRendererFactoryRegistry;
049            }
050    
051            public static long[] getClassNameIds() {
052                    return getAssetRendererFactoryRegistry().getClassNameIds();
053            }
054    
055            public static void register(AssetRendererFactory assetRendererFactory) {
056                    getAssetRendererFactoryRegistry().register(assetRendererFactory);
057            }
058    
059            public static void register(
060                    List<AssetRendererFactory> assetRendererFactories) {
061    
062                    for (AssetRendererFactory assetRendererFactory :
063                                    assetRendererFactories) {
064    
065                            register(assetRendererFactory);
066                    }
067            }
068    
069            public static void unregister(AssetRendererFactory assetRendererFactory) {
070                    getAssetRendererFactoryRegistry().unregister(assetRendererFactory);
071            }
072    
073            public static void unregister(
074                    List<AssetRendererFactory> assetRendererFactories) {
075    
076                    for (AssetRendererFactory assetRendererFactory :
077                                    assetRendererFactories) {
078    
079                            unregister(assetRendererFactory);
080                    }
081            }
082    
083            public void setAssetRendererFactoryRegistry(
084                    AssetRendererFactoryRegistry assetRendererFactoryRegistry) {
085    
086                    _assetRendererFactoryRegistry = assetRendererFactoryRegistry;
087            }
088    
089            private static AssetRendererFactoryRegistry _assetRendererFactoryRegistry;
090    
091    }