2
* Copyright 2003-2007 Luck Consulting Pty Ltd
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
package net.sf.ehcache.distribution.jgroups;
19
import java.util.Properties;
21
import org.apache.commons.logging.Log;
22
import org.apache.commons.logging.LogFactory;
24
import net.sf.ehcache.CacheManager;
25
import net.sf.ehcache.distribution.CacheManagerPeerProvider;
26
import net.sf.ehcache.distribution.CacheManagerPeerProviderFactory;
27
import net.sf.ehcache.util.PropertyUtil;
30
* @author Pierre Monestie (pmonestie__REMOVE__THIS__@gmail.com)
31
* @author <a href="mailto:gluck@gregluck.com">Greg Luck</a>
32
* @version $Id: JGroupsCacheManagerPeerProviderFactory.java 592 2008-03-17 08:39:56Z gregluck $
35
public class JGroupsCacheManagerPeerProviderFactory extends CacheManagerPeerProviderFactory {
36
private static final Log LOG = LogFactory.getLog(JGroupsCacheManagerPeerProviderFactory.class);
37
private static final String CONNECT = "connect";
42
public CacheManagerPeerProvider createCachePeerProvider(CacheManager cacheManager, Properties properties) {
43
LOG.debug("CREATING JGOUPS PEER PROVIDER");
44
String connect = PropertyUtil.extractAndLogProperty(CONNECT, properties);
45
if (connect == null) {
49
connect = connect.replaceAll(" ", "");
50
if (connect.trim().equals("")) {
53
LOG.debug("Connect is:" + connect);
54
return new JGroupManager(cacheManager, connect);