/** * Sets the default SizeOfPolicyConfiguration for this cache manager. * * @param sizeOfPolicy the SizeOfPolicy Configuration */ public final void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicy) { if (sizeOfPolicyConfiguration != null) { throw new ObjectExistsException("The SizeOfPolicy class has already been configured"); } sizeOfPolicyConfiguration = sizeOfPolicy; }
e.printStackTrace(); throw new JDOException("Cant create cache");
/** * Allows BeanHandler to add a default configuration to the configuration. */ public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException { if (this.defaultCacheConfiguration != null) { throw new ObjectExistsException("The Default Cache has already been configured"); } setDefaultCacheConfiguration(defaultCacheConfiguration); }
/** * Maintains the known Cache's configuration map in this Configuration * @param cacheConfiguration the CacheConfiguration * @param strict true if added regularly, validation dyn config constraints, false if added through the cache being added */ void addCache(CacheConfiguration cacheConfiguration, final boolean strict) throws ObjectExistsException { final String prop = "cacheConfigurations"; Object oldValue = null; boolean publishChange = strict && checkDynChange(prop); if (publishChange) { oldValue = new HashMap<String, CacheConfiguration>(cacheConfigurations); } if (cacheConfigurations.get(cacheConfiguration.name) != null) { throw new ObjectExistsException("Cannot create cache: " + cacheConfiguration.name + " with the same name as an existing one."); } if (cacheConfiguration.name.equalsIgnoreCase(net.sf.ehcache.Cache.DEFAULT_CACHE_NAME)) { throw new ObjectExistsException("The Default Cache has already been configured"); } cacheConfigurations.put(cacheConfiguration.name, cacheConfiguration); if (publishChange) { firePropertyChange(prop, oldValue, cacheConfigurations); } }
private void internalAddDecoratedCache(final Ehcache decoratedCache, final boolean strict) { Ehcache old = ehcaches.putIfAbsent(decoratedCache.getName(), decoratedCache); if (strict && old != null) { throw new ObjectExistsException("Cache " + decoratedCache.getName() + " already exists in the CacheManager"); } }
/** * Allows BeanHandler to add a Terracotta configuration to the configuration */ public final void addTerracottaConfig(TerracottaClientConfiguration terracottaConfiguration) throws ObjectExistsException { if (this.terracottaConfigConfiguration != null && terracottaConfiguration != null) { throw new ObjectExistsException("The TerracottaConfig has already been configured"); } final String prop = "terracottaConfigConfiguration"; final boolean publish = checkDynChange(prop); final TerracottaClientConfiguration oldValue = this.terracottaConfigConfiguration; this.terracottaConfigConfiguration = terracottaConfiguration; if (publish) { firePropertyChange(prop, oldValue, terracottaConfiguration); } }
/** * Allows BeanHandler to add disk store location to the configuration. */ public final void addDiskStore(DiskStoreConfiguration diskStoreConfigurationParameter) throws ObjectExistsException { if (diskStoreConfiguration != null) { throw new ObjectExistsException("The Disk Store has already been configured"); } final String prop = "diskStoreConfiguration"; boolean publish = checkDynChange(prop); DiskStoreConfiguration oldValue = diskStoreConfiguration; diskStoreConfiguration = diskStoreConfigurationParameter; if (publish) { firePropertyChange(prop, oldValue, diskStoreConfiguration); } }
/** * Allows BeanHandler to add transaction manager lookup to the configuration. */ public final void addTransactionManagerLookup(FactoryConfiguration transactionManagerLookupParameter) throws ObjectExistsException { if (transactionManagerLookupConfiguration != null) { throw new ObjectExistsException("The TransactionManagerLookup class has already been configured"); } final String prop = "transactionManagerLookupConfiguration"; boolean publish = checkDynChange(prop); FactoryConfiguration oldValue = this.transactionManagerLookupConfiguration; transactionManagerLookupConfiguration = transactionManagerLookupParameter; if (publish) { firePropertyChange(prop, oldValue, transactionManagerLookupParameter); } }
/** * Allows BeanHandler to add a ManagementRESTService configuration to the configuration */ public final void addManagementRESTService(ManagementRESTServiceConfiguration managementRESTServiceConfiguration) throws ObjectExistsException { if (this.managementRESTService != null) { throw new ObjectExistsException("The ManagementRESTService has already been configured"); } final String prop = "managementRESTService"; final boolean publish = checkDynChange(prop); final ManagementRESTServiceConfiguration oldValue = this.managementRESTService; this.managementRESTService = managementRESTServiceConfiguration; if (publish) { firePropertyChange(prop, oldValue, managementRESTServiceConfiguration); } }
throw new ObjectExistsException("Cache " + cacheName + " already exists");
if (ehcache != null) { if (strict) { throw new ObjectExistsException("Cache " + cache.getName() + " already exists"); } else { return ehcache;
/** * Sets the default SizeOfPolicyConfiguration for this cache manager. * * @param sizeOfPolicy the SizeOfPolicy Configuration */ public final void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicy) { if (sizeOfPolicyConfiguration != null) { throw new ObjectExistsException("The SizeOfPolicy class has already been configured"); } sizeOfPolicyConfiguration = sizeOfPolicy; }
/** * Sets the default SizeOfPolicyConfiguration for this cache manager. * * @param sizeOfPolicy the SizeOfPolicy Configuration */ public final void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicy) { if (sizeOfPolicyConfiguration != null) { throw new ObjectExistsException("The SizeOfPolicy class has already been configured"); } sizeOfPolicyConfiguration = sizeOfPolicy; }
/** * Sets the default SizeOfPolicyConfiguration for this cache manager. * * @param sizeOfPolicy the SizeOfPolicy Configuration */ public final void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicy) { if (sizeOfPolicyConfiguration != null) { throw new ObjectExistsException("The SizeOfPolicy class has already been configured"); } sizeOfPolicyConfiguration = sizeOfPolicy; }
/** * Allows BeanHandler to add a default configuration to the configuration. */ public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException { if (this.defaultCacheConfiguration != null) { throw new ObjectExistsException("The Default Cache has already been configured"); } setDefaultCacheConfiguration(defaultCacheConfiguration); }
/** * Allows BeanHandler to add a default configuration to the configuration. */ public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException { if (this.defaultCacheConfiguration != null) { throw new ObjectExistsException("The Default Cache has already been configured"); } setDefaultCacheConfiguration(defaultCacheConfiguration); }
/** * Allows BeanHandler to add a default configuration to the configuration. */ public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException { if (this.defaultCacheConfiguration != null) { throw new ObjectExistsException("The Default Cache has already been configured"); } setDefaultCacheConfiguration(defaultCacheConfiguration); }
/** * Maintains the known Cache's configuration map in this Configuration * @param cacheConfiguration the CacheConfiguration * @param strict true if added regularly, validation dyn config constraints, false if added through the cache being added */ void addCache(CacheConfiguration cacheConfiguration, final boolean strict) throws ObjectExistsException { final String prop = "cacheConfigurations"; Object oldValue = null; boolean publishChange = strict && checkDynChange(prop); if (publishChange) { oldValue = new HashMap<String, CacheConfiguration>(cacheConfigurations); } if (cacheConfigurations.get(cacheConfiguration.name) != null) { throw new ObjectExistsException("Cannot create cache: " + cacheConfiguration.name + " with the same name as an existing one."); } if (cacheConfiguration.name.equalsIgnoreCase(net.sf.ehcache.Cache.DEFAULT_CACHE_NAME)) { throw new ObjectExistsException("The Default Cache has already been configured"); } cacheConfigurations.put(cacheConfiguration.name, cacheConfiguration); if (publishChange) { firePropertyChange(prop, oldValue, cacheConfigurations); } }
/** * Maintains the known Cache's configuration map in this Configuration * @param cacheConfiguration the CacheConfiguration * @param strict true if added regularly, validation dyn config constraints, false if added through the cache being added */ void addCache(CacheConfiguration cacheConfiguration, final boolean strict) throws ObjectExistsException { final String prop = "cacheConfigurations"; Object oldValue = null; boolean publishChange = strict && checkDynChange(prop); if (publishChange) { oldValue = new HashMap<String, CacheConfiguration>(cacheConfigurations); } if (cacheConfigurations.get(cacheConfiguration.name) != null) { throw new ObjectExistsException("Cannot create cache: " + cacheConfiguration.name + " with the same name as an existing one."); } if (cacheConfiguration.name.equalsIgnoreCase(net.sf.ehcache.Cache.DEFAULT_CACHE_NAME)) { throw new ObjectExistsException("The Default Cache has already been configured"); } cacheConfigurations.put(cacheConfiguration.name, cacheConfiguration); if (publishChange) { firePropertyChange(prop, oldValue, cacheConfigurations); } }
/** * Maintains the known Cache's configuration map in this Configuration * @param cacheConfiguration the CacheConfiguration * @param strict true if added regularly, validation dyn config constraints, false if added through the cache being added */ void addCache(CacheConfiguration cacheConfiguration, final boolean strict) throws ObjectExistsException { final String prop = "cacheConfigurations"; Object oldValue = null; boolean publishChange = strict && checkDynChange(prop); if (publishChange) { oldValue = new HashMap<String, CacheConfiguration>(cacheConfigurations); } if (cacheConfigurations.get(cacheConfiguration.name) != null) { throw new ObjectExistsException("Cannot create cache: " + cacheConfiguration.name + " with the same name as an existing one."); } if (cacheConfiguration.name.equalsIgnoreCase(net.sf.ehcache.Cache.DEFAULT_CACHE_NAME)) { throw new ObjectExistsException("The Default Cache has already been configured"); } cacheConfigurations.put(cacheConfiguration.name, cacheConfiguration); if (publishChange) { firePropertyChange(prop, oldValue, cacheConfigurations); } }