001
014
015 package com.liferay.portal.kernel.cache.configuration;
016
017 import java.util.Collections;
018 import java.util.HashSet;
019 import java.util.Properties;
020 import java.util.Set;
021
022
025 public class PortalCacheConfiguration {
026
027 public static final String DEFAULT_PORTAL_CACHE_NAME =
028 "DEFAULT_PORTAL_CACHE_NAME";
029
030 public static final String PORTAL_CACHE_LISTENER_SCOPE =
031 "PORTAL_CACHE_LISTENER_SCOPE";
032
033 public PortalCacheConfiguration(
034 String portalCacheName,
035 Set<Properties> portalCacheListenerPropertiesSet,
036 Properties portalCacheBootstrapLoaderProperties) {
037
038 if (portalCacheName == null) {
039 throw new NullPointerException("Portal cache name is null");
040 }
041
042 _portalCacheName = portalCacheName;
043
044 if (portalCacheListenerPropertiesSet == null) {
045 _portalCacheListenerPropertiesSet = Collections.emptySet();
046 }
047 else {
048 _portalCacheListenerPropertiesSet = new HashSet<>(
049 portalCacheListenerPropertiesSet);
050 }
051
052 _portalCacheBootstrapLoaderProperties =
053 portalCacheBootstrapLoaderProperties;
054 }
055
056 public Properties getPortalCacheBootstrapLoaderProperties() {
057 return _portalCacheBootstrapLoaderProperties;
058 }
059
060 public Set<Properties> getPortalCacheListenerPropertiesSet() {
061 return Collections.unmodifiableSet(_portalCacheListenerPropertiesSet);
062 }
063
064 public String getPortalCacheName() {
065 return _portalCacheName;
066 }
067
068 public PortalCacheConfiguration newPortalCacheConfiguration(
069 String portalCacheName) {
070
071 return new PortalCacheConfiguration(
072 portalCacheName, _portalCacheListenerPropertiesSet,
073 _portalCacheBootstrapLoaderProperties);
074 }
075
076 private final Properties _portalCacheBootstrapLoaderProperties;
077 private final Set<Properties> _portalCacheListenerPropertiesSet;
078 private final String _portalCacheName;
079
080 }