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.kernel.repository.registry;
016    
017    import com.liferay.portal.kernel.repository.DocumentRepository;
018    import com.liferay.portal.kernel.repository.RepositoryConfiguration;
019    import com.liferay.portal.kernel.repository.RepositoryConfigurationBuilder;
020    import com.liferay.portal.security.permission.ResourceActionsUtil;
021    
022    import java.util.Locale;
023    
024    /**
025     * @author Adolfo P??rez
026     */
027    public abstract class BaseRepositoryDefiner implements RepositoryDefiner {
028    
029            public BaseRepositoryDefiner() {
030                    RepositoryConfigurationBuilder repositoryConfigurationBuilder =
031                            new RepositoryConfigurationBuilder();
032    
033                    _repositoryConfiguration = repositoryConfigurationBuilder.build();
034            }
035    
036            @Override
037            public abstract String getClassName();
038    
039            @Override
040            public RepositoryConfiguration getRepositoryConfiguration() {
041                    return _repositoryConfiguration;
042            }
043    
044            @Override
045            public String getRepositoryTypeLabel(Locale locale) {
046                    return ResourceActionsUtil.getModelResource(locale, getClassName());
047            }
048    
049            @Override
050            public abstract boolean isExternalRepository();
051    
052            @Override
053            public void registerCapabilities(
054                    CapabilityRegistry<DocumentRepository> capabilityRegistry) {
055            }
056    
057            @Override
058            public void registerRepositoryEventListeners(
059                    RepositoryEventRegistry repositoryEventRegistry) {
060            }
061    
062            @Override
063            public abstract void registerRepositoryFactory(
064                    RepositoryFactoryRegistry repositoryFactoryRegistry);
065    
066            private final RepositoryConfiguration _repositoryConfiguration;
067    
068    }