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.cache.cluster;
016    
017    import com.liferay.portal.cache.bootstrap.ClusterLinkBootstrapLoader;
018    import com.liferay.portal.kernel.cache.BootstrapLoader;
019    import com.liferay.portal.kernel.cache.CacheListener;
020    import com.liferay.portal.kernel.cache.CacheManagerListener;
021    import com.liferay.portal.kernel.cache.CallbackFactory;
022    
023    import java.io.Serializable;
024    
025    import java.util.Properties;
026    
027    /**
028     * @author Tina Tian
029     */
030    public class ClusterLinkCallbackFactory implements CallbackFactory {
031    
032            public static final CallbackFactory INSTANCE =
033                    new ClusterLinkCallbackFactory();
034    
035            @Override
036            public BootstrapLoader createBootstrapLoader(Properties properties) {
037                    return new ClusterLinkBootstrapLoader(properties);
038            }
039    
040            @Override
041            public <K extends Serializable, V> CacheListener<K, V> createCacheListener(
042                    Properties properties) {
043    
044                    return (CacheListener<K, V>)
045                            new ClusterLinkCacheReplicator<K, Serializable>(properties);
046            }
047    
048            @Override
049            public CacheManagerListener createCacheManagerListener(
050                    Properties properties) {
051    
052                    throw new UnsupportedOperationException();
053            }
054    
055            private ClusterLinkCallbackFactory() {
056            }
057    
058    }