org.fjank.jcache
Class CacheAccessFactoryImpl

java.lang.Object
  extended by javax.util.jcache.CacheAccessFactory
      extended by org.fjank.jcache.CacheAccessFactoryImpl

public final class CacheAccessFactoryImpl
extends CacheAccessFactory

A factory for CacheAccess objects.

Author:
Frank Karlstrøm

Constructor Summary
CacheAccessFactoryImpl()
          Creates a new CacheAccessFactoryImpl object.
 
Method Summary
 void defineRegion(String name)
          Will create a named region within the cache.
 void defineRegion(String name, Attributes attributes)
          Will create a named region within the cache.
 Cache getCache()
          gets an initialized instance of the cache.
 Cache getCache(boolean init)
          gets an instance of the cache.
 CacheMap getMapAccess()
          A method to retrieve a Map based implementation of a CacheAccess to the default region.
 CacheMap getMapAccess(String region)
          A method to retrieve a Map based implementation of a CacheAccess to the specified region.
 
Methods inherited from class javax.util.jcache.CacheAccessFactory
getDefaultAttributes, getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheAccessFactoryImpl

public CacheAccessFactoryImpl()
Creates a new CacheAccessFactoryImpl object.

Method Detail

defineRegion

public void defineRegion(String name)
                  throws ObjectExistsException,
                         NullObjectNameException,
                         CacheNotAvailableException
Will create a named region within the cache. This defines a namespace for storing objects. Gets it default attributes from the properties file.

Specified by:
defineRegion in class CacheAccessFactory
Parameters:
name - the name for the region. Must be globally unique.
Throws:
ObjectExistsException - if the name already exists in the cache.
NullObjectNameException - if the region is attempted initialized with null as name.
CacheNotAvailableException - if the cache is not available, either it is not initialized, or it is unavailable.

defineRegion

public void defineRegion(String name,
                         Attributes attributes)
                  throws ObjectExistsException,
                         NullObjectNameException,
                         CacheNotAvailableException
Will create a named region within the cache. This defines a namespace for storing objects.

Specified by:
defineRegion in class CacheAccessFactory
Parameters:
name - the name for the region. Must be globally unique.
attributes - sets the default attributes for objects in the new region.
Throws:
ObjectExistsException - if the name already exists in the cache.
NullObjectNameException - if the region is attempted initialized with null as name.
CacheNotAvailableException - if the cache is not available, either it is not initialized, or it is unavailable.

getMapAccess

public CacheMap getMapAccess()
A method to retrieve a Map based implementation of a CacheAccess to the default region.

Specified by:
getMapAccess in class CacheAccessFactory
Returns:
a Map based Cache implementation to the default region.

getMapAccess

public CacheMap getMapAccess(String region)
A method to retrieve a Map based implementation of a CacheAccess to the specified region.

Specified by:
getMapAccess in class CacheAccessFactory
Returns:
a Map based Cache implementation to the specified region.

getCache

public Cache getCache()
               throws CacheException
gets an initialized instance of the cache.

Specified by:
getCache in class CacheAccessFactory
Returns:
A Cache object wich is initialized.
Throws:
CacheException - if exceptions occur.
See Also:
CacheAccessFactory.getCache()

getCache

public Cache getCache(boolean init)
               throws CacheException
gets an instance of the cache. if the parameter init is true the cache is initialized. Otherwise the cache is not initialized.

Specified by:
getCache in class CacheAccessFactory
Parameters:
init - a boolean indicating wether to initialize the Cache or not. if already initialized, this is ignored.
Returns:
the Cache instance.
Throws:
CacheException - if fatal exceptions occur.
See Also:
CacheAccessFactory.getCache(boolean)


Copyright © 2002-2009 Hosted by SourceForge. All Rights Reserved.