1 /* 2 * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH 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 de.smartics.properties.spi.config.cache.infinispan; 17 18 import org.infinispan.manager.EmbeddedCacheManager; 19 20 import de.smartics.util.lang.Arg; 21 22 /** 23 * Provides information about the cache to use. 24 */ 25 public final class CacheManagerProxy 26 { 27 // ********************************* Fields ********************************* 28 29 // --- constants ------------------------------------------------------------ 30 31 // --- members -------------------------------------------------------------- 32 33 /** 34 * The embedded cache manager to use. 35 */ 36 private final EmbeddedCacheManager manager; 37 38 /** 39 * The name of the cache within the cache container. 40 */ 41 private final String cacheName; 42 43 // ****************************** Initializer ******************************* 44 45 // ****************************** Constructors ****************************** 46 47 /** 48 * Default constructor. 49 * 50 * @param manager the embedded cache manager to use. 51 * @param cacheName the name of the cache within the cache container. 52 * @throws NullPointerException if {@code manager} or {@code cacheName} is 53 * <code>null</code>. 54 * @throws IllegalArgumentException if {@code cacheName} is blank. 55 */ 56 public CacheManagerProxy(final EmbeddedCacheManager manager, 57 final String cacheName) throws NullPointerException, 58 IllegalArgumentException 59 { 60 this.manager = Arg.checkNotNull("manager", manager); 61 this.cacheName = Arg.checkNotBlank("cacheName", cacheName); 62 } 63 64 // ****************************** Inner Classes ***************************** 65 66 // ********************************* Methods ******************************** 67 68 // --- init ----------------------------------------------------------------- 69 70 // --- get&set -------------------------------------------------------------- 71 72 /** 73 * Returns the embedded cache manager to use. 74 * 75 * @return the embedded cache manager to use. 76 */ 77 public EmbeddedCacheManager getManager() 78 { 79 return manager; 80 } 81 82 /** 83 * Returns the name of the cache within the cache container. 84 * 85 * @return the name of the cache within the cache container. 86 */ 87 public String getCacheName() 88 { 89 return cacheName; 90 } 91 92 // --- business ------------------------------------------------------------- 93 94 // --- object basics -------------------------------------------------------- 95 96 }