~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to net/sf/ehcache/distribution/jgroups/JGroupsCacheManagerPeerProviderFactory.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2008-07-14 02:08:53 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080714020853-37uz6uzh6mc5mcgx
Tags: 1.5.0-1
* New upstream release
* Add libjgroups-java to Build-Depends-Indep
* Bump Standards-Version to 3.8.0
* debian/copyright: remove the full text of Apache 2.0 license, as now
  is included in common licenses

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *  Copyright 2003-2007 Luck Consulting Pty Ltd
 
3
 *
 
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
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
package net.sf.ehcache.distribution.jgroups;
 
18
 
 
19
import java.util.Properties;
 
20
 
 
21
import org.apache.commons.logging.Log;
 
22
import org.apache.commons.logging.LogFactory;
 
23
 
 
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;
 
28
 
 
29
/**
 
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 $
 
33
 */
 
34
 
 
35
public class JGroupsCacheManagerPeerProviderFactory extends CacheManagerPeerProviderFactory {
 
36
    private static final Log LOG = LogFactory.getLog(JGroupsCacheManagerPeerProviderFactory.class);
 
37
    private static final String CONNECT = "connect";
 
38
 
 
39
    /**
 
40
     * {@inheritDoc}
 
41
     */
 
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) {
 
46
            connect = "";
 
47
        }
 
48
 
 
49
        connect = connect.replaceAll(" ", "");
 
50
        if (connect.trim().equals("")) {
 
51
            connect = null;
 
52
        }
 
53
        LOG.debug("Connect is:" + connect);
 
54
        return new JGroupManager(cacheManager, connect);
 
55
 
 
56
    }
 
57
 
 
58
}