|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| HibernateJCache.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/**
|
|
| 2 |
*
|
|
| 3 |
* Copyright 2004 Protique Ltd
|
|
| 4 |
*
|
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
| 7 |
* You may obtain a copy of the License at
|
|
| 8 |
*
|
|
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 10 |
*
|
|
| 11 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 14 |
* See the License for the specific language governing permissions and
|
|
| 15 |
* limitations under the License.
|
|
| 16 |
*
|
|
| 17 |
**/
|
|
| 18 |
package org.codehaus.activespace.cache.hibernate;
|
|
| 19 |
|
|
| 20 |
import net.sf.hibernate.cache.Cache;
|
|
| 21 |
import net.sf.hibernate.cache.CacheException;
|
|
| 22 |
|
|
| 23 |
/**
|
|
| 24 |
* A Hibernate Cache implementation using a JCache provider.
|
|
| 25 |
*
|
|
| 26 |
* @version $Revision: 1.1 $
|
|
| 27 |
*/
|
|
| 28 |
public class HibernateJCache implements Cache { |
|
| 29 |
private String regionName;
|
|
| 30 |
private javax.cache.Cache jcache;
|
|
| 31 |
private int timeout = 60000; |
|
| 32 |
|
|
| 33 | 0 |
public HibernateJCache(javax.cache.Cache jcache, String regionName) {
|
| 34 | 0 |
this.jcache = jcache;
|
| 35 | 0 |
this.regionName = regionName;
|
| 36 |
} |
|
| 37 |
|
|
| 38 | 0 |
public Object get(Object key) throws CacheException { |
| 39 | 0 |
return jcache.get(key);
|
| 40 |
} |
|
| 41 |
|
|
| 42 | 0 |
public void put(Object key, Object value) throws CacheException { |
| 43 | 0 |
jcache.put(key, value); |
| 44 |
} |
|
| 45 |
|
|
| 46 | 0 |
public void remove(Object key) throws CacheException { |
| 47 | 0 |
jcache.remove(key); |
| 48 |
} |
|
| 49 |
|
|
| 50 | 0 |
public void clear() throws CacheException { |
| 51 | 0 |
jcache.clear(); |
| 52 |
} |
|
| 53 |
|
|
| 54 | 0 |
public void destroy() throws CacheException { |
| 55 |
} |
|
| 56 |
|
|
| 57 | 0 |
public void lock(Object o) throws CacheException { |
| 58 | 0 |
throw new UnsupportedOperationException("ActiveSpace is a fully transactional cache: " + regionName); |
| 59 |
} |
|
| 60 |
|
|
| 61 | 0 |
public void unlock(Object o) throws CacheException { |
| 62 | 0 |
throw new UnsupportedOperationException("ActiveSpace is a fully transactional cache: " + regionName); |
| 63 |
} |
|
| 64 |
|
|
| 65 | 0 |
public int getTimeout() { |
| 66 | 0 |
return timeout;
|
| 67 |
} |
|
| 68 |
|
|
| 69 | 0 |
public long nextTimestamp() { |
| 70 | 0 |
return System.currentTimeMillis();
|
| 71 |
} |
|
| 72 |
|
|
| 73 | 0 |
public String getRegionName() {
|
| 74 | 0 |
return regionName;
|
| 75 |
} |
|
| 76 |
|
|
| 77 | 0 |
public long getSizeInMemory() { |
| 78 | 0 |
return -1;
|
| 79 |
} |
|
| 80 |
|
|
| 81 | 0 |
public long getElementCountInMemory() { |
| 82 | 0 |
return -1;
|
| 83 |
} |
|
| 84 |
|
|
| 85 | 0 |
public long getElementCountOnDisk() { |
| 86 | 0 |
return -1;
|
| 87 |
} |
|
| 88 |
|
|
| 89 | 0 |
public void setTimeout(int timeout) { |
| 90 | 0 |
this.timeout = timeout;
|
| 91 |
} |
|
| 92 |
} |
|
| 93 |
|
|
||||||||||