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.ehcache;
016    
017    import com.liferay.portal.kernel.cache.CacheManagerListener;
018    import com.liferay.portal.kernel.cache.PortalCacheException;
019    
020    import net.sf.ehcache.event.CacheManagerEventListener;
021    
022    /**
023     * @author Tina Tian
024     */
025    public class EhcacheCacheManagerListenerAdapter
026            implements CacheManagerListener {
027    
028            public EhcacheCacheManagerListenerAdapter(
029                    CacheManagerEventListener cacheManagerEventListener) {
030    
031                    _cacheManagerEventListener = cacheManagerEventListener;
032            }
033    
034            @Override
035            public void dispose() throws PortalCacheException {
036                    _cacheManagerEventListener.dispose();
037            }
038    
039            @Override
040            public void init() throws PortalCacheException {
041                    _cacheManagerEventListener.init();
042            }
043    
044            @Override
045            public void notifyCacheAdded(String portalCacheName) {
046                    _cacheManagerEventListener.notifyCacheAdded(portalCacheName);
047            }
048    
049            @Override
050            public void notifyCacheRemoved(String portalCacheName) {
051                    _cacheManagerEventListener.notifyCacheRemoved(portalCacheName);
052            }
053    
054            private final CacheManagerEventListener _cacheManagerEventListener;
055    
056    }