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

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/hibernate/HibernateUtil.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 *  Copyright 2003-2010 Terracotta, Inc.
 
2
 *  Copyright Terracotta, Inc.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
16
16
package net.sf.ehcache.hibernate;
17
17
 
18
18
import java.net.URL;
 
19
import java.util.Properties;
19
20
 
20
21
import net.sf.ehcache.Ehcache;
21
22
import net.sf.ehcache.config.CacheConfiguration;
95
96
        }
96
97
    }
97
98
 
98
 
 
 
99
    /**
 
100
     * Will overwrite the CacheManager name from the passed in configuration with the value of
 
101
     * net.sf.ehcache.hibernate.AbstractEhcacheRegionFactory#NET_SF_EHCACHE_CACHE_MANAGER_NAME of the passed in Properties
 
102
     * @param configuration the configuration
 
103
     * @param properties the properties passed in from Hibernate
 
104
     * @return the configuration object passed in, only for convenience
 
105
     */
 
106
    static Configuration overwriteCacheManagerIfConfigured(final Configuration configuration, final Properties properties) {
 
107
        final String cacheManagerName = properties.getProperty(AbstractEhcacheRegionFactory.NET_SF_EHCACHE_CACHE_MANAGER_NAME);
 
108
        if (cacheManagerName != null) {
 
109
            configuration.setName(cacheManagerName);
 
110
        }
 
111
        return configuration;
 
112
    }
99
113
}