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.repository.registry;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    import com.liferay.portal.kernel.util.ResourceBundleLoader;
019    import com.liferay.portal.repository.util.ExternalRepositoryFactory;
020    
021    import java.util.Collection;
022    
023    /**
024     * @author Adolfo Pérez
025     */
026    public class RepositoryClassDefinitionCatalogUtil {
027    
028            public static Iterable<RepositoryClassDefinition>
029                    getExternalRepositoryClassDefinitions() {
030    
031                    return getRepositoryClassDefinitionCatalog().
032                            getExternalRepositoryClassDefinitions();
033            }
034    
035            public static Collection<String> getExternalRepositoryClassNames() {
036                    return getRepositoryClassDefinitionCatalog().
037                            getExternalRepositoryClassNames();
038            }
039    
040            public static RepositoryClassDefinition getRepositoryClassDefinition(
041                    String repositoryTypeKey) {
042    
043                    return getRepositoryClassDefinitionCatalog().
044                            getRepositoryClassDefinition(repositoryTypeKey);
045            }
046    
047            public static RepositoryClassDefinitionCatalog
048                    getRepositoryClassDefinitionCatalog() {
049    
050                    PortalRuntimePermission.checkGetBeanProperty(
051                            RepositoryClassDefinitionCatalogUtil.class);
052    
053                    return _repositoryClassDefinitionCatalog;
054            }
055    
056            public static void registerLegacyExternalRepositoryFactory(
057                    String className, ExternalRepositoryFactory externalRepositoryFactory,
058                    ResourceBundleLoader resourceBundleLoader) {
059    
060                    getRepositoryClassDefinitionCatalog().
061                            registerLegacyExternalRepositoryFactory(
062                                    className, externalRepositoryFactory, resourceBundleLoader);
063            }
064    
065            public static void unregisterLegacyExternalRepositoryFactory(
066                    String className) {
067    
068                    getRepositoryClassDefinitionCatalog().
069                            unregisterLegacyExternalRepositoryFactory(className);
070            }
071    
072            public void setRepositoryClassDefinitionCatalog(
073                    RepositoryClassDefinitionCatalog repositoryClassDefinitionCatalog) {
074    
075                    PortalRuntimePermission.checkSetBeanProperty(getClass());
076    
077                    _repositoryClassDefinitionCatalog = repositoryClassDefinitionCatalog;
078            }
079    
080            private static RepositoryClassDefinitionCatalog
081                    _repositoryClassDefinitionCatalog;
082    
083    }