/hazelcast-hibernate/src/main/java/com/hazelcast/hibernate/region/CollectionRegionAccessStrategyAdapter.java

https://bitbucket.org/gabral6_gmailcom/hazelcast · Java · 85 lines · 50 code · 17 blank · 18 comment · 0 complexity · 0707e4aa4ee94f4690a847a180b32b48 MD5 · raw file

  1. /*
  2. * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
  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. package com.hazelcast.hibernate.region;
  17. import com.hazelcast.hibernate.access.AccessDelegate;
  18. import org.hibernate.cache.CacheException;
  19. import org.hibernate.cache.CollectionRegion;
  20. import org.hibernate.cache.access.CollectionRegionAccessStrategy;
  21. import org.hibernate.cache.access.SoftLock;
  22. /**
  23. * @author Leo Kim (lkim@limewire.com)
  24. */
  25. public final class CollectionRegionAccessStrategyAdapter implements CollectionRegionAccessStrategy {
  26. private final AccessDelegate<? extends HazelcastCollectionRegion> delegate;
  27. public CollectionRegionAccessStrategyAdapter(final AccessDelegate<? extends HazelcastCollectionRegion> delegate) {
  28. this.delegate = delegate;
  29. }
  30. public void evict(final Object key) throws CacheException {
  31. delegate.evict(key);
  32. }
  33. public void evictAll() throws CacheException {
  34. delegate.evictAll();
  35. }
  36. public Object get(final Object key, final long txTimestamp) throws CacheException {
  37. return delegate.get(key, txTimestamp);
  38. }
  39. public CollectionRegion getRegion() {
  40. return delegate.getHazelcastRegion();
  41. }
  42. public SoftLock lockItem(final Object key, final Object version) throws CacheException {
  43. return delegate.lockItem(key, version);
  44. }
  45. public SoftLock lockRegion() throws CacheException {
  46. return delegate.lockRegion();
  47. }
  48. public boolean putFromLoad(final Object key, final Object value, final long txTimestamp, final Object version)
  49. throws CacheException {
  50. return delegate.putFromLoad(key, value, txTimestamp, version);
  51. }
  52. public boolean putFromLoad(final Object key, final Object value, final long txTimestamp, final Object version,
  53. final boolean minimalPutOverride) throws CacheException {
  54. return delegate.putFromLoad(key, value, txTimestamp, version, minimalPutOverride);
  55. }
  56. public void remove(final Object key) throws CacheException {
  57. delegate.remove(key);
  58. }
  59. public void removeAll() throws CacheException {
  60. delegate.removeAll();
  61. }
  62. public void unlockItem(final Object key, final SoftLock lock) throws CacheException {
  63. delegate.unlockItem(key, lock);
  64. }
  65. public void unlockRegion(final SoftLock lock) throws CacheException {
  66. delegate.unlockRegion(lock);
  67. }
  68. }